code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
static HttpRequestFactory resolveDefaultRequestFactory() {
Optional<ServiceDefinition<HttpRequestFactory>> definition = SoftServiceLoader.load(HttpRequestFactory.class)
.firstOr("io.micronaut.http.client.NettyClientHttpRequestFactory", HttpRequestFactory.class.getClassLoader());
if (definition.isPresent()) {
ServiceDefinition<HttpRequestFactory> sd = definition.get();
try {
return sd.load();
} catch (Throwable e) {
LOG.warn("Unable to load default request factory for definition [" + definition + "]: " + e.getMessage(), e);
}
}
return new SimpleHttpRequestFactory();
} }
|
public class class_name {
static HttpRequestFactory resolveDefaultRequestFactory() {
Optional<ServiceDefinition<HttpRequestFactory>> definition = SoftServiceLoader.load(HttpRequestFactory.class)
.firstOr("io.micronaut.http.client.NettyClientHttpRequestFactory", HttpRequestFactory.class.getClassLoader());
if (definition.isPresent()) {
ServiceDefinition<HttpRequestFactory> sd = definition.get();
try {
return sd.load(); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
LOG.warn("Unable to load default request factory for definition [" + definition + "]: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
return new SimpleHttpRequestFactory();
} }
|
public class class_name {
public static MountPOptions fromMountEntry(File.AddMountPointEntry mountEntryPoint) {
MountPOptions.Builder optionsBuilder = MountPOptions.newBuilder();
if (mountEntryPoint != null) {
if (mountEntryPoint.hasReadOnly()) {
optionsBuilder.setReadOnly(mountEntryPoint.getReadOnly());
}
for (File.StringPairEntry entry : mountEntryPoint.getPropertiesList()) {
optionsBuilder.putProperties(entry.getKey(), entry.getValue());
}
if (mountEntryPoint.hasShared()) {
optionsBuilder.setShared(mountEntryPoint.getShared());
}
}
return optionsBuilder.build();
} }
|
public class class_name {
public static MountPOptions fromMountEntry(File.AddMountPointEntry mountEntryPoint) {
MountPOptions.Builder optionsBuilder = MountPOptions.newBuilder();
if (mountEntryPoint != null) {
if (mountEntryPoint.hasReadOnly()) {
optionsBuilder.setReadOnly(mountEntryPoint.getReadOnly()); // depends on control dependency: [if], data = [none]
}
for (File.StringPairEntry entry : mountEntryPoint.getPropertiesList()) {
optionsBuilder.putProperties(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry]
}
if (mountEntryPoint.hasShared()) {
optionsBuilder.setShared(mountEntryPoint.getShared()); // depends on control dependency: [if], data = [none]
}
}
return optionsBuilder.build();
} }
|
public class class_name {
public FluidItem sendToFlowSynchronized(
Form formToSendToFlowParam,
String destinationFlowParam) {
if(formToSendToFlowParam == null)
{
return null;
}
if(destinationFlowParam == null ||
destinationFlowParam.trim().isEmpty())
{
throw new FluidClientException(
"No destination Flow provided.",
FluidClientException.ErrorCode.FIELD_VALIDATE);
}
FluidItem itemToSend = new FluidItem();
itemToSend.setFlow(destinationFlowParam);
itemToSend.setForm(formToSendToFlowParam);
//Send all the messages...
itemToSend.setEcho(UUID.randomUUID().toString());
//Start a new request...
String uniqueReqId = this.initNewRequest();
//Send the actual message...
this.sendMessage(itemToSend, uniqueReqId);
try {
List<FluidItem> returnValue = this.getHandler(uniqueReqId).getCF().get(
this.getTimeoutInMillis(),TimeUnit.MILLISECONDS);
//Connection was closed.. this is a problem....
if(this.getHandler(uniqueReqId).isConnectionClosed()) {
throw new FluidClientException(
"WebSocket-SendToFlow: " +
"The connection was closed by the server prior to the response received.",
FluidClientException.ErrorCode.IO_ERROR);
}
if(returnValue == null || returnValue.isEmpty())
{
return null;
}
return returnValue.get(0);
}
//Interrupted...
catch (InterruptedException exceptParam) {
throw new FluidClientException(
"WebSocket-Interrupted-SendToFlow: " +
exceptParam.getMessage(),
exceptParam,
FluidClientException.ErrorCode.STATEMENT_EXECUTION_ERROR);
}
//Error on the web-socket...
catch (ExecutionException executeProblem) {
Throwable cause = executeProblem.getCause();
//Fluid client exception...
if(cause instanceof FluidClientException)
{
throw (FluidClientException)cause;
}
else
{
throw new FluidClientException(
"WebSocket-SendToFlow: " +
cause.getMessage(), cause,
FluidClientException.ErrorCode.STATEMENT_EXECUTION_ERROR);
}
}
//Timeout...
catch (TimeoutException eParam) {
throw new FluidClientException(
"WebSocket-SendToFlow: Timeout while waiting for all return data. There were '"
+this.getHandler(uniqueReqId).getReturnValue().size()
+"' items after a Timeout of "+(
TimeUnit.MILLISECONDS.toSeconds(this.getTimeoutInMillis()))+" seconds."
,FluidClientException.ErrorCode.IO_ERROR);
}
finally {
this.removeHandler(uniqueReqId);
}
} }
|
public class class_name {
public FluidItem sendToFlowSynchronized(
Form formToSendToFlowParam,
String destinationFlowParam) {
if(formToSendToFlowParam == null)
{
return null; // depends on control dependency: [if], data = [none]
}
if(destinationFlowParam == null ||
destinationFlowParam.trim().isEmpty())
{
throw new FluidClientException(
"No destination Flow provided.",
FluidClientException.ErrorCode.FIELD_VALIDATE);
}
FluidItem itemToSend = new FluidItem();
itemToSend.setFlow(destinationFlowParam);
itemToSend.setForm(formToSendToFlowParam);
//Send all the messages...
itemToSend.setEcho(UUID.randomUUID().toString());
//Start a new request...
String uniqueReqId = this.initNewRequest();
//Send the actual message...
this.sendMessage(itemToSend, uniqueReqId);
try {
List<FluidItem> returnValue = this.getHandler(uniqueReqId).getCF().get(
this.getTimeoutInMillis(),TimeUnit.MILLISECONDS);
//Connection was closed.. this is a problem....
if(this.getHandler(uniqueReqId).isConnectionClosed()) {
throw new FluidClientException(
"WebSocket-SendToFlow: " +
"The connection was closed by the server prior to the response received.",
FluidClientException.ErrorCode.IO_ERROR);
}
if(returnValue == null || returnValue.isEmpty())
{
return null; // depends on control dependency: [if], data = [none]
}
return returnValue.get(0); // depends on control dependency: [try], data = [none]
}
//Interrupted...
catch (InterruptedException exceptParam) {
throw new FluidClientException(
"WebSocket-Interrupted-SendToFlow: " +
exceptParam.getMessage(),
exceptParam,
FluidClientException.ErrorCode.STATEMENT_EXECUTION_ERROR);
} // depends on control dependency: [catch], data = [none]
//Error on the web-socket...
catch (ExecutionException executeProblem) {
Throwable cause = executeProblem.getCause();
//Fluid client exception...
if(cause instanceof FluidClientException)
{
throw (FluidClientException)cause;
}
else
{
throw new FluidClientException(
"WebSocket-SendToFlow: " +
cause.getMessage(), cause,
FluidClientException.ErrorCode.STATEMENT_EXECUTION_ERROR);
}
} // depends on control dependency: [catch], data = [none]
//Timeout...
catch (TimeoutException eParam) {
throw new FluidClientException(
"WebSocket-SendToFlow: Timeout while waiting for all return data. There were '"
+this.getHandler(uniqueReqId).getReturnValue().size()
+"' items after a Timeout of "+(
TimeUnit.MILLISECONDS.toSeconds(this.getTimeoutInMillis()))+" seconds."
,FluidClientException.ErrorCode.IO_ERROR);
} // depends on control dependency: [catch], data = [none]
finally {
this.removeHandler(uniqueReqId);
}
} }
|
public class class_name {
public static Map<String, Object> getSubsetStartingWith(
final ServiceReference<?> serviceReference, final String prefix) {
final Map<String, Object> subset = new HashMap<>();
for (String key : serviceReference.getPropertyKeys()) {
if (key != null && key.startsWith(prefix)
&& key.trim().length() > prefix.length()) {
subset.put(key.substring(prefix.length()),
serviceReference.getProperty(key));
}
}
if (subset.isEmpty()) {
return null;
}
return subset;
} }
|
public class class_name {
public static Map<String, Object> getSubsetStartingWith(
final ServiceReference<?> serviceReference, final String prefix) {
final Map<String, Object> subset = new HashMap<>();
for (String key : serviceReference.getPropertyKeys()) {
if (key != null && key.startsWith(prefix)
&& key.trim().length() > prefix.length()) {
subset.put(key.substring(prefix.length()),
serviceReference.getProperty(key));
// depends on control dependency: [if], data = [(key]
}
}
if (subset.isEmpty()) {
return null;
// depends on control dependency: [if], data = [none]
}
return subset;
} }
|
public class class_name {
@javax.annotation.Nonnull
public static List<double[]> op(@javax.annotation.Nonnull final List<double[]> a, @javax.annotation.Nonnull final DoubleUnaryOperator fn) {
@javax.annotation.Nonnull final ArrayList<double[]> list = new ArrayList<>();
for (int i = 0; i < a.size(); i++) {
@javax.annotation.Nonnull final double[] c = new double[a.get(i).length];
for (int j = 0; j < a.get(i).length; j++) {
c[j] = fn.applyAsDouble(a.get(i)[j]);
}
list.add(c);
}
return list;
} }
|
public class class_name {
@javax.annotation.Nonnull
public static List<double[]> op(@javax.annotation.Nonnull final List<double[]> a, @javax.annotation.Nonnull final DoubleUnaryOperator fn) {
@javax.annotation.Nonnull final ArrayList<double[]> list = new ArrayList<>();
for (int i = 0; i < a.size(); i++) {
@javax.annotation.Nonnull final double[] c = new double[a.get(i).length];
for (int j = 0; j < a.get(i).length; j++) {
c[j] = fn.applyAsDouble(a.get(i)[j]); // depends on control dependency: [for], data = [j]
}
list.add(c); // depends on control dependency: [for], data = [none]
}
return list;
} }
|
public class class_name {
private boolean isMavenVersionTag(GraphContext context, FileLocationModel model)
{
if (isMavenFile(context, model))
{
Document doc = ((XmlFileModel) model.getFile()).asDocument();
for (Element elm : $(doc).find("version"))
{
String text = StringUtils.trim($(elm).text());
if (StringUtils.equals(text, model.getSourceSnippit()))
{
return true;
}
}
}
return false;
} }
|
public class class_name {
private boolean isMavenVersionTag(GraphContext context, FileLocationModel model)
{
if (isMavenFile(context, model))
{
Document doc = ((XmlFileModel) model.getFile()).asDocument();
for (Element elm : $(doc).find("version"))
{
String text = StringUtils.trim($(elm).text());
if (StringUtils.equals(text, model.getSourceSnippit()))
{
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} }
|
public class class_name {
static public void setDebugLeaks(boolean b) {
if (b) {
count_openFiles.set(0);
maxOpenFiles.set(0);
allFiles = new HashSet<>(1000);
}
debugLeaks = b;
} }
|
public class class_name {
static public void setDebugLeaks(boolean b) {
if (b) {
count_openFiles.set(0);
// depends on control dependency: [if], data = [none]
maxOpenFiles.set(0);
// depends on control dependency: [if], data = [none]
allFiles = new HashSet<>(1000);
// depends on control dependency: [if], data = [none]
}
debugLeaks = b;
} }
|
public class class_name {
public static MethodNotAllowed of(int errorCode) {
if (_localizedErrorMsg()) {
return of(errorCode, defaultMessage(METHOD_NOT_ALLOWED));
} else {
touchPayload().errorCode(errorCode);
return _INSTANCE;
}
} }
|
public class class_name {
public static MethodNotAllowed of(int errorCode) {
if (_localizedErrorMsg()) {
return of(errorCode, defaultMessage(METHOD_NOT_ALLOWED)); // depends on control dependency: [if], data = [none]
} else {
touchPayload().errorCode(errorCode); // depends on control dependency: [if], data = [none]
return _INSTANCE; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public String getMountedExternalStorageDirectoryPath() {
String path = null;
String state = Environment.getExternalStorageState();
if (state.equals(Environment.MEDIA_MOUNTED) ||
state.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) {
path = absPath(Environment.getExternalStorageDirectory());
}
return path;
} }
|
public class class_name {
public String getMountedExternalStorageDirectoryPath() {
String path = null;
String state = Environment.getExternalStorageState();
if (state.equals(Environment.MEDIA_MOUNTED) ||
state.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) {
path = absPath(Environment.getExternalStorageDirectory()); // depends on control dependency: [if], data = [none]
}
return path;
} }
|
public class class_name {
public Config build() {
if (this.language == null) {
this.language = "java";
}
if (this.endpoint == null) {
this.endpoint = SyncSender.DEFAULT_API_ENDPOINT;
}
if (this.notifier == null) {
this.notifier = new NotifierProvider();
}
if (this.sender == null) {
SyncSender.Builder innerSender =
new SyncSender.Builder(this.endpoint)
.accessToken(accessToken)
.proxy(proxy);
if (this.jsonSerializer != null) {
innerSender.jsonSerializer(this.jsonSerializer);
}
this.sender =
new BufferedSender.Builder().sender(innerSender.build()).build();
}
if (this.timestamp == null) {
this.timestamp = new TimestampProvider();
}
return new ConfigImpl(this);
} }
|
public class class_name {
public Config build() {
if (this.language == null) {
this.language = "java"; // depends on control dependency: [if], data = [none]
}
if (this.endpoint == null) {
this.endpoint = SyncSender.DEFAULT_API_ENDPOINT; // depends on control dependency: [if], data = [none]
}
if (this.notifier == null) {
this.notifier = new NotifierProvider(); // depends on control dependency: [if], data = [none]
}
if (this.sender == null) {
SyncSender.Builder innerSender =
new SyncSender.Builder(this.endpoint)
.accessToken(accessToken)
.proxy(proxy);
if (this.jsonSerializer != null) {
innerSender.jsonSerializer(this.jsonSerializer); // depends on control dependency: [if], data = [(this.jsonSerializer]
}
this.sender =
new BufferedSender.Builder().sender(innerSender.build()).build(); // depends on control dependency: [if], data = [none]
}
if (this.timestamp == null) {
this.timestamp = new TimestampProvider(); // depends on control dependency: [if], data = [none]
}
return new ConfigImpl(this);
} }
|
public class class_name {
public void init(String url, String user, String pass, String driver) {
this.driver = StrUtil.isNotBlank(driver) ? driver : DriverUtil.identifyDriver(url);
try {
Class.forName(this.driver);
} catch (ClassNotFoundException e) {
throw new DbRuntimeException(e, "Get jdbc driver [{}] error!", driver);
}
this.url = url;
this.user = user;
this.pass = pass;
} }
|
public class class_name {
public void init(String url, String user, String pass, String driver) {
this.driver = StrUtil.isNotBlank(driver) ? driver : DriverUtil.identifyDriver(url);
try {
Class.forName(this.driver);
// depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException e) {
throw new DbRuntimeException(e, "Get jdbc driver [{}] error!", driver);
}
// depends on control dependency: [catch], data = [none]
this.url = url;
this.user = user;
this.pass = pass;
} }
|
public class class_name {
public GlobalSecondaryIndexDescription withKeySchema(KeySchemaElement... keySchema) {
if (this.keySchema == null) {
setKeySchema(new java.util.ArrayList<KeySchemaElement>(keySchema.length));
}
for (KeySchemaElement ele : keySchema) {
this.keySchema.add(ele);
}
return this;
} }
|
public class class_name {
public GlobalSecondaryIndexDescription withKeySchema(KeySchemaElement... keySchema) {
if (this.keySchema == null) {
setKeySchema(new java.util.ArrayList<KeySchemaElement>(keySchema.length)); // depends on control dependency: [if], data = [none]
}
for (KeySchemaElement ele : keySchema) {
this.keySchema.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public static <T> Collection<MemberResponse<T>> executeOptimistic(IExecutorService execSvc, Set<Member> members, Callable<T> callable, long maxWaitTime, TimeUnit unit) {
Collection<MemberResponse<T>> result = new ArrayList<MemberResponse<T>>(members.size());
Map<Member, Future<T>> resultFutures = execSvc.submitToMembers(callable, members);
for(Entry<Member, Future<T>> futureEntry : resultFutures.entrySet()) {
Future<T> future = futureEntry.getValue();
Member member = futureEntry.getKey();
try {
if(maxWaitTime > 0) {
result.add(new MemberResponse<T>(member, future.get(maxWaitTime, unit)));
} else {
result.add(new MemberResponse<T>(member, future.get()));
}
//ignore exceptions... return what you can
} catch (InterruptedException e) {
Thread.currentThread().interrupt(); //restore interrupted status and return what we have
return result;
} catch (MemberLeftException e) {
log.warn("Member {} left while trying to get a distributed callable result", member);
} catch (ExecutionException e) {
if(e.getCause() instanceof InterruptedException) {
//restore interrupted state and return
Thread.currentThread().interrupt();
return result;
} else {
log.warn("Unable to execute callable on "+member+". There was an error.", e);
}
} catch (TimeoutException e) {
log.error("Unable to execute task on "+member+" within 10 seconds.");
} catch (RuntimeException e) {
log.error("Unable to execute task on "+member+". An unexpected error occurred.", e);
}
}
return result;
} }
|
public class class_name {
public static <T> Collection<MemberResponse<T>> executeOptimistic(IExecutorService execSvc, Set<Member> members, Callable<T> callable, long maxWaitTime, TimeUnit unit) {
Collection<MemberResponse<T>> result = new ArrayList<MemberResponse<T>>(members.size());
Map<Member, Future<T>> resultFutures = execSvc.submitToMembers(callable, members);
for(Entry<Member, Future<T>> futureEntry : resultFutures.entrySet()) {
Future<T> future = futureEntry.getValue();
Member member = futureEntry.getKey();
try {
if(maxWaitTime > 0) {
result.add(new MemberResponse<T>(member, future.get(maxWaitTime, unit))); // depends on control dependency: [if], data = [(maxWaitTime]
} else {
result.add(new MemberResponse<T>(member, future.get())); // depends on control dependency: [if], data = [none]
}
//ignore exceptions... return what you can
} catch (InterruptedException e) {
Thread.currentThread().interrupt(); //restore interrupted status and return what we have
return result;
} catch (MemberLeftException e) { // depends on control dependency: [catch], data = [none]
log.warn("Member {} left while trying to get a distributed callable result", member);
} catch (ExecutionException e) { // depends on control dependency: [catch], data = [none]
if(e.getCause() instanceof InterruptedException) {
//restore interrupted state and return
Thread.currentThread().interrupt(); // depends on control dependency: [if], data = [none]
return result; // depends on control dependency: [if], data = [none]
} else {
log.warn("Unable to execute callable on "+member+". There was an error.", e); // depends on control dependency: [if], data = [none]
}
} catch (TimeoutException e) { // depends on control dependency: [catch], data = [none]
log.error("Unable to execute task on "+member+" within 10 seconds.");
} catch (RuntimeException e) { // depends on control dependency: [catch], data = [none]
log.error("Unable to execute task on "+member+". An unexpected error occurred.", e);
} // depends on control dependency: [catch], data = [none]
}
return result;
} }
|
public class class_name {
public void passivateDialog(HASipDialog dialog) {
String dialogId = dialog.getDialogIdToReplicate();
sipCache.evictDialog(dialogId);
String mergeId = dialog.getMergeId();
if (mergeId != null) {
serverDialogMergeTestTable.remove(mergeId);
}
dialogTable.remove(dialogId);
} }
|
public class class_name {
public void passivateDialog(HASipDialog dialog) {
String dialogId = dialog.getDialogIdToReplicate();
sipCache.evictDialog(dialogId);
String mergeId = dialog.getMergeId();
if (mergeId != null) {
serverDialogMergeTestTable.remove(mergeId); // depends on control dependency: [if], data = [(mergeId]
}
dialogTable.remove(dialogId);
} }
|
public class class_name {
private void snapBondToPosition(IAtom beg, IBond bond, Point2d tP) {
IAtom end = bond.getOther(beg);
Point2d bP = beg.getPoint2d();
Point2d eP = end.getPoint2d();
Vector2d curr = new Vector2d(eP.x-bP.x, eP.y-bP.y);
Vector2d dest = new Vector2d(tP.x-bP.x, tP.y-bP.y);
double theta = Math.atan2(curr.y, curr.x) - Math.atan2(dest.y, dest.x);
double sin = Math.sin(theta);
double cos = Math.cos(theta);
bond.setFlag(CDKConstants.VISITED, true);
Deque<IAtom> queue = new ArrayDeque<>();
queue.add(end);
while (!queue.isEmpty()) {
IAtom atom = queue.poll();
if (!atom.getFlag(CDKConstants.VISITED)) {
rotate(atom.getPoint2d(), bP, cos, sin);
atom.setFlag(CDKConstants.VISITED, true);
}
for (IBond b : container.getConnectedBondsList(atom))
if (!b.getFlag(CDKConstants.VISITED)) {
queue.add(b.getOther(atom));
b.setFlag(CDKConstants.VISITED, true);
}
}
} }
|
public class class_name {
private void snapBondToPosition(IAtom beg, IBond bond, Point2d tP) {
IAtom end = bond.getOther(beg);
Point2d bP = beg.getPoint2d();
Point2d eP = end.getPoint2d();
Vector2d curr = new Vector2d(eP.x-bP.x, eP.y-bP.y);
Vector2d dest = new Vector2d(tP.x-bP.x, tP.y-bP.y);
double theta = Math.atan2(curr.y, curr.x) - Math.atan2(dest.y, dest.x);
double sin = Math.sin(theta);
double cos = Math.cos(theta);
bond.setFlag(CDKConstants.VISITED, true);
Deque<IAtom> queue = new ArrayDeque<>();
queue.add(end);
while (!queue.isEmpty()) {
IAtom atom = queue.poll();
if (!atom.getFlag(CDKConstants.VISITED)) {
rotate(atom.getPoint2d(), bP, cos, sin); // depends on control dependency: [if], data = [none]
atom.setFlag(CDKConstants.VISITED, true); // depends on control dependency: [if], data = [none]
}
for (IBond b : container.getConnectedBondsList(atom))
if (!b.getFlag(CDKConstants.VISITED)) {
queue.add(b.getOther(atom)); // depends on control dependency: [if], data = [none]
b.setFlag(CDKConstants.VISITED, true); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public ResponseTimeRootCause withServices(ResponseTimeRootCauseService... services) {
if (this.services == null) {
setServices(new java.util.ArrayList<ResponseTimeRootCauseService>(services.length));
}
for (ResponseTimeRootCauseService ele : services) {
this.services.add(ele);
}
return this;
} }
|
public class class_name {
public ResponseTimeRootCause withServices(ResponseTimeRootCauseService... services) {
if (this.services == null) {
setServices(new java.util.ArrayList<ResponseTimeRootCauseService>(services.length)); // depends on control dependency: [if], data = [none]
}
for (ResponseTimeRootCauseService ele : services) {
this.services.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
private static void write(BERoleConfig config,
boolean wholeElement,
boolean skipIfAllNull,
PrintWriter writer) {
if (wholeElement) {
if (skipIfAllNull && config.getCallSSL() == null
&& config.getCallBasicAuth() == null
&& config.getCallUsername() == null
&& config.getCallPassword() == null
&& config.getCallbackSSL() == null
&& config.getCallbackBasicAuth() == null
&& config.getIPList() == null) {
return;
}
writer.print(" <" + _CONFIG);
}
writeAttribute(_ROLE, config.getRole(), writer);
writeAttribute(_CALLSSL, config.getCallSSL(), writer);
writeAttribute(_CALLBASICAUTH, config.getCallBasicAuth(), writer);
writeAttribute(_CALLUSERNAME, config.getCallUsername(), writer);
writeAttribute(_CALLPASSWORD, config.getCallPassword(), writer);
writeAttribute(_CALLBACKSSL, config.getCallbackSSL(), writer);
writeAttribute(_CALLBACKBASICAUTH,
config.getCallbackBasicAuth(),
writer);
writeAttribute(_IPLIST, config.getIPList(), writer);
if (wholeElement) {
writer.println("/>");
}
} }
|
public class class_name {
private static void write(BERoleConfig config,
boolean wholeElement,
boolean skipIfAllNull,
PrintWriter writer) {
if (wholeElement) {
if (skipIfAllNull && config.getCallSSL() == null
&& config.getCallBasicAuth() == null
&& config.getCallUsername() == null
&& config.getCallPassword() == null
&& config.getCallbackSSL() == null
&& config.getCallbackBasicAuth() == null
&& config.getIPList() == null) {
return; // depends on control dependency: [if], data = [none]
}
writer.print(" <" + _CONFIG); // depends on control dependency: [if], data = [none]
}
writeAttribute(_ROLE, config.getRole(), writer);
writeAttribute(_CALLSSL, config.getCallSSL(), writer);
writeAttribute(_CALLBASICAUTH, config.getCallBasicAuth(), writer);
writeAttribute(_CALLUSERNAME, config.getCallUsername(), writer);
writeAttribute(_CALLPASSWORD, config.getCallPassword(), writer);
writeAttribute(_CALLBACKSSL, config.getCallbackSSL(), writer);
writeAttribute(_CALLBACKBASICAUTH,
config.getCallbackBasicAuth(),
writer);
writeAttribute(_IPLIST, config.getIPList(), writer);
if (wholeElement) {
writer.println("/>"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public double getTimeToEstimate(int sequenceNumNow, int sequenceNumTo) {
double timeCounter = 0.0;
for (int i = sequenceNumNow-this.sequenceNumberStart; i <= sequenceNumTo; i++) {
timeCounter += this.getDTs()[i];
}
return timeCounter;
} }
|
public class class_name {
public double getTimeToEstimate(int sequenceNumNow, int sequenceNumTo) {
double timeCounter = 0.0;
for (int i = sequenceNumNow-this.sequenceNumberStart; i <= sequenceNumTo; i++) {
timeCounter += this.getDTs()[i]; // depends on control dependency: [for], data = [i]
}
return timeCounter;
} }
|
public class class_name {
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if (lombokDisabled) return false;
if (roundEnv.processingOver()) {
cleanup.run();
return false;
}
// We have: A sorted set of all priority levels: 'priorityLevels'
// Step 1: Take all CUs which aren't already in the map. Give them the first priority level.
String randomModuleName = null;
for (Element element : roundEnv.getRootElements()) {
if (randomModuleName == null) randomModuleName = getModuleNameFor(element);
JCCompilationUnit unit = toUnit(element);
if (unit == null) continue;
if (roots.containsKey(unit)) continue;
roots.put(unit, priorityLevels[0]);
}
while (true) {
// Step 2: For all CUs (in the map, not the roundEnv!), run them across all handlers at their current prio level.
for (long prio : priorityLevels) {
List<JCCompilationUnit> cusForThisRound = new ArrayList<JCCompilationUnit>();
for (Map.Entry<JCCompilationUnit, Long> entry : roots.entrySet()) {
Long prioOfCu = entry.getValue();
if (prioOfCu == null || prioOfCu != prio) continue;
cusForThisRound.add(entry.getKey());
}
transformer.transform(prio, javacProcessingEnv.getContext(), cusForThisRound, cleanup);
}
// Step 3: Push up all CUs to the next level. Set level to null if there is no next level.
Set<Long> newLevels = new HashSet<Long>();
for (int i = priorityLevels.length - 1; i >= 0; i--) {
Long curLevel = priorityLevels[i];
Long nextLevel = (i == priorityLevels.length - 1) ? null : priorityLevels[i + 1];
List<JCCompilationUnit> cusToAdvance = new ArrayList<JCCompilationUnit>();
for (Map.Entry<JCCompilationUnit, Long> entry : roots.entrySet()) {
if (curLevel.equals(entry.getValue())) {
cusToAdvance.add(entry.getKey());
newLevels.add(nextLevel);
}
}
for (JCCompilationUnit unit : cusToAdvance) {
roots.put(unit, nextLevel);
}
}
newLevels.remove(null);
// Step 4: If ALL values are null, quit. Else, either do another loop right now or force a resolution reset by forcing a new round in the annotation processor.
if (newLevels.isEmpty()) return false;
newLevels.retainAll(priorityLevelsRequiringResolutionReset);
if (!newLevels.isEmpty()) {
// Force a new round to reset resolution. The next round will cause this method (process) to be called again.
forceNewRound(randomModuleName, javacFiler);
return false;
}
// None of the new levels need resolution, so just keep going.
}
} }
|
public class class_name {
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if (lombokDisabled) return false;
if (roundEnv.processingOver()) {
cleanup.run(); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
// We have: A sorted set of all priority levels: 'priorityLevels'
// Step 1: Take all CUs which aren't already in the map. Give them the first priority level.
String randomModuleName = null;
for (Element element : roundEnv.getRootElements()) {
if (randomModuleName == null) randomModuleName = getModuleNameFor(element);
JCCompilationUnit unit = toUnit(element);
if (unit == null) continue;
if (roots.containsKey(unit)) continue;
roots.put(unit, priorityLevels[0]); // depends on control dependency: [for], data = [none]
}
while (true) {
// Step 2: For all CUs (in the map, not the roundEnv!), run them across all handlers at their current prio level.
for (long prio : priorityLevels) {
List<JCCompilationUnit> cusForThisRound = new ArrayList<JCCompilationUnit>();
for (Map.Entry<JCCompilationUnit, Long> entry : roots.entrySet()) {
Long prioOfCu = entry.getValue();
if (prioOfCu == null || prioOfCu != prio) continue;
cusForThisRound.add(entry.getKey()); // depends on control dependency: [for], data = [entry]
}
transformer.transform(prio, javacProcessingEnv.getContext(), cusForThisRound, cleanup); // depends on control dependency: [for], data = [prio]
}
// Step 3: Push up all CUs to the next level. Set level to null if there is no next level.
Set<Long> newLevels = new HashSet<Long>();
for (int i = priorityLevels.length - 1; i >= 0; i--) {
Long curLevel = priorityLevels[i];
Long nextLevel = (i == priorityLevels.length - 1) ? null : priorityLevels[i + 1];
List<JCCompilationUnit> cusToAdvance = new ArrayList<JCCompilationUnit>();
for (Map.Entry<JCCompilationUnit, Long> entry : roots.entrySet()) {
if (curLevel.equals(entry.getValue())) {
cusToAdvance.add(entry.getKey()); // depends on control dependency: [if], data = [none]
newLevels.add(nextLevel); // depends on control dependency: [if], data = [none]
}
}
for (JCCompilationUnit unit : cusToAdvance) {
roots.put(unit, nextLevel); // depends on control dependency: [for], data = [unit]
}
}
newLevels.remove(null); // depends on control dependency: [while], data = [none]
// Step 4: If ALL values are null, quit. Else, either do another loop right now or force a resolution reset by forcing a new round in the annotation processor.
if (newLevels.isEmpty()) return false;
newLevels.retainAll(priorityLevelsRequiringResolutionReset); // depends on control dependency: [while], data = [none]
if (!newLevels.isEmpty()) {
// Force a new round to reset resolution. The next round will cause this method (process) to be called again.
forceNewRound(randomModuleName, javacFiler); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
// None of the new levels need resolution, so just keep going.
}
} }
|
public class class_name {
protected void adoptSubWidgets(Element root) {
GQuery children = $(root).children();
for (Element child : children.elements()) {
Widget w = $(child).widget();
if (w != null) {
doAdopt(w);
} else {
adoptSubWidgets(child);
}
}
} }
|
public class class_name {
protected void adoptSubWidgets(Element root) {
GQuery children = $(root).children();
for (Element child : children.elements()) {
Widget w = $(child).widget();
if (w != null) {
doAdopt(w); // depends on control dependency: [if], data = [(w]
} else {
adoptSubWidgets(child); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public float[][] getTheta() {
float[][] theta = new float[documents.length][K];
if (SAMPLE_LAG > 0) {
for (int m = 0; m < documents.length; m++) {
for (int k = 0; k < K; k++) {
theta[m][k] = thetasum[m][k] / numstats;
}
}
} else {
for (int m = 0; m < documents.length; m++) {
for (int k = 0; k < K; k++) {
theta[m][k] = (nd[m][k] + alpha) / (ndsum[m] + K * alpha);
}
}
}
return theta;
} }
|
public class class_name {
public float[][] getTheta() {
float[][] theta = new float[documents.length][K];
if (SAMPLE_LAG > 0) {
for (int m = 0; m < documents.length; m++) {
for (int k = 0; k < K; k++) {
theta[m][k] = thetasum[m][k] / numstats;
// depends on control dependency: [for], data = [k]
}
}
} else {
for (int m = 0; m < documents.length; m++) {
for (int k = 0; k < K; k++) {
theta[m][k] = (nd[m][k] + alpha) / (ndsum[m] + K * alpha);
// depends on control dependency: [for], data = [k]
}
}
}
return theta;
} }
|
public class class_name {
private static boolean containsDelimiter(String string) {
final char[] charArray = string.toCharArray();
for (char c : charArray) {
if (isDelimiter(c)) {
return true;
}
}
return false;
} }
|
public class class_name {
private static boolean containsDelimiter(String string) {
final char[] charArray = string.toCharArray();
for (char c : charArray) {
if (isDelimiter(c)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
public static synchronized void disableTextDestination() {
if (textHandler != null) {
Logger.getLogger("").removeHandler(textHandler);
// ManagerAdmin.getWsHandlerManager().removeWsHandler(textHandler);
//735356 Before deleting textHandler, we should close the file. Otherwise file remains open and causes hang during log rotation.
textHandler.stop();
textHandler = null;
}
} }
|
public class class_name {
public static synchronized void disableTextDestination() {
if (textHandler != null) {
Logger.getLogger("").removeHandler(textHandler); // depends on control dependency: [if], data = [(textHandler]
// ManagerAdmin.getWsHandlerManager().removeWsHandler(textHandler);
//735356 Before deleting textHandler, we should close the file. Otherwise file remains open and causes hang during log rotation.
textHandler.stop(); // depends on control dependency: [if], data = [none]
textHandler = null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public CreateEventSubscriptionRequest withEventCategories(String... eventCategories) {
if (this.eventCategories == null) {
setEventCategories(new java.util.ArrayList<String>(eventCategories.length));
}
for (String ele : eventCategories) {
this.eventCategories.add(ele);
}
return this;
} }
|
public class class_name {
public CreateEventSubscriptionRequest withEventCategories(String... eventCategories) {
if (this.eventCategories == null) {
setEventCategories(new java.util.ArrayList<String>(eventCategories.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : eventCategories) {
this.eventCategories.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
@Override
protected void paintComponent(Graphics g) {
final Graphics2D G2 = (Graphics2D) g.create();
MAIN_CENTER.setLocation(INNER_BOUNDS.getCenterX(), INNER_BOUNDS.getCenterX());
SMALL_CENTER.setLocation(INNER_BOUNDS.getCenterX(), INNER_BOUNDS.width * 0.3130841121);
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 the insets
G2.translate(getFramelessOffset().getX(), getFramelessOffset().getY());
final AffineTransform OLD_TRANSFORM = G2.getTransform();
// Draw combined background image
G2.drawImage(bImage, 0, 0, null);
G2.drawImage(smallTickmarkImage, ((INNER_BOUNDS.width - smallTickmarkImage.getWidth()) / 2), (int) (SMALL_CENTER.getY() - smallTickmarkImage.getHeight() / 2.0), null);
// Draw the small pointer
G2.rotate(Math.toRadians(minutePointerAngle + (2 * Math.sin(Math.toRadians(minutePointerAngle)))), SMALL_CENTER.getX(), SMALL_CENTER.getY());
G2.drawImage(smallPointerShadowImage, 0, 0, null);
G2.setTransform(OLD_TRANSFORM);
G2.rotate(Math.toRadians(minutePointerAngle), SMALL_CENTER.getX(), SMALL_CENTER.getY());
G2.drawImage(smallPointerImage, 0, 0, null);
G2.setTransform(OLD_TRANSFORM);
// Draw the main pointer
G2.rotate(Math.toRadians(secondPointerAngle + (2 * Math.sin(Math.toRadians(secondPointerAngle)))), MAIN_CENTER.getX(), MAIN_CENTER.getY());
G2.drawImage(mainPointerShadowImage, 0, 0, null);
G2.setTransform(OLD_TRANSFORM);
G2.rotate(Math.toRadians(secondPointerAngle), MAIN_CENTER.getX(), MAIN_CENTER.getY());
G2.drawImage(mainPointerImage, 0, 0, null);
G2.setTransform(OLD_TRANSFORM);
// 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();
MAIN_CENTER.setLocation(INNER_BOUNDS.getCenterX(), INNER_BOUNDS.getCenterX());
SMALL_CENTER.setLocation(INNER_BOUNDS.getCenterX(), INNER_BOUNDS.width * 0.3130841121);
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 the insets
G2.translate(getFramelessOffset().getX(), getFramelessOffset().getY());
final AffineTransform OLD_TRANSFORM = G2.getTransform();
// Draw combined background image
G2.drawImage(bImage, 0, 0, null);
G2.drawImage(smallTickmarkImage, ((INNER_BOUNDS.width - smallTickmarkImage.getWidth()) / 2), (int) (SMALL_CENTER.getY() - smallTickmarkImage.getHeight() / 2.0), null);
// Draw the small pointer
G2.rotate(Math.toRadians(minutePointerAngle + (2 * Math.sin(Math.toRadians(minutePointerAngle)))), SMALL_CENTER.getX(), SMALL_CENTER.getY());
G2.drawImage(smallPointerShadowImage, 0, 0, null);
G2.setTransform(OLD_TRANSFORM);
G2.rotate(Math.toRadians(minutePointerAngle), SMALL_CENTER.getX(), SMALL_CENTER.getY());
G2.drawImage(smallPointerImage, 0, 0, null);
G2.setTransform(OLD_TRANSFORM);
// Draw the main pointer
G2.rotate(Math.toRadians(secondPointerAngle + (2 * Math.sin(Math.toRadians(secondPointerAngle)))), MAIN_CENTER.getX(), MAIN_CENTER.getY());
G2.drawImage(mainPointerShadowImage, 0, 0, null);
G2.setTransform(OLD_TRANSFORM);
G2.rotate(Math.toRadians(secondPointerAngle), MAIN_CENTER.getX(), MAIN_CENTER.getY());
G2.drawImage(mainPointerImage, 0, 0, null);
G2.setTransform(OLD_TRANSFORM);
// Draw combined foreground image
G2.drawImage(fImage, 0, 0, null);
if (!isEnabled()) {
G2.drawImage(disabledImage, 0, 0, null); // depends on control dependency: [if], data = [none]
}
// Translate the coordinate system back to original
G2.translate(-getInnerBounds().x, -getInnerBounds().y);
G2.dispose();
} }
|
public class class_name {
@Override
public int compareTo(Object other) {
if (other == null) {
return -1;
}
JobKey otherKey = (JobKey)other;
return new CompareToBuilder().appendSuper(super.compareTo(otherKey))
.append(this.jobId, otherKey.getJobId())
.toComparison();
} }
|
public class class_name {
@Override
public int compareTo(Object other) {
if (other == null) {
return -1; // depends on control dependency: [if], data = [none]
}
JobKey otherKey = (JobKey)other;
return new CompareToBuilder().appendSuper(super.compareTo(otherKey))
.append(this.jobId, otherKey.getJobId())
.toComparison();
} }
|
public class class_name {
public static DateTime floorToSecond(DateTime value) {
if (value == null) {
return null;
}
return new DateTime(value.getYear(), value.getMonthOfYear(), value.getDayOfMonth(), value.getHourOfDay(), value.getMinuteOfHour(), value.getSecondOfMinute(), 0, value.getZone());
} }
|
public class class_name {
public static DateTime floorToSecond(DateTime value) {
if (value == null) {
return null; // depends on control dependency: [if], data = [none]
}
return new DateTime(value.getYear(), value.getMonthOfYear(), value.getDayOfMonth(), value.getHourOfDay(), value.getMinuteOfHour(), value.getSecondOfMinute(), 0, value.getZone());
} }
|
public class class_name {
public boolean verify(String publicKeyId, String message, String signature) {
Base64EncodedVerifier verifier = cache.get(publicKeyId);
if (verifier != null) {
return verifier.verify(message, signature);
}
Base64EncodedVerifierImpl verifierImpl = new Base64EncodedVerifierImpl();
verifierImpl.setAlgorithm(algorithm);
verifierImpl.setCharsetName(charsetName);
verifierImpl.setProvider(provider);
PublicKey publicKey = publicKeyMap.get(publicKeyId);
if (publicKey == null) {
throw new SignatureException("public key not found: publicKeyId=" + publicKeyId);
}
verifierImpl.setPublicKey(publicKey);
cache.put(publicKeyId, verifierImpl);
return verifierImpl.verify(message, signature);
} }
|
public class class_name {
public boolean verify(String publicKeyId, String message, String signature) {
Base64EncodedVerifier verifier = cache.get(publicKeyId);
if (verifier != null) {
return verifier.verify(message, signature); // depends on control dependency: [if], data = [none]
}
Base64EncodedVerifierImpl verifierImpl = new Base64EncodedVerifierImpl();
verifierImpl.setAlgorithm(algorithm);
verifierImpl.setCharsetName(charsetName);
verifierImpl.setProvider(provider);
PublicKey publicKey = publicKeyMap.get(publicKeyId);
if (publicKey == null) {
throw new SignatureException("public key not found: publicKeyId=" + publicKeyId);
}
verifierImpl.setPublicKey(publicKey);
cache.put(publicKeyId, verifierImpl);
return verifierImpl.verify(message, signature);
} }
|
public class class_name {
public void destroy() {
if (mContentView != null) {
if (mGroupBasicAdapter != null) {
mGroupBasicAdapter.destroy();
}
mContentView.setAdapter(null);
mContentView = null;
}
TimerSupport timerSupport = getService(TimerSupport.class);
if (timerSupport != null) {
timerSupport.clear();
}
SimpleClickSupport simpleClickSupport = getService(SimpleClickSupport.class);
if (simpleClickSupport != null) {
simpleClickSupport.destroy();
}
ExposureSupport exposureSupport = getService(ExposureSupport.class);
if (exposureSupport != null) {
exposureSupport.destroy();
}
BusSupport busSupport = getService(BusSupport.class);
if (busSupport != null) {
busSupport.shutdown();
}
BannerSupport bannerSupport = getService(BannerSupport.class);
if (bannerSupport != null) {
bannerSupport.destroy();
}
MVHelper mvHelper = getService(MVHelper.class);
if (mvHelper != null) {
mvHelper.renderManager().destroyRenderService();
}
} }
|
public class class_name {
public void destroy() {
if (mContentView != null) {
if (mGroupBasicAdapter != null) {
mGroupBasicAdapter.destroy(); // depends on control dependency: [if], data = [none]
}
mContentView.setAdapter(null); // depends on control dependency: [if], data = [null)]
mContentView = null; // depends on control dependency: [if], data = [none]
}
TimerSupport timerSupport = getService(TimerSupport.class);
if (timerSupport != null) {
timerSupport.clear(); // depends on control dependency: [if], data = [none]
}
SimpleClickSupport simpleClickSupport = getService(SimpleClickSupport.class);
if (simpleClickSupport != null) {
simpleClickSupport.destroy(); // depends on control dependency: [if], data = [none]
}
ExposureSupport exposureSupport = getService(ExposureSupport.class);
if (exposureSupport != null) {
exposureSupport.destroy(); // depends on control dependency: [if], data = [none]
}
BusSupport busSupport = getService(BusSupport.class);
if (busSupport != null) {
busSupport.shutdown(); // depends on control dependency: [if], data = [none]
}
BannerSupport bannerSupport = getService(BannerSupport.class);
if (bannerSupport != null) {
bannerSupport.destroy(); // depends on control dependency: [if], data = [none]
}
MVHelper mvHelper = getService(MVHelper.class);
if (mvHelper != null) {
mvHelper.renderManager().destroyRenderService(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void sendEvent(T event, Object receiver, CreationalContext<?> creationalContext) {
try {
preNotify(event, receiver);
// As we are working with the contextual instance, we may not have the
// actual object, but a container proxy (e.g. EJB)
notificationStrategy.invoke(receiver, observerMethod, event, beanManager, creationalContext);
} finally {
postNotify(event, receiver);
}
} }
|
public class class_name {
protected void sendEvent(T event, Object receiver, CreationalContext<?> creationalContext) {
try {
preNotify(event, receiver); // depends on control dependency: [try], data = [none]
// As we are working with the contextual instance, we may not have the
// actual object, but a container proxy (e.g. EJB)
notificationStrategy.invoke(receiver, observerMethod, event, beanManager, creationalContext); // depends on control dependency: [try], data = [none]
} finally {
postNotify(event, receiver);
}
} }
|
public class class_name {
@Override
public boolean validate(final Problems problems, final String compName, final Object model) {
final boolean result = model != null && model.toString().length() > 0;
if (!result) {
final String message = ValidationBundle.getMessage(EmptyStringIllegalValidator.class, "MSG_MAY_NOT_BE_EMPTY", compName); // NOI18N
problems.add(message);
}
return result;
} }
|
public class class_name {
@Override
public boolean validate(final Problems problems, final String compName, final Object model) {
final boolean result = model != null && model.toString().length() > 0;
if (!result) {
final String message = ValidationBundle.getMessage(EmptyStringIllegalValidator.class, "MSG_MAY_NOT_BE_EMPTY", compName); // NOI18N
problems.add(message); // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
@WillNotClose
public static Optional<InterruptedException> uninterruptibleSleepFor(long timeout, TimeUnit unit) {
try {
unit.sleep(timeout);
return Optional.absent();
} catch (InterruptedException e) {
return Optional.of(e);
}
} }
|
public class class_name {
@WillNotClose
public static Optional<InterruptedException> uninterruptibleSleepFor(long timeout, TimeUnit unit) {
try {
unit.sleep(timeout); // depends on control dependency: [try], data = [none]
return Optional.absent(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
return Optional.of(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void addObjective(Objective<? super SolutionType, ? super DataType> objective, double weight) {
// check weight
if(weight > 0.0){
// add objective to map
weights.put(objective, weight);
} else {
throw new IllegalArgumentException("Error in weighted index: each objective's weight should be strictly positive.");
}
} }
|
public class class_name {
public void addObjective(Objective<? super SolutionType, ? super DataType> objective, double weight) {
// check weight
if(weight > 0.0){
// add objective to map
weights.put(objective, weight); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Error in weighted index: each objective's weight should be strictly positive.");
}
} }
|
public class class_name {
private CounterMetricFamily fromCounter(List<Map.Entry<MetricName, Counter>> countersWithSameName) {
final Map.Entry<MetricName, Counter> first = countersWithSameName.get(0);
final MetricName firstName = first.getKey();
final CounterMetricFamily metricFamily = new CounterMetricFamily(firstName.getName(), getHelpMessage(firstName, first.getValue()), firstName.getTagKeys());
for (Map.Entry<MetricName, Counter> entry : countersWithSameName) {
metricFamily.addMetric(entry.getKey().getTagValues(), entry.getValue().getCount());
}
return metricFamily;
} }
|
public class class_name {
private CounterMetricFamily fromCounter(List<Map.Entry<MetricName, Counter>> countersWithSameName) {
final Map.Entry<MetricName, Counter> first = countersWithSameName.get(0);
final MetricName firstName = first.getKey();
final CounterMetricFamily metricFamily = new CounterMetricFamily(firstName.getName(), getHelpMessage(firstName, first.getValue()), firstName.getTagKeys());
for (Map.Entry<MetricName, Counter> entry : countersWithSameName) {
metricFamily.addMetric(entry.getKey().getTagValues(), entry.getValue().getCount()); // depends on control dependency: [for], data = [entry]
}
return metricFamily;
} }
|
public class class_name {
protected synchronized void releaseBeanContextResources() {
for (Class serviceClass : _serviceProviders.keySet()) {
ServiceProvider sp = _serviceProviders.get(serviceClass);
if (sp.isDelegated()) {
sp.revoke(new BeanContextServiceRevokedEvent((BeanContextServices)getPeer(), serviceClass, true));
}
}
} }
|
public class class_name {
protected synchronized void releaseBeanContextResources() {
for (Class serviceClass : _serviceProviders.keySet()) {
ServiceProvider sp = _serviceProviders.get(serviceClass);
if (sp.isDelegated()) {
sp.revoke(new BeanContextServiceRevokedEvent((BeanContextServices)getPeer(), serviceClass, true)); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public Collection<Message> getAll() {
final int firstMessagePosition = this.getFirstPosition();
if (firstMessagePosition < MessageStore.INITIAL_MESSAGE_POSITION) {
return Collections.unmodifiableList(Collections.emptyList());
}
return this.getFrom(firstMessagePosition);
} }
|
public class class_name {
public Collection<Message> getAll() {
final int firstMessagePosition = this.getFirstPosition();
if (firstMessagePosition < MessageStore.INITIAL_MESSAGE_POSITION) {
return Collections.unmodifiableList(Collections.emptyList()); // depends on control dependency: [if], data = [none]
}
return this.getFrom(firstMessagePosition);
} }
|
public class class_name {
public static Type getFirstVisibleSuperClass(ClassDoc classDoc,
Configuration configuration) {
if (classDoc == null) {
return null;
}
Type sup = classDoc.superclassType();
ClassDoc supClassDoc = classDoc.superclass();
while (sup != null &&
(! (supClassDoc.isPublic() ||
isLinkable(supClassDoc, configuration))) ) {
if (supClassDoc.superclass().qualifiedName().equals(supClassDoc.qualifiedName()))
break;
sup = supClassDoc.superclassType();
supClassDoc = supClassDoc.superclass();
}
if (classDoc.equals(supClassDoc)) {
return null;
}
return sup;
} }
|
public class class_name {
public static Type getFirstVisibleSuperClass(ClassDoc classDoc,
Configuration configuration) {
if (classDoc == null) {
return null; // depends on control dependency: [if], data = [none]
}
Type sup = classDoc.superclassType();
ClassDoc supClassDoc = classDoc.superclass();
while (sup != null &&
(! (supClassDoc.isPublic() ||
isLinkable(supClassDoc, configuration))) ) {
if (supClassDoc.superclass().qualifiedName().equals(supClassDoc.qualifiedName()))
break;
sup = supClassDoc.superclassType(); // depends on control dependency: [while], data = [none]
supClassDoc = supClassDoc.superclass(); // depends on control dependency: [while], data = [none]
}
if (classDoc.equals(supClassDoc)) {
return null; // depends on control dependency: [if], data = [none]
}
return sup;
} }
|
public class class_name {
public Map<String, PubApi> getPubapis(Collection<JavaFileObject> explicitJFOs, boolean explicits) {
// Maps ":java.lang" to a package level pub api (with only types on top level)
Map<String, PubApi> result = new HashMap<>();
for (ClassSymbol cs : publicApiPerClass.keySet()) {
boolean amongExplicits = explicitJFOs.contains(cs.sourcefile);
if (explicits != amongExplicits)
continue;
String pkg = ":" + cs.packge().fullname;
PubApi currentPubApi = result.getOrDefault(pkg, new PubApi());
result.put(pkg, PubApi.mergeTypes(currentPubApi, publicApiPerClass.get(cs)));
}
return result;
} }
|
public class class_name {
public Map<String, PubApi> getPubapis(Collection<JavaFileObject> explicitJFOs, boolean explicits) {
// Maps ":java.lang" to a package level pub api (with only types on top level)
Map<String, PubApi> result = new HashMap<>();
for (ClassSymbol cs : publicApiPerClass.keySet()) {
boolean amongExplicits = explicitJFOs.contains(cs.sourcefile);
if (explicits != amongExplicits)
continue;
String pkg = ":" + cs.packge().fullname;
PubApi currentPubApi = result.getOrDefault(pkg, new PubApi());
result.put(pkg, PubApi.mergeTypes(currentPubApi, publicApiPerClass.get(cs))); // depends on control dependency: [for], data = [cs]
}
return result;
} }
|
public class class_name {
@Override
public LocalDateTime plus(long amountToAdd, TemporalUnit unit) {
if (unit instanceof ChronoUnit) {
ChronoUnit f = (ChronoUnit) unit;
switch (f) {
case NANOS: return plusNanos(amountToAdd);
case MICROS: return plusDays(amountToAdd / MICROS_PER_DAY).plusNanos((amountToAdd % MICROS_PER_DAY) * 1000);
case MILLIS: return plusDays(amountToAdd / MILLIS_PER_DAY).plusNanos((amountToAdd % MILLIS_PER_DAY) * 1000000);
case SECONDS: return plusSeconds(amountToAdd);
case MINUTES: return plusMinutes(amountToAdd);
case HOURS: return plusHours(amountToAdd);
case HALF_DAYS: return plusDays(amountToAdd / 256).plusHours((amountToAdd % 256) * 12); // no overflow (256 is multiple of 2)
}
return with(date.plus(amountToAdd, unit), time);
}
return unit.addTo(this, amountToAdd);
} }
|
public class class_name {
@Override
public LocalDateTime plus(long amountToAdd, TemporalUnit unit) {
if (unit instanceof ChronoUnit) {
ChronoUnit f = (ChronoUnit) unit;
switch (f) {
case NANOS: return plusNanos(amountToAdd);
case MICROS: return plusDays(amountToAdd / MICROS_PER_DAY).plusNanos((amountToAdd % MICROS_PER_DAY) * 1000);
case MILLIS: return plusDays(amountToAdd / MILLIS_PER_DAY).plusNanos((amountToAdd % MILLIS_PER_DAY) * 1000000);
case SECONDS: return plusSeconds(amountToAdd);
case MINUTES: return plusMinutes(amountToAdd);
case HOURS: return plusHours(amountToAdd);
case HALF_DAYS: return plusDays(amountToAdd / 256).plusHours((amountToAdd % 256) * 12); // no overflow (256 is multiple of 2)
}
return with(date.plus(amountToAdd, unit), time); // depends on control dependency: [if], data = [none]
}
return unit.addTo(this, amountToAdd);
} }
|
public class class_name {
public void startDME2(Properties props) throws DME2Exception, CadiException {
dme2Man = new DME2Manager("GatewayDME2Manager",props);
DME2ServiceHolder svcHolder;
List<DME2ServletHolder> slist = new ArrayList<DME2ServletHolder>();
svcHolder = new DME2ServiceHolder();
String serviceName = env.getProperty("DMEServiceName",null);
if(serviceName!=null) {
svcHolder.setServiceURI(serviceName);
svcHolder.setManager(dme2Man);
svcHolder.setContext("/");
DME2ServletHolder srvHolder = new DME2ServletHolder(this, new String[] {"/dme2","/api"});
srvHolder.setContextPath("/*");
slist.add(srvHolder);
EnumSet<RequestDispatcherType> edlist = EnumSet.of(
RequestDispatcherType.REQUEST,
RequestDispatcherType.FORWARD,
RequestDispatcherType.ASYNC
);
///////////////////////
// Apply Filters
///////////////////////
List<DME2FilterHolder> flist = new ArrayList<DME2FilterHolder>();
// Leave Login page un secured
// AuthzTransOnlyFilter atof = new AuthzTransOnlyFilter(env);
// flist.add(new DME2FilterHolder(atof,"/login", edlist));
// Secure all other interactions with AuthzTransFilter
// flist.add(new DME2FilterHolder(
// new AuthzTransFilter(env, aafCon, new AAFTrustChecker(
// env.getProperty(Config.CADI_TRUST_PROP, Config.CADI_USER_CHAIN),
// Define.ROOT_NS + ".mechid|"+Define.ROOT_COMPANY+"|trust"
// )),
// "/*", edlist));
//
svcHolder.setFilters(flist);
svcHolder.setServletHolders(slist);
DME2Server dme2svr = dme2Man.getServer();
// dme2svr.setGracefulShutdownTimeMs(1000);
// env.init().log("Starting GW Jetty/DME2 server...");
dme2svr.start();
DME2ServerProperties dsprops = dme2svr.getServerProperties();
try {
// if(env.getProperty("NO_REGISTER",null)!=null)
dme2Man.bindService(svcHolder);
// env.init().log("DME2 is available as HTTP"+(dsprops.isSslEnable()?"/S":""),"on port:",dsprops.getPort());
while(true) { // Per DME2 Examples...
Thread.sleep(5000);
}
} catch(InterruptedException e) {
// env.init().log("AAF Jetty Server interrupted!");
} catch(Exception e) { // Error binding service doesn't seem to stop DME2 or Process
// env.init().log(e,"DME2 Initialization Error");
dme2svr.stop();
System.exit(1);
}
} else {
//env.init().log("Properties must contain DMEServiceName");
}
} }
|
public class class_name {
public void startDME2(Properties props) throws DME2Exception, CadiException {
dme2Man = new DME2Manager("GatewayDME2Manager",props);
DME2ServiceHolder svcHolder;
List<DME2ServletHolder> slist = new ArrayList<DME2ServletHolder>();
svcHolder = new DME2ServiceHolder();
String serviceName = env.getProperty("DMEServiceName",null);
if(serviceName!=null) {
svcHolder.setServiceURI(serviceName);
svcHolder.setManager(dme2Man);
svcHolder.setContext("/");
DME2ServletHolder srvHolder = new DME2ServletHolder(this, new String[] {"/dme2","/api"});
srvHolder.setContextPath("/*");
slist.add(srvHolder);
EnumSet<RequestDispatcherType> edlist = EnumSet.of(
RequestDispatcherType.REQUEST,
RequestDispatcherType.FORWARD,
RequestDispatcherType.ASYNC
);
///////////////////////
// Apply Filters
///////////////////////
List<DME2FilterHolder> flist = new ArrayList<DME2FilterHolder>();
// Leave Login page un secured
// AuthzTransOnlyFilter atof = new AuthzTransOnlyFilter(env);
// flist.add(new DME2FilterHolder(atof,"/login", edlist));
// Secure all other interactions with AuthzTransFilter
// flist.add(new DME2FilterHolder(
// new AuthzTransFilter(env, aafCon, new AAFTrustChecker(
// env.getProperty(Config.CADI_TRUST_PROP, Config.CADI_USER_CHAIN),
// Define.ROOT_NS + ".mechid|"+Define.ROOT_COMPANY+"|trust"
// )),
// "/*", edlist));
//
svcHolder.setFilters(flist);
svcHolder.setServletHolders(slist);
DME2Server dme2svr = dme2Man.getServer();
// dme2svr.setGracefulShutdownTimeMs(1000);
// env.init().log("Starting GW Jetty/DME2 server...");
dme2svr.start();
DME2ServerProperties dsprops = dme2svr.getServerProperties();
try {
// if(env.getProperty("NO_REGISTER",null)!=null)
dme2Man.bindService(svcHolder);
// env.init().log("DME2 is available as HTTP"+(dsprops.isSslEnable()?"/S":""),"on port:",dsprops.getPort());
while(true) { // Per DME2 Examples...
Thread.sleep(5000); // depends on control dependency: [while], data = [none]
}
} catch(InterruptedException e) {
// env.init().log("AAF Jetty Server interrupted!");
} catch(Exception e) { // Error binding service doesn't seem to stop DME2 or Process
// env.init().log(e,"DME2 Initialization Error");
dme2svr.stop();
System.exit(1);
}
} else {
//env.init().log("Properties must contain DMEServiceName");
}
} }
|
public class class_name {
public Result<Void> addDescription(AuthzTrans trans, String ns, String type,
String instance, String action, String description) {
try {
getSession(trans).execute(UPDATE_SP + TABLE + " SET description = '"
+ description + "' WHERE ns = '" + ns + "' AND type = '" + type + "'"
+ "AND instance = '" + instance + "' AND action = '" + action + "';");
} catch (DriverException | APIException | IOException e) {
reportPerhapsReset(trans,e);
return Result.err(Result.ERR_Backend, CassAccess.ERR_ACCESS_MSG);
}
Data data = new Data();
data.ns=ns;
data.type=type;
data.instance=instance;
data.action=action;
wasModified(trans, CRUD.update, data, "Added description " + description + " to permission "
+ data.encode(), null );
return Result.ok();
} }
|
public class class_name {
public Result<Void> addDescription(AuthzTrans trans, String ns, String type,
String instance, String action, String description) {
try {
getSession(trans).execute(UPDATE_SP + TABLE + " SET description = '"
+ description + "' WHERE ns = '" + ns + "' AND type = '" + type + "'"
+ "AND instance = '" + instance + "' AND action = '" + action + "';"); // depends on control dependency: [try], data = [none]
} catch (DriverException | APIException | IOException e) {
reportPerhapsReset(trans,e);
return Result.err(Result.ERR_Backend, CassAccess.ERR_ACCESS_MSG);
} // depends on control dependency: [catch], data = [none]
Data data = new Data();
data.ns=ns;
data.type=type;
data.instance=instance;
data.action=action;
wasModified(trans, CRUD.update, data, "Added description " + description + " to permission "
+ data.encode(), null );
return Result.ok();
} }
|
public class class_name {
@Initiate(priority = AutumnActionPriority.HIGH_PRIORITY)
private void parseMacros() {
if (GdxArrays.isEmpty(macros)) {
return;
}
final LmlParser parser = interfaceService.get().getParser();
for (final FileHandle macro : macros) {
parser.parseTemplate(macro);
}
} }
|
public class class_name {
@Initiate(priority = AutumnActionPriority.HIGH_PRIORITY)
private void parseMacros() {
if (GdxArrays.isEmpty(macros)) {
return; // depends on control dependency: [if], data = [none]
}
final LmlParser parser = interfaceService.get().getParser();
for (final FileHandle macro : macros) {
parser.parseTemplate(macro); // depends on control dependency: [for], data = [macro]
}
} }
|
public class class_name {
private void parseSinglePattern(String pattern) {
final String[] parts = pattern.split("\\s");
int offset = 0;// 偏移量用于兼容Quartz表达式,当表达式有6或7项时,第一项为秒
if (parts.length == 6 || parts.length == 7) {
offset = 1;
} else if (parts.length != 5) {
throw new CronException("Pattern [{}] is invalid, it must be 5-7 parts!", pattern);
}
// 秒
if (1 == offset) {// 支持秒的表达式
try {
this.secondMatchers.add(ValueMatcherBuilder.build(parts[0], SECOND_VALUE_PARSER));
} catch (Exception e) {
throw new CronException(e, "Invalid pattern [{}], parsing 'second' field error!", pattern);
}
} else {// 不支持秒的表达式,则第一位按照表达式生成时间的秒数赋值,表示整分匹配
this.secondMatchers.add(ValueMatcherBuilder.build(String.valueOf(DateUtil.date().second()), SECOND_VALUE_PARSER));
}
// 分
try {
this.minuteMatchers.add(ValueMatcherBuilder.build(parts[0 + offset], MINUTE_VALUE_PARSER));
} catch (Exception e) {
throw new CronException(e, "Invalid pattern [{}], parsing 'minute' field error!", pattern);
}
// 小时
try {
this.hourMatchers.add(ValueMatcherBuilder.build(parts[1 + offset], HOUR_VALUE_PARSER));
} catch (Exception e) {
throw new CronException(e, "Invalid pattern [{}], parsing 'hour' field error!", pattern);
}
// 每月第几天
try {
this.dayOfMonthMatchers.add(ValueMatcherBuilder.build(parts[2 + offset], DAY_OF_MONTH_VALUE_PARSER));
} catch (Exception e) {
throw new CronException(e, "Invalid pattern [{}], parsing 'day of month' field error!", pattern);
}
// 月
try {
this.monthMatchers.add(ValueMatcherBuilder.build(parts[3 + offset], MONTH_VALUE_PARSER));
} catch (Exception e) {
throw new CronException(e, "Invalid pattern [{}], parsing 'month' field error!", pattern);
}
// 星期几
try {
this.dayOfWeekMatchers.add(ValueMatcherBuilder.build(parts[4 + offset], DAY_OF_WEEK_VALUE_PARSER));
} catch (Exception e) {
throw new CronException(e, "Invalid pattern [{}], parsing 'day of week' field error!", pattern);
}
// 年
if (parts.length == 7) {// 支持年的表达式
try {
this.yearMatchers.add(ValueMatcherBuilder.build(parts[6], YEAR_VALUE_PARSER));
} catch (Exception e) {
throw new CronException(e, "Invalid pattern [{}], parsing 'year' field error!", pattern);
}
} else {// 不支持年的表达式,全部匹配
this.secondMatchers.add(new AlwaysTrueValueMatcher());
}
matcherSize++;
} }
|
public class class_name {
private void parseSinglePattern(String pattern) {
final String[] parts = pattern.split("\\s");
int offset = 0;// 偏移量用于兼容Quartz表达式,当表达式有6或7项时,第一项为秒
if (parts.length == 6 || parts.length == 7) {
offset = 1;
// depends on control dependency: [if], data = [none]
} else if (parts.length != 5) {
throw new CronException("Pattern [{}] is invalid, it must be 5-7 parts!", pattern);
}
// 秒
if (1 == offset) {// 支持秒的表达式
try {
this.secondMatchers.add(ValueMatcherBuilder.build(parts[0], SECOND_VALUE_PARSER));
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new CronException(e, "Invalid pattern [{}], parsing 'second' field error!", pattern);
}
// depends on control dependency: [catch], data = [none]
} else {// 不支持秒的表达式,则第一位按照表达式生成时间的秒数赋值,表示整分匹配
this.secondMatchers.add(ValueMatcherBuilder.build(String.valueOf(DateUtil.date().second()), SECOND_VALUE_PARSER));
// depends on control dependency: [if], data = [none]
}
// 分
try {
this.minuteMatchers.add(ValueMatcherBuilder.build(parts[0 + offset], MINUTE_VALUE_PARSER));
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new CronException(e, "Invalid pattern [{}], parsing 'minute' field error!", pattern);
}
// depends on control dependency: [catch], data = [none]
// 小时
try {
this.hourMatchers.add(ValueMatcherBuilder.build(parts[1 + offset], HOUR_VALUE_PARSER));
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new CronException(e, "Invalid pattern [{}], parsing 'hour' field error!", pattern);
}
// depends on control dependency: [catch], data = [none]
// 每月第几天
try {
this.dayOfMonthMatchers.add(ValueMatcherBuilder.build(parts[2 + offset], DAY_OF_MONTH_VALUE_PARSER));
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new CronException(e, "Invalid pattern [{}], parsing 'day of month' field error!", pattern);
}
// depends on control dependency: [catch], data = [none]
// 月
try {
this.monthMatchers.add(ValueMatcherBuilder.build(parts[3 + offset], MONTH_VALUE_PARSER));
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new CronException(e, "Invalid pattern [{}], parsing 'month' field error!", pattern);
}
// depends on control dependency: [catch], data = [none]
// 星期几
try {
this.dayOfWeekMatchers.add(ValueMatcherBuilder.build(parts[4 + offset], DAY_OF_WEEK_VALUE_PARSER));
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new CronException(e, "Invalid pattern [{}], parsing 'day of week' field error!", pattern);
}
// depends on control dependency: [catch], data = [none]
// 年
if (parts.length == 7) {// 支持年的表达式
try {
this.yearMatchers.add(ValueMatcherBuilder.build(parts[6], YEAR_VALUE_PARSER));
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new CronException(e, "Invalid pattern [{}], parsing 'year' field error!", pattern);
}
// depends on control dependency: [catch], data = [none]
} else {// 不支持年的表达式,全部匹配
this.secondMatchers.add(new AlwaysTrueValueMatcher());
// depends on control dependency: [if], data = [none]
}
matcherSize++;
} }
|
public class class_name {
public Authorizer withProviderARNs(String... providerARNs) {
if (this.providerARNs == null) {
setProviderARNs(new java.util.ArrayList<String>(providerARNs.length));
}
for (String ele : providerARNs) {
this.providerARNs.add(ele);
}
return this;
} }
|
public class class_name {
public Authorizer withProviderARNs(String... providerARNs) {
if (this.providerARNs == null) {
setProviderARNs(new java.util.ArrayList<String>(providerARNs.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : providerARNs) {
this.providerARNs.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public void marshall(UpdateAccountRequest updateAccountRequest, ProtocolMarshaller protocolMarshaller) {
if (updateAccountRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateAccountRequest.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(UpdateAccountRequest updateAccountRequest, ProtocolMarshaller protocolMarshaller) {
if (updateAccountRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateAccountRequest.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 {
public final TypeParser.typeExpression_return typeExpression() throws RecognitionException {
TypeParser.typeExpression_return retval = new TypeParser.typeExpression_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token CLASSNAME2=null;
Token CLASSNAME3=null;
Token BEGINTYPEPARAM4=null;
Token COMMA5=null;
Token ENDTYPEPARAM6=null;
Token arr=null;
List list_arr=null;
List list_typePar=null;
TypeParser.typeParameterization_return typePar = null;
typePar = null;
CommonTree CLASSNAME2_tree=null;
CommonTree CLASSNAME3_tree=null;
CommonTree BEGINTYPEPARAM4_tree=null;
CommonTree COMMA5_tree=null;
CommonTree ENDTYPEPARAM6_tree=null;
CommonTree arr_tree=null;
RewriteRuleTokenStream stream_ENDTYPEPARAM=new RewriteRuleTokenStream(adaptor,"token ENDTYPEPARAM");
RewriteRuleTokenStream stream_COMMA=new RewriteRuleTokenStream(adaptor,"token COMMA");
RewriteRuleTokenStream stream_ARRAY=new RewriteRuleTokenStream(adaptor,"token ARRAY");
RewriteRuleTokenStream stream_BEGINTYPEPARAM=new RewriteRuleTokenStream(adaptor,"token BEGINTYPEPARAM");
RewriteRuleTokenStream stream_CLASSNAME=new RewriteRuleTokenStream(adaptor,"token CLASSNAME");
RewriteRuleSubtreeStream stream_typeParameterization=new RewriteRuleSubtreeStream(adaptor,"rule typeParameterization");
try {
// org/javaruntype/type/parser/Type.g:106:5: ( CLASSNAME (arr+= ARRAY )* -> ^( CLASSNAME ( $arr)* ) | CLASSNAME BEGINTYPEPARAM typePar+= typeParameterization ( COMMA typePar+= typeParameterization )* ENDTYPEPARAM (arr+= ARRAY )* -> ^( CLASSNAME ( $arr)* ( $typePar)+ ) )
int alt4=2;
int LA4_0 = input.LA(1);
if ( (LA4_0==CLASSNAME) ) {
int LA4_1 = input.LA(2);
if ( (LA4_1==BEGINTYPEPARAM) ) {
alt4=2;
}
else if ( (LA4_1==EOF||LA4_1==ARRAY||(LA4_1>=ENDTYPEPARAM && LA4_1<=COMMA)) ) {
alt4=1;
}
else {
NoViableAltException nvae =
new NoViableAltException("", 4, 1, input);
throw nvae;
}
}
else {
NoViableAltException nvae =
new NoViableAltException("", 4, 0, input);
throw nvae;
}
switch (alt4) {
case 1 :
// org/javaruntype/type/parser/Type.g:106:7: CLASSNAME (arr+= ARRAY )*
{
CLASSNAME2=(Token)match(input,CLASSNAME,FOLLOW_CLASSNAME_in_typeExpression178);
stream_CLASSNAME.add(CLASSNAME2);
// org/javaruntype/type/parser/Type.g:106:17: (arr+= ARRAY )*
loop1:
do {
int alt1=2;
int LA1_0 = input.LA(1);
if ( (LA1_0==ARRAY) ) {
alt1=1;
}
switch (alt1) {
case 1 :
// org/javaruntype/type/parser/Type.g:106:18: arr+= ARRAY
{
arr=(Token)match(input,ARRAY,FOLLOW_ARRAY_in_typeExpression183);
stream_ARRAY.add(arr);
if (list_arr==null) list_arr=new ArrayList();
list_arr.add(arr);
}
break;
default :
break loop1;
}
} while (true);
// AST REWRITE
// elements: CLASSNAME, arr
// token labels:
// rule labels: retval
// token list labels: arr
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleTokenStream stream_arr=new RewriteRuleTokenStream(adaptor,"token arr", list_arr);
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
root_0 = (CommonTree)adaptor.nil();
// 106:36: -> ^( CLASSNAME ( $arr)* )
{
// org/javaruntype/type/parser/Type.g:106:39: ^( CLASSNAME ( $arr)* )
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot(stream_CLASSNAME.nextNode(), root_1);
// org/javaruntype/type/parser/Type.g:106:51: ( $arr)*
while ( stream_arr.hasNext() ) {
adaptor.addChild(root_1, stream_arr.nextNode());
}
stream_arr.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
break;
case 2 :
// org/javaruntype/type/parser/Type.g:107:7: CLASSNAME BEGINTYPEPARAM typePar+= typeParameterization ( COMMA typePar+= typeParameterization )* ENDTYPEPARAM (arr+= ARRAY )*
{
CLASSNAME3=(Token)match(input,CLASSNAME,FOLLOW_CLASSNAME_in_typeExpression208);
stream_CLASSNAME.add(CLASSNAME3);
BEGINTYPEPARAM4=(Token)match(input,BEGINTYPEPARAM,FOLLOW_BEGINTYPEPARAM_in_typeExpression210);
stream_BEGINTYPEPARAM.add(BEGINTYPEPARAM4);
pushFollow(FOLLOW_typeParameterization_in_typeExpression214);
typePar=typeParameterization();
state._fsp--;
stream_typeParameterization.add(typePar.getTree());
if (list_typePar==null) list_typePar=new ArrayList();
list_typePar.add(typePar.getTree());
// org/javaruntype/type/parser/Type.g:107:62: ( COMMA typePar+= typeParameterization )*
loop2:
do {
int alt2=2;
int LA2_0 = input.LA(1);
if ( (LA2_0==COMMA) ) {
alt2=1;
}
switch (alt2) {
case 1 :
// org/javaruntype/type/parser/Type.g:107:63: COMMA typePar+= typeParameterization
{
COMMA5=(Token)match(input,COMMA,FOLLOW_COMMA_in_typeExpression217);
stream_COMMA.add(COMMA5);
pushFollow(FOLLOW_typeParameterization_in_typeExpression221);
typePar=typeParameterization();
state._fsp--;
stream_typeParameterization.add(typePar.getTree());
if (list_typePar==null) list_typePar=new ArrayList();
list_typePar.add(typePar.getTree());
}
break;
default :
break loop2;
}
} while (true);
ENDTYPEPARAM6=(Token)match(input,ENDTYPEPARAM,FOLLOW_ENDTYPEPARAM_in_typeExpression225);
stream_ENDTYPEPARAM.add(ENDTYPEPARAM6);
// org/javaruntype/type/parser/Type.g:107:114: (arr+= ARRAY )*
loop3:
do {
int alt3=2;
int LA3_0 = input.LA(1);
if ( (LA3_0==ARRAY) ) {
alt3=1;
}
switch (alt3) {
case 1 :
// org/javaruntype/type/parser/Type.g:107:115: arr+= ARRAY
{
arr=(Token)match(input,ARRAY,FOLLOW_ARRAY_in_typeExpression230);
stream_ARRAY.add(arr);
if (list_arr==null) list_arr=new ArrayList();
list_arr.add(arr);
}
break;
default :
break loop3;
}
} while (true);
// AST REWRITE
// elements: arr, typePar, CLASSNAME
// token labels:
// rule labels: retval
// token list labels: arr
// rule list labels: typePar
// wildcard labels:
retval.tree = root_0;
RewriteRuleTokenStream stream_arr=new RewriteRuleTokenStream(adaptor,"token arr", list_arr);
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
RewriteRuleSubtreeStream stream_typePar=new RewriteRuleSubtreeStream(adaptor,"token typePar",list_typePar);
root_0 = (CommonTree)adaptor.nil();
// 107:133: -> ^( CLASSNAME ( $arr)* ( $typePar)+ )
{
// org/javaruntype/type/parser/Type.g:107:136: ^( CLASSNAME ( $arr)* ( $typePar)+ )
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot(stream_CLASSNAME.nextNode(), root_1);
// org/javaruntype/type/parser/Type.g:107:148: ( $arr)*
while ( stream_arr.hasNext() ) {
adaptor.addChild(root_1, stream_arr.nextNode());
}
stream_arr.reset();
if ( !(stream_typePar.hasNext()) ) {
throw new RewriteEarlyExitException();
}
while ( stream_typePar.hasNext() ) {
adaptor.addChild(root_1, stream_typePar.nextTree());
}
stream_typePar.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
break;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException e) {
throw e;
}
finally {
}
return retval;
} }
|
public class class_name {
public final TypeParser.typeExpression_return typeExpression() throws RecognitionException {
TypeParser.typeExpression_return retval = new TypeParser.typeExpression_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token CLASSNAME2=null;
Token CLASSNAME3=null;
Token BEGINTYPEPARAM4=null;
Token COMMA5=null;
Token ENDTYPEPARAM6=null;
Token arr=null;
List list_arr=null;
List list_typePar=null;
TypeParser.typeParameterization_return typePar = null;
typePar = null;
CommonTree CLASSNAME2_tree=null;
CommonTree CLASSNAME3_tree=null;
CommonTree BEGINTYPEPARAM4_tree=null;
CommonTree COMMA5_tree=null;
CommonTree ENDTYPEPARAM6_tree=null;
CommonTree arr_tree=null;
RewriteRuleTokenStream stream_ENDTYPEPARAM=new RewriteRuleTokenStream(adaptor,"token ENDTYPEPARAM");
RewriteRuleTokenStream stream_COMMA=new RewriteRuleTokenStream(adaptor,"token COMMA");
RewriteRuleTokenStream stream_ARRAY=new RewriteRuleTokenStream(adaptor,"token ARRAY");
RewriteRuleTokenStream stream_BEGINTYPEPARAM=new RewriteRuleTokenStream(adaptor,"token BEGINTYPEPARAM");
RewriteRuleTokenStream stream_CLASSNAME=new RewriteRuleTokenStream(adaptor,"token CLASSNAME");
RewriteRuleSubtreeStream stream_typeParameterization=new RewriteRuleSubtreeStream(adaptor,"rule typeParameterization");
try {
// org/javaruntype/type/parser/Type.g:106:5: ( CLASSNAME (arr+= ARRAY )* -> ^( CLASSNAME ( $arr)* ) | CLASSNAME BEGINTYPEPARAM typePar+= typeParameterization ( COMMA typePar+= typeParameterization )* ENDTYPEPARAM (arr+= ARRAY )* -> ^( CLASSNAME ( $arr)* ( $typePar)+ ) )
int alt4=2;
int LA4_0 = input.LA(1);
if ( (LA4_0==CLASSNAME) ) {
int LA4_1 = input.LA(2);
if ( (LA4_1==BEGINTYPEPARAM) ) {
alt4=2; // depends on control dependency: [if], data = [none]
}
else if ( (LA4_1==EOF||LA4_1==ARRAY||(LA4_1>=ENDTYPEPARAM && LA4_1<=COMMA)) ) {
alt4=1; // depends on control dependency: [if], data = [none]
}
else {
NoViableAltException nvae =
new NoViableAltException("", 4, 1, input);
throw nvae;
}
}
else {
NoViableAltException nvae =
new NoViableAltException("", 4, 0, input);
throw nvae;
}
switch (alt4) {
case 1 :
// org/javaruntype/type/parser/Type.g:106:7: CLASSNAME (arr+= ARRAY )*
{
CLASSNAME2=(Token)match(input,CLASSNAME,FOLLOW_CLASSNAME_in_typeExpression178);
stream_CLASSNAME.add(CLASSNAME2);
// org/javaruntype/type/parser/Type.g:106:17: (arr+= ARRAY )*
loop1:
do {
int alt1=2;
int LA1_0 = input.LA(1);
if ( (LA1_0==ARRAY) ) {
alt1=1; // depends on control dependency: [if], data = [none]
}
switch (alt1) {
case 1 :
// org/javaruntype/type/parser/Type.g:106:18: arr+= ARRAY
{
arr=(Token)match(input,ARRAY,FOLLOW_ARRAY_in_typeExpression183);
stream_ARRAY.add(arr);
if (list_arr==null) list_arr=new ArrayList();
list_arr.add(arr);
}
break;
default :
break loop1;
}
} while (true);
// AST REWRITE
// elements: CLASSNAME, arr
// token labels:
// rule labels: retval
// token list labels: arr
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleTokenStream stream_arr=new RewriteRuleTokenStream(adaptor,"token arr", list_arr);
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
root_0 = (CommonTree)adaptor.nil();
// 106:36: -> ^( CLASSNAME ( $arr)* )
{
// org/javaruntype/type/parser/Type.g:106:39: ^( CLASSNAME ( $arr)* )
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot(stream_CLASSNAME.nextNode(), root_1);
// org/javaruntype/type/parser/Type.g:106:51: ( $arr)*
while ( stream_arr.hasNext() ) {
adaptor.addChild(root_1, stream_arr.nextNode()); // depends on control dependency: [while], data = [none]
}
stream_arr.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
break;
case 2 :
// org/javaruntype/type/parser/Type.g:107:7: CLASSNAME BEGINTYPEPARAM typePar+= typeParameterization ( COMMA typePar+= typeParameterization )* ENDTYPEPARAM (arr+= ARRAY )*
{
CLASSNAME3=(Token)match(input,CLASSNAME,FOLLOW_CLASSNAME_in_typeExpression208);
stream_CLASSNAME.add(CLASSNAME3);
BEGINTYPEPARAM4=(Token)match(input,BEGINTYPEPARAM,FOLLOW_BEGINTYPEPARAM_in_typeExpression210);
stream_BEGINTYPEPARAM.add(BEGINTYPEPARAM4);
pushFollow(FOLLOW_typeParameterization_in_typeExpression214);
typePar=typeParameterization();
state._fsp--;
stream_typeParameterization.add(typePar.getTree());
if (list_typePar==null) list_typePar=new ArrayList();
list_typePar.add(typePar.getTree());
// org/javaruntype/type/parser/Type.g:107:62: ( COMMA typePar+= typeParameterization )*
loop2:
do {
int alt2=2;
int LA2_0 = input.LA(1);
if ( (LA2_0==COMMA) ) {
alt2=1; // depends on control dependency: [if], data = [none]
}
switch (alt2) {
case 1 :
// org/javaruntype/type/parser/Type.g:107:63: COMMA typePar+= typeParameterization
{
COMMA5=(Token)match(input,COMMA,FOLLOW_COMMA_in_typeExpression217);
stream_COMMA.add(COMMA5);
pushFollow(FOLLOW_typeParameterization_in_typeExpression221);
typePar=typeParameterization();
state._fsp--;
stream_typeParameterization.add(typePar.getTree());
if (list_typePar==null) list_typePar=new ArrayList();
list_typePar.add(typePar.getTree());
}
break;
default :
break loop2;
}
} while (true);
ENDTYPEPARAM6=(Token)match(input,ENDTYPEPARAM,FOLLOW_ENDTYPEPARAM_in_typeExpression225);
stream_ENDTYPEPARAM.add(ENDTYPEPARAM6);
// org/javaruntype/type/parser/Type.g:107:114: (arr+= ARRAY )*
loop3:
do {
int alt3=2;
int LA3_0 = input.LA(1);
if ( (LA3_0==ARRAY) ) {
alt3=1; // depends on control dependency: [if], data = [none]
}
switch (alt3) {
case 1 :
// org/javaruntype/type/parser/Type.g:107:115: arr+= ARRAY
{
arr=(Token)match(input,ARRAY,FOLLOW_ARRAY_in_typeExpression230);
stream_ARRAY.add(arr);
if (list_arr==null) list_arr=new ArrayList();
list_arr.add(arr);
}
break;
default :
break loop3;
}
} while (true);
// AST REWRITE
// elements: arr, typePar, CLASSNAME
// token labels:
// rule labels: retval
// token list labels: arr
// rule list labels: typePar
// wildcard labels:
retval.tree = root_0;
RewriteRuleTokenStream stream_arr=new RewriteRuleTokenStream(adaptor,"token arr", list_arr);
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
RewriteRuleSubtreeStream stream_typePar=new RewriteRuleSubtreeStream(adaptor,"token typePar",list_typePar);
root_0 = (CommonTree)adaptor.nil();
// 107:133: -> ^( CLASSNAME ( $arr)* ( $typePar)+ )
{
// org/javaruntype/type/parser/Type.g:107:136: ^( CLASSNAME ( $arr)* ( $typePar)+ )
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot(stream_CLASSNAME.nextNode(), root_1);
// org/javaruntype/type/parser/Type.g:107:148: ( $arr)*
while ( stream_arr.hasNext() ) {
adaptor.addChild(root_1, stream_arr.nextNode()); // depends on control dependency: [while], data = [none]
}
stream_arr.reset();
if ( !(stream_typePar.hasNext()) ) {
throw new RewriteEarlyExitException();
}
while ( stream_typePar.hasNext() ) {
adaptor.addChild(root_1, stream_typePar.nextTree()); // depends on control dependency: [while], data = [none]
}
stream_typePar.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
break;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException e) {
throw e;
}
finally {
}
return retval;
} }
|
public class class_name {
public static String maxTruncStr(String source, int maxNrChars) {
if (source != null && source.length() > maxNrChars) {
return source.substring(0, maxNrChars);
} else {
return source;
}
} }
|
public class class_name {
public static String maxTruncStr(String source, int maxNrChars) {
if (source != null && source.length() > maxNrChars) {
return source.substring(0, maxNrChars); // depends on control dependency: [if], data = [none]
} else {
return source; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void beginImport()
{
try
{
if (m_writer == null)
{
m_writer = m_writerFactory.create();
}
CsvPreference preferences =
new CsvPreference.Builder(m_quoteChar, m_delimiterChar, m_endOfLineSymbols).build();
m_csvWriter = new CsvMapWriter(m_writer, preferences);
m_csvWriter.writeHeader(m_propertyNames);
}
catch (IOException e)
{
throw new RuntimeException(e);
}
} }
|
public class class_name {
public void beginImport()
{
try
{
if (m_writer == null)
{
m_writer = m_writerFactory.create(); // depends on control dependency: [if], data = [none]
}
CsvPreference preferences =
new CsvPreference.Builder(m_quoteChar, m_delimiterChar, m_endOfLineSymbols).build();
m_csvWriter = new CsvMapWriter(m_writer, preferences); // depends on control dependency: [try], data = [none]
m_csvWriter.writeHeader(m_propertyNames); // depends on control dependency: [try], data = [none]
}
catch (IOException e)
{
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@SuppressLint("NewApi")
protected boolean isActivitiyDestroyed() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
return mActivity.isFinishing() || mActivity.isDestroyed();
} else {
return mActivity.isFinishing();
}
} }
|
public class class_name {
@SuppressLint("NewApi")
protected boolean isActivitiyDestroyed() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
return mActivity.isFinishing() || mActivity.isDestroyed(); // depends on control dependency: [if], data = [none]
} else {
return mActivity.isFinishing(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void mapAndSetOffset() {
try {
final RandomAccessFile backingFile = new RandomAccessFile(this.file, "rw");
backingFile.setLength(this.size);
final FileChannel ch = backingFile.getChannel();
this.addr = (Long) mmap.invoke(ch, 1, 0L, this.size);
ch.close();
backingFile.close();
} catch (Exception e) {
throw new RuntimeException(e);
}
} }
|
public class class_name {
private void mapAndSetOffset() {
try {
final RandomAccessFile backingFile = new RandomAccessFile(this.file, "rw");
backingFile.setLength(this.size); // depends on control dependency: [try], data = [none]
final FileChannel ch = backingFile.getChannel();
this.addr = (Long) mmap.invoke(ch, 1, 0L, this.size); // depends on control dependency: [try], data = [none]
ch.close(); // depends on control dependency: [try], data = [none]
backingFile.close(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static void main(final String[] args) {
Switch about = new Switch("a", "about", "display about message");
Switch help = new Switch("h", "help", "display help message");
FileArgument bedFile = new FileArgument("o", "bed-file", "output BED file, default stdout", false);
IntegerArgument n = new IntegerArgument("n", "n", "number of BED records to generate, default " + DEFAULT_N, false);
IntegerArgument size = new IntegerArgument("s", "size", "chromosome size, default " + DEFAULT_SIZE, false);
StringArgument chrom = new StringArgument("c", "chrom", "chromosome name, default " + DEFAULT_CHROM, false);
DoubleArgument meanLength = new DoubleArgument("l", "mean-length", "mean length, default " + DEFAULT_MEAN_LENGTH, false);
DoubleArgument lengthVariation = new DoubleArgument("v", "length-variation", "length variation, default " + DEFAULT_LENGTH_VARIATION, false);
IntegerArgument seed = new IntegerArgument("z", "seed", "random number seed, default relates to current time", false);
ArgumentList arguments = new ArgumentList(about, help, bedFile, n, size, chrom, meanLength, lengthVariation, seed);
CommandLine commandLine = new CommandLine(args);
GenerateBed generateBed = null;
try
{
CommandLineParser.parse(commandLine, arguments);
if (about.wasFound()) {
About.about(System.out);
System.exit(0);
}
if (help.wasFound()) {
Usage.usage(USAGE, null, commandLine, arguments, System.out);
System.exit(0);
}
RandomGenerator random = seed.wasFound() ? new MersenneTwister(seed.getValue()) : new MersenneTwister();
double lv = Math.max(NO_VARIATION, lengthVariation.getValue(DEFAULT_LENGTH_VARIATION));
RealDistribution length = new NormalDistribution(random, meanLength.getValue(DEFAULT_MEAN_LENGTH), lv, NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
generateBed = new GenerateBed(bedFile.getValue(), n.getValue(DEFAULT_N), size.getValue(DEFAULT_SIZE), chrom.getValue(DEFAULT_CHROM), random, length);
}
catch (CommandLineParseException e) {
Usage.usage(USAGE, e, commandLine, arguments, System.err);
System.exit(-1);
}
try {
System.exit(generateBed.call());
}
catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
} }
|
public class class_name {
public static void main(final String[] args) {
Switch about = new Switch("a", "about", "display about message");
Switch help = new Switch("h", "help", "display help message");
FileArgument bedFile = new FileArgument("o", "bed-file", "output BED file, default stdout", false);
IntegerArgument n = new IntegerArgument("n", "n", "number of BED records to generate, default " + DEFAULT_N, false);
IntegerArgument size = new IntegerArgument("s", "size", "chromosome size, default " + DEFAULT_SIZE, false);
StringArgument chrom = new StringArgument("c", "chrom", "chromosome name, default " + DEFAULT_CHROM, false);
DoubleArgument meanLength = new DoubleArgument("l", "mean-length", "mean length, default " + DEFAULT_MEAN_LENGTH, false);
DoubleArgument lengthVariation = new DoubleArgument("v", "length-variation", "length variation, default " + DEFAULT_LENGTH_VARIATION, false);
IntegerArgument seed = new IntegerArgument("z", "seed", "random number seed, default relates to current time", false);
ArgumentList arguments = new ArgumentList(about, help, bedFile, n, size, chrom, meanLength, lengthVariation, seed);
CommandLine commandLine = new CommandLine(args);
GenerateBed generateBed = null;
try
{
CommandLineParser.parse(commandLine, arguments); // depends on control dependency: [try], data = [none]
if (about.wasFound()) {
About.about(System.out); // depends on control dependency: [if], data = [none]
System.exit(0); // depends on control dependency: [if], data = [none]
}
if (help.wasFound()) {
Usage.usage(USAGE, null, commandLine, arguments, System.out); // depends on control dependency: [if], data = [none]
System.exit(0); // depends on control dependency: [if], data = [none]
}
RandomGenerator random = seed.wasFound() ? new MersenneTwister(seed.getValue()) : new MersenneTwister();
double lv = Math.max(NO_VARIATION, lengthVariation.getValue(DEFAULT_LENGTH_VARIATION));
RealDistribution length = new NormalDistribution(random, meanLength.getValue(DEFAULT_MEAN_LENGTH), lv, NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
generateBed = new GenerateBed(bedFile.getValue(), n.getValue(DEFAULT_N), size.getValue(DEFAULT_SIZE), chrom.getValue(DEFAULT_CHROM), random, length); // depends on control dependency: [try], data = [none]
}
catch (CommandLineParseException e) {
Usage.usage(USAGE, e, commandLine, arguments, System.err);
System.exit(-1);
} // depends on control dependency: [catch], data = [none]
try {
System.exit(generateBed.call()); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
e.printStackTrace();
System.exit(1);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private static Transformer newTransformer() {
if (TEMPLATES == null) {
throw new IllegalStateException("TransformXMLInterceptor not initialized.");
}
try {
return TEMPLATES.newTransformer();
} catch (TransformerConfigurationException ex) {
throw new SystemException("Could not create transformer for " + RESOURCE_NAME, ex);
}
} }
|
public class class_name {
private static Transformer newTransformer() {
if (TEMPLATES == null) {
throw new IllegalStateException("TransformXMLInterceptor not initialized.");
}
try {
return TEMPLATES.newTransformer(); // depends on control dependency: [try], data = [none]
} catch (TransformerConfigurationException ex) {
throw new SystemException("Could not create transformer for " + RESOURCE_NAME, ex);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static <E extends Comparable<E>> Interval<E> toValidInterval(E a, E b, int flags) {
int comp = a.compareTo(b);
if (comp <= 0) {
return new Interval(a,b,flags);
} else {
return new Interval(b,a,flags);
}
} }
|
public class class_name {
public static <E extends Comparable<E>> Interval<E> toValidInterval(E a, E b, int flags) {
int comp = a.compareTo(b);
if (comp <= 0) {
return new Interval(a,b,flags);
// depends on control dependency: [if], data = [none]
} else {
return new Interval(b,a,flags);
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private static byte[] processBulkReply(final RedisInputStream is) {
int len = Integer.parseInt(is.readLine());
log.trace("[RedisProtocol] Reply bulk-reply. ${}", len);
if (len == -1) {
return null;
}
byte[] read = new byte[len];
int offset = 0;
while (offset < len) {
offset += is.read(read, offset, (len - offset));
}
// read 2 more bytes for the command delimiter
is.readByte();
is.readByte();
return read;
} }
|
public class class_name {
private static byte[] processBulkReply(final RedisInputStream is) {
int len = Integer.parseInt(is.readLine());
log.trace("[RedisProtocol] Reply bulk-reply. ${}", len);
if (len == -1) {
return null; // depends on control dependency: [if], data = [none]
}
byte[] read = new byte[len];
int offset = 0;
while (offset < len) {
offset += is.read(read, offset, (len - offset)); // depends on control dependency: [while], data = [none]
}
// read 2 more bytes for the command delimiter
is.readByte();
is.readByte();
return read;
} }
|
public class class_name {
public void marshall(AuditTaskMetadata auditTaskMetadata, ProtocolMarshaller protocolMarshaller) {
if (auditTaskMetadata == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(auditTaskMetadata.getTaskId(), TASKID_BINDING);
protocolMarshaller.marshall(auditTaskMetadata.getTaskStatus(), TASKSTATUS_BINDING);
protocolMarshaller.marshall(auditTaskMetadata.getTaskType(), TASKTYPE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(AuditTaskMetadata auditTaskMetadata, ProtocolMarshaller protocolMarshaller) {
if (auditTaskMetadata == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(auditTaskMetadata.getTaskId(), TASKID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(auditTaskMetadata.getTaskStatus(), TASKSTATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(auditTaskMetadata.getTaskType(), TASKTYPE_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 void marshall(BatchArrayProperties batchArrayProperties, ProtocolMarshaller protocolMarshaller) {
if (batchArrayProperties == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(batchArrayProperties.getSize(), SIZE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(BatchArrayProperties batchArrayProperties, ProtocolMarshaller protocolMarshaller) {
if (batchArrayProperties == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(batchArrayProperties.getSize(), SIZE_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 prepareTopic(final Map<String, InternalTopicMetadata> topicPartitions) {
log.debug("Starting to validate internal topics {} in partition assignor.", topicPartitions);
// first construct the topics to make ready
final Map<String, InternalTopicConfig> topicsToMakeReady = new HashMap<>();
for (final InternalTopicMetadata metadata : topicPartitions.values()) {
final InternalTopicConfig topic = metadata.config;
final int numPartitions = metadata.numPartitions;
if (numPartitions < 0) {
throw new StreamsException(String.format("%sTopic [%s] number of partitions not defined", logPrefix, topic.name()));
}
topic.setNumberOfPartitions(numPartitions);
topicsToMakeReady.put(topic.name(), topic);
}
if (!topicsToMakeReady.isEmpty()) {
internalTopicManager.makeReady(topicsToMakeReady);
}
log.debug("Completed validating internal topics {} in partition assignor.", topicPartitions);
} }
|
public class class_name {
private void prepareTopic(final Map<String, InternalTopicMetadata> topicPartitions) {
log.debug("Starting to validate internal topics {} in partition assignor.", topicPartitions);
// first construct the topics to make ready
final Map<String, InternalTopicConfig> topicsToMakeReady = new HashMap<>();
for (final InternalTopicMetadata metadata : topicPartitions.values()) {
final InternalTopicConfig topic = metadata.config;
final int numPartitions = metadata.numPartitions;
if (numPartitions < 0) {
throw new StreamsException(String.format("%sTopic [%s] number of partitions not defined", logPrefix, topic.name()));
}
topic.setNumberOfPartitions(numPartitions); // depends on control dependency: [for], data = [none]
topicsToMakeReady.put(topic.name(), topic); // depends on control dependency: [for], data = [none]
}
if (!topicsToMakeReady.isEmpty()) {
internalTopicManager.makeReady(topicsToMakeReady); // depends on control dependency: [if], data = [none]
}
log.debug("Completed validating internal topics {} in partition assignor.", topicPartitions);
} }
|
public class class_name {
private void addForeignkeys(ReferenceDescriptorDef refDef, TableDef tableDef)
{
if (!refDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_DATABASE_FOREIGNKEY, true))
{
// we shall not generate a database foreignkey
return;
}
// a foreignkey is added to the table schema if
// the referenced table exists (i.e. the referenced type has an associated table)
// then the foreignkey consists of:
// remote table = table of referenced type
// local fields = foreignkey fields of the reference
// remote fields = primarykeys of the referenced type
ClassDescriptorDef ownerClassDef = (ClassDescriptorDef)refDef.getOwner();
String targetClassName = refDef.getProperty(PropertyHelper.OJB_PROPERTY_CLASS_REF);
ClassDescriptorDef referencedClassDef = ((ModelDef)ownerClassDef.getOwner()).getClass(targetClassName);
// we can add a foreignkey only if the target type and all its subtypes either
// map to the same table or do not map to a table at all
String tableName = getHierarchyTable(referencedClassDef);
if (tableName == null)
{
return;
}
try
{
String name = refDef.getName();
ArrayList localFields = ownerClassDef.getFields(refDef.getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY));
ArrayList remoteFields = referencedClassDef.getPrimaryKeys();
tableDef.addForeignkey(name, tableName, getColumns(localFields), getColumns(remoteFields));
}
catch (NoSuchFieldException ex)
{
// won't happen if we already checked the constraints
}
} }
|
public class class_name {
private void addForeignkeys(ReferenceDescriptorDef refDef, TableDef tableDef)
{
if (!refDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_DATABASE_FOREIGNKEY, true))
{
// we shall not generate a database foreignkey
return;
// depends on control dependency: [if], data = [none]
}
// a foreignkey is added to the table schema if
// the referenced table exists (i.e. the referenced type has an associated table)
// then the foreignkey consists of:
// remote table = table of referenced type
// local fields = foreignkey fields of the reference
// remote fields = primarykeys of the referenced type
ClassDescriptorDef ownerClassDef = (ClassDescriptorDef)refDef.getOwner();
String targetClassName = refDef.getProperty(PropertyHelper.OJB_PROPERTY_CLASS_REF);
ClassDescriptorDef referencedClassDef = ((ModelDef)ownerClassDef.getOwner()).getClass(targetClassName);
// we can add a foreignkey only if the target type and all its subtypes either
// map to the same table or do not map to a table at all
String tableName = getHierarchyTable(referencedClassDef);
if (tableName == null)
{
return;
// depends on control dependency: [if], data = [none]
}
try
{
String name = refDef.getName();
ArrayList localFields = ownerClassDef.getFields(refDef.getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY));
ArrayList remoteFields = referencedClassDef.getPrimaryKeys();
tableDef.addForeignkey(name, tableName, getColumns(localFields), getColumns(remoteFields));
// depends on control dependency: [try], data = [none]
}
catch (NoSuchFieldException ex)
{
// won't happen if we already checked the constraints
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public EClass getIfcBoxAlignment() {
if (ifcBoxAlignmentEClass == null) {
ifcBoxAlignmentEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(895);
}
return ifcBoxAlignmentEClass;
} }
|
public class class_name {
@Override
public EClass getIfcBoxAlignment() {
if (ifcBoxAlignmentEClass == null) {
ifcBoxAlignmentEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(895);
// depends on control dependency: [if], data = [none]
}
return ifcBoxAlignmentEClass;
} }
|
public class class_name {
@Override
public void init() {
// TODO Auto-generated method stub
reader = new IOB2DataReader();
tagger = new TaggingData();
//Read feature template file
String templateFile = modelDir + File.separator + "featuretemplate.xml";
Vector<Element> nodes = BasicContextGenerator.readFeatureNodes(templateFile);
for (int i = 0; i < nodes.size(); ++i){
Element node = nodes.get(i);
String cpType = node.getAttribute("value");
BasicContextGenerator contextGen = null;
if (cpType.equals("Conjunction")){
contextGen = new ConjunctionContextGenerator(node);
}
else if (cpType.equals("Lexicon")){
contextGen = new LexiconContextGenerator(node);
LexiconContextGenerator.loadVietnameseDict(modelDir + File.separator + "VNDic_UTF-8.txt");
LexiconContextGenerator.loadViLocationList(modelDir + File.separator + "vnlocations.txt");
LexiconContextGenerator.loadViPersonalNames(modelDir + File.separator + "vnpernames.txt");
}
else if (cpType.equals("Regex")){
contextGen = new RegexContextGenerator(node);
}
else if (cpType.equals("SyllableFeature")){
contextGen = new SyllableContextGenerator(node);
}
else if (cpType.equals("ViSyllableFeature")){
contextGen = new VietnameseContextGenerator(node);
}
if (contextGen != null)
tagger.addContextGenerator(contextGen);
}
} }
|
public class class_name {
@Override
public void init() {
// TODO Auto-generated method stub
reader = new IOB2DataReader();
tagger = new TaggingData();
//Read feature template file
String templateFile = modelDir + File.separator + "featuretemplate.xml";
Vector<Element> nodes = BasicContextGenerator.readFeatureNodes(templateFile);
for (int i = 0; i < nodes.size(); ++i){
Element node = nodes.get(i);
String cpType = node.getAttribute("value");
BasicContextGenerator contextGen = null;
if (cpType.equals("Conjunction")){
contextGen = new ConjunctionContextGenerator(node);
// depends on control dependency: [if], data = [none]
}
else if (cpType.equals("Lexicon")){
contextGen = new LexiconContextGenerator(node);
// depends on control dependency: [if], data = [none]
LexiconContextGenerator.loadVietnameseDict(modelDir + File.separator + "VNDic_UTF-8.txt");
// depends on control dependency: [if], data = [none]
LexiconContextGenerator.loadViLocationList(modelDir + File.separator + "vnlocations.txt");
LexiconContextGenerator.loadViPersonalNames(modelDir + File.separator + "vnpernames.txt");
}
else if (cpType.equals("Regex")){
contextGen = new RegexContextGenerator(node);
}
else if (cpType.equals("SyllableFeature")){
contextGen = new SyllableContextGenerator(node);
}
else if (cpType.equals("ViSyllableFeature")){
contextGen = new VietnameseContextGenerator(node);
}
if (contextGen != null)
tagger.addContextGenerator(contextGen);
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public String insertList(MappedStatement ms) {
final Class<?> entityClass = getEntityClass(ms);
//开始拼sql
StringBuilder sql = new StringBuilder();
sql.append("<bind name=\"listNotEmptyCheck\" value=\"@tk.mybatis.mapper.util.OGNL@notEmptyCollectionCheck(list, '" + ms.getId() + " 方法参数为空')\"/>");
sql.append(SqlHelper.insertIntoTable(entityClass, tableName(entityClass), "list[0]"));
sql.append(SqlHelper.insertColumns(entityClass, true, false, false));
sql.append(" VALUES ");
sql.append("<foreach collection=\"list\" item=\"record\" separator=\",\" >");
sql.append("<trim prefix=\"(\" suffix=\")\" suffixOverrides=\",\">");
//获取全部列
Set<EntityColumn> columnList = EntityHelper.getColumns(entityClass);
//当某个列有主键策略时,不需要考虑他的属性是否为空,因为如果为空,一定会根据主键策略给他生成一个值
for (EntityColumn column : columnList) {
if (!column.isId() && column.isInsertable()) {
sql.append(column.getColumnHolder("record") + ",");
}
}
sql.append("</trim>");
sql.append("</foreach>");
// 反射把MappedStatement中的设置主键名
EntityHelper.setKeyProperties(EntityHelper.getPKColumns(entityClass), ms);
return sql.toString();
} }
|
public class class_name {
public String insertList(MappedStatement ms) {
final Class<?> entityClass = getEntityClass(ms);
//开始拼sql
StringBuilder sql = new StringBuilder();
sql.append("<bind name=\"listNotEmptyCheck\" value=\"@tk.mybatis.mapper.util.OGNL@notEmptyCollectionCheck(list, '" + ms.getId() + " 方法参数为空')\"/>");
sql.append(SqlHelper.insertIntoTable(entityClass, tableName(entityClass), "list[0]"));
sql.append(SqlHelper.insertColumns(entityClass, true, false, false));
sql.append(" VALUES ");
sql.append("<foreach collection=\"list\" item=\"record\" separator=\",\" >");
sql.append("<trim prefix=\"(\" suffix=\")\" suffixOverrides=\",\">");
//获取全部列
Set<EntityColumn> columnList = EntityHelper.getColumns(entityClass);
//当某个列有主键策略时,不需要考虑他的属性是否为空,因为如果为空,一定会根据主键策略给他生成一个值
for (EntityColumn column : columnList) {
if (!column.isId() && column.isInsertable()) {
sql.append(column.getColumnHolder("record") + ","); // depends on control dependency: [if], data = [none]
}
}
sql.append("</trim>");
sql.append("</foreach>");
// 反射把MappedStatement中的设置主键名
EntityHelper.setKeyProperties(EntityHelper.getPKColumns(entityClass), ms);
return sql.toString();
} }
|
public class class_name {
private void obtainButtonBarElevation() {
int elevation;
try {
elevation = ThemeUtil.getDimensionPixelSize(this, R.attr.buttonBarElevation);
} catch (NotFoundException e) {
elevation = getResources().getDimensionPixelSize(R.dimen.button_bar_elevation);
}
setButtonBarElevation(pixelsToDp(this, elevation));
} }
|
public class class_name {
private void obtainButtonBarElevation() {
int elevation;
try {
elevation = ThemeUtil.getDimensionPixelSize(this, R.attr.buttonBarElevation); // depends on control dependency: [try], data = [none]
} catch (NotFoundException e) {
elevation = getResources().getDimensionPixelSize(R.dimen.button_bar_elevation);
} // depends on control dependency: [catch], data = [none]
setButtonBarElevation(pixelsToDp(this, elevation));
} }
|
public class class_name {
private String formatTimeUnit(TimeUnit timeUnit)
{
int units = timeUnit.getValue();
String result;
String[][] unitNames = LocaleData.getStringArrays(m_locale, LocaleData.TIME_UNITS_ARRAY);
if (units < 0 || units >= unitNames.length)
{
result = "";
}
else
{
result = unitNames[units][0];
}
return (result);
} }
|
public class class_name {
private String formatTimeUnit(TimeUnit timeUnit)
{
int units = timeUnit.getValue();
String result;
String[][] unitNames = LocaleData.getStringArrays(m_locale, LocaleData.TIME_UNITS_ARRAY);
if (units < 0 || units >= unitNames.length)
{
result = ""; // depends on control dependency: [if], data = [none]
}
else
{
result = unitNames[units][0]; // depends on control dependency: [if], data = [none]
}
return (result);
} }
|
public class class_name {
public static TableReference parseTableReference(String tableRefString) {
// Logic mirrored from cloud/helix/clients/cli/bigquery_client.py.
TableReference tableRef = new TableReference();
int projectIdEnd = tableRefString.lastIndexOf(':');
String datasetAndTableString = tableRefString;
if (projectIdEnd != -1) {
tableRef.setProjectId(tableRefString.substring(0, projectIdEnd));
// Omit the ':' from the remaining datasetId.tableId substring.
datasetAndTableString = tableRefString.substring(projectIdEnd + 1);
}
Preconditions.checkArgument(datasetAndTableString.matches(DATASET_AND_TABLE_REGEX),
"Invalid datasetAndTableString '%s'; must match regex '%s'.",
datasetAndTableString, DATASET_AND_TABLE_REGEX);
String[] idParts = datasetAndTableString.split("\\.");
tableRef.setDatasetId(idParts[0]);
tableRef.setTableId(idParts[1]);
return tableRef;
} }
|
public class class_name {
public static TableReference parseTableReference(String tableRefString) {
// Logic mirrored from cloud/helix/clients/cli/bigquery_client.py.
TableReference tableRef = new TableReference();
int projectIdEnd = tableRefString.lastIndexOf(':');
String datasetAndTableString = tableRefString;
if (projectIdEnd != -1) {
tableRef.setProjectId(tableRefString.substring(0, projectIdEnd)); // depends on control dependency: [if], data = [none]
// Omit the ':' from the remaining datasetId.tableId substring.
datasetAndTableString = tableRefString.substring(projectIdEnd + 1); // depends on control dependency: [if], data = [(projectIdEnd]
}
Preconditions.checkArgument(datasetAndTableString.matches(DATASET_AND_TABLE_REGEX),
"Invalid datasetAndTableString '%s'; must match regex '%s'.",
datasetAndTableString, DATASET_AND_TABLE_REGEX);
String[] idParts = datasetAndTableString.split("\\.");
tableRef.setDatasetId(idParts[0]);
tableRef.setTableId(idParts[1]);
return tableRef;
} }
|
public class class_name {
public void authenticate() {
log.info("Authenticating user: " + this.name);
WebSession result = null;
try {
result = getContext().getAuthenticationMethod().authenticate(
getContext().getSessionManagementMethod(), this.authenticationCredentials, this);
} catch (UnsupportedAuthenticationCredentialsException e) {
log.error("User does not have the expected type of credentials:", e);
}
// no issues appear if a simultaneous call to #queueAuthentication() is made
synchronized (this) {
this.lastSuccessfulAuthTime = System.currentTimeMillis();
this.authenticatedSession = result;
}
} }
|
public class class_name {
public void authenticate() {
log.info("Authenticating user: " + this.name);
WebSession result = null;
try {
result = getContext().getAuthenticationMethod().authenticate(
getContext().getSessionManagementMethod(), this.authenticationCredentials, this); // depends on control dependency: [try], data = [none]
} catch (UnsupportedAuthenticationCredentialsException e) {
log.error("User does not have the expected type of credentials:", e);
} // depends on control dependency: [catch], data = [none]
// no issues appear if a simultaneous call to #queueAuthentication() is made
synchronized (this) {
this.lastSuccessfulAuthTime = System.currentTimeMillis();
this.authenticatedSession = result;
}
} }
|
public class class_name {
@Override
public String toPattern(boolean escapeUnprintable) {
if (pat != null && !escapeUnprintable) {
return pat;
}
StringBuilder result = new StringBuilder();
return _toPattern(result, escapeUnprintable).toString();
} }
|
public class class_name {
@Override
public String toPattern(boolean escapeUnprintable) {
if (pat != null && !escapeUnprintable) {
return pat; // depends on control dependency: [if], data = [none]
}
StringBuilder result = new StringBuilder();
return _toPattern(result, escapeUnprintable).toString();
} }
|
public class class_name {
public static UserAgent getUserAgent(String userAgent) {
if (userAgent == null || userAgent.isEmpty()) {
return null;
}
for (String aAGENT_INDEX : AGENT_INDEX) {
Pattern pattern = AGENT_PATTERNS.get(aAGENT_INDEX);
Matcher matcher = pattern.matcher(userAgent);
if (matcher.find()) {
return new UserAgent(aAGENT_INDEX, matcher.group(1));
}
}
return null;
} }
|
public class class_name {
public static UserAgent getUserAgent(String userAgent) {
if (userAgent == null || userAgent.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
for (String aAGENT_INDEX : AGENT_INDEX) {
Pattern pattern = AGENT_PATTERNS.get(aAGENT_INDEX);
Matcher matcher = pattern.matcher(userAgent);
if (matcher.find()) {
return new UserAgent(aAGENT_INDEX, matcher.group(1)); // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
String resetSubject(long sessionId) {
if (prefix == null) {
return String.format("reset-%d", sessionId);
} else {
return String.format("%s-reset-%d", prefix, sessionId);
}
} }
|
public class class_name {
String resetSubject(long sessionId) {
if (prefix == null) {
return String.format("reset-%d", sessionId); // depends on control dependency: [if], data = [none]
} else {
return String.format("%s-reset-%d", prefix, sessionId); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public ResultHandlerContext<DPO, RI, RO, TRO> handleWith(Collection<ResultHandler<TRO>> resultHandlers) {
List<ResultHandler<TRO>> addedResultHandlers = new ArrayList<ResultHandler<TRO>>();
if (resultHandlers != null) {
addedResultHandlers.addAll(resultHandlers);
}
// Change context
return new ResultHandlerContext<DPO, RI, RO, TRO>(addedTriggers, addedDataProviders,
dataProviderToRuleMapping, addedRuleInputTransformers, addedRules, ruleToResultHandlerMapping,
addedResultHandlerInputTransformers, addedResultHandlers);
} }
|
public class class_name {
public ResultHandlerContext<DPO, RI, RO, TRO> handleWith(Collection<ResultHandler<TRO>> resultHandlers) {
List<ResultHandler<TRO>> addedResultHandlers = new ArrayList<ResultHandler<TRO>>();
if (resultHandlers != null) {
addedResultHandlers.addAll(resultHandlers); // depends on control dependency: [if], data = [(resultHandlers]
}
// Change context
return new ResultHandlerContext<DPO, RI, RO, TRO>(addedTriggers, addedDataProviders,
dataProviderToRuleMapping, addedRuleInputTransformers, addedRules, ruleToResultHandlerMapping,
addedResultHandlerInputTransformers, addedResultHandlers);
} }
|
public class class_name {
private String forceChild(String url)
{
String prefix = path;
if (prefix.endsWith("/"))
prefix = path.substring(0, path.length() - 1); // because the url also contains a '/' that we will use
int j = url.substring(0, url.length() - 1).lastIndexOf('/'); // url.length() - 1 was intentional .. if the last char is a '/', we're interested in the previous one.
if (j >= 0)
{
String ret = prefix + url.substring(j);
return ret;
}
else // relative paths .. leave intact
return url;
} }
|
public class class_name {
private String forceChild(String url)
{
String prefix = path;
if (prefix.endsWith("/"))
prefix = path.substring(0, path.length() - 1); // because the url also contains a '/' that we will use
int j = url.substring(0, url.length() - 1).lastIndexOf('/'); // url.length() - 1 was intentional .. if the last char is a '/', we're interested in the previous one.
if (j >= 0)
{
String ret = prefix + url.substring(j);
return ret; // depends on control dependency: [if], data = [none]
}
else // relative paths .. leave intact
return url;
} }
|
public class class_name {
public static <T> ObservableList<T> wrapList(com.canoo.platform.remoting.ObservableList<T> dolphinList) {
Assert.requireNonNull(dolphinList, "dolphinList");
final ObservableList<T> list = FXCollections.observableArrayList(dolphinList);
list.addListener((ListChangeListener<T>) c -> {
if (listenToFx) {
listenToDolphin = false;
while (c.next()) {
if (c.wasAdded() || c.wasRemoved() || c.wasReplaced()) {
for (T removed : c.getRemoved()) {
dolphinList.remove(removed);
}
for (T added : c.getAddedSubList()) {
dolphinList.add(list.indexOf(added), added);
}
}
}
listenToDolphin = true;
}
});
dolphinList.onChanged(e -> {
if (listenToDolphin) {
listenToFx = false;
for (ListChangeEvent.Change<? extends T> c : e.getChanges()) {
if (c.isAdded()) {
for (int i = c.getFrom(); i < c.getTo(); i++) {
list.add(i, dolphinList.get(i));
}
} else if (c.isRemoved()) {
final int index = c.getFrom();
list.remove(index, index + c.getRemovedElements().size());
}
}
listenToFx = true;
}
});
return list;
} }
|
public class class_name {
public static <T> ObservableList<T> wrapList(com.canoo.platform.remoting.ObservableList<T> dolphinList) {
Assert.requireNonNull(dolphinList, "dolphinList");
final ObservableList<T> list = FXCollections.observableArrayList(dolphinList);
list.addListener((ListChangeListener<T>) c -> {
if (listenToFx) {
listenToDolphin = false;
while (c.next()) {
if (c.wasAdded() || c.wasRemoved() || c.wasReplaced()) {
for (T removed : c.getRemoved()) {
dolphinList.remove(removed); // depends on control dependency: [for], data = [removed]
}
for (T added : c.getAddedSubList()) {
dolphinList.add(list.indexOf(added), added); // depends on control dependency: [for], data = [added]
}
}
}
listenToDolphin = true;
}
});
dolphinList.onChanged(e -> {
if (listenToDolphin) {
listenToFx = false;
for (ListChangeEvent.Change<? extends T> c : e.getChanges()) {
if (c.isAdded()) {
for (int i = c.getFrom(); i < c.getTo(); i++) {
list.add(i, dolphinList.get(i));
}
} else if (c.isRemoved()) {
final int index = c.getFrom();
list.remove(index, index + c.getRemovedElements().size());
}
}
listenToFx = true;
}
});
return list;
} }
|
public class class_name {
@Override
public EClass getIfcMeasureWithUnit() {
if (ifcMeasureWithUnitEClass == null) {
ifcMeasureWithUnitEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(375);
}
return ifcMeasureWithUnitEClass;
} }
|
public class class_name {
@Override
public EClass getIfcMeasureWithUnit() {
if (ifcMeasureWithUnitEClass == null) {
ifcMeasureWithUnitEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(375);
// depends on control dependency: [if], data = [none]
}
return ifcMeasureWithUnitEClass;
} }
|
public class class_name {
@Api
public void setRectangleStyle(ShapeStyle rectangleStyle) {
this.rectangleStyle = rectangleStyle;
if (targetRectangle != null) {
targetRectangle.setStyle(rectangleStyle);
render(targetRectangle, RenderGroup.SCREEN, RenderStatus.ALL);
}
} }
|
public class class_name {
@Api
public void setRectangleStyle(ShapeStyle rectangleStyle) {
this.rectangleStyle = rectangleStyle;
if (targetRectangle != null) {
targetRectangle.setStyle(rectangleStyle); // depends on control dependency: [if], data = [none]
render(targetRectangle, RenderGroup.SCREEN, RenderStatus.ALL); // depends on control dependency: [if], data = [(targetRectangle]
}
} }
|
public class class_name {
protected String getButtonName(String barItem, Map<String, String> buttonNamesLookUp) {
String result = barItem;
if (buttonNamesLookUp != null) {
String translatedName = buttonNamesLookUp.get(barItem);
if (CmsStringUtil.isNotEmpty(translatedName)) {
result = translatedName;
}
}
return result;
} }
|
public class class_name {
protected String getButtonName(String barItem, Map<String, String> buttonNamesLookUp) {
String result = barItem;
if (buttonNamesLookUp != null) {
String translatedName = buttonNamesLookUp.get(barItem);
if (CmsStringUtil.isNotEmpty(translatedName)) {
result = translatedName; // depends on control dependency: [if], data = [none]
}
}
return result;
} }
|
public class class_name {
private void uploadSampleFile() {
mDialog = ProgressDialog.show(MainActivity.this, getText(R.string.boxsdk_Please_wait), getText(R.string.boxsdk_Please_wait));
new Thread() {
@Override
public void run() {
try {
String uploadFileName = "box_logo.png";
InputStream uploadStream = getResources().getAssets().open(uploadFileName);
String destinationFolderId = "0";
String uploadName = "BoxSDKUpload.png";
BoxRequestsFile.UploadFile request = mFileApi.getUploadRequest(uploadStream, uploadName, destinationFolderId);
final BoxFile uploadFileInfo = request.send();
showToast("Uploaded " + uploadFileInfo.getName());
loadRootFolder();
} catch (IOException e) {
e.printStackTrace();
} catch (BoxException e) {
e.printStackTrace();
BoxError error = e.getAsBoxError();
if (error != null && error.getStatus() == HttpURLConnection.HTTP_CONFLICT) {
ArrayList<BoxEntity> conflicts = error.getContextInfo().getConflicts();
if (conflicts != null && conflicts.size() == 1 && conflicts.get(0) instanceof BoxFile) {
uploadNewVersion((BoxFile) conflicts.get(0));
return;
}
}
showToast("Upload failed");
} finally {
mDialog.dismiss();
}
}
}.start();
} }
|
public class class_name {
private void uploadSampleFile() {
mDialog = ProgressDialog.show(MainActivity.this, getText(R.string.boxsdk_Please_wait), getText(R.string.boxsdk_Please_wait));
new Thread() {
@Override
public void run() {
try {
String uploadFileName = "box_logo.png";
InputStream uploadStream = getResources().getAssets().open(uploadFileName);
String destinationFolderId = "0";
String uploadName = "BoxSDKUpload.png";
BoxRequestsFile.UploadFile request = mFileApi.getUploadRequest(uploadStream, uploadName, destinationFolderId);
final BoxFile uploadFileInfo = request.send();
showToast("Uploaded " + uploadFileInfo.getName()); // depends on control dependency: [try], data = [none]
loadRootFolder(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
e.printStackTrace();
} catch (BoxException e) { // depends on control dependency: [catch], data = [none]
e.printStackTrace();
BoxError error = e.getAsBoxError();
if (error != null && error.getStatus() == HttpURLConnection.HTTP_CONFLICT) {
ArrayList<BoxEntity> conflicts = error.getContextInfo().getConflicts();
if (conflicts != null && conflicts.size() == 1 && conflicts.get(0) instanceof BoxFile) {
uploadNewVersion((BoxFile) conflicts.get(0)); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
showToast("Upload failed");
} finally { // depends on control dependency: [catch], data = [none]
mDialog.dismiss();
}
}
}.start();
} }
|
public class class_name {
private void checkDrain() {
if (full && !paused && messages.size() < maxQueueSize / 2) {
full = false;
log.debug(String.format("%s - Connection to %s is drained", this, context.target()));
if (drainHandler != null) {
drainHandler.handle((Void) null);
}
}
} }
|
public class class_name {
private void checkDrain() {
if (full && !paused && messages.size() < maxQueueSize / 2) {
full = false; // depends on control dependency: [if], data = [none]
log.debug(String.format("%s - Connection to %s is drained", this, context.target())); // depends on control dependency: [if], data = [none]
if (drainHandler != null) {
drainHandler.handle((Void) null); // depends on control dependency: [if], data = [null)]
}
}
} }
|
public class class_name {
private static void addRequestProperties(final Map<String, String> requestProperties, final HttpURLConnection connection) {
if (requestProperties != null) {
for (Entry<String, String> entry : requestProperties.entrySet()) {
connection.addRequestProperty(entry.getKey(), entry.getValue());
}
}
} }
|
public class class_name {
private static void addRequestProperties(final Map<String, String> requestProperties, final HttpURLConnection connection) {
if (requestProperties != null) {
for (Entry<String, String> entry : requestProperties.entrySet()) {
connection.addRequestProperty(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry]
}
}
} }
|
public class class_name {
private static List<AnnotatedElement> resolveTargetElements(AnnotatedElement element,
EnumSet<FindOption> findOptions) {
final List<AnnotatedElement> elements;
if (findOptions.contains(FindOption.LOOKUP_SUPER_CLASSES) && element instanceof Class) {
final Class<?> superclass = ((Class<?>) element).getSuperclass();
if ((superclass == null || superclass == Object.class) &&
((Class<?>) element).getInterfaces().length == 0) {
elements = ImmutableList.of(element);
} else {
final Builder<AnnotatedElement> collector = new Builder<>();
collectSuperClasses((Class<?>) element, collector,
findOptions.contains(FindOption.COLLECT_SUPER_CLASSES_FIRST));
elements = collector.build();
}
} else {
elements = ImmutableList.of(element);
}
return elements;
} }
|
public class class_name {
private static List<AnnotatedElement> resolveTargetElements(AnnotatedElement element,
EnumSet<FindOption> findOptions) {
final List<AnnotatedElement> elements;
if (findOptions.contains(FindOption.LOOKUP_SUPER_CLASSES) && element instanceof Class) {
final Class<?> superclass = ((Class<?>) element).getSuperclass();
if ((superclass == null || superclass == Object.class) &&
((Class<?>) element).getInterfaces().length == 0) {
elements = ImmutableList.of(element); // depends on control dependency: [if], data = [none]
} else {
final Builder<AnnotatedElement> collector = new Builder<>();
collectSuperClasses((Class<?>) element, collector,
findOptions.contains(FindOption.COLLECT_SUPER_CLASSES_FIRST)); // depends on control dependency: [if], data = [none]
elements = collector.build(); // depends on control dependency: [if], data = [none]
}
} else {
elements = ImmutableList.of(element); // depends on control dependency: [if], data = [none]
}
return elements;
} }
|
public class class_name {
public static double KullbackLeiblerDivergence(SparseArray x, double[] y) {
if (x.isEmpty()) {
throw new IllegalArgumentException("List x is empty.");
}
Iterator<SparseArray.Entry> iter = x.iterator();
boolean intersection = false;
double kl = 0.0;
while (iter.hasNext()) {
SparseArray.Entry b = iter.next();
int i = b.i;
if (y[i] > 0) {
intersection = true;
kl += b.x * Math.log(b.x / y[i]);
}
}
if (intersection) {
return kl;
} else {
return Double.POSITIVE_INFINITY;
}
} }
|
public class class_name {
public static double KullbackLeiblerDivergence(SparseArray x, double[] y) {
if (x.isEmpty()) {
throw new IllegalArgumentException("List x is empty.");
}
Iterator<SparseArray.Entry> iter = x.iterator();
boolean intersection = false;
double kl = 0.0;
while (iter.hasNext()) {
SparseArray.Entry b = iter.next();
int i = b.i;
if (y[i] > 0) {
intersection = true; // depends on control dependency: [if], data = [none]
kl += b.x * Math.log(b.x / y[i]); // depends on control dependency: [if], data = [none]
}
}
if (intersection) {
return kl; // depends on control dependency: [if], data = [none]
} else {
return Double.POSITIVE_INFINITY; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setTargetUrlParameter(String targetUrlParameter) {
if (targetUrlParameter != null) {
Assert.hasText(targetUrlParameter, "targetUrlParameter cannot be empty");
}
this.targetUrlParameter = targetUrlParameter;
} }
|
public class class_name {
public void setTargetUrlParameter(String targetUrlParameter) {
if (targetUrlParameter != null) {
Assert.hasText(targetUrlParameter, "targetUrlParameter cannot be empty"); // depends on control dependency: [if], data = [(targetUrlParameter]
}
this.targetUrlParameter = targetUrlParameter;
} }
|
public class class_name {
public static Object getThis(Object ref) {
Object thisValue = null;
// FIXME: We can probably remove this check for IRJSFunctions since we will not be using references
if (ref instanceof Reference) {
if (((Reference) ref).isPropertyReference()) {
thisValue = ((Reference) ref).getBase();
} else {
thisValue = ((EnvironmentRecord) ((Reference) ref).getBase()).implicitThisValue();
}
}
return thisValue;
} }
|
public class class_name {
public static Object getThis(Object ref) {
Object thisValue = null;
// FIXME: We can probably remove this check for IRJSFunctions since we will not be using references
if (ref instanceof Reference) {
if (((Reference) ref).isPropertyReference()) {
thisValue = ((Reference) ref).getBase(); // depends on control dependency: [if], data = [none]
} else {
thisValue = ((EnvironmentRecord) ((Reference) ref).getBase()).implicitThisValue(); // depends on control dependency: [if], data = [none]
}
}
return thisValue;
} }
|
public class class_name {
public void setComposition(@NonNull LottieComposition composition) {
if (L.DBG) {
Log.v(TAG, "Set Composition \n" + composition);
}
lottieDrawable.setCallback(this);
this.composition = composition;
boolean isNewComposition = lottieDrawable.setComposition(composition);
enableOrDisableHardwareLayer();
if (getDrawable() == lottieDrawable && !isNewComposition) {
// We can avoid re-setting the drawable, and invalidating the view, since the composition
// hasn't changed.
return;
}
// If you set a different composition on the view, the bounds will not update unless
// the drawable is different than the original.
setImageDrawable(null);
setImageDrawable(lottieDrawable);
requestLayout();
for (LottieOnCompositionLoadedListener lottieOnCompositionLoadedListener : lottieOnCompositionLoadedListeners) {
lottieOnCompositionLoadedListener.onCompositionLoaded(composition);
}
} }
|
public class class_name {
public void setComposition(@NonNull LottieComposition composition) {
if (L.DBG) {
Log.v(TAG, "Set Composition \n" + composition); // depends on control dependency: [if], data = [none]
}
lottieDrawable.setCallback(this);
this.composition = composition;
boolean isNewComposition = lottieDrawable.setComposition(composition);
enableOrDisableHardwareLayer();
if (getDrawable() == lottieDrawable && !isNewComposition) {
// We can avoid re-setting the drawable, and invalidating the view, since the composition
// hasn't changed.
return; // depends on control dependency: [if], data = [none]
}
// If you set a different composition on the view, the bounds will not update unless
// the drawable is different than the original.
setImageDrawable(null);
setImageDrawable(lottieDrawable);
requestLayout();
for (LottieOnCompositionLoadedListener lottieOnCompositionLoadedListener : lottieOnCompositionLoadedListeners) {
lottieOnCompositionLoadedListener.onCompositionLoaded(composition); // depends on control dependency: [for], data = [lottieOnCompositionLoadedListener]
}
} }
|
public class class_name {
public static String get(URI metadataService, String path) {
checkNotNull(metadataService, "metadataService");
checkArgument(metadataService.getPath().endsWith("/"),
"metadataService must end with '/'; %s provided",
metadataService);
checkNotNull(path, "path");
InputStream stream = null;
try {
stream = openStream(metadataService + path);
String content = slurp(new InputStreamReader(stream));
if (content.isEmpty()) {
return null;
}
return content;
} catch (IOException e) {
return null;
} finally {
try {
if (stream != null) {
stream.close();
}
} catch (IOException e) {
}
}
} }
|
public class class_name {
public static String get(URI metadataService, String path) {
checkNotNull(metadataService, "metadataService");
checkArgument(metadataService.getPath().endsWith("/"),
"metadataService must end with '/'; %s provided",
metadataService);
checkNotNull(path, "path");
InputStream stream = null;
try {
stream = openStream(metadataService + path); // depends on control dependency: [try], data = [none]
String content = slurp(new InputStreamReader(stream));
if (content.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
return content; // depends on control dependency: [try], data = [none]
} catch (IOException e) {
return null;
} finally { // depends on control dependency: [catch], data = [none]
try {
if (stream != null) {
stream.close(); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public static boolean contains(final String cssValue,
final Collection<String> cssValues, final int lowestLength,
final int highestLength) {
if (cssValue == null || cssValue.length() < lowestLength
|| cssValue.length() > highestLength) {
return false;
}
final boolean contains = cssValues
.contains(TagStringUtil.toUpperCase(cssValue));
return contains;
} }
|
public class class_name {
public static boolean contains(final String cssValue,
final Collection<String> cssValues, final int lowestLength,
final int highestLength) {
if (cssValue == null || cssValue.length() < lowestLength
|| cssValue.length() > highestLength) {
return false; // depends on control dependency: [if], data = [none]
}
final boolean contains = cssValues
.contains(TagStringUtil.toUpperCase(cssValue));
return contains;
} }
|
public class class_name {
public DescribeComplianceByResourceRequest withComplianceTypes(ComplianceType... complianceTypes) {
com.amazonaws.internal.SdkInternalList<String> complianceTypesCopy = new com.amazonaws.internal.SdkInternalList<String>(complianceTypes.length);
for (ComplianceType value : complianceTypes) {
complianceTypesCopy.add(value.toString());
}
if (getComplianceTypes() == null) {
setComplianceTypes(complianceTypesCopy);
} else {
getComplianceTypes().addAll(complianceTypesCopy);
}
return this;
} }
|
public class class_name {
public DescribeComplianceByResourceRequest withComplianceTypes(ComplianceType... complianceTypes) {
com.amazonaws.internal.SdkInternalList<String> complianceTypesCopy = new com.amazonaws.internal.SdkInternalList<String>(complianceTypes.length);
for (ComplianceType value : complianceTypes) {
complianceTypesCopy.add(value.toString()); // depends on control dependency: [for], data = [value]
}
if (getComplianceTypes() == null) {
setComplianceTypes(complianceTypesCopy); // depends on control dependency: [if], data = [none]
} else {
getComplianceTypes().addAll(complianceTypesCopy); // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
public static void main(String args[]) {
String deviceName = null;
String commandName = null;
try {
commandName = args[0];
deviceName = args[1];
} catch (final Exception e) {
if (commandName==null) {
System.out.println("Usage :");
System.out.println("fr.esrf.TangoApi.DeviceProxy commandName deviceName");
System.out.println(" - info : Display device info.");
System.out.println(" - commandName : command name (ping, state, status, unexport...)");
System.out.println(" - deviceName : device name to send command.");
} else {
System.out.println("Device name ?");
}
System.exit(0);
}
try {
// Check if wildcard
String[] devnames;
DeviceProxy[] deviceProxies;
if (!deviceName.contains("*")) {
devnames = new String[1];
devnames[0] = deviceName;
} else {
devnames = ApiUtil.get_db_obj().getDevices(deviceName);
}
// Create DeviceProxy Objects
deviceProxies = new DeviceProxy[devnames.length];
for (int i = 0 ; i<devnames.length ; i++) {
deviceProxies[i] = new DeviceProxy(devnames[i]);
}
// switch (commandName) {
// case "info":
if (commandName.equals("info")) {
for (DeviceProxy deviceProxy : deviceProxies) {
System.out.println(deviceProxy + "\n");
}
// break;
// case "ping":
}
else
if (commandName.equals("ping")) {
// noinspection InfiniteLoopStatement
while (true) {
for (int i = 0; i < deviceProxies.length; i++) {
try {
final long t = deviceProxies[i].ping();
System.out.println(devnames[i] + " is alive (" + t / 1000 + " ms)");
} catch (final DevFailed e) {
System.out.println(devnames[i] + " " + e.errors[0].desc);
}
}
if (deviceProxies.length > 1) {
System.out.println();
}
try {
Thread.sleep(1000);
} catch (final InterruptedException e) { /* */ }
}
// break;
// case "status":
}
else
if (commandName.equals("status")) {
for (int i = 0; i < deviceProxies.length; i++) {
try {
System.out.println(devnames[i] + " - " + deviceProxies[i].status());
} catch (final DevFailed e) {
System.out.println(devnames[i] + " " + e.errors[0].desc);
}
}
// break;
// case "state":
}
else
if (commandName.equals("state")) {
for (int i = 0; i < deviceProxies.length; i++) {
try {
System.out
.println(devnames[i] + " is " + ApiUtil.stateName(deviceProxies[i].state()));
/*
* DeviceAttribute da = dev[i].read_attribute("State");
* DevState st = da.extractDevStateArray()[0];
* System.out.println(devnames[i] + " is " +
* ApiUtil.stateName(st));
*/
} catch (final DevFailed e) {
System.out.println(devnames[i] + " " + e.errors[0].desc);
}
}
// break;
// case "":
}
else
if (commandName.equals("unexport")) {
for (int i = 0; i < deviceProxies.length; i++) {
try {
deviceProxies[i].unexport_device();
System.out.println(devnames[i] + " unexported !");
} catch (final DevFailed e) {
System.out.println(devnames[i] + " " + e.errors[0].desc);
}
}
// break;
// default:
}
else
System.out.println(commandName + " ? Unknow command !");
// break;
// }
} catch (final DevFailed e) {
Except.print_exception(e);
// e.printStackTrace();
}
} }
|
public class class_name {
public static void main(String args[]) {
String deviceName = null;
String commandName = null;
try {
commandName = args[0]; // depends on control dependency: [try], data = [none]
deviceName = args[1]; // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
if (commandName==null) {
System.out.println("Usage :"); // depends on control dependency: [if], data = [none]
System.out.println("fr.esrf.TangoApi.DeviceProxy commandName deviceName"); // depends on control dependency: [if], data = [none]
System.out.println(" - info : Display device info."); // depends on control dependency: [if], data = [none]
System.out.println(" - commandName : command name (ping, state, status, unexport...)");
System.out.println(" - deviceName : device name to send command."); // depends on control dependency: [if], data = [none]
} else {
System.out.println("Device name ?"); // depends on control dependency: [if], data = [none]
}
System.exit(0);
} // depends on control dependency: [catch], data = [none]
try {
// Check if wildcard
String[] devnames;
DeviceProxy[] deviceProxies;
if (!deviceName.contains("*")) {
devnames = new String[1]; // depends on control dependency: [if], data = [none]
devnames[0] = deviceName; // depends on control dependency: [if], data = [none]
} else {
devnames = ApiUtil.get_db_obj().getDevices(deviceName); // depends on control dependency: [if], data = [none]
}
// Create DeviceProxy Objects
deviceProxies = new DeviceProxy[devnames.length]; // depends on control dependency: [try], data = [none]
for (int i = 0 ; i<devnames.length ; i++) {
deviceProxies[i] = new DeviceProxy(devnames[i]); // depends on control dependency: [for], data = [i]
}
// switch (commandName) {
// case "info":
if (commandName.equals("info")) {
for (DeviceProxy deviceProxy : deviceProxies) {
System.out.println(deviceProxy + "\n"); // depends on control dependency: [for], data = [deviceProxy]
}
// break;
// case "ping":
}
else
if (commandName.equals("ping")) {
// noinspection InfiniteLoopStatement
while (true) {
for (int i = 0; i < deviceProxies.length; i++) {
try {
final long t = deviceProxies[i].ping();
System.out.println(devnames[i] + " is alive (" + t / 1000 + " ms)"); // depends on control dependency: [try], data = [none]
} catch (final DevFailed e) {
System.out.println(devnames[i] + " " + e.errors[0].desc);
} // depends on control dependency: [catch], data = [none]
}
if (deviceProxies.length > 1) {
System.out.println(); // depends on control dependency: [if], data = [none]
}
try {
Thread.sleep(1000); // depends on control dependency: [try], data = [none]
} catch (final InterruptedException e) { /* */ } // depends on control dependency: [catch], data = [none]
}
// break;
// case "status":
}
else
if (commandName.equals("status")) {
for (int i = 0; i < deviceProxies.length; i++) {
try {
System.out.println(devnames[i] + " - " + deviceProxies[i].status()); // depends on control dependency: [try], data = [none]
} catch (final DevFailed e) {
System.out.println(devnames[i] + " " + e.errors[0].desc);
} // depends on control dependency: [catch], data = [none]
}
// break;
// case "state":
}
else
if (commandName.equals("state")) {
for (int i = 0; i < deviceProxies.length; i++) {
try {
System.out
.println(devnames[i] + " is " + ApiUtil.stateName(deviceProxies[i].state())); // depends on control dependency: [try], data = [none]
/*
* DeviceAttribute da = dev[i].read_attribute("State");
* DevState st = da.extractDevStateArray()[0];
* System.out.println(devnames[i] + " is " +
* ApiUtil.stateName(st));
*/
} catch (final DevFailed e) {
System.out.println(devnames[i] + " " + e.errors[0].desc);
} // depends on control dependency: [catch], data = [none]
}
// break;
// case "":
}
else
if (commandName.equals("unexport")) {
for (int i = 0; i < deviceProxies.length; i++) {
try {
deviceProxies[i].unexport_device(); // depends on control dependency: [try], data = [none]
System.out.println(devnames[i] + " unexported !"); // depends on control dependency: [try], data = [none]
} catch (final DevFailed e) {
System.out.println(devnames[i] + " " + e.errors[0].desc);
} // depends on control dependency: [catch], data = [none]
}
// break;
// default:
}
else
System.out.println(commandName + " ? Unknow command !");
// break;
// }
} catch (final DevFailed e) {
Except.print_exception(e);
// e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void removePairs(GvmCluster<S,K> cluster) {
GvmClusterPair<S,K>[] pairs = cluster.pairs;
for (int i = 0; i < bound-1; i++) {
GvmClusterPair<S,K> pair = pairs[i];
if (pair.c1.removed || pair.c2.removed) continue;
this.pairs.remove(pair);
}
} }
|
public class class_name {
private void removePairs(GvmCluster<S,K> cluster) {
GvmClusterPair<S,K>[] pairs = cluster.pairs;
for (int i = 0; i < bound-1; i++) {
GvmClusterPair<S,K> pair = pairs[i];
if (pair.c1.removed || pair.c2.removed) continue;
this.pairs.remove(pair); // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
protected static OStatement parse(String statement) throws OCommandSQLParsingException {
try {
ODatabaseDocumentInternal db = ODatabaseRecordThreadLocal.instance().getIfDefined();
InputStream is;
if (db == null) {
is = new ByteArrayInputStream(statement.getBytes());
} else {
try {
is = new ByteArrayInputStream(statement.getBytes(db.getStorage().getConfiguration().getCharset()));
} catch (UnsupportedEncodingException e2) {
OLogManager.instance()
.warn(null, "Unsupported charset for database " + db + " " + db.getStorage().getConfiguration().getCharset());
is = new ByteArrayInputStream(statement.getBytes());
}
}
OrientSql osql = null;
if (db == null) {
osql = new OrientSql(is);
} else {
try {
osql = new OrientSql(is, db.getStorage().getConfiguration().getCharset());
} catch (UnsupportedEncodingException e2) {
OLogManager.instance()
.warn(null, "Unsupported charset for database " + db + " " + db.getStorage().getConfiguration().getCharset());
osql = new OrientSql(is);
}
}
OStatement result = osql.parse();
result.originalStatement = statement;
return result;
} catch (ParseException e) {
throwParsingException(e, statement);
} catch (TokenMgrError e2) {
throwParsingException(e2, statement);
}
return null;
} }
|
public class class_name {
protected static OStatement parse(String statement) throws OCommandSQLParsingException {
try {
ODatabaseDocumentInternal db = ODatabaseRecordThreadLocal.instance().getIfDefined();
InputStream is;
if (db == null) {
is = new ByteArrayInputStream(statement.getBytes());
} else {
try {
is = new ByteArrayInputStream(statement.getBytes(db.getStorage().getConfiguration().getCharset())); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e2) {
OLogManager.instance()
.warn(null, "Unsupported charset for database " + db + " " + db.getStorage().getConfiguration().getCharset());
is = new ByteArrayInputStream(statement.getBytes());
} // depends on control dependency: [catch], data = [none]
}
OrientSql osql = null;
if (db == null) {
osql = new OrientSql(is);
} else {
try {
osql = new OrientSql(is, db.getStorage().getConfiguration().getCharset()); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e2) {
OLogManager.instance()
.warn(null, "Unsupported charset for database " + db + " " + db.getStorage().getConfiguration().getCharset());
osql = new OrientSql(is);
} // depends on control dependency: [catch], data = [none]
}
OStatement result = osql.parse();
result.originalStatement = statement;
return result;
} catch (ParseException e) {
throwParsingException(e, statement);
} catch (TokenMgrError e2) {
throwParsingException(e2, statement);
}
return null;
} }
|
public class class_name {
private void readDoctype(boolean saveDtdText) throws IOException, XmlPullParserException {
read(START_DOCTYPE);
int startPosition = -1;
if (saveDtdText) {
bufferCapture = new StringBuilder();
startPosition = position;
}
try {
skip();
rootElementName = readName();
readExternalId(true, true);
skip();
if (peekCharacter() == '[') {
readInternalSubset();
}
skip();
} finally {
if (saveDtdText) {
bufferCapture.append(buffer, 0, position);
bufferCapture.delete(0, startPosition);
text = bufferCapture.toString();
bufferCapture = null;
}
}
read('>');
skip();
} }
|
public class class_name {
private void readDoctype(boolean saveDtdText) throws IOException, XmlPullParserException {
read(START_DOCTYPE);
int startPosition = -1;
if (saveDtdText) {
bufferCapture = new StringBuilder();
startPosition = position;
}
try {
skip();
rootElementName = readName();
readExternalId(true, true);
skip();
if (peekCharacter() == '[') {
readInternalSubset(); // depends on control dependency: [if], data = [none]
}
skip();
} finally {
if (saveDtdText) {
bufferCapture.append(buffer, 0, position); // depends on control dependency: [if], data = [none]
bufferCapture.delete(0, startPosition); // depends on control dependency: [if], data = [none]
text = bufferCapture.toString(); // depends on control dependency: [if], data = [none]
bufferCapture = null; // depends on control dependency: [if], data = [none]
}
}
read('>');
skip();
} }
|
public class class_name {
private static void includeAffected(Set<String> allClasses, Set<String> affectedClasses, List<File> sortedFiles) {
Storer storer = Config.createStorer();
Hasher hasher = Config.createHasher();
NameBasedCheck classCheck = Config.DEBUG_MODE_V != Config.DebugMode.NONE ?
new DebugNameCheck(storer, hasher, DependencyAnalyzer.CLASS_EXT) :
new NameBasedCheck(storer, hasher, DependencyAnalyzer.CLASS_EXT);
NameBasedCheck covCheck = new NameBasedCheck(storer, hasher, DependencyAnalyzer.COV_EXT);
MethodCheck methodCheck = new MethodCheck(storer, hasher);
String prevClassName = null;
for (File file : sortedFiles) {
String fileName = file.getName();
String dirName = file.getParent();
String className = null;
if (file.isDirectory()) {
continue;
}
if (fileName.endsWith(DependencyAnalyzer.COV_EXT)) {
className = covCheck.includeAll(fileName, dirName);
} else if (fileName.endsWith(DependencyAnalyzer.CLASS_EXT)) {
className = classCheck.includeAll(fileName, dirName);
} else {
className = methodCheck.includeAll(fileName, dirName);
}
// Reset after some time to free space.
if (prevClassName != null && className != null && !prevClassName.equals(className)) {
methodCheck.includeAffected(affectedClasses);
methodCheck = new MethodCheck(Config.createStorer(), Config.createHasher());
}
if (className != null) {
allClasses.add(className);
prevClassName = className;
}
}
classCheck.includeAffected(affectedClasses);
covCheck.includeAffected(affectedClasses);
methodCheck.includeAffected(affectedClasses);
} }
|
public class class_name {
private static void includeAffected(Set<String> allClasses, Set<String> affectedClasses, List<File> sortedFiles) {
Storer storer = Config.createStorer();
Hasher hasher = Config.createHasher();
NameBasedCheck classCheck = Config.DEBUG_MODE_V != Config.DebugMode.NONE ?
new DebugNameCheck(storer, hasher, DependencyAnalyzer.CLASS_EXT) :
new NameBasedCheck(storer, hasher, DependencyAnalyzer.CLASS_EXT);
NameBasedCheck covCheck = new NameBasedCheck(storer, hasher, DependencyAnalyzer.COV_EXT);
MethodCheck methodCheck = new MethodCheck(storer, hasher);
String prevClassName = null;
for (File file : sortedFiles) {
String fileName = file.getName();
String dirName = file.getParent();
String className = null;
if (file.isDirectory()) {
continue;
}
if (fileName.endsWith(DependencyAnalyzer.COV_EXT)) {
className = covCheck.includeAll(fileName, dirName); // depends on control dependency: [if], data = [none]
} else if (fileName.endsWith(DependencyAnalyzer.CLASS_EXT)) {
className = classCheck.includeAll(fileName, dirName); // depends on control dependency: [if], data = [none]
} else {
className = methodCheck.includeAll(fileName, dirName); // depends on control dependency: [if], data = [none]
}
// Reset after some time to free space.
if (prevClassName != null && className != null && !prevClassName.equals(className)) {
methodCheck.includeAffected(affectedClasses); // depends on control dependency: [if], data = [none]
methodCheck = new MethodCheck(Config.createStorer(), Config.createHasher()); // depends on control dependency: [if], data = [none]
}
if (className != null) {
allClasses.add(className); // depends on control dependency: [if], data = [(className]
prevClassName = className; // depends on control dependency: [if], data = [none]
}
}
classCheck.includeAffected(affectedClasses);
covCheck.includeAffected(affectedClasses);
methodCheck.includeAffected(affectedClasses);
} }
|
public class class_name {
public synchronized void setTypeCheckedStatus(boolean checked)
{
this.isTypeChecked = true;
this.isTypeCorrect = checked;
this.checkedTime = new Date();
if (checked)
{
fireModelCheckedEvent();
}
} }
|
public class class_name {
public synchronized void setTypeCheckedStatus(boolean checked)
{
this.isTypeChecked = true;
this.isTypeCorrect = checked;
this.checkedTime = new Date();
if (checked)
{
fireModelCheckedEvent(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void stateChanged(ChangeEvent e) {
SpinnerNumberModel model = (SpinnerNumberModel) ((JSpinner) e
.getSource()).getModel();
int value = model.getNumber().intValue();
boolean increase = (value > oldSpinnerValue) ? true : false;
oldSpinnerValue = value;
int month = getMonth();
if (increase) {
month += 1;
if (month == 12) {
month = 0;
if (yearChooser != null) {
int year = yearChooser.getYear();
year += 1;
yearChooser.setYear(year);
}
}
} else {
month -= 1;
if (month == -1) {
month = 11;
if (yearChooser != null) {
int year = yearChooser.getYear();
year -= 1;
yearChooser.setYear(year);
}
}
}
setMonth(month);
} }
|
public class class_name {
public void stateChanged(ChangeEvent e) {
SpinnerNumberModel model = (SpinnerNumberModel) ((JSpinner) e
.getSource()).getModel();
int value = model.getNumber().intValue();
boolean increase = (value > oldSpinnerValue) ? true : false;
oldSpinnerValue = value;
int month = getMonth();
if (increase) {
month += 1; // depends on control dependency: [if], data = [none]
if (month == 12) {
month = 0; // depends on control dependency: [if], data = [none]
if (yearChooser != null) {
int year = yearChooser.getYear();
year += 1; // depends on control dependency: [if], data = [none]
yearChooser.setYear(year); // depends on control dependency: [if], data = [none]
}
}
} else {
month -= 1; // depends on control dependency: [if], data = [none]
if (month == -1) {
month = 11; // depends on control dependency: [if], data = [none]
if (yearChooser != null) {
int year = yearChooser.getYear();
year -= 1; // depends on control dependency: [if], data = [none]
yearChooser.setYear(year); // depends on control dependency: [if], data = [none]
}
}
}
setMonth(month);
} }
|
public class class_name {
public static @SlashedClassName
String extractClassName(String originalName) {
String name = originalName;
if (name.charAt(0) != '[' && name.charAt(name.length() - 1) != ';') {
return name;
}
while (name.charAt(0) == '[') {
name = name.substring(1);
}
if (name.charAt(0) == 'L' && name.charAt(name.length() - 1) == ';') {
name = name.substring(1, name.length() - 1);
}
if (name.charAt(0) == '[') {
throw new IllegalArgumentException("Bad class name: " + originalName);
}
return name;
} }
|
public class class_name {
public static @SlashedClassName
String extractClassName(String originalName) {
String name = originalName;
if (name.charAt(0) != '[' && name.charAt(name.length() - 1) != ';') {
return name; // depends on control dependency: [if], data = [none]
}
while (name.charAt(0) == '[') {
name = name.substring(1); // depends on control dependency: [while], data = [none]
}
if (name.charAt(0) == 'L' && name.charAt(name.length() - 1) == ';') {
name = name.substring(1, name.length() - 1); // depends on control dependency: [if], data = [none]
}
if (name.charAt(0) == '[') {
throw new IllegalArgumentException("Bad class name: " + originalName);
}
return name;
} }
|
public class class_name {
@Override
public int generateAt(Instance instance, IFeatureAlphabet features, int pos,
int... numLabels) {
String[][] data = ( String[][]) instance.getData();
// int len = data[0].length;
StringBuilder sb = new StringBuilder();
sb.append(id);
sb.append(':');
char c = data[0][pos].charAt(0); //这里数据行列和模板中行列相反
// 得到字符串类型
for(int i=0;i<dicts.length;i++){
if(dicts[i].contains(c)){
sb.append("/");
sb.append(dicts[i].name);
}
}
if(sb.length()<3)
return -1;
int index = features.lookupIndex(sb.toString(),numLabels[0]);
return index;
} }
|
public class class_name {
@Override
public int generateAt(Instance instance, IFeatureAlphabet features, int pos,
int... numLabels) {
String[][] data = ( String[][]) instance.getData();
// int len = data[0].length;
StringBuilder sb = new StringBuilder();
sb.append(id);
sb.append(':');
char c = data[0][pos].charAt(0); //这里数据行列和模板中行列相反
// 得到字符串类型
for(int i=0;i<dicts.length;i++){
if(dicts[i].contains(c)){
sb.append("/");
// depends on control dependency: [if], data = [none]
sb.append(dicts[i].name);
// depends on control dependency: [if], data = [none]
}
}
if(sb.length()<3)
return -1;
int index = features.lookupIndex(sb.toString(),numLabels[0]);
return index;
} }
|
public class class_name {
private String extractUserId(String studentId, ResponseEntity<String> response) {
Configuration config = Configuration.builder().options(
Option.DEFAULT_PATH_LEAF_TO_NULL
).build();
ReadContext readContext = JsonPath
.using(config)
.parse(response.getBody());
String success = readContext.read(SUCCESS_QUERY);
// SSP passes this as a string...
if (!"true".equalsIgnoreCase(success)) {
return null;
}
int count = readContext.read(RESULTS_QUERY, Integer.class);
if (count != 1) {
// couldn't find a single unique result. Bail now...
log.warn("Expected a single unique result for " + studentId + ". Found " + count);
return null;
}
String id = readContext.read(STUDENT_ID_QUERY);
return id;
} }
|
public class class_name {
private String extractUserId(String studentId, ResponseEntity<String> response) {
Configuration config = Configuration.builder().options(
Option.DEFAULT_PATH_LEAF_TO_NULL
).build();
ReadContext readContext = JsonPath
.using(config)
.parse(response.getBody());
String success = readContext.read(SUCCESS_QUERY);
// SSP passes this as a string...
if (!"true".equalsIgnoreCase(success)) {
return null; // depends on control dependency: [if], data = [none]
}
int count = readContext.read(RESULTS_QUERY, Integer.class);
if (count != 1) {
// couldn't find a single unique result. Bail now...
log.warn("Expected a single unique result for " + studentId + ". Found " + count); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
String id = readContext.read(STUDENT_ID_QUERY);
return id;
} }
|
public class class_name {
private void setRawDirection(SwipyRefreshLayoutDirection direction) {
if (mDirection == direction) {
return;
}
mDirection = direction;
switch (mDirection) {
case BOTTOM:
mCurrentTargetOffsetTop = mOriginalOffsetTop = getMeasuredHeight();
break;
case TOP:
default:
mCurrentTargetOffsetTop = mOriginalOffsetTop = -mCircleView.getMeasuredHeight();
break;
}
} }
|
public class class_name {
private void setRawDirection(SwipyRefreshLayoutDirection direction) {
if (mDirection == direction) {
return; // depends on control dependency: [if], data = [none]
}
mDirection = direction;
switch (mDirection) {
case BOTTOM:
mCurrentTargetOffsetTop = mOriginalOffsetTop = getMeasuredHeight();
break;
case TOP:
default:
mCurrentTargetOffsetTop = mOriginalOffsetTop = -mCircleView.getMeasuredHeight();
break;
}
} }
|
public class class_name {
public static Observable<RxComapiClient> initialise(@NonNull Application app, @NonNull ComapiConfig config) {
String error = checkIfCanInitialise(app, config, false);
if (!TextUtils.isEmpty(error)) {
return Observable.error(new Exception(error));
}
RxComapiClient client = new RxComapiClient(config);
return client.initialise(app, config.getCallbackAdapter() != null ? config.getCallbackAdapter() : new CallbackAdapter(), client);
} }
|
public class class_name {
public static Observable<RxComapiClient> initialise(@NonNull Application app, @NonNull ComapiConfig config) {
String error = checkIfCanInitialise(app, config, false);
if (!TextUtils.isEmpty(error)) {
return Observable.error(new Exception(error)); // depends on control dependency: [if], data = [none]
}
RxComapiClient client = new RxComapiClient(config);
return client.initialise(app, config.getCallbackAdapter() != null ? config.getCallbackAdapter() : new CallbackAdapter(), client);
} }
|
public class class_name {
public long getAlignedVirtualAddress() {
long virtAddr = get(VIRTUAL_ADDRESS);
if (virtAddr == (virtAddr & ~0xfff)) {
return virtAddr;
}
long result = (virtAddr + 0xfff) & ~0xfff;
assert result % 4096 == 0;
return result;
} }
|
public class class_name {
public long getAlignedVirtualAddress() {
long virtAddr = get(VIRTUAL_ADDRESS);
if (virtAddr == (virtAddr & ~0xfff)) {
return virtAddr; // depends on control dependency: [if], data = [none]
}
long result = (virtAddr + 0xfff) & ~0xfff;
assert result % 4096 == 0;
return result;
} }
|
public class class_name {
public void setCursor(Object parent, String name, String cursor) {
Element element = getElement(parent, name);
if (element != null) {
Dom.setStyleAttribute(element, "cursor", cursor);
}
} }
|
public class class_name {
public void setCursor(Object parent, String name, String cursor) {
Element element = getElement(parent, name);
if (element != null) {
Dom.setStyleAttribute(element, "cursor", cursor); // depends on control dependency: [if], data = [(element]
}
} }
|
public class class_name {
public static void setConstructorArgValue(BeanDefinitionBuilder builder, String propertyValue) {
if (StringUtils.hasText(propertyValue)) {
builder.addConstructorArgValue(propertyValue);
}
} }
|
public class class_name {
public static void setConstructorArgValue(BeanDefinitionBuilder builder, String propertyValue) {
if (StringUtils.hasText(propertyValue)) {
builder.addConstructorArgValue(propertyValue); // depends on control dependency: [if], data = [none]
}
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.