code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public void marshall(SchemaChangePolicy schemaChangePolicy, ProtocolMarshaller protocolMarshaller) {
if (schemaChangePolicy == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(schemaChangePolicy.getUpdateBehavior(), UPDATEBEHAVIOR_BINDING);
protocolMarshaller.marshall(schemaChangePolicy.getDeleteBehavior(), DELETEBEHAVIOR_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(SchemaChangePolicy schemaChangePolicy, ProtocolMarshaller protocolMarshaller) {
if (schemaChangePolicy == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(schemaChangePolicy.getUpdateBehavior(), UPDATEBEHAVIOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(schemaChangePolicy.getDeleteBehavior(), DELETEBEHAVIOR_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 {
@Override
public int size(boolean includeDiskCache) {
int mappings = 0;
mappings = cache.getNumberCacheEntries();
if (includeDiskCache) {
if (cache instanceof CacheProviderWrapper) {
CacheProviderWrapper cpw = (CacheProviderWrapper) cache;
if (cpw.featureSupport.isDiskCacheSupported())
mappings = mappings + cache.getIdsSizeDisk();
} else {
mappings = mappings + cache.getIdsSizeDisk();
}
}
return mappings;
} }
|
public class class_name {
@Override
public int size(boolean includeDiskCache) {
int mappings = 0;
mappings = cache.getNumberCacheEntries();
if (includeDiskCache) {
if (cache instanceof CacheProviderWrapper) {
CacheProviderWrapper cpw = (CacheProviderWrapper) cache;
if (cpw.featureSupport.isDiskCacheSupported())
mappings = mappings + cache.getIdsSizeDisk();
} else {
mappings = mappings + cache.getIdsSizeDisk(); // depends on control dependency: [if], data = [none]
}
}
return mappings;
} }
|
public class class_name {
final public void Equality() throws ParseException {
Compare();
label_9:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case EQ0:
case EQ1:
case NE0:
case NE1:
;
break;
default:
jj_la1[14] = jj_gen;
break label_9;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case EQ0:
case EQ1:
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case EQ0:
jj_consume_token(EQ0);
break;
case EQ1:
jj_consume_token(EQ1);
break;
default:
jj_la1[15] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
AstEqual jjtn001 = new AstEqual(JJTEQUAL);
boolean jjtc001 = true;
jjtree.openNodeScope(jjtn001);
try {
Compare();
} catch (Throwable jjte001) {
if (jjtc001) {
jjtree.clearNodeScope(jjtn001);
jjtc001 = false;
} else {
jjtree.popNode();
}
if (jjte001 instanceof RuntimeException) {
{if (true) throw (RuntimeException)jjte001;}
}
if (jjte001 instanceof ParseException) {
{if (true) throw (ParseException)jjte001;}
}
{if (true) throw (Error)jjte001;}
} finally {
if (jjtc001) {
jjtree.closeNodeScope(jjtn001, 2);
}
}
break;
case NE0:
case NE1:
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case NE0:
jj_consume_token(NE0);
break;
case NE1:
jj_consume_token(NE1);
break;
default:
jj_la1[16] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
AstNotEqual jjtn002 = new AstNotEqual(JJTNOTEQUAL);
boolean jjtc002 = true;
jjtree.openNodeScope(jjtn002);
try {
Compare();
} catch (Throwable jjte002) {
if (jjtc002) {
jjtree.clearNodeScope(jjtn002);
jjtc002 = false;
} else {
jjtree.popNode();
}
if (jjte002 instanceof RuntimeException) {
{if (true) throw (RuntimeException)jjte002;}
}
if (jjte002 instanceof ParseException) {
{if (true) throw (ParseException)jjte002;}
}
{if (true) throw (Error)jjte002;}
} finally {
if (jjtc002) {
jjtree.closeNodeScope(jjtn002, 2);
}
}
break;
default:
jj_la1[17] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
} }
|
public class class_name {
final public void Equality() throws ParseException {
Compare();
label_9:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case EQ0:
case EQ1:
case NE0:
case NE1:
;
break;
default:
jj_la1[14] = jj_gen;
break label_9;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case EQ0:
case EQ1:
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case EQ0:
jj_consume_token(EQ0);
break;
case EQ1:
jj_consume_token(EQ1);
break;
default:
jj_la1[15] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
AstEqual jjtn001 = new AstEqual(JJTEQUAL);
boolean jjtc001 = true;
jjtree.openNodeScope(jjtn001);
try {
Compare();
} catch (Throwable jjte001) {
if (jjtc001) {
jjtree.clearNodeScope(jjtn001); // depends on control dependency: [if], data = [none]
jjtc001 = false; // depends on control dependency: [if], data = [none]
} else {
jjtree.popNode(); // depends on control dependency: [if], data = [none]
}
if (jjte001 instanceof RuntimeException) {
{if (true) throw (RuntimeException)jjte001;}
}
if (jjte001 instanceof ParseException) {
{if (true) throw (ParseException)jjte001;}
}
{if (true) throw (Error)jjte001;}
} finally {
if (jjtc001) {
jjtree.closeNodeScope(jjtn001, 2); // depends on control dependency: [if], data = [none]
}
}
break;
case NE0:
case NE1:
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case NE0:
jj_consume_token(NE0);
break;
case NE1:
jj_consume_token(NE1);
break;
default:
jj_la1[16] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
AstNotEqual jjtn002 = new AstNotEqual(JJTNOTEQUAL);
boolean jjtc002 = true;
jjtree.openNodeScope(jjtn002);
try {
Compare();
} catch (Throwable jjte002) {
if (jjtc002) {
jjtree.clearNodeScope(jjtn002);
jjtc002 = false;
} else {
jjtree.popNode();
}
if (jjte002 instanceof RuntimeException) {
{if (true) throw (RuntimeException)jjte002;}
}
if (jjte002 instanceof ParseException) {
{if (true) throw (ParseException)jjte002;}
}
{if (true) throw (Error)jjte002;}
} finally {
if (jjtc002) {
jjtree.closeNodeScope(jjtn002, 2);
}
}
break;
default:
jj_la1[17] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
} }
|
public class class_name {
private static Class<?> tryToLoadClass(final ClassLoader loader, final Class<?> helper)
throws ClassNotFoundException {
try {
return Class.forName(helper.getName(), false, loader);
} catch (ClassNotFoundException e1) {
if (loader == null) {
// cannot defineClass inside bootstrap class loader
throw e1;
}
try {
// The helper class is NOT found in target ClassLoader, we have to define the helper class.
final byte[] classBinary = classToByteArray(helper);
return AccessController.doPrivileged(new PrivilegedAction<Class<?>>() {
@Override
public Class<?> run() {
try {
// Define the helper class in the target ClassLoader,
// then we can call the helper to load the native library.
Method defineClass = ClassLoader.class.getDeclaredMethod("defineClass", String.class,
byte[].class, int.class, int.class);
defineClass.setAccessible(true);
return (Class<?>) defineClass.invoke(loader, helper.getName(), classBinary, 0,
classBinary.length);
} catch (Exception e) {
throw new IllegalStateException("Define class failed!", e);
}
}
});
} catch (ClassNotFoundException e2) {
ThrowableUtil.addSuppressed(e2, e1);
throw e2;
} catch (RuntimeException e2) {
ThrowableUtil.addSuppressed(e2, e1);
throw e2;
} catch (Error e2) {
ThrowableUtil.addSuppressed(e2, e1);
throw e2;
}
}
} }
|
public class class_name {
private static Class<?> tryToLoadClass(final ClassLoader loader, final Class<?> helper)
throws ClassNotFoundException {
try {
return Class.forName(helper.getName(), false, loader);
} catch (ClassNotFoundException e1) {
if (loader == null) {
// cannot defineClass inside bootstrap class loader
throw e1;
}
try {
// The helper class is NOT found in target ClassLoader, we have to define the helper class.
final byte[] classBinary = classToByteArray(helper);
return AccessController.doPrivileged(new PrivilegedAction<Class<?>>() {
@Override
public Class<?> run() {
try {
// Define the helper class in the target ClassLoader,
// then we can call the helper to load the native library.
Method defineClass = ClassLoader.class.getDeclaredMethod("defineClass", String.class,
byte[].class, int.class, int.class);
defineClass.setAccessible(true);
return (Class<?>) defineClass.invoke(loader, helper.getName(), classBinary, 0,
classBinary.length);
} catch (Exception e) {
throw new IllegalStateException("Define class failed!", e);
}
}
}); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException e2) {
ThrowableUtil.addSuppressed(e2, e1);
throw e2;
} catch (RuntimeException e2) { // depends on control dependency: [catch], data = [none]
ThrowableUtil.addSuppressed(e2, e1);
throw e2;
} catch (Error e2) { // depends on control dependency: [catch], data = [none]
ThrowableUtil.addSuppressed(e2, e1);
throw e2;
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
@Deprecated
public static ResourceHandler.Builder fileOrClasspath(String fileRootIfExists, String classpathRoot) {
Path path = Paths.get(fileRootIfExists);
if (Files.isDirectory(path)) {
return fileHandler(path);
} else {
return classpathHandler(classpathRoot);
}
} }
|
public class class_name {
@Deprecated
public static ResourceHandler.Builder fileOrClasspath(String fileRootIfExists, String classpathRoot) {
Path path = Paths.get(fileRootIfExists);
if (Files.isDirectory(path)) {
return fileHandler(path); // depends on control dependency: [if], data = [none]
} else {
return classpathHandler(classpathRoot); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public FacesConfigFlowDefinitionFlowCallParameterType<FacesConfigFlowDefinitionFacesMethodCallType<T>> getOrCreateParameter()
{
List<Node> nodeList = childNode.get("parameter");
if (nodeList != null && nodeList.size() > 0)
{
return new FacesConfigFlowDefinitionFlowCallParameterTypeImpl<FacesConfigFlowDefinitionFacesMethodCallType<T>>(this, "parameter", childNode, nodeList.get(0));
}
return createParameter();
} }
|
public class class_name {
public FacesConfigFlowDefinitionFlowCallParameterType<FacesConfigFlowDefinitionFacesMethodCallType<T>> getOrCreateParameter()
{
List<Node> nodeList = childNode.get("parameter");
if (nodeList != null && nodeList.size() > 0)
{
return new FacesConfigFlowDefinitionFlowCallParameterTypeImpl<FacesConfigFlowDefinitionFacesMethodCallType<T>>(this, "parameter", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createParameter();
} }
|
public class class_name {
public void marshall(CreateSimulationJobRequest createSimulationJobRequest, ProtocolMarshaller protocolMarshaller) {
if (createSimulationJobRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createSimulationJobRequest.getClientRequestToken(), CLIENTREQUESTTOKEN_BINDING);
protocolMarshaller.marshall(createSimulationJobRequest.getOutputLocation(), OUTPUTLOCATION_BINDING);
protocolMarshaller.marshall(createSimulationJobRequest.getMaxJobDurationInSeconds(), MAXJOBDURATIONINSECONDS_BINDING);
protocolMarshaller.marshall(createSimulationJobRequest.getIamRole(), IAMROLE_BINDING);
protocolMarshaller.marshall(createSimulationJobRequest.getFailureBehavior(), FAILUREBEHAVIOR_BINDING);
protocolMarshaller.marshall(createSimulationJobRequest.getRobotApplications(), ROBOTAPPLICATIONS_BINDING);
protocolMarshaller.marshall(createSimulationJobRequest.getSimulationApplications(), SIMULATIONAPPLICATIONS_BINDING);
protocolMarshaller.marshall(createSimulationJobRequest.getTags(), TAGS_BINDING);
protocolMarshaller.marshall(createSimulationJobRequest.getVpcConfig(), VPCCONFIG_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(CreateSimulationJobRequest createSimulationJobRequest, ProtocolMarshaller protocolMarshaller) {
if (createSimulationJobRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createSimulationJobRequest.getClientRequestToken(), CLIENTREQUESTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createSimulationJobRequest.getOutputLocation(), OUTPUTLOCATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createSimulationJobRequest.getMaxJobDurationInSeconds(), MAXJOBDURATIONINSECONDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createSimulationJobRequest.getIamRole(), IAMROLE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createSimulationJobRequest.getFailureBehavior(), FAILUREBEHAVIOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createSimulationJobRequest.getRobotApplications(), ROBOTAPPLICATIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createSimulationJobRequest.getSimulationApplications(), SIMULATIONAPPLICATIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createSimulationJobRequest.getTags(), TAGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createSimulationJobRequest.getVpcConfig(), VPCCONFIG_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 {
@Override
public final byte get(int index) {
final long pos = address + index;
if (index >= 0 && pos < addressLimit) {
return UNSAFE.getByte(heapMemory, pos);
}
else if (address > addressLimit) {
throw new IllegalStateException("segment has been freed");
}
else {
// index is in fact invalid
throw new IndexOutOfBoundsException();
}
} }
|
public class class_name {
@Override
public final byte get(int index) {
final long pos = address + index;
if (index >= 0 && pos < addressLimit) {
return UNSAFE.getByte(heapMemory, pos); // depends on control dependency: [if], data = [none]
}
else if (address > addressLimit) {
throw new IllegalStateException("segment has been freed");
}
else {
// index is in fact invalid
throw new IndexOutOfBoundsException();
}
} }
|
public class class_name {
public static String verifyCertificate(X509Certificate cert, Collection crls, Calendar calendar) {
if (calendar == null)
calendar = new GregorianCalendar();
if (cert.hasUnsupportedCriticalExtension())
return "Has unsupported critical extension";
try {
cert.checkValidity(calendar.getTime());
}
catch (Exception e) {
return e.getMessage();
}
if (crls != null) {
for (Iterator it = crls.iterator(); it.hasNext();) {
if (((CRL)it.next()).isRevoked(cert))
return "Certificate revoked";
}
}
return null;
} }
|
public class class_name {
public static String verifyCertificate(X509Certificate cert, Collection crls, Calendar calendar) {
if (calendar == null)
calendar = new GregorianCalendar();
if (cert.hasUnsupportedCriticalExtension())
return "Has unsupported critical extension";
try {
cert.checkValidity(calendar.getTime()); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
return e.getMessage();
} // depends on control dependency: [catch], data = [none]
if (crls != null) {
for (Iterator it = crls.iterator(); it.hasNext();) {
if (((CRL)it.next()).isRevoked(cert))
return "Certificate revoked";
}
}
return null;
} }
|
public class class_name {
public Map<String, SubsystemInformation> getAvailableSubsystems(String moduleName) {
Map<String, SubsystemInformation> result = null;
final ExtensionInfo info = extensions.get(moduleName);
if (info != null) {
//noinspection SynchronizationOnLocalVariableOrMethodParameter
synchronized (info) {
result = Collections.unmodifiableMap(new HashMap<String, SubsystemInformation>(info.subsystems));
}
}
return result;
} }
|
public class class_name {
public Map<String, SubsystemInformation> getAvailableSubsystems(String moduleName) {
Map<String, SubsystemInformation> result = null;
final ExtensionInfo info = extensions.get(moduleName);
if (info != null) {
//noinspection SynchronizationOnLocalVariableOrMethodParameter
synchronized (info) { // depends on control dependency: [if], data = [(info]
result = Collections.unmodifiableMap(new HashMap<String, SubsystemInformation>(info.subsystems));
}
}
return result;
} }
|
public class class_name {
@Override
public CommerceNotificationQueueEntry fetchBySent_First(boolean sent,
OrderByComparator<CommerceNotificationQueueEntry> orderByComparator) {
List<CommerceNotificationQueueEntry> list = findBySent(sent, 0, 1,
orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} }
|
public class class_name {
@Override
public CommerceNotificationQueueEntry fetchBySent_First(boolean sent,
OrderByComparator<CommerceNotificationQueueEntry> orderByComparator) {
List<CommerceNotificationQueueEntry> list = findBySent(sent, 0, 1,
orderByComparator);
if (!list.isEmpty()) {
return list.get(0); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public void marshall(ListOnPremisesInstancesRequest listOnPremisesInstancesRequest, ProtocolMarshaller protocolMarshaller) {
if (listOnPremisesInstancesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listOnPremisesInstancesRequest.getRegistrationStatus(), REGISTRATIONSTATUS_BINDING);
protocolMarshaller.marshall(listOnPremisesInstancesRequest.getTagFilters(), TAGFILTERS_BINDING);
protocolMarshaller.marshall(listOnPremisesInstancesRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ListOnPremisesInstancesRequest listOnPremisesInstancesRequest, ProtocolMarshaller protocolMarshaller) {
if (listOnPremisesInstancesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listOnPremisesInstancesRequest.getRegistrationStatus(), REGISTRATIONSTATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listOnPremisesInstancesRequest.getTagFilters(), TAGFILTERS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listOnPremisesInstancesRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void setProxyChainName(String proxyChainName) {
if (proxyChainName == null) {
return;
}
this.proxyChainName = proxyChainName.trim();
if (proxyChainName.isEmpty()) {
setUseProxyChain(false);
}
getConfig().setProperty(PROXY_CHAIN_NAME, this.proxyChainName);
} }
|
public class class_name {
public void setProxyChainName(String proxyChainName) {
if (proxyChainName == null) {
return;
// depends on control dependency: [if], data = [none]
}
this.proxyChainName = proxyChainName.trim();
if (proxyChainName.isEmpty()) {
setUseProxyChain(false);
// depends on control dependency: [if], data = [none]
}
getConfig().setProperty(PROXY_CHAIN_NAME, this.proxyChainName);
} }
|
public class class_name {
public static DMatrixRMaj singular(int numRows, int numCols,
Random rand, double ...sv)
{
DMatrixRMaj U,V,S;
// speed it up in compact format
if( numRows > numCols ) {
U = RandomMatrices_DDRM.orthogonal(numRows, numCols, rand);
V = RandomMatrices_DDRM.orthogonal(numCols, numCols, rand);
S = new DMatrixRMaj(numCols, numCols);
} else {
U = RandomMatrices_DDRM.orthogonal(numRows, numRows, rand);
V = RandomMatrices_DDRM.orthogonal(numCols, numCols, rand);
S = new DMatrixRMaj(numRows, numCols);
}
int min = Math.min(numRows,numCols);
min = Math.min(min,sv.length);
for( int i = 0; i < min; i++ ) {
S.set(i,i,sv[i]);
}
DMatrixRMaj tmp = new DMatrixRMaj(numRows,numCols);
CommonOps_DDRM.mult(U,S,tmp);
S.reshape(numRows,numCols);
CommonOps_DDRM.multTransB(tmp,V,S);
return S;
} }
|
public class class_name {
public static DMatrixRMaj singular(int numRows, int numCols,
Random rand, double ...sv)
{
DMatrixRMaj U,V,S;
// speed it up in compact format
if( numRows > numCols ) {
U = RandomMatrices_DDRM.orthogonal(numRows, numCols, rand); // depends on control dependency: [if], data = [none]
V = RandomMatrices_DDRM.orthogonal(numCols, numCols, rand); // depends on control dependency: [if], data = [none]
S = new DMatrixRMaj(numCols, numCols); // depends on control dependency: [if], data = [none]
} else {
U = RandomMatrices_DDRM.orthogonal(numRows, numRows, rand); // depends on control dependency: [if], data = [none]
V = RandomMatrices_DDRM.orthogonal(numCols, numCols, rand); // depends on control dependency: [if], data = [none]
S = new DMatrixRMaj(numRows, numCols); // depends on control dependency: [if], data = [none]
}
int min = Math.min(numRows,numCols);
min = Math.min(min,sv.length);
for( int i = 0; i < min; i++ ) {
S.set(i,i,sv[i]); // depends on control dependency: [for], data = [i]
}
DMatrixRMaj tmp = new DMatrixRMaj(numRows,numCols);
CommonOps_DDRM.mult(U,S,tmp);
S.reshape(numRows,numCols);
CommonOps_DDRM.multTransB(tmp,V,S);
return S;
} }
|
public class class_name {
public int correlationDistance(PCAFilteredResult pca1, PCAFilteredResult pca2, int dimensionality) {
// TODO: Can we delay copying the matrixes?
// pca of rv1
double[][] v1t = copy(pca1.getEigenvectors());
double[][] v1t_strong = pca1.getStrongEigenvectors();
int lambda1 = pca1.getCorrelationDimension();
// pca of rv2
double[][] v2t = copy(pca2.getEigenvectors());
double[][] v2t_strong = pca2.getStrongEigenvectors();
int lambda2 = pca2.getCorrelationDimension();
// for all strong eigenvectors of rv2
double[][] m1_czech = pca1.dissimilarityMatrix();
for(int i = 0; i < v2t_strong.length; i++) {
double[] v2_i = v2t_strong[i];
// check, if distance of v2_i to the space of rv1 > delta
// (i.e., if v2_i spans up a new dimension)
double distsq = squareSum(v2_i) - transposeTimesTimes(v2_i, m1_czech, v2_i);
// if so, insert v2_i into v1 and adjust v1
// and compute m1_czech new, increase lambda1
if(lambda1 < dimensionality && distsq > deltasq) {
adjust(v1t, v2_i, lambda1++);
// TODO: make this incremental?
double[] e1_czech_d = new double[v1t.length];
Arrays.fill(e1_czech_d, 0, lambda1, 1);
m1_czech = transposeDiagonalTimes(v1t, e1_czech_d, v1t);
}
}
// for all strong eigenvectors of rv1
double[][] m2_czech = pca2.dissimilarityMatrix();
for(int i = 0; i < v1t_strong.length; i++) {
double[] v1_i = v1t_strong[i];
// check, if distance of v1_i to the space of rv2 > delta
// (i.e., if v1_i spans up a new dimension)
double distsq = squareSum(v1_i) - transposeTimesTimes(v1_i, m2_czech, v1_i);
// if so, insert v1_i into v2 and adjust v2
// and compute m2_czech new , increase lambda2
if(lambda2 < dimensionality && distsq > deltasq) {
adjust(v2t, v1_i, lambda2++);
// TODO: make this incremental?
double[] e2_czech_d = new double[v1t.length];
Arrays.fill(e2_czech_d, 0, lambda2, 1);
m2_czech = transposeDiagonalTimes(v2t, e2_czech_d, v2t);
}
}
return Math.max(lambda1, lambda2);
} }
|
public class class_name {
public int correlationDistance(PCAFilteredResult pca1, PCAFilteredResult pca2, int dimensionality) {
// TODO: Can we delay copying the matrixes?
// pca of rv1
double[][] v1t = copy(pca1.getEigenvectors());
double[][] v1t_strong = pca1.getStrongEigenvectors();
int lambda1 = pca1.getCorrelationDimension();
// pca of rv2
double[][] v2t = copy(pca2.getEigenvectors());
double[][] v2t_strong = pca2.getStrongEigenvectors();
int lambda2 = pca2.getCorrelationDimension();
// for all strong eigenvectors of rv2
double[][] m1_czech = pca1.dissimilarityMatrix();
for(int i = 0; i < v2t_strong.length; i++) {
double[] v2_i = v2t_strong[i];
// check, if distance of v2_i to the space of rv1 > delta
// (i.e., if v2_i spans up a new dimension)
double distsq = squareSum(v2_i) - transposeTimesTimes(v2_i, m1_czech, v2_i);
// if so, insert v2_i into v1 and adjust v1
// and compute m1_czech new, increase lambda1
if(lambda1 < dimensionality && distsq > deltasq) {
adjust(v1t, v2_i, lambda1++); // depends on control dependency: [if], data = [none]
// TODO: make this incremental?
double[] e1_czech_d = new double[v1t.length];
Arrays.fill(e1_czech_d, 0, lambda1, 1); // depends on control dependency: [if], data = [none]
m1_czech = transposeDiagonalTimes(v1t, e1_czech_d, v1t); // depends on control dependency: [if], data = [none]
}
}
// for all strong eigenvectors of rv1
double[][] m2_czech = pca2.dissimilarityMatrix();
for(int i = 0; i < v1t_strong.length; i++) {
double[] v1_i = v1t_strong[i];
// check, if distance of v1_i to the space of rv2 > delta
// (i.e., if v1_i spans up a new dimension)
double distsq = squareSum(v1_i) - transposeTimesTimes(v1_i, m2_czech, v1_i);
// if so, insert v1_i into v2 and adjust v2
// and compute m2_czech new , increase lambda2
if(lambda2 < dimensionality && distsq > deltasq) {
adjust(v2t, v1_i, lambda2++); // depends on control dependency: [if], data = [none]
// TODO: make this incremental?
double[] e2_czech_d = new double[v1t.length];
Arrays.fill(e2_czech_d, 0, lambda2, 1); // depends on control dependency: [if], data = [none]
m2_czech = transposeDiagonalTimes(v2t, e2_czech_d, v2t); // depends on control dependency: [if], data = [none]
}
}
return Math.max(lambda1, lambda2);
} }
|
public class class_name {
public CachedFieldValue getCachedFieldValueFrom(
Long formDefIdParam,
Long formContIdParam,
Long formFieldIdParam)
{
if((formDefIdParam == null || formContIdParam == null) ||
formFieldIdParam == null)
{
return null;
}
String storageKey = this.getStorageKeyFrom(
formDefIdParam,
formContIdParam,
formFieldIdParam);
Object objWithKey;
try {
objWithKey = this.memcachedClient.get(storageKey);
}
//Changed for Java 1.6 compatibility...
catch (MemcachedException e) {
throw new FluidCacheException("Unable to get Field value for '"+storageKey+"'." +
"Contact administrator. "+e.getMessage(),e);
} catch (TimeoutException e) {
throw new FluidCacheException("Unable to get Field value for '"+storageKey+"'." +
"Contact administrator. "+e.getMessage(),e);
} catch (InterruptedException e) {
throw new FluidCacheException("Unable to get Field value for '"+storageKey+"'." +
"Contact administrator. "+e.getMessage(),e);
}
return this.getCacheFieldValueFromObject(objWithKey);
} }
|
public class class_name {
public CachedFieldValue getCachedFieldValueFrom(
Long formDefIdParam,
Long formContIdParam,
Long formFieldIdParam)
{
if((formDefIdParam == null || formContIdParam == null) ||
formFieldIdParam == null)
{
return null; // depends on control dependency: [if], data = [null]
}
String storageKey = this.getStorageKeyFrom(
formDefIdParam,
formContIdParam,
formFieldIdParam);
Object objWithKey;
try {
objWithKey = this.memcachedClient.get(storageKey); // depends on control dependency: [try], data = [none]
}
//Changed for Java 1.6 compatibility...
catch (MemcachedException e) {
throw new FluidCacheException("Unable to get Field value for '"+storageKey+"'." +
"Contact administrator. "+e.getMessage(),e);
} catch (TimeoutException e) { // depends on control dependency: [catch], data = [none]
throw new FluidCacheException("Unable to get Field value for '"+storageKey+"'." +
"Contact administrator. "+e.getMessage(),e);
} catch (InterruptedException e) { // depends on control dependency: [catch], data = [none]
throw new FluidCacheException("Unable to get Field value for '"+storageKey+"'." +
"Contact administrator. "+e.getMessage(),e);
} // depends on control dependency: [catch], data = [none]
return this.getCacheFieldValueFromObject(objWithKey);
} }
|
public class class_name {
public Object invoke( Object[] args )
{
Object value = getValue();
if( value instanceof ISymbol )
{
return ((Symbol)value).invoke( args );
}
if( value instanceof IBlock )
{
return ((IBlock) value).invokeWithArgs( args );
}
Method method = (Method)value;
Object ret;
try
{
ret = method.invoke( null, args );
}
catch( Exception e )
{
throw GosuExceptionUtil.forceThrow( e );
}
return ret;
} }
|
public class class_name {
public Object invoke( Object[] args )
{
Object value = getValue();
if( value instanceof ISymbol )
{
return ((Symbol)value).invoke( args ); // depends on control dependency: [if], data = [none]
}
if( value instanceof IBlock )
{
return ((IBlock) value).invokeWithArgs( args ); // depends on control dependency: [if], data = [none]
}
Method method = (Method)value;
Object ret;
try
{
ret = method.invoke( null, args ); // depends on control dependency: [try], data = [none]
}
catch( Exception e )
{
throw GosuExceptionUtil.forceThrow( e );
} // depends on control dependency: [catch], data = [none]
return ret;
} }
|
public class class_name {
public static byte[] packInt(final int value) {
if ((value & 0xFFFFFF80) == 0) {
return new byte[] {(byte) value};
} else if ((value & 0xFFFF0000) == 0) {
return new byte[] {(byte) 0x80, (byte) (value >>> 8), (byte) value};
} else {
return new byte[] {(byte) 0x81, (byte) (value >>> 24), (byte) (value >>> 16), (byte) (value >>> 8), (byte) value};
}
} }
|
public class class_name {
public static byte[] packInt(final int value) {
if ((value & 0xFFFFFF80) == 0) {
return new byte[] {(byte) value}; // depends on control dependency: [if], data = [none]
} else if ((value & 0xFFFF0000) == 0) {
return new byte[] {(byte) 0x80, (byte) (value >>> 8), (byte) value}; // depends on control dependency: [if], data = [none]
} else {
return new byte[] {(byte) 0x81, (byte) (value >>> 24), (byte) (value >>> 16), (byte) (value >>> 8), (byte) value}; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static FullTypeSignature getTypeSignature(Class<?> clazz, Class<?>[] typeArgs) {
ClassTypeSignature rawClassTypeSignature = (ClassTypeSignature) javaTypeToTypeSignature
.getTypeSignature(clazz);
TypeArgSignature[] typeArgSignatures = new TypeArgSignature[typeArgs.length];
for (int i = 0; i < typeArgs.length; i++) {
typeArgSignatures[i] = new TypeArgSignature(
TypeArgSignature.NO_WILDCARD,
(FieldTypeSignature) javaTypeToTypeSignature
.getTypeSignature(typeArgs[i]));
}
ClassTypeSignature classTypeSignature = new ClassTypeSignature(
rawClassTypeSignature.getBinaryName(), typeArgSignatures,
rawClassTypeSignature.getOwnerTypeSignature());
return classTypeSignature;
} }
|
public class class_name {
public static FullTypeSignature getTypeSignature(Class<?> clazz, Class<?>[] typeArgs) {
ClassTypeSignature rawClassTypeSignature = (ClassTypeSignature) javaTypeToTypeSignature
.getTypeSignature(clazz);
TypeArgSignature[] typeArgSignatures = new TypeArgSignature[typeArgs.length];
for (int i = 0; i < typeArgs.length; i++) {
typeArgSignatures[i] = new TypeArgSignature(
TypeArgSignature.NO_WILDCARD,
(FieldTypeSignature) javaTypeToTypeSignature
.getTypeSignature(typeArgs[i])); // depends on control dependency: [for], data = [i]
}
ClassTypeSignature classTypeSignature = new ClassTypeSignature(
rawClassTypeSignature.getBinaryName(), typeArgSignatures,
rawClassTypeSignature.getOwnerTypeSignature());
return classTypeSignature;
} }
|
public class class_name {
public static boolean isAllBlank(final CharSequence... css) {
if (ArrayUtils.isEmpty(css)) {
return true;
}
for (final CharSequence cs : css) {
if (isNotBlank(cs)) {
return false;
}
}
return true;
} }
|
public class class_name {
public static boolean isAllBlank(final CharSequence... css) {
if (ArrayUtils.isEmpty(css)) {
return true; // depends on control dependency: [if], data = [none]
}
for (final CharSequence cs : css) {
if (isNotBlank(cs)) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} }
|
public class class_name {
public void setDate(String date) {
if (date == null || date.trim().isEmpty()) {
throw new IllegalArgumentException("Date cannot be null or empty.");
}
try {
Date dateToSet = new SimpleDateFormat("MM/dd/yyyy").parse(date);
Calendar to = Calendar.getInstance();
to.setTime(dateToSet);
setDate(to);
} catch (ParseException e) {
throw new IllegalArgumentException(e);
}
} }
|
public class class_name {
public void setDate(String date) {
if (date == null || date.trim().isEmpty()) {
throw new IllegalArgumentException("Date cannot be null or empty.");
}
try {
Date dateToSet = new SimpleDateFormat("MM/dd/yyyy").parse(date);
Calendar to = Calendar.getInstance();
to.setTime(dateToSet); // depends on control dependency: [try], data = [none]
setDate(to); // depends on control dependency: [try], data = [none]
} catch (ParseException e) {
throw new IllegalArgumentException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void abort(int slot) {
try {
HttpGet httpGet = httpGets.get(slot);
httpGet.abort();
abortListeners(httpGet.getURI().toString());
} catch(Exception e) {
log.error(e.getMessage());
}
} }
|
public class class_name {
public void abort(int slot) {
try {
HttpGet httpGet = httpGets.get(slot);
httpGet.abort(); // depends on control dependency: [try], data = [none]
abortListeners(httpGet.getURI().toString()); // depends on control dependency: [try], data = [none]
} catch(Exception e) {
log.error(e.getMessage());
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private String[] getCleanInstallCommandParams() {
if (isWindows()) {
return new String[]{Constants.CMD, C_CHAR_WINDOWS, MVN_COMMAND, MVN_CLEAN, MVN_INSTALL, MVN_SKIP_TESTS};
} else {
return new String[]{MVN_COMMAND, MVN_CLEAN, MVN_INSTALL, MVN_SKIP_TESTS};
}
} }
|
public class class_name {
private String[] getCleanInstallCommandParams() {
if (isWindows()) {
return new String[]{Constants.CMD, C_CHAR_WINDOWS, MVN_COMMAND, MVN_CLEAN, MVN_INSTALL, MVN_SKIP_TESTS}; // depends on control dependency: [if], data = [none]
} else {
return new String[]{MVN_COMMAND, MVN_CLEAN, MVN_INSTALL, MVN_SKIP_TESTS}; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void findLocalScaleSpaceMax(PyramidFloat<T> ss, int layerID) {
int index0 = spaceIndex;
int index1 = (spaceIndex + 1) % 3;
int index2 = (spaceIndex + 2) % 3;
List<Point2D_I16> candidates = maximums[index1];
ImageBorder_F32 inten0 = (ImageBorder_F32) FactoryImageBorderAlgs.value(intensities[index0], 0);
GrayF32 inten1 = intensities[index1];
ImageBorder_F32 inten2 = (ImageBorder_F32) FactoryImageBorderAlgs.value(intensities[index2], 0);
float scale0 = (float) ss.scale[layerID - 1];
float scale1 = (float) ss.scale[layerID];
float scale2 = (float) ss.scale[layerID + 1];
float sigma0 = (float) ss.getSigma(layerID - 1);
float sigma1 = (float) ss.getSigma(layerID);
float sigma2 = (float) ss.getSigma(layerID + 1);
// not sure if this is the correct way to handle the change in scale
float ss0 = (float) (Math.pow(sigma0, scalePower)/scale0);
float ss1 = (float) (Math.pow(sigma1, scalePower)/scale1);
float ss2 = (float) (Math.pow(sigma2, scalePower)/scale2);
for (Point2D_I16 c : candidates) {
float val = ss1 * inten1.get(c.x, c.y);
// find pixel location in each image's local coordinate
int x0 = (int) (c.x * scale1 / scale0);
int y0 = (int) (c.y * scale1 / scale0);
int x2 = (int) (c.x * scale1 / scale2);
int y2 = (int) (c.y * scale1 / scale2);
if (checkMax(inten0, val / ss0, x0, y0) && checkMax(inten2, val / ss2, x2, y2)) {
// put features into the scale of the upper image
foundPoints.add(new ScalePoint(c.x * scale1, c.y * scale1, sigma1));
}
}
} }
|
public class class_name {
protected void findLocalScaleSpaceMax(PyramidFloat<T> ss, int layerID) {
int index0 = spaceIndex;
int index1 = (spaceIndex + 1) % 3;
int index2 = (spaceIndex + 2) % 3;
List<Point2D_I16> candidates = maximums[index1];
ImageBorder_F32 inten0 = (ImageBorder_F32) FactoryImageBorderAlgs.value(intensities[index0], 0);
GrayF32 inten1 = intensities[index1];
ImageBorder_F32 inten2 = (ImageBorder_F32) FactoryImageBorderAlgs.value(intensities[index2], 0);
float scale0 = (float) ss.scale[layerID - 1];
float scale1 = (float) ss.scale[layerID];
float scale2 = (float) ss.scale[layerID + 1];
float sigma0 = (float) ss.getSigma(layerID - 1);
float sigma1 = (float) ss.getSigma(layerID);
float sigma2 = (float) ss.getSigma(layerID + 1);
// not sure if this is the correct way to handle the change in scale
float ss0 = (float) (Math.pow(sigma0, scalePower)/scale0);
float ss1 = (float) (Math.pow(sigma1, scalePower)/scale1);
float ss2 = (float) (Math.pow(sigma2, scalePower)/scale2);
for (Point2D_I16 c : candidates) {
float val = ss1 * inten1.get(c.x, c.y);
// find pixel location in each image's local coordinate
int x0 = (int) (c.x * scale1 / scale0);
int y0 = (int) (c.y * scale1 / scale0);
int x2 = (int) (c.x * scale1 / scale2);
int y2 = (int) (c.y * scale1 / scale2);
if (checkMax(inten0, val / ss0, x0, y0) && checkMax(inten2, val / ss2, x2, y2)) {
// put features into the scale of the upper image
foundPoints.add(new ScalePoint(c.x * scale1, c.y * scale1, sigma1)); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static double logpdf(double x, double dof) {
if(x <= 0) {
return Double.NEGATIVE_INFINITY;
}
if(dof <= 0) {
return Double.NaN;
}
final double k = dof * .5;
final double twox = x * 2.0;
return twox == Double.POSITIVE_INFINITY ? Double.NEGATIVE_INFINITY : //
(k - 1.0) * FastMath.log(twox) - twox - logGamma(k) + MathUtil.LOG2;
} }
|
public class class_name {
public static double logpdf(double x, double dof) {
if(x <= 0) {
return Double.NEGATIVE_INFINITY; // depends on control dependency: [if], data = [none]
}
if(dof <= 0) {
return Double.NaN; // depends on control dependency: [if], data = [none]
}
final double k = dof * .5;
final double twox = x * 2.0;
return twox == Double.POSITIVE_INFINITY ? Double.NEGATIVE_INFINITY : //
(k - 1.0) * FastMath.log(twox) - twox - logGamma(k) + MathUtil.LOG2;
} }
|
public class class_name {
private String parseToken(final char[] terminators) {
char ch;
i1 = pos;
i2 = pos;
while (hasChar()) {
ch = chars[pos];
if (isOneOf(ch, terminators)) {
break;
}
i2++;
pos++;
}
return getToken(false);
} }
|
public class class_name {
private String parseToken(final char[] terminators) {
char ch;
i1 = pos;
i2 = pos;
while (hasChar()) {
ch = chars[pos]; // depends on control dependency: [while], data = [none]
if (isOneOf(ch, terminators)) {
break;
}
i2++; // depends on control dependency: [while], data = [none]
pos++; // depends on control dependency: [while], data = [none]
}
return getToken(false);
} }
|
public class class_name {
public <T> List<T> get(final URI property, final Class<T> valueClass,
final List<T> defaultValue) {
try {
final List<T> values = get(property, valueClass);
return values.isEmpty() ? defaultValue : values;
} catch (final IllegalArgumentException ex) {
return defaultValue;
}
} }
|
public class class_name {
public <T> List<T> get(final URI property, final Class<T> valueClass,
final List<T> defaultValue) {
try {
final List<T> values = get(property, valueClass);
return values.isEmpty() ? defaultValue : values; // depends on control dependency: [try], data = [none]
} catch (final IllegalArgumentException ex) {
return defaultValue;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
boolean wasProxyRequestSent()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "wasProxyRequestSent");
SibTr.exit(tc, "wasProxyRequestSent", new Boolean(iRequestSent));
}
return iRequestSent;
} }
|
public class class_name {
boolean wasProxyRequestSent()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "wasProxyRequestSent"); // depends on control dependency: [if], data = [none]
SibTr.exit(tc, "wasProxyRequestSent", new Boolean(iRequestSent)); // depends on control dependency: [if], data = [none]
}
return iRequestSent;
} }
|
public class class_name {
private static Version getDockerVersion(String serverUrl) {
try {
DockerClient client = DockerClientBuilder.getInstance(serverUrl).build();
return client.versionCmd().exec();
} catch (Exception e) {
return null;
}
} }
|
public class class_name {
private static Version getDockerVersion(String serverUrl) {
try {
DockerClient client = DockerClientBuilder.getInstance(serverUrl).build();
return client.versionCmd().exec(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return null;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public ItemData get(final String identifier)
{
if (enabled && identifier != null)
{
try
{
return getItem(identifier);
}
catch (Exception e)
{
LOG.error("GET operation fails. Item ID=" + identifier + ". Error " + e + ". NULL returned.", e);
}
}
return null;
} }
|
public class class_name {
public ItemData get(final String identifier)
{
if (enabled && identifier != null)
{
try
{
return getItem(identifier); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
LOG.error("GET operation fails. Item ID=" + identifier + ". Error " + e + ". NULL returned.", e);
} // depends on control dependency: [catch], data = [none]
}
return null;
} }
|
public class class_name {
public Date getEndDate(Date startDate, long period) {
long now = getNow().getTime();
long endDate = startDate.getTime() + period;
if (now - period > endDate) {
return new Date(endDate);
} else {
return null;
}
} }
|
public class class_name {
public Date getEndDate(Date startDate, long period) {
long now = getNow().getTime();
long endDate = startDate.getTime() + period;
if (now - period > endDate) {
return new Date(endDate); // depends on control dependency: [if], data = [endDate)]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Tuple set(int idx, Object val) {
while (idx >= fields.size()) {
fields.add(null);
}
fields.set(idx, val);
return this;
} }
|
public class class_name {
public Tuple set(int idx, Object val) {
while (idx >= fields.size()) {
fields.add(null); // depends on control dependency: [while], data = [none]
}
fields.set(idx, val);
return this;
} }
|
public class class_name {
@Override
public boolean useDaylightTime() {
// If DST was observed in 1942 (for example) but has never been
// observed from 1943 to the present, most clients will expect
// this method to return FALSE. This method determines whether
// DST is in use in the current year (at any point in the year)
// and returns TRUE if so.
long current = System.currentTimeMillis();
if (finalZone != null && current >= finalStartMillis) {
return (finalZone != null && finalZone.useDaylightTime());
}
int[] fields = Grego.timeToFields(current, null);
// Find start of this year, and start of next year
long start = Grego.fieldsToDay(fields[0], 0, 1) * SECONDS_PER_DAY;
long limit = Grego.fieldsToDay(fields[0] + 1, 0, 1) * SECONDS_PER_DAY;
// Return TRUE if DST is observed at any time during the current
// year.
for (int i = 0; i < transitionCount; ++i) {
if (transitionTimes64[i] >= limit) {
break;
}
if ((transitionTimes64[i] >= start && dstOffsetAt(i) != 0)
|| (transitionTimes64[i] > start && i > 0 && dstOffsetAt(i - 1) != 0)) {
return true;
}
}
return false;
} }
|
public class class_name {
@Override
public boolean useDaylightTime() {
// If DST was observed in 1942 (for example) but has never been
// observed from 1943 to the present, most clients will expect
// this method to return FALSE. This method determines whether
// DST is in use in the current year (at any point in the year)
// and returns TRUE if so.
long current = System.currentTimeMillis();
if (finalZone != null && current >= finalStartMillis) {
return (finalZone != null && finalZone.useDaylightTime()); // depends on control dependency: [if], data = [(finalZone]
}
int[] fields = Grego.timeToFields(current, null);
// Find start of this year, and start of next year
long start = Grego.fieldsToDay(fields[0], 0, 1) * SECONDS_PER_DAY;
long limit = Grego.fieldsToDay(fields[0] + 1, 0, 1) * SECONDS_PER_DAY;
// Return TRUE if DST is observed at any time during the current
// year.
for (int i = 0; i < transitionCount; ++i) {
if (transitionTimes64[i] >= limit) {
break;
}
if ((transitionTimes64[i] >= start && dstOffsetAt(i) != 0)
|| (transitionTimes64[i] > start && i > 0 && dstOffsetAt(i - 1) != 0)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
private JsonNode invokeCallbackSet(final SetRequest req) {
final Object obj = this.getObject(req.getObjref());
String setterMethodName = javaScriptPropertyToJavaPropertyName("set", req.getProperty());
Method setter = null;
for (Method method: obj.getClass().getMethods()) {
if (method.getName().equals(setterMethodName)) {
setter = method;
break;
}
}
if (setter == null) {
throw new JsiiException("Unable to find property setter " + setterMethodName);
}
final Object arg = JsiiObjectMapper.treeToValue(req.getValue(), setter.getParameterTypes()[0]);
return JsiiObjectMapper.valueToTree(invokeMethod(obj, setter, arg));
} }
|
public class class_name {
private JsonNode invokeCallbackSet(final SetRequest req) {
final Object obj = this.getObject(req.getObjref());
String setterMethodName = javaScriptPropertyToJavaPropertyName("set", req.getProperty());
Method setter = null;
for (Method method: obj.getClass().getMethods()) {
if (method.getName().equals(setterMethodName)) {
setter = method; // depends on control dependency: [if], data = [none]
break;
}
}
if (setter == null) {
throw new JsiiException("Unable to find property setter " + setterMethodName);
}
final Object arg = JsiiObjectMapper.treeToValue(req.getValue(), setter.getParameterTypes()[0]);
return JsiiObjectMapper.valueToTree(invokeMethod(obj, setter, arg));
} }
|
public class class_name {
public EClass getIfcFooting() {
if (ifcFootingEClass == null) {
ifcFootingEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(257);
}
return ifcFootingEClass;
} }
|
public class class_name {
public EClass getIfcFooting() {
if (ifcFootingEClass == null) {
ifcFootingEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(257);
// depends on control dependency: [if], data = [none]
}
return ifcFootingEClass;
} }
|
public class class_name {
private boolean contains(ArrayList defs, DefBase obj)
{
for (Iterator it = defs.iterator(); it.hasNext();)
{
if (obj.getName().equals(((DefBase)it.next()).getName()))
{
return true;
}
}
return false;
} }
|
public class class_name {
private boolean contains(ArrayList defs, DefBase obj)
{
for (Iterator it = defs.iterator(); it.hasNext();)
{
if (obj.getName().equals(((DefBase)it.next()).getName()))
{
return true;
// depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
@Override protected void handleEvents(final String EVENT_TYPE) {
super.handleEvents(EVENT_TYPE);
if ("VISIBILITY".equals(EVENT_TYPE)) {
Helper.enableNode(titleText, !tile.getTitle().isEmpty());
Helper.enableNode(valueText, tile.isValueVisible());
Helper.enableNode(sectionPane, tile.getSectionsVisible());
Helper.enableNode(thresholdRect, tile.isThresholdVisible());
Helper.enableNode(thresholdText, tile.isThresholdVisible());
Helper.enableNode(unitText, !tile.getUnit().isEmpty());
sectionsVisible = tile.getSectionsVisible();
} else if ("SECTION".equals(EVENT_TYPE)) {
sections = tile.getSections();
sectionMap.clear();
for(Section section : sections) { sectionMap.put(section, new Arc()); }
} else if ("ALERT".equals(EVENT_TYPE)) {
Helper.enableNode(valueText, tile.isValueVisible() && !tile.isAlert());
Helper.enableNode(unitText, tile.isValueVisible() && !tile.isAlert());
Helper.enableNode(alertIcon, tile.isAlert());
alertTooltip.setText(tile.getAlertMessage());
}
} }
|
public class class_name {
@Override protected void handleEvents(final String EVENT_TYPE) {
super.handleEvents(EVENT_TYPE);
if ("VISIBILITY".equals(EVENT_TYPE)) {
Helper.enableNode(titleText, !tile.getTitle().isEmpty()); // depends on control dependency: [if], data = [none]
Helper.enableNode(valueText, tile.isValueVisible()); // depends on control dependency: [if], data = [none]
Helper.enableNode(sectionPane, tile.getSectionsVisible()); // depends on control dependency: [if], data = [none]
Helper.enableNode(thresholdRect, tile.isThresholdVisible()); // depends on control dependency: [if], data = [none]
Helper.enableNode(thresholdText, tile.isThresholdVisible()); // depends on control dependency: [if], data = [none]
Helper.enableNode(unitText, !tile.getUnit().isEmpty()); // depends on control dependency: [if], data = [none]
sectionsVisible = tile.getSectionsVisible(); // depends on control dependency: [if], data = [none]
} else if ("SECTION".equals(EVENT_TYPE)) {
sections = tile.getSections(); // depends on control dependency: [if], data = [none]
sectionMap.clear(); // depends on control dependency: [if], data = [none]
for(Section section : sections) { sectionMap.put(section, new Arc()); } // depends on control dependency: [for], data = [section]
} else if ("ALERT".equals(EVENT_TYPE)) {
Helper.enableNode(valueText, tile.isValueVisible() && !tile.isAlert()); // depends on control dependency: [if], data = [none]
Helper.enableNode(unitText, tile.isValueVisible() && !tile.isAlert()); // depends on control dependency: [if], data = [none]
Helper.enableNode(alertIcon, tile.isAlert()); // depends on control dependency: [if], data = [none]
alertTooltip.setText(tile.getAlertMessage()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void drawBitmap(int x, int y, byte[][] bitmap, boolean opaque) {
int h = bitmap.length;
if (h == 0) {
return;
}
int w = bitmap[0].length;
if (w == 0) {
return;
}
for (int i = 0; i < h; i++) {
if (y + i >= 0 && y + i < height) {
for (int j = 0; j < w; j++) {
if (x + j * 8 >= 0 && x + j * 8 < width) {
byte b = bitmap[i][j];
for (int shift = 7; shift >= 0; shift--) {
int mask = 1 << shift;
if ((b & mask) != 0) {
setPixel(x + j * 8 + (7 - shift), y + i, color);
} else if (opaque) {
setPixel(x + j * 8 + (7 - shift), y + i, bgcolor);
}
}
}
}
}
}
} }
|
public class class_name {
public void drawBitmap(int x, int y, byte[][] bitmap, boolean opaque) {
int h = bitmap.length;
if (h == 0) {
return; // depends on control dependency: [if], data = [none]
}
int w = bitmap[0].length;
if (w == 0) {
return; // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < h; i++) {
if (y + i >= 0 && y + i < height) {
for (int j = 0; j < w; j++) {
if (x + j * 8 >= 0 && x + j * 8 < width) {
byte b = bitmap[i][j];
for (int shift = 7; shift >= 0; shift--) {
int mask = 1 << shift;
if ((b & mask) != 0) {
setPixel(x + j * 8 + (7 - shift), y + i, color); // depends on control dependency: [if], data = [none]
} else if (opaque) {
setPixel(x + j * 8 + (7 - shift), y + i, bgcolor); // depends on control dependency: [if], data = [none]
}
}
}
}
}
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static <T> T getValue(Field field, Object self) {
try {
return (T) field.get(self);
} catch (IllegalAccessException e) {
throw ShedException.wrap(e, ShedErrorCode.UNABLE_TO_GET_FIELD)
.put("field", field.toGenericString());
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static <T> T getValue(Field field, Object self) {
try {
return (T) field.get(self); // depends on control dependency: [try], data = [none]
} catch (IllegalAccessException e) {
throw ShedException.wrap(e, ShedErrorCode.UNABLE_TO_GET_FIELD)
.put("field", field.toGenericString());
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Nullable
public static URL getClassPathURL (@Nonnull @Nonempty final String sPath)
{
ValueEnforcer.notEmpty (sPath, "Path");
// Use the default class loader. Returns null if not found
URL ret = ClassLoaderHelper.getResource (ClassLoaderHelper.getDefaultClassLoader (), sPath);
if (ret == null)
{
// This is essential if we're running as a web application!!!
ret = ClassHelper.getResource (URLHelper.class, sPath);
if (ret == null)
{
// this is a fix for a user that needed to have the application
// loaded by the bootstrap class loader
ret = ClassLoaderHelper.getResource (ClassLoaderHelper.getSystemClassLoader (), sPath);
}
}
return ret;
} }
|
public class class_name {
@Nullable
public static URL getClassPathURL (@Nonnull @Nonempty final String sPath)
{
ValueEnforcer.notEmpty (sPath, "Path");
// Use the default class loader. Returns null if not found
URL ret = ClassLoaderHelper.getResource (ClassLoaderHelper.getDefaultClassLoader (), sPath);
if (ret == null)
{
// This is essential if we're running as a web application!!!
ret = ClassHelper.getResource (URLHelper.class, sPath); // depends on control dependency: [if], data = [none]
if (ret == null)
{
// this is a fix for a user that needed to have the application
// loaded by the bootstrap class loader
ret = ClassLoaderHelper.getResource (ClassLoaderHelper.getSystemClassLoader (), sPath); // depends on control dependency: [if], data = [none]
}
}
return ret;
} }
|
public class class_name {
@SafeVarargs
public final <T extends Client> void write(T... clients) {
if (clients.length == 0) {
throw new IllegalArgumentException("You must send this packet to at least one client!");
}
for (var client : clients) {
write(client);
}
} }
|
public class class_name {
@SafeVarargs
public final <T extends Client> void write(T... clients) {
if (clients.length == 0) {
throw new IllegalArgumentException("You must send this packet to at least one client!");
}
for (var client : clients) {
write(client); // depends on control dependency: [for], data = [client]
}
} }
|
public class class_name {
@Override
public boolean cancel(boolean ignored) {
boolean cancelled = false;
if (latch.getCount() == 1) {
latch.countDown();
output = null;
cancelled = true;
}
return cancelled;
} }
|
public class class_name {
@Override
public boolean cancel(boolean ignored) {
boolean cancelled = false;
if (latch.getCount() == 1) {
latch.countDown(); // depends on control dependency: [if], data = [none]
output = null; // depends on control dependency: [if], data = [none]
cancelled = true; // depends on control dependency: [if], data = [none]
}
return cancelled;
} }
|
public class class_name {
public static MultiPolygon removeCoordinates(MultiPolygon g) {
ArrayList<Polygon> polys = new ArrayList<Polygon>();
for (int i = 0; i < g.getNumGeometries(); i++) {
Polygon poly = (Polygon) g.getGeometryN(i);
polys.add(removeCoordinates(poly));
}
return FACTORY.createMultiPolygon(GeometryFactory.toPolygonArray(polys));
} }
|
public class class_name {
public static MultiPolygon removeCoordinates(MultiPolygon g) {
ArrayList<Polygon> polys = new ArrayList<Polygon>();
for (int i = 0; i < g.getNumGeometries(); i++) {
Polygon poly = (Polygon) g.getGeometryN(i);
polys.add(removeCoordinates(poly)); // depends on control dependency: [for], data = [none]
}
return FACTORY.createMultiPolygon(GeometryFactory.toPolygonArray(polys));
} }
|
public class class_name {
@Override
public void monitorFaxJobImpl(FaxClientSpi faxClientSpi,FaxJob faxJob)
{
//get fax job status
FaxJobStatus faxJobStatus=faxClientSpi.getFaxJobStatus(faxJob);
if(faxJobStatus==null)
{
throw new FaxException("Unable to extract fax job status for fax job: "+faxJob.getID());
}
synchronized(this.LOCK)
{
Map<FaxJob,FaxJobStatus> faxJobMap=this.data.get(faxClientSpi);
if(faxJobMap==null)
{
faxJobMap=new HashMap<FaxJob,FaxJobStatus>(500);
this.data.put(faxClientSpi,faxJobMap);
}
//add new fax job
faxJobMap.put(faxJob,faxJobStatus);
if(!this.pollerTask.isRunning())
{
this.pollerTask.startTask();
}
}
} }
|
public class class_name {
@Override
public void monitorFaxJobImpl(FaxClientSpi faxClientSpi,FaxJob faxJob)
{
//get fax job status
FaxJobStatus faxJobStatus=faxClientSpi.getFaxJobStatus(faxJob);
if(faxJobStatus==null)
{
throw new FaxException("Unable to extract fax job status for fax job: "+faxJob.getID());
}
synchronized(this.LOCK)
{
Map<FaxJob,FaxJobStatus> faxJobMap=this.data.get(faxClientSpi);
if(faxJobMap==null)
{
faxJobMap=new HashMap<FaxJob,FaxJobStatus>(500); // depends on control dependency: [if], data = [none]
this.data.put(faxClientSpi,faxJobMap); // depends on control dependency: [if], data = [none]
}
//add new fax job
faxJobMap.put(faxJob,faxJobStatus);
if(!this.pollerTask.isRunning())
{
this.pollerTask.startTask(); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void addValueList(String key, String value) {
Objects.requireNonNull(key, Required.KEY.toString());
if (!valueMap.containsKey(key)) {
List<String> values = new ArrayList<>();
values.add(value);
valueMap.put(key, values);
} else {
List<String> values = valueMap.get(key);
values.add(value);
valueMap.put(key, values);
}
} }
|
public class class_name {
public void addValueList(String key, String value) {
Objects.requireNonNull(key, Required.KEY.toString());
if (!valueMap.containsKey(key)) {
List<String> values = new ArrayList<>();
values.add(value); // depends on control dependency: [if], data = [none]
valueMap.put(key, values); // depends on control dependency: [if], data = [none]
} else {
List<String> values = valueMap.get(key);
values.add(value); // depends on control dependency: [if], data = [none]
valueMap.put(key, values); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public boolean executeBatchClient(boolean mustExecuteOnMaster, Results results,
final ClientPrepareResult prepareResult,
final List<ParameterHolder[]> parametersList, boolean hasLongData)
throws SQLException {
//***********************************************************************************************************
// Multiple solution for batching :
// - rewrite as multi-values (only if generated keys are not needed and query can be rewritten)
// - multiple INSERT separate by semi-columns
// - use pipeline
// - use bulk
// - one after the other
//***********************************************************************************************************
if (options.rewriteBatchedStatements) {
if (prepareResult.isQueryMultiValuesRewritable()
&& results.getAutoGeneratedKeys() == Statement.NO_GENERATED_KEYS) {
//values rewritten in one query :
// INSERT INTO X(a,b) VALUES (1,2), (3,4), ...
executeBatchRewrite(results, prepareResult, parametersList, true);
return true;
} else if (prepareResult.isQueryMultipleRewritable()) {
if (options.useBulkStmts
&& !hasLongData
&& prepareResult.isQueryMultipleRewritable() //INSERT FROM SELECT not allowed
&& results.getAutoGeneratedKeys() == Statement.NO_GENERATED_KEYS
&& versionGreaterOrEqual(10, 2, 7)
&& executeBulkBatch(results, prepareResult.getSql(), null, parametersList)) {
return true;
}
//multi rewritten in one query :
// INSERT INTO X(a,b) VALUES (1,2);INSERT INTO X(a,b) VALUES (3,4); ...
executeBatchRewrite(results, prepareResult, parametersList, false);
return true;
}
}
if (options.useBulkStmts
&& !hasLongData
&& results.getAutoGeneratedKeys() == Statement.NO_GENERATED_KEYS
&& versionGreaterOrEqual(10, 2, 7)
&& executeBulkBatch(results, prepareResult.getSql(), null, parametersList)) {
return true;
}
if (options.useBatchMultiSend) {
//send by bulk : send data by bulk before reading corresponding results
executeBatchMulti(results, prepareResult, parametersList);
return true;
}
return false;
} }
|
public class class_name {
public boolean executeBatchClient(boolean mustExecuteOnMaster, Results results,
final ClientPrepareResult prepareResult,
final List<ParameterHolder[]> parametersList, boolean hasLongData)
throws SQLException {
//***********************************************************************************************************
// Multiple solution for batching :
// - rewrite as multi-values (only if generated keys are not needed and query can be rewritten)
// - multiple INSERT separate by semi-columns
// - use pipeline
// - use bulk
// - one after the other
//***********************************************************************************************************
if (options.rewriteBatchedStatements) {
if (prepareResult.isQueryMultiValuesRewritable()
&& results.getAutoGeneratedKeys() == Statement.NO_GENERATED_KEYS) {
//values rewritten in one query :
// INSERT INTO X(a,b) VALUES (1,2), (3,4), ...
executeBatchRewrite(results, prepareResult, parametersList, true); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else if (prepareResult.isQueryMultipleRewritable()) {
if (options.useBulkStmts
&& !hasLongData
&& prepareResult.isQueryMultipleRewritable() //INSERT FROM SELECT not allowed
&& results.getAutoGeneratedKeys() == Statement.NO_GENERATED_KEYS
&& versionGreaterOrEqual(10, 2, 7)
&& executeBulkBatch(results, prepareResult.getSql(), null, parametersList)) {
return true; // depends on control dependency: [if], data = [none]
}
//multi rewritten in one query :
// INSERT INTO X(a,b) VALUES (1,2);INSERT INTO X(a,b) VALUES (3,4); ...
executeBatchRewrite(results, prepareResult, parametersList, false); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
if (options.useBulkStmts
&& !hasLongData
&& results.getAutoGeneratedKeys() == Statement.NO_GENERATED_KEYS
&& versionGreaterOrEqual(10, 2, 7)
&& executeBulkBatch(results, prepareResult.getSql(), null, parametersList)) {
return true;
}
if (options.useBatchMultiSend) {
//send by bulk : send data by bulk before reading corresponding results
executeBatchMulti(results, prepareResult, parametersList);
return true;
}
return false;
} }
|
public class class_name {
@Override
public Prediction _predictRecord(Record r) {
ModelParameters modelParameters = knowledgeBase.getModelParameters();
Set<Object> classesSet = modelParameters.getClasses();
Map<List<Object>, Double> thitas = modelParameters.getThitas();
AssociativeArray predictionScores = new AssociativeArray();
for(Object theClass : classesSet) {
predictionScores.put(theClass, calculateClassScore(r.getX(), theClass, thitas));
}
Object predictedClass=getSelectedClassFromClassScores(predictionScores);
Descriptives.normalizeExp(predictionScores);
return new Prediction(predictedClass, predictionScores);
} }
|
public class class_name {
@Override
public Prediction _predictRecord(Record r) {
ModelParameters modelParameters = knowledgeBase.getModelParameters();
Set<Object> classesSet = modelParameters.getClasses();
Map<List<Object>, Double> thitas = modelParameters.getThitas();
AssociativeArray predictionScores = new AssociativeArray();
for(Object theClass : classesSet) {
predictionScores.put(theClass, calculateClassScore(r.getX(), theClass, thitas)); // depends on control dependency: [for], data = [theClass]
}
Object predictedClass=getSelectedClassFromClassScores(predictionScores);
Descriptives.normalizeExp(predictionScores);
return new Prediction(predictedClass, predictionScores);
} }
|
public class class_name {
private QYBaseRespMsg processMessageHandle(QYBaseReqMsg msg){
if(CollectionUtil.isEmpty(messageHandles)){
synchronized (LOCK){
messageHandles = this.initMessageHandles();
}
}
if(CollectionUtil.isNotEmpty(messageHandles)){
for(QYMessageHandle messageHandle : messageHandles){
QYBaseRespMsg resultMsg = null;
boolean result;
try{
result = messageHandle.beforeHandle(msg);
}catch (Exception e){
result = false;
}
if(result){
resultMsg = messageHandle.handle(msg);
}
if(BeanUtil.nonNull(resultMsg)){
return resultMsg;
}
}
}
return null;
} }
|
public class class_name {
private QYBaseRespMsg processMessageHandle(QYBaseReqMsg msg){
if(CollectionUtil.isEmpty(messageHandles)){
synchronized (LOCK){ // depends on control dependency: [if], data = [none]
messageHandles = this.initMessageHandles();
}
}
if(CollectionUtil.isNotEmpty(messageHandles)){
for(QYMessageHandle messageHandle : messageHandles){
QYBaseRespMsg resultMsg = null;
boolean result;
try{
result = messageHandle.beforeHandle(msg); // depends on control dependency: [try], data = [none]
}catch (Exception e){
result = false;
} // depends on control dependency: [catch], data = [none]
if(result){
resultMsg = messageHandle.handle(msg); // depends on control dependency: [if], data = [none]
}
if(BeanUtil.nonNull(resultMsg)){
return resultMsg; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} }
|
public class class_name {
public static final long getLong(byte[] data, int offset)
{
if (data.length != 8)
{
throw new UnexpectedStructureException();
}
long result = 0;
int i = offset;
for (int shiftBy = 0; shiftBy < 64; shiftBy += 8)
{
result |= ((long) (data[i] & 0xff)) << shiftBy;
++i;
}
return result;
} }
|
public class class_name {
public static final long getLong(byte[] data, int offset)
{
if (data.length != 8)
{
throw new UnexpectedStructureException();
}
long result = 0;
int i = offset;
for (int shiftBy = 0; shiftBy < 64; shiftBy += 8)
{
result |= ((long) (data[i] & 0xff)) << shiftBy; // depends on control dependency: [for], data = [shiftBy]
++i; // depends on control dependency: [for], data = [none]
}
return result;
} }
|
public class class_name {
@Override
public void onExecute(StreamMessage input)
{
// データ保存前実行処理を実行
onStoreBefore(input);
K storeKey = null;
try
{
storeKey = this.mapper.convertToKey(input);
}
catch (ConvertFailException ex)
{
String messageFormat = "Tuple convert to key failed. Trash tuple. : InputTuple={0}";
String errorMessage = MessageFormat.format(messageFormat, input.toString());
logger.warn(errorMessage, ex);
return;
}
V storeValue = null;
try
{
storeValue = this.mapper.convertToValue(input);
}
catch (ConvertFailException ex)
{
String messageFormat = "Tuple convert to value failed. Trash tuple. : InputTuple={0}";
String errorMessage = MessageFormat.format(messageFormat, input.toString());
logger.warn(errorMessage, ex);
return;
}
try
{
this.cacheHelper.getCache().put(storeKey, storeValue);
}
catch (Exception ex)
{
String messageFormat = "Cache store failed. Trash tuple. : InputTuple={0}";
String errorMessage = MessageFormat.format(messageFormat, input.toString());
logger.warn(errorMessage, ex);
return;
}
// データ保存後実行処理を実行
onStoreAfter(input, storeKey, storeValue);
} }
|
public class class_name {
@Override
public void onExecute(StreamMessage input)
{
// データ保存前実行処理を実行
onStoreBefore(input);
K storeKey = null;
try
{
storeKey = this.mapper.convertToKey(input); // depends on control dependency: [try], data = [none]
}
catch (ConvertFailException ex)
{
String messageFormat = "Tuple convert to key failed. Trash tuple. : InputTuple={0}";
String errorMessage = MessageFormat.format(messageFormat, input.toString());
logger.warn(errorMessage, ex);
return;
} // depends on control dependency: [catch], data = [none]
V storeValue = null;
try
{
storeValue = this.mapper.convertToValue(input); // depends on control dependency: [try], data = [none]
}
catch (ConvertFailException ex)
{
String messageFormat = "Tuple convert to value failed. Trash tuple. : InputTuple={0}";
String errorMessage = MessageFormat.format(messageFormat, input.toString());
logger.warn(errorMessage, ex);
return;
} // depends on control dependency: [catch], data = [none]
try
{
this.cacheHelper.getCache().put(storeKey, storeValue); // depends on control dependency: [try], data = [none]
}
catch (Exception ex)
{
String messageFormat = "Cache store failed. Trash tuple. : InputTuple={0}";
String errorMessage = MessageFormat.format(messageFormat, input.toString());
logger.warn(errorMessage, ex);
return;
} // depends on control dependency: [catch], data = [none]
// データ保存後実行処理を実行
onStoreAfter(input, storeKey, storeValue);
} }
|
public class class_name {
private static boolean isPubliclyCallable(Member member) {
if (!Modifier.isPublic(member.getModifiers())) {
return false;
}
Class<?>[] parameterTypes;
if (member instanceof Constructor) {
parameterTypes = ((Constructor) member).getParameterTypes();
} else {
Method method = (Method) member;
if (!Modifier.isPublic(method.getReturnType().getModifiers())) {
return false;
}
parameterTypes = method.getParameterTypes();
}
for (Class<?> type : parameterTypes) {
if (!Modifier.isPublic(type.getModifiers())) {
return false;
}
}
return true;
} }
|
public class class_name {
private static boolean isPubliclyCallable(Member member) {
if (!Modifier.isPublic(member.getModifiers())) {
return false; // depends on control dependency: [if], data = [none]
}
Class<?>[] parameterTypes;
if (member instanceof Constructor) {
parameterTypes = ((Constructor) member).getParameterTypes(); // depends on control dependency: [if], data = [none]
} else {
Method method = (Method) member;
if (!Modifier.isPublic(method.getReturnType().getModifiers())) {
return false; // depends on control dependency: [if], data = [none]
}
parameterTypes = method.getParameterTypes(); // depends on control dependency: [if], data = [none]
}
for (Class<?> type : parameterTypes) {
if (!Modifier.isPublic(type.getModifiers())) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} }
|
public class class_name {
public LibraryService getLibraryService() {
if (_libraryService == null) {
synchronized (CCApi2.class) {
if (_libraryService == null) {
_libraryService = _retrofit.create(LibraryService.class);
}
}
}
return _libraryService;
} }
|
public class class_name {
public LibraryService getLibraryService() {
if (_libraryService == null) {
synchronized (CCApi2.class) { // depends on control dependency: [if], data = [none]
if (_libraryService == null) {
_libraryService = _retrofit.create(LibraryService.class); // depends on control dependency: [if], data = [none]
}
}
}
return _libraryService;
} }
|
public class class_name {
private void appendLiteral(int word)
{
// when we have a zero sequence of the maximum lenght (that is,
// 00.00000.1111111111111111111111111 = 0x01FFFFFF), it could happen
// that we try to append a zero literal because the result of the given operation must be an
// empty set. Whitout the following test, we would have increased the
// counter of the zero sequence, thus obtaining 0x02000000 that
// represents a sequence with the first bit set!
if (lastWordIndex == 0 && word == ConciseSetUtils.ALL_ZEROS_LITERAL && words[0] == 0x01FFFFFF) {
return;
}
// first addition
if (lastWordIndex < 0) {
words[lastWordIndex = 0] = word;
return;
}
final int lastWord = words[lastWordIndex];
if (word == ConciseSetUtils.ALL_ZEROS_LITERAL) {
if (lastWord == ConciseSetUtils.ALL_ZEROS_LITERAL) {
words[lastWordIndex] = 1;
} else if (isZeroSequence(lastWord)) {
words[lastWordIndex]++;
} else if (!simulateWAH && containsOnlyOneBit(getLiteralBits(lastWord))) {
words[lastWordIndex] = 1 | ((1 + Integer.numberOfTrailingZeros(lastWord)) << 25);
} else {
words[++lastWordIndex] = word;
}
} else if (word == ConciseSetUtils.ALL_ONES_LITERAL) {
if (lastWord == ConciseSetUtils.ALL_ONES_LITERAL) {
words[lastWordIndex] = ConciseSetUtils.SEQUENCE_BIT | 1;
} else if (isOneSequence(lastWord)) {
words[lastWordIndex]++;
} else if (!simulateWAH && containsOnlyOneBit(~lastWord)) {
words[lastWordIndex] = ConciseSetUtils.SEQUENCE_BIT | 1 | ((1 + Integer.numberOfTrailingZeros(~lastWord))
<< 25);
} else {
words[++lastWordIndex] = word;
}
} else {
words[++lastWordIndex] = word;
}
} }
|
public class class_name {
private void appendLiteral(int word)
{
// when we have a zero sequence of the maximum lenght (that is,
// 00.00000.1111111111111111111111111 = 0x01FFFFFF), it could happen
// that we try to append a zero literal because the result of the given operation must be an
// empty set. Whitout the following test, we would have increased the
// counter of the zero sequence, thus obtaining 0x02000000 that
// represents a sequence with the first bit set!
if (lastWordIndex == 0 && word == ConciseSetUtils.ALL_ZEROS_LITERAL && words[0] == 0x01FFFFFF) {
return;
// depends on control dependency: [if], data = [none]
}
// first addition
if (lastWordIndex < 0) {
words[lastWordIndex = 0] = word;
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
final int lastWord = words[lastWordIndex];
if (word == ConciseSetUtils.ALL_ZEROS_LITERAL) {
if (lastWord == ConciseSetUtils.ALL_ZEROS_LITERAL) {
words[lastWordIndex] = 1;
// depends on control dependency: [if], data = [none]
} else if (isZeroSequence(lastWord)) {
words[lastWordIndex]++;
// depends on control dependency: [if], data = [none]
} else if (!simulateWAH && containsOnlyOneBit(getLiteralBits(lastWord))) {
words[lastWordIndex] = 1 | ((1 + Integer.numberOfTrailingZeros(lastWord)) << 25);
// depends on control dependency: [if], data = [none]
} else {
words[++lastWordIndex] = word;
// depends on control dependency: [if], data = [none]
}
} else if (word == ConciseSetUtils.ALL_ONES_LITERAL) {
if (lastWord == ConciseSetUtils.ALL_ONES_LITERAL) {
words[lastWordIndex] = ConciseSetUtils.SEQUENCE_BIT | 1;
// depends on control dependency: [if], data = [none]
} else if (isOneSequence(lastWord)) {
words[lastWordIndex]++;
// depends on control dependency: [if], data = [none]
} else if (!simulateWAH && containsOnlyOneBit(~lastWord)) {
words[lastWordIndex] = ConciseSetUtils.SEQUENCE_BIT | 1 | ((1 + Integer.numberOfTrailingZeros(~lastWord))
<< 25);
// depends on control dependency: [if], data = [none]
} else {
words[++lastWordIndex] = word;
// depends on control dependency: [if], data = [none]
}
} else {
words[++lastWordIndex] = word;
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected String getErasureAnchor(ExecutableMemberDoc emd) {
StringBuilder buf = new StringBuilder(emd.name() + "(");
Parameter[] params = emd.parameters();
boolean foundTypeVariable = false;
for (int i = 0; i < params.length; i++) {
if (i > 0) {
buf.append(",");
}
Type t = params[i].type();
foundTypeVariable = foundTypeVariable || t.asTypeVariable() != null;
buf.append(t.isPrimitive() ?
t.typeName() : t.asClassDoc().qualifiedName());
buf.append(t.dimension());
}
buf.append(")");
return foundTypeVariable ? writer.getName(buf.toString()) : null;
} }
|
public class class_name {
protected String getErasureAnchor(ExecutableMemberDoc emd) {
StringBuilder buf = new StringBuilder(emd.name() + "(");
Parameter[] params = emd.parameters();
boolean foundTypeVariable = false;
for (int i = 0; i < params.length; i++) {
if (i > 0) {
buf.append(","); // depends on control dependency: [if], data = [none]
}
Type t = params[i].type();
foundTypeVariable = foundTypeVariable || t.asTypeVariable() != null; // depends on control dependency: [for], data = [none]
buf.append(t.isPrimitive() ?
t.typeName() : t.asClassDoc().qualifiedName()); // depends on control dependency: [for], data = [none]
buf.append(t.dimension()); // depends on control dependency: [for], data = [none]
}
buf.append(")");
return foundTypeVariable ? writer.getName(buf.toString()) : null;
} }
|
public class class_name {
private void createProxyJsMethod(Builder componentExposedTypeBuilder,
ExecutableElement originalMethod, String proxyMethodName) {
Emit emitAnnotation = originalMethod.getAnnotation(Emit.class);
MethodSpec.Builder proxyMethodBuilder = MethodSpec
.methodBuilder(proxyMethodName)
.addModifiers(Modifier.PUBLIC)
.addAnnotation(JsMethod.class)
.addAnnotation(getUnusableByJSAnnotation())
.returns(ClassName.get(originalMethod.getReturnType()));
originalMethod
.getParameters()
.forEach(parameter -> proxyMethodBuilder.addParameter(TypeName.get(parameter.asType()),
parameter.getSimpleName().toString()));
String methodCallParameters = getSuperMethodCallParameters(originalMethod);
boolean hasReturnValue = !"void".equals(originalMethod.getReturnType().toString());
if (hasReturnValue) {
proxyMethodBuilder.addStatement("$T result = super.$L($L)",
originalMethod.getReturnType(),
originalMethod.getSimpleName().toString(),
methodCallParameters);
} else {
proxyMethodBuilder.addStatement("super.$L($L)",
originalMethod.getSimpleName().toString(),
methodCallParameters);
}
if (emitAnnotation != null) {
addEmitEventCall(originalMethod, proxyMethodBuilder, methodCallParameters);
}
if (hasReturnValue) {
proxyMethodBuilder.addStatement("return result");
}
componentExposedTypeBuilder.addMethod(proxyMethodBuilder.build());
} }
|
public class class_name {
private void createProxyJsMethod(Builder componentExposedTypeBuilder,
ExecutableElement originalMethod, String proxyMethodName) {
Emit emitAnnotation = originalMethod.getAnnotation(Emit.class);
MethodSpec.Builder proxyMethodBuilder = MethodSpec
.methodBuilder(proxyMethodName)
.addModifiers(Modifier.PUBLIC)
.addAnnotation(JsMethod.class)
.addAnnotation(getUnusableByJSAnnotation())
.returns(ClassName.get(originalMethod.getReturnType()));
originalMethod
.getParameters()
.forEach(parameter -> proxyMethodBuilder.addParameter(TypeName.get(parameter.asType()),
parameter.getSimpleName().toString()));
String methodCallParameters = getSuperMethodCallParameters(originalMethod);
boolean hasReturnValue = !"void".equals(originalMethod.getReturnType().toString());
if (hasReturnValue) {
proxyMethodBuilder.addStatement("$T result = super.$L($L)",
originalMethod.getReturnType(),
originalMethod.getSimpleName().toString(),
methodCallParameters); // depends on control dependency: [if], data = [none]
} else {
proxyMethodBuilder.addStatement("super.$L($L)",
originalMethod.getSimpleName().toString(),
methodCallParameters); // depends on control dependency: [if], data = [none]
}
if (emitAnnotation != null) {
addEmitEventCall(originalMethod, proxyMethodBuilder, methodCallParameters); // depends on control dependency: [if], data = [none]
}
if (hasReturnValue) {
proxyMethodBuilder.addStatement("return result"); // depends on control dependency: [if], data = [none]
}
componentExposedTypeBuilder.addMethod(proxyMethodBuilder.build());
} }
|
public class class_name {
protected void onDateBoxKeyPress(KeyUpEvent event) {
switch (event.getNativeEvent().getKeyCode()) {
case KeyCodes.KEY_CTRL:
case KeyCodes.KEY_SHIFT:
case KeyCodes.KEY_ALT:
case KeyCodes.KEY_LEFT:
case KeyCodes.KEY_RIGHT:
break;
case KeyCodes.KEY_ENTER:
case KeyCodes.KEY_TAB:
case KeyCodes.KEY_ESCAPE:
case KeyCodes.KEY_UP:
updateFromTextBox(false);
hidePopup();
break;
case KeyCodes.KEY_DOWN:
showPopup();
break;
default:
hidePopup();
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
updateCloseBehavior();
if (isValideDateBox() || allowInvalidValue()) {
setErrorMessage(null);
fireChange(getValue(), true);
}
}
});
break;
}
} }
|
public class class_name {
protected void onDateBoxKeyPress(KeyUpEvent event) {
switch (event.getNativeEvent().getKeyCode()) {
case KeyCodes.KEY_CTRL:
case KeyCodes.KEY_SHIFT:
case KeyCodes.KEY_ALT:
case KeyCodes.KEY_LEFT:
case KeyCodes.KEY_RIGHT:
break;
case KeyCodes.KEY_ENTER:
case KeyCodes.KEY_TAB:
case KeyCodes.KEY_ESCAPE:
case KeyCodes.KEY_UP:
updateFromTextBox(false);
hidePopup();
break;
case KeyCodes.KEY_DOWN:
showPopup();
break;
default:
hidePopup();
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
updateCloseBehavior();
if (isValideDateBox() || allowInvalidValue()) {
setErrorMessage(null); // depends on control dependency: [if], data = [none]
fireChange(getValue(), true); // depends on control dependency: [if], data = [none]
}
}
});
break;
}
} }
|
public class class_name {
public TransactionOptions timeout(long timeout, TimeUnit timeoutUnit) {
if (timeout == -1) {
this.timeout = timeout;
return this;
}
this.timeout = timeoutUnit.toMillis(timeout);
return this;
} }
|
public class class_name {
public TransactionOptions timeout(long timeout, TimeUnit timeoutUnit) {
if (timeout == -1) {
this.timeout = timeout; // depends on control dependency: [if], data = [none]
return this; // depends on control dependency: [if], data = [none]
}
this.timeout = timeoutUnit.toMillis(timeout);
return this;
} }
|
public class class_name {
public void checkExpectedValidationViolations(
Set<ConstraintViolation<T>> violations,
List<String> expectedValidationViolations) {
if (violations != null && expectedValidationViolations != null) {
List<String> givenViolations = new ArrayList<String>();
for (ConstraintViolation<T> violation : violations) {
givenViolations.add(violation.getMessageTemplate());
}
checkViolations(givenViolations, expectedValidationViolations);
}
} }
|
public class class_name {
public void checkExpectedValidationViolations(
Set<ConstraintViolation<T>> violations,
List<String> expectedValidationViolations) {
if (violations != null && expectedValidationViolations != null) {
List<String> givenViolations = new ArrayList<String>();
for (ConstraintViolation<T> violation : violations) {
givenViolations.add(violation.getMessageTemplate()); // depends on control dependency: [for], data = [violation]
}
checkViolations(givenViolations, expectedValidationViolations); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected KeyStore getKeyStore(InputStream storeStream, String storePath, String storeType, String storeProvider, String storePassword) throws Exception {
KeyStore keystore = null;
if (storeStream != null || storePath != null) {
InputStream inStream = storeStream;
try {
if (inStream == null) {
inStream = new FileInputStream(storePath); //assume it's a file
}
if (storeProvider != null) {
keystore = KeyStore.getInstance(storeType, storeProvider);
} else {
keystore = KeyStore.getInstance(storeType);
}
keystore.load(inStream, storePassword == null ? null : storePassword.toCharArray());
} finally {
if (inStream != null) {
inStream.close();
}
}
}
return keystore;
} }
|
public class class_name {
protected KeyStore getKeyStore(InputStream storeStream, String storePath, String storeType, String storeProvider, String storePassword) throws Exception {
KeyStore keystore = null;
if (storeStream != null || storePath != null) {
InputStream inStream = storeStream;
try {
if (inStream == null) {
inStream = new FileInputStream(storePath); //assume it's a file // depends on control dependency: [if], data = [none]
}
if (storeProvider != null) {
keystore = KeyStore.getInstance(storeType, storeProvider); // depends on control dependency: [if], data = [none]
} else {
keystore = KeyStore.getInstance(storeType); // depends on control dependency: [if], data = [none]
}
keystore.load(inStream, storePassword == null ? null : storePassword.toCharArray()); // depends on control dependency: [try], data = [none]
} finally {
if (inStream != null) {
inStream.close(); // depends on control dependency: [if], data = [none]
}
}
}
return keystore;
} }
|
public class class_name {
protected boolean splitChildren( NodeKey key,
EditableDocument document,
EditableArray children,
int targetCountPerBlock,
int tolerance,
boolean isFirst,
String nextBlock ) {
assert 0 < targetCountPerBlock;
assert 0 < tolerance;
assert tolerance < targetCountPerBlock;
// Calculate the number of blocks that we'll create and the size of the last block ...
int total = children.size();
int numFullBlocks = total / targetCountPerBlock;
if (numFullBlocks == 0) {
// This block doesn't need to be split ...
return false;
}
int sizeOfLastBlock = total % targetCountPerBlock;
if (sizeOfLastBlock < (targetCountPerBlock - tolerance)) {
// The last block would be too small to be on its own ...
if (numFullBlocks == 1) {
// We would split into one full block and a second too-small block, so there's no point of splitting ...
return false;
}
// We'll split it into multiple blocks, so we'll just include the children in the last too-small block
// in the previous block ...
sizeOfLastBlock = 0;
}
// The order we do things is important here. The best thing is to create and persist blocks 2...n immediately,
// and then we can change the first document to have the smaller number of children and to point to the newly-created
// block 2 (which points to block 3, etc.). This order means that anybody reading the input document never reads an
// inconsistent set of children.
int startIndex = targetCountPerBlock;
int endIndex = 0;
final String firstNewBlockKey = key.withRandomId().toString();
String blockKey = firstNewBlockKey;
for (int n = 1; n != numFullBlocks; ++n) {
// Create the sublist of children that should be written to a new block ...
boolean isLast = n == (numFullBlocks - 1);
endIndex = isLast ? total : (startIndex + targetCountPerBlock);
EditableArray blockChildren = Schematic.newArray(children.subList(startIndex, endIndex));
// Create the new block, with a key that contains a UUID for the identifier ...
String nextBlockKey = (isLast) ? nextBlockKey = nextBlock : key.withRandomId().toString();
EditableDocument blockDoc = Schematic.newDocument();
EditableDocument childInfo = blockDoc.setDocument(CHILDREN_INFO);
childInfo.setNumber(BLOCK_SIZE, blockChildren.size());
if (nextBlockKey != null) {
childInfo.setString(NEXT_BLOCK, nextBlockKey);
}
// Write the children ...
blockDoc.setArray(CHILDREN, blockChildren);
// Now persist the new document ...
documentStore.localStore().put(blockKey, blockDoc);
// And get ready for the next block ...
if (!isLast) {
blockKey = nextBlockKey;
startIndex = endIndex;
}
}
// Now we can update the input document's children and nextBlock reference ...
EditableArray newChildren = Schematic.newArray(children.subList(0, targetCountPerBlock));
document.setArray(CHILDREN, newChildren);
EditableDocument childInfo = document.getDocument(CHILDREN_INFO);
if (childInfo == null) {
childInfo = document.setDocument(CHILDREN_INFO);
}
childInfo.setNumber(BLOCK_SIZE, newChildren.size());
childInfo.setString(NEXT_BLOCK, firstNewBlockKey);
if (isFirst && nextBlock == null) {
// We generated a new last block and we have to update the reference ...
childInfo.setString(LAST_BLOCK, blockKey);
}
// Note we never changed the number of children, so we don't need to update 'count'.
return true;
} }
|
public class class_name {
protected boolean splitChildren( NodeKey key,
EditableDocument document,
EditableArray children,
int targetCountPerBlock,
int tolerance,
boolean isFirst,
String nextBlock ) {
assert 0 < targetCountPerBlock;
assert 0 < tolerance;
assert tolerance < targetCountPerBlock;
// Calculate the number of blocks that we'll create and the size of the last block ...
int total = children.size();
int numFullBlocks = total / targetCountPerBlock;
if (numFullBlocks == 0) {
// This block doesn't need to be split ...
return false; // depends on control dependency: [if], data = [none]
}
int sizeOfLastBlock = total % targetCountPerBlock;
if (sizeOfLastBlock < (targetCountPerBlock - tolerance)) {
// The last block would be too small to be on its own ...
if (numFullBlocks == 1) {
// We would split into one full block and a second too-small block, so there's no point of splitting ...
return false; // depends on control dependency: [if], data = [none]
}
// We'll split it into multiple blocks, so we'll just include the children in the last too-small block
// in the previous block ...
sizeOfLastBlock = 0; // depends on control dependency: [if], data = [none]
}
// The order we do things is important here. The best thing is to create and persist blocks 2...n immediately,
// and then we can change the first document to have the smaller number of children and to point to the newly-created
// block 2 (which points to block 3, etc.). This order means that anybody reading the input document never reads an
// inconsistent set of children.
int startIndex = targetCountPerBlock;
int endIndex = 0;
final String firstNewBlockKey = key.withRandomId().toString();
String blockKey = firstNewBlockKey;
for (int n = 1; n != numFullBlocks; ++n) {
// Create the sublist of children that should be written to a new block ...
boolean isLast = n == (numFullBlocks - 1);
endIndex = isLast ? total : (startIndex + targetCountPerBlock); // depends on control dependency: [for], data = [none]
EditableArray blockChildren = Schematic.newArray(children.subList(startIndex, endIndex));
// Create the new block, with a key that contains a UUID for the identifier ...
String nextBlockKey = (isLast) ? nextBlockKey = nextBlock : key.withRandomId().toString();
EditableDocument blockDoc = Schematic.newDocument();
EditableDocument childInfo = blockDoc.setDocument(CHILDREN_INFO);
childInfo.setNumber(BLOCK_SIZE, blockChildren.size()); // depends on control dependency: [for], data = [none]
if (nextBlockKey != null) {
childInfo.setString(NEXT_BLOCK, nextBlockKey); // depends on control dependency: [if], data = [none]
}
// Write the children ...
blockDoc.setArray(CHILDREN, blockChildren); // depends on control dependency: [for], data = [none]
// Now persist the new document ...
documentStore.localStore().put(blockKey, blockDoc); // depends on control dependency: [for], data = [none]
// And get ready for the next block ...
if (!isLast) {
blockKey = nextBlockKey; // depends on control dependency: [if], data = [none]
startIndex = endIndex; // depends on control dependency: [if], data = [none]
}
}
// Now we can update the input document's children and nextBlock reference ...
EditableArray newChildren = Schematic.newArray(children.subList(0, targetCountPerBlock));
document.setArray(CHILDREN, newChildren);
EditableDocument childInfo = document.getDocument(CHILDREN_INFO);
if (childInfo == null) {
childInfo = document.setDocument(CHILDREN_INFO); // depends on control dependency: [if], data = [none]
}
childInfo.setNumber(BLOCK_SIZE, newChildren.size());
childInfo.setString(NEXT_BLOCK, firstNewBlockKey);
if (isFirst && nextBlock == null) {
// We generated a new last block and we have to update the reference ...
childInfo.setString(LAST_BLOCK, blockKey); // depends on control dependency: [if], data = [none]
}
// Note we never changed the number of children, so we don't need to update 'count'.
return true;
} }
|
public class class_name {
private Connection getDerbyConnection(String wkpDir) {
// See your driver documentation for the proper format of this string :
wkpDir = wkpDir.replaceAll("\\\\", "/");
System.err.println(wkpDir);
String DB_CONN_STRING = "jdbc:derby:" + wkpDir // "d:/workspace/workspace-next-work/nextreports-server/data/workspaces/default"
+ "/db;create=false";
// Provided by your driver documentation. In this case, a MySql driver
// is used :
String DRIVER_CLASS_NAME = "org.apache.derby.jdbc.EmbeddedDriver";
String USER_NAME = null;
String PASSWORD = null;
Connection result = null;
try {
Class.forName(DRIVER_CLASS_NAME).newInstance();
} catch (Exception ex) {
LOG.debug("Check classpath. Cannot load db driver: " + DRIVER_CLASS_NAME);
}
try {
result = DriverManager.getConnection(DB_CONN_STRING, USER_NAME, PASSWORD);
} catch (SQLException e) {
LOG.debug("Driver loaded, but cannot connect to db: " + DB_CONN_STRING);
}
return result;
} }
|
public class class_name {
private Connection getDerbyConnection(String wkpDir) {
// See your driver documentation for the proper format of this string :
wkpDir = wkpDir.replaceAll("\\\\", "/");
System.err.println(wkpDir);
String DB_CONN_STRING = "jdbc:derby:" + wkpDir // "d:/workspace/workspace-next-work/nextreports-server/data/workspaces/default"
+ "/db;create=false";
// Provided by your driver documentation. In this case, a MySql driver
// is used :
String DRIVER_CLASS_NAME = "org.apache.derby.jdbc.EmbeddedDriver";
String USER_NAME = null;
String PASSWORD = null;
Connection result = null;
try {
Class.forName(DRIVER_CLASS_NAME).newInstance();
} catch (Exception ex) {
LOG.debug("Check classpath. Cannot load db driver: " + DRIVER_CLASS_NAME);
} // depends on control dependency: [catch], data = [none]
try {
result = DriverManager.getConnection(DB_CONN_STRING, USER_NAME, PASSWORD); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
LOG.debug("Driver loaded, but cannot connect to db: " + DB_CONN_STRING);
} // depends on control dependency: [catch], data = [none]
return result;
} }
|
public class class_name {
public static String commonPrefix(final String a, final String b) {
if (N.isNullOrEmpty(a) || N.isNullOrEmpty(b)) {
return N.EMPTY_STRING;
}
int maxPrefixLength = Math.min(a.length(), b.length());
int p = 0;
while (p < maxPrefixLength && a.charAt(p) == b.charAt(p)) {
p++;
}
if (validSurrogatePairAt(a, p - 1) || validSurrogatePairAt(b, p - 1)) {
p--;
}
if (p == a.length()) {
return a.toString();
} else if (p == b.length()) {
return b.toString();
} else {
return a.subSequence(0, p).toString();
}
} }
|
public class class_name {
public static String commonPrefix(final String a, final String b) {
if (N.isNullOrEmpty(a) || N.isNullOrEmpty(b)) {
return N.EMPTY_STRING;
// depends on control dependency: [if], data = [none]
}
int maxPrefixLength = Math.min(a.length(), b.length());
int p = 0;
while (p < maxPrefixLength && a.charAt(p) == b.charAt(p)) {
p++;
// depends on control dependency: [while], data = [none]
}
if (validSurrogatePairAt(a, p - 1) || validSurrogatePairAt(b, p - 1)) {
p--;
// depends on control dependency: [if], data = [none]
}
if (p == a.length()) {
return a.toString();
// depends on control dependency: [if], data = [none]
} else if (p == b.length()) {
return b.toString();
// depends on control dependency: [if], data = [none]
} else {
return a.subSequence(0, p).toString();
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected Object getInstantiatedClass(String query) {
if (query.equals(Constants.UIAUTOMATOR_UIDEVICE)) {
return device;
}
return null;
} }
|
public class class_name {
protected Object getInstantiatedClass(String query) {
if (query.equals(Constants.UIAUTOMATOR_UIDEVICE)) {
return device; // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
protected Position position(final int position) {
int line;
int offset;
int lastNewLineOffset;
if (position > lastOffset) {
line = 1;
offset = 0;
lastNewLineOffset = 0;
} else {
line = lastLine;
offset = lastOffset;
lastNewLineOffset = lastLastNewLineOffset;
}
while (offset < position) {
final char c = input[offset];
if (c == '\n') {
line++;
lastNewLineOffset = offset + 1;
}
offset++;
}
lastOffset = offset;
lastLine = line;
lastLastNewLineOffset = lastNewLineOffset;
return new Position(position, line, position - lastNewLineOffset + 1);
} }
|
public class class_name {
protected Position position(final int position) {
int line;
int offset;
int lastNewLineOffset;
if (position > lastOffset) {
line = 1; // depends on control dependency: [if], data = [none]
offset = 0; // depends on control dependency: [if], data = [none]
lastNewLineOffset = 0; // depends on control dependency: [if], data = [none]
} else {
line = lastLine; // depends on control dependency: [if], data = [none]
offset = lastOffset; // depends on control dependency: [if], data = [none]
lastNewLineOffset = lastLastNewLineOffset; // depends on control dependency: [if], data = [none]
}
while (offset < position) {
final char c = input[offset];
if (c == '\n') {
line++; // depends on control dependency: [if], data = [none]
lastNewLineOffset = offset + 1; // depends on control dependency: [if], data = [none]
}
offset++; // depends on control dependency: [while], data = [none]
}
lastOffset = offset;
lastLine = line;
lastLastNewLineOffset = lastNewLineOffset;
return new Position(position, line, position - lastNewLineOffset + 1);
} }
|
public class class_name {
public HtmlPolicyBuilder requireRelsOnLinks(String... linkValues) {
this.invalidateCompiledState();
if (this.extraRelsForLinks == null) {
this.extraRelsForLinks = Sets.newLinkedHashSet();
}
for (String linkValue : linkValues) {
linkValue = HtmlLexer.canonicalName(linkValue);
Preconditions.checkArgument(
!Strings.containsHtmlSpace(linkValue),
"spaces in input. use f(\"foo\", \"bar\") not f(\"foo bar\")");
this.extraRelsForLinks.add(linkValue);
}
if (this.skipRelsForLinks != null) {
this.skipRelsForLinks.removeAll(this.extraRelsForLinks);
}
return this;
} }
|
public class class_name {
public HtmlPolicyBuilder requireRelsOnLinks(String... linkValues) {
this.invalidateCompiledState();
if (this.extraRelsForLinks == null) {
this.extraRelsForLinks = Sets.newLinkedHashSet(); // depends on control dependency: [if], data = [none]
}
for (String linkValue : linkValues) {
linkValue = HtmlLexer.canonicalName(linkValue); // depends on control dependency: [for], data = [linkValue]
Preconditions.checkArgument(
!Strings.containsHtmlSpace(linkValue),
"spaces in input. use f(\"foo\", \"bar\") not f(\"foo bar\")"); // depends on control dependency: [for], data = [none]
this.extraRelsForLinks.add(linkValue); // depends on control dependency: [for], data = [linkValue]
}
if (this.skipRelsForLinks != null) {
this.skipRelsForLinks.removeAll(this.extraRelsForLinks); // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
@ReadOperation
public WebEndpointResponse<Resource> exportServices() throws Exception {
val date = new SimpleDateFormat("yyyy-MM-dd-HH-mm").format(new Date());
val file = File.createTempFile("services-" + date, ".zip");
Files.deleteIfExists(file.toPath());
val env = new HashMap<String, Object>();
env.put("create", "true");
env.put("encoding", StandardCharsets.UTF_8.name());
try (val zipfs = FileSystems.newFileSystem(URI.create("jar:" + file.toURI().toString()), env)) {
val serializer = new RegisteredServiceJsonSerializer();
val services = this.servicesManager.load();
services.forEach(Unchecked.consumer(service -> {
val fileName = String.format("%s-%s", service.getName(), service.getId());
val sourceFile = File.createTempFile(fileName, ".json");
serializer.to(sourceFile, service);
if (sourceFile.exists()) {
val pathInZipfile = zipfs.getPath("/".concat(sourceFile.getName()));
Files.copy(sourceFile.toPath(), pathInZipfile, StandardCopyOption.REPLACE_EXISTING);
}
}));
}
val resource = new TemporaryFileSystemResource(file);
return new WebEndpointResponse(resource);
} }
|
public class class_name {
@ReadOperation
public WebEndpointResponse<Resource> exportServices() throws Exception {
val date = new SimpleDateFormat("yyyy-MM-dd-HH-mm").format(new Date());
val file = File.createTempFile("services-" + date, ".zip");
Files.deleteIfExists(file.toPath());
val env = new HashMap<String, Object>();
env.put("create", "true");
env.put("encoding", StandardCharsets.UTF_8.name());
try (val zipfs = FileSystems.newFileSystem(URI.create("jar:" + file.toURI().toString()), env)) {
val serializer = new RegisteredServiceJsonSerializer();
val services = this.servicesManager.load();
services.forEach(Unchecked.consumer(service -> {
val fileName = String.format("%s-%s", service.getName(), service.getId());
val sourceFile = File.createTempFile(fileName, ".json");
serializer.to(sourceFile, service);
if (sourceFile.exists()) {
val pathInZipfile = zipfs.getPath("/".concat(sourceFile.getName()));
Files.copy(sourceFile.toPath(), pathInZipfile, StandardCopyOption.REPLACE_EXISTING); // depends on control dependency: [if], data = [none]
}
}));
}
val resource = new TemporaryFileSystemResource(file);
return new WebEndpointResponse(resource);
} }
|
public class class_name {
public <TContinuationResult> Task<TContinuationResult> continueWithTask(
final Continuation<TResult, Task<TContinuationResult>> continuation, final Executor executor,
final CancellationToken ct) {
boolean completed;
final bolts.TaskCompletionSource<TContinuationResult> tcs = new bolts.TaskCompletionSource<>();
synchronized (lock) {
completed = this.isCompleted();
if (!completed) {
this.continuations.add(new Continuation<TResult, Void>() {
@Override
public Void then(Task<TResult> task) {
completeAfterTask(tcs, continuation, task, executor, ct);
return null;
}
});
}
}
if (completed) {
completeAfterTask(tcs, continuation, this, executor, ct);
}
return tcs.getTask();
} }
|
public class class_name {
public <TContinuationResult> Task<TContinuationResult> continueWithTask(
final Continuation<TResult, Task<TContinuationResult>> continuation, final Executor executor,
final CancellationToken ct) {
boolean completed;
final bolts.TaskCompletionSource<TContinuationResult> tcs = new bolts.TaskCompletionSource<>();
synchronized (lock) {
completed = this.isCompleted();
if (!completed) {
this.continuations.add(new Continuation<TResult, Void>() {
@Override
public Void then(Task<TResult> task) {
completeAfterTask(tcs, continuation, task, executor, ct);
return null;
}
}); // depends on control dependency: [if], data = [none]
}
}
if (completed) {
completeAfterTask(tcs, continuation, this, executor, ct); // depends on control dependency: [if], data = [none]
}
return tcs.getTask();
} }
|
public class class_name {
public HttpResponse doResourceBundle(StaplerRequest request) {
String baseName = request.getParameter("baseName");
if (baseName == null) {
return HttpResponses.errorJSON("Mandatory parameter 'baseName' not specified.");
}
String language = request.getParameter("language");
String country = request.getParameter("country");
String variant = request.getParameter("variant");
// https://www.w3.org/International/questions/qa-lang-priorities
// in case we have regions/countries in the language query parameter
if (language != null) {
String[] languageTokens = language.split("-|_");
language = languageTokens[0];
if (country == null && languageTokens.length > 1) {
country = languageTokens[1];
if (variant == null && languageTokens.length > 2) {
variant = languageTokens[2];
}
}
}
try {
Locale locale = request.getLocale();
if (language != null && country != null && variant != null) {
locale = new Locale(language, country, variant);
} else if (language != null && country != null) {
locale = new Locale(language, country);
} else if (language != null) {
locale = new Locale(language);
}
return HttpResponses.okJSON(ResourceBundleUtil.getBundle(baseName, locale));
} catch (Exception e) {
return HttpResponses.errorJSON(e.getMessage());
}
} }
|
public class class_name {
public HttpResponse doResourceBundle(StaplerRequest request) {
String baseName = request.getParameter("baseName");
if (baseName == null) {
return HttpResponses.errorJSON("Mandatory parameter 'baseName' not specified."); // depends on control dependency: [if], data = [none]
}
String language = request.getParameter("language");
String country = request.getParameter("country");
String variant = request.getParameter("variant");
// https://www.w3.org/International/questions/qa-lang-priorities
// in case we have regions/countries in the language query parameter
if (language != null) {
String[] languageTokens = language.split("-|_");
language = languageTokens[0]; // depends on control dependency: [if], data = [none]
if (country == null && languageTokens.length > 1) {
country = languageTokens[1]; // depends on control dependency: [if], data = [none]
if (variant == null && languageTokens.length > 2) {
variant = languageTokens[2]; // depends on control dependency: [if], data = [none]
}
}
}
try {
Locale locale = request.getLocale();
if (language != null && country != null && variant != null) {
locale = new Locale(language, country, variant); // depends on control dependency: [if], data = [(language]
} else if (language != null && country != null) {
locale = new Locale(language, country); // depends on control dependency: [if], data = [(language]
} else if (language != null) {
locale = new Locale(language); // depends on control dependency: [if], data = [(language]
}
return HttpResponses.okJSON(ResourceBundleUtil.getBundle(baseName, locale)); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return HttpResponses.errorJSON(e.getMessage());
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void handleThrows() {
Scope curScope = scope;
while (curScope != null) {
if (curScope.kind == Scope.Kind.TRY) {
scope.mergeInto(curScope.next);
}
curScope = curScope.next;
}
} }
|
public class class_name {
private void handleThrows() {
Scope curScope = scope;
while (curScope != null) {
if (curScope.kind == Scope.Kind.TRY) {
scope.mergeInto(curScope.next); // depends on control dependency: [if], data = [none]
}
curScope = curScope.next; // depends on control dependency: [while], data = [none]
}
} }
|
public class class_name {
public DataStore getOrAddDataStore(final Collection<String> columns) {
DataStore ret = getDataStore(columns);
if (ret == null) {
ret = this.createDataStore(columns);
}
return ret;
} }
|
public class class_name {
public DataStore getOrAddDataStore(final Collection<String> columns) {
DataStore ret = getDataStore(columns);
if (ret == null) {
ret = this.createDataStore(columns); // depends on control dependency: [if], data = [none]
}
return ret;
} }
|
public class class_name {
static String replaceSlashes(final String target) {
String replaced = target;
if (replaced != null) {
replaced = replaced.replaceAll("/+", "/");
}
return replaced;
} }
|
public class class_name {
static String replaceSlashes(final String target) {
String replaced = target;
if (replaced != null) {
replaced = replaced.replaceAll("/+", "/"); // depends on control dependency: [if], data = [none]
}
return replaced;
} }
|
public class class_name {
protected void prepareResourceCondition(CmsUUID projectId, int mode, StringBuffer conditions) {
if ((mode & CmsDriverManager.READMODE_ONLY_FOLDERS) > 0) {
// C_READMODE_ONLY_FOLDERS: add condition to match only folders
conditions.append(BEGIN_INCLUDE_CONDITION);
conditions.append(m_sqlManager.readQuery(projectId, "C_RESOURCES_SELECT_ONLY_FOLDERS"));
conditions.append(END_CONDITION);
} else if ((mode & CmsDriverManager.READMODE_ONLY_FILES) > 0) {
// C_READMODE_ONLY_FILES: add condition to match only files
conditions.append(BEGIN_INCLUDE_CONDITION);
conditions.append(m_sqlManager.readQuery(projectId, "C_RESOURCES_SELECT_ONLY_FILES"));
conditions.append(END_CONDITION);
}
} }
|
public class class_name {
protected void prepareResourceCondition(CmsUUID projectId, int mode, StringBuffer conditions) {
if ((mode & CmsDriverManager.READMODE_ONLY_FOLDERS) > 0) {
// C_READMODE_ONLY_FOLDERS: add condition to match only folders
conditions.append(BEGIN_INCLUDE_CONDITION); // depends on control dependency: [if], data = [none]
conditions.append(m_sqlManager.readQuery(projectId, "C_RESOURCES_SELECT_ONLY_FOLDERS")); // depends on control dependency: [if], data = [none]
conditions.append(END_CONDITION); // depends on control dependency: [if], data = [none]
} else if ((mode & CmsDriverManager.READMODE_ONLY_FILES) > 0) {
// C_READMODE_ONLY_FILES: add condition to match only files
conditions.append(BEGIN_INCLUDE_CONDITION); // depends on control dependency: [if], data = [none]
conditions.append(m_sqlManager.readQuery(projectId, "C_RESOURCES_SELECT_ONLY_FILES")); // depends on control dependency: [if], data = [none]
conditions.append(END_CONDITION); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void reIndexParticipantData ()
{
final LocalDateTime aNow = PDTFactory.getCurrentLocalDateTime ();
// Get and remove all items to re-index "now"
final List <IReIndexWorkItem> aReIndexNowItems = m_aReIndexList.getAndRemoveAllEntries (aWorkItem -> aWorkItem.isRetryPossible (aNow));
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Re-indexing " + aReIndexNowItems.size () + " work items");
for (final IReIndexWorkItem aReIndexItem : aReIndexNowItems)
{
LOGGER.info ("Try to re-index " + aReIndexItem.getLogText ());
PDIndexExecutor.executeWorkItem (m_aStorageMgr,
aReIndexItem.getWorkItem (),
1 + aReIndexItem.getRetryCount (),
aSuccessItem -> _onReIndexSuccess (aSuccessItem),
aFailureItem -> _onReIndexFailure (aReIndexItem));
}
} }
|
public class class_name {
public void reIndexParticipantData ()
{
final LocalDateTime aNow = PDTFactory.getCurrentLocalDateTime ();
// Get and remove all items to re-index "now"
final List <IReIndexWorkItem> aReIndexNowItems = m_aReIndexList.getAndRemoveAllEntries (aWorkItem -> aWorkItem.isRetryPossible (aNow));
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Re-indexing " + aReIndexNowItems.size () + " work items");
for (final IReIndexWorkItem aReIndexItem : aReIndexNowItems)
{
LOGGER.info ("Try to re-index " + aReIndexItem.getLogText ()); // depends on control dependency: [for], data = [aReIndexItem]
PDIndexExecutor.executeWorkItem (m_aStorageMgr,
aReIndexItem.getWorkItem (),
1 + aReIndexItem.getRetryCount (),
aSuccessItem -> _onReIndexSuccess (aSuccessItem),
aFailureItem -> _onReIndexFailure (aReIndexItem)); // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
private String getServiceName() {
TransportMetadata tm = getTransportMetadata();
if (tm == null) {
return "null";
}
return tm.getProviderName() + ' ' + tm.getName();
} }
|
public class class_name {
private String getServiceName() {
TransportMetadata tm = getTransportMetadata();
if (tm == null) {
return "null"; // depends on control dependency: [if], data = [none]
}
return tm.getProviderName() + ' ' + tm.getName();
} }
|
public class class_name {
private static Presence deserialize(String message){
Presence result = new Presence();
if(!Strings.isNullOrEmpty(message))
{
JSONObject json = (JSONObject) (JSONValue.parse(message));
if (json != null) {
result.setSubscriptions((Long) json.get("subscriptions"));
JSONObject jsonMetadata = (JSONObject)json.get("metadata");
if(jsonMetadata != null){
@SuppressWarnings("unchecked")
Iterator<?> iter = ((Map<String, Long>) jsonMetadata).entrySet().iterator();
while (iter.hasNext()) {
@SuppressWarnings("unchecked")
Map.Entry<String, Long> entry = (Map.Entry<String, Long>) iter.next();
result.metadata.put(entry.getKey(), entry.getValue());
}
}
}
}
return result;
} }
|
public class class_name {
private static Presence deserialize(String message){
Presence result = new Presence();
if(!Strings.isNullOrEmpty(message))
{
JSONObject json = (JSONObject) (JSONValue.parse(message));
if (json != null) {
result.setSubscriptions((Long) json.get("subscriptions")); // depends on control dependency: [if], data = [none]
JSONObject jsonMetadata = (JSONObject)json.get("metadata");
if(jsonMetadata != null){
@SuppressWarnings("unchecked")
Iterator<?> iter = ((Map<String, Long>) jsonMetadata).entrySet().iterator();
while (iter.hasNext()) {
@SuppressWarnings("unchecked")
Map.Entry<String, Long> entry = (Map.Entry<String, Long>) iter.next();
result.metadata.put(entry.getKey(), entry.getValue()); // depends on control dependency: [while], data = [none]
}
}
}
}
return result;
} }
|
public class class_name {
private static boolean peek(ListIterator<Segment> segments, SegmentKind... kinds) {
int start = segments.nextIndex();
boolean success = false;
for (SegmentKind kind : kinds) {
if (!segments.hasNext() || segments.next().kind() != kind) {
success = false;
break;
}
}
if (success) {
return true;
}
restore(segments, start);
return false;
} }
|
public class class_name {
private static boolean peek(ListIterator<Segment> segments, SegmentKind... kinds) {
int start = segments.nextIndex();
boolean success = false;
for (SegmentKind kind : kinds) {
if (!segments.hasNext() || segments.next().kind() != kind) {
success = false; // depends on control dependency: [if], data = [none]
break;
}
}
if (success) {
return true; // depends on control dependency: [if], data = [none]
}
restore(segments, start);
return false;
} }
|
public class class_name {
@SuppressWarnings("all")
public void retain() {
if (allocationDebugging) {
AllocationDebugger.getInstance().retain(this);
}
final int baseCount = refcount.getAndIncrement();
if (allocationDebugging && baseCount < 1) {
throw new RuntimeException("attempt to retain object with invalid ref count");
}
} }
|
public class class_name {
@SuppressWarnings("all")
public void retain() {
if (allocationDebugging) {
AllocationDebugger.getInstance().retain(this);
// depends on control dependency: [if], data = [none]
}
final int baseCount = refcount.getAndIncrement();
if (allocationDebugging && baseCount < 1) {
throw new RuntimeException("attempt to retain object with invalid ref count");
}
} }
|
public class class_name {
public List<CmsResource> getResourcesWithBrokenLinks() {
if (m_resourcesWithBrokenLinks == null) {
// sort the resulting hash map
List<String> resources = new ArrayList<String>(m_brokenRelations.keySet());
Collections.sort(resources);
m_resourcesWithBrokenLinks = new ArrayList<CmsResource>(resources.size());
m_notVisibleResourcesCount = 0;
// remove not visible resources
CmsResourceFilter filter = CmsResourceFilter.IGNORE_EXPIRATION.addRequireVisible();
String storedSiteRoot = m_cms.getRequestContext().getSiteRoot();
try {
m_cms.getRequestContext().setSiteRoot("/");
Iterator<String> itResources = resources.iterator();
while (itResources.hasNext()) {
String resourceName = itResources.next();
try {
m_resourcesWithBrokenLinks.add(m_cms.readResource(resourceName, filter));
} catch (Exception e) {
// resource is not visible, increase count
m_notVisibleResourcesCount++;
}
}
} finally {
m_cms.getRequestContext().setSiteRoot(storedSiteRoot);
}
}
return m_resourcesWithBrokenLinks;
} }
|
public class class_name {
public List<CmsResource> getResourcesWithBrokenLinks() {
if (m_resourcesWithBrokenLinks == null) {
// sort the resulting hash map
List<String> resources = new ArrayList<String>(m_brokenRelations.keySet());
Collections.sort(resources); // depends on control dependency: [if], data = [none]
m_resourcesWithBrokenLinks = new ArrayList<CmsResource>(resources.size()); // depends on control dependency: [if], data = [none]
m_notVisibleResourcesCount = 0; // depends on control dependency: [if], data = [none]
// remove not visible resources
CmsResourceFilter filter = CmsResourceFilter.IGNORE_EXPIRATION.addRequireVisible();
String storedSiteRoot = m_cms.getRequestContext().getSiteRoot();
try {
m_cms.getRequestContext().setSiteRoot("/"); // depends on control dependency: [try], data = [none]
Iterator<String> itResources = resources.iterator();
while (itResources.hasNext()) {
String resourceName = itResources.next();
try {
m_resourcesWithBrokenLinks.add(m_cms.readResource(resourceName, filter)); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// resource is not visible, increase count
m_notVisibleResourcesCount++;
} // depends on control dependency: [catch], data = [none]
}
} finally {
m_cms.getRequestContext().setSiteRoot(storedSiteRoot);
}
}
return m_resourcesWithBrokenLinks;
} }
|
public class class_name {
private void addFourEyesTaskListener(ActivityImpl activity) {
UserTaskActivityBehavior userTaskActivityBehavior = (UserTaskActivityBehavior) activity.getActivityBehavior();
boolean listenerAlreadyExists = false;
// check that the listener wasn't added in the XML explicitly
List<TaskListener> existingListeners = userTaskActivityBehavior.getTaskDefinition().getTaskListeners().get("complete");
for (TaskListener taskListener : existingListeners) {
if (taskListener instanceof ClassDelegate &&
((ClassDelegate)taskListener).getClassName().equals(TaskCompletionListener.class.getName())) {
listenerAlreadyExists = true;
logger.info(TaskCompletionListener.class.getSimpleName() + " was already explicitly added to usertask in the bpmn xml.");
break;
}
}
if (!listenerAlreadyExists) {
logger.info("Adding " + TaskCompletionListener.class.getSimpleName() + " implicitly to usertask.");
ClassDelegate taskListener = new ClassDelegate(TaskCompletionListener.class, null);
userTaskActivityBehavior.getTaskDefinition().addTaskListener("complete", taskListener);
}
} }
|
public class class_name {
private void addFourEyesTaskListener(ActivityImpl activity) {
UserTaskActivityBehavior userTaskActivityBehavior = (UserTaskActivityBehavior) activity.getActivityBehavior();
boolean listenerAlreadyExists = false;
// check that the listener wasn't added in the XML explicitly
List<TaskListener> existingListeners = userTaskActivityBehavior.getTaskDefinition().getTaskListeners().get("complete");
for (TaskListener taskListener : existingListeners) {
if (taskListener instanceof ClassDelegate &&
((ClassDelegate)taskListener).getClassName().equals(TaskCompletionListener.class.getName())) {
listenerAlreadyExists = true; // depends on control dependency: [if], data = [none]
logger.info(TaskCompletionListener.class.getSimpleName() + " was already explicitly added to usertask in the bpmn xml."); // depends on control dependency: [if], data = [none]
break;
}
}
if (!listenerAlreadyExists) {
logger.info("Adding " + TaskCompletionListener.class.getSimpleName() + " implicitly to usertask."); // depends on control dependency: [if], data = [none]
ClassDelegate taskListener = new ClassDelegate(TaskCompletionListener.class, null);
userTaskActivityBehavior.getTaskDefinition().addTaskListener("complete", taskListener); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static String flagsToString(short flags) {
StringBuilder sb=new StringBuilder();
boolean first=true;
Flag[] all_flags=Flag.values();
for(Flag flag: all_flags) {
if(isFlagSet(flags, flag)) {
if(first)
first=false;
else
sb.append("|");
sb.append(flag);
}
}
return sb.toString();
} }
|
public class class_name {
public static String flagsToString(short flags) {
StringBuilder sb=new StringBuilder();
boolean first=true;
Flag[] all_flags=Flag.values();
for(Flag flag: all_flags) {
if(isFlagSet(flags, flag)) {
if(first)
first=false;
else
sb.append("|");
sb.append(flag); // depends on control dependency: [if], data = [none]
}
}
return sb.toString();
} }
|
public class class_name {
private void exportResources(PluginClassLoaderDef def, ClassloaderBuilder builder, Collection<PluginClassLoaderDef> allPlugins) {
// export the resources to all other plugins
builder.setExportMask(def.getBasePluginKey(), def.getExportMask());
for (PluginClassLoaderDef other : allPlugins) {
if (!other.getBasePluginKey().equals(def.getBasePluginKey())) {
builder.addSibling(def.getBasePluginKey(), other.getBasePluginKey(), new Mask());
}
}
} }
|
public class class_name {
private void exportResources(PluginClassLoaderDef def, ClassloaderBuilder builder, Collection<PluginClassLoaderDef> allPlugins) {
// export the resources to all other plugins
builder.setExportMask(def.getBasePluginKey(), def.getExportMask());
for (PluginClassLoaderDef other : allPlugins) {
if (!other.getBasePluginKey().equals(def.getBasePluginKey())) {
builder.addSibling(def.getBasePluginKey(), other.getBasePluginKey(), new Mask()); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public <T extends Value> T getField(int fieldNum, T target) {
// range check
if (fieldNum < 0 || fieldNum >= this.numFields) {
throw new IndexOutOfBoundsException();
}
if (target == null) {
throw new NullPointerException("The target object may not be null");
}
// get offset and check for null
final int offset = this.offsets[fieldNum];
if (offset == NULL_INDICATOR_OFFSET) {
return null;
}
else if (offset == MODIFIED_INDICATOR_OFFSET) {
// value that has been set is new or modified
// bring the binary in sync so that the deserialization gives the correct result
return (T) this.writeFields[fieldNum];
}
final int limit = offset + this.lengths[fieldNum];
deserialize(target, offset, limit, fieldNum);
return target;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public <T extends Value> T getField(int fieldNum, T target) {
// range check
if (fieldNum < 0 || fieldNum >= this.numFields) {
throw new IndexOutOfBoundsException();
}
if (target == null) {
throw new NullPointerException("The target object may not be null");
}
// get offset and check for null
final int offset = this.offsets[fieldNum];
if (offset == NULL_INDICATOR_OFFSET) {
return null; // depends on control dependency: [if], data = [none]
}
else if (offset == MODIFIED_INDICATOR_OFFSET) {
// value that has been set is new or modified
// bring the binary in sync so that the deserialization gives the correct result
return (T) this.writeFields[fieldNum]; // depends on control dependency: [if], data = [none]
}
final int limit = offset + this.lengths[fieldNum];
deserialize(target, offset, limit, fieldNum);
return target;
} }
|
public class class_name {
public static String decode(String s) {
byte[] baKeyword = new byte[s.length() / 2];
for (int i = 0; i < baKeyword.length; i++) {
baKeyword[i] = (byte) (0xff & Integer.parseInt(s.substring(i * 2, i * 2 + 2), 16));
}
return new String(baKeyword);// UTF-16le:Not
} }
|
public class class_name {
public static String decode(String s) {
byte[] baKeyword = new byte[s.length() / 2];
for (int i = 0; i < baKeyword.length; i++) {
baKeyword[i] = (byte) (0xff & Integer.parseInt(s.substring(i * 2, i * 2 + 2), 16));
// depends on control dependency: [for], data = [i]
}
return new String(baKeyword);// UTF-16le:Not
} }
|
public class class_name {
@Override
public void flush()
{
ObjectMapper mapper = ObjectMapperFactory.getObjectMapper();
String dtoDump;
URI incidentURI;
try
{
dtoDump = mapper.writeValueAsString(new IncidentV2DTO(this));
}
catch (JsonProcessingException ex)
{
logger.error("Incident registration failed, could not map "
+ "incident report to json string. Exception: {}", ex.getMessage());
return;
}
// Sanity check...
Preconditions.checkNotNull(dtoDump);
try
{
URIBuilder uriBuilder = new URIBuilder(this.serverUrl);
uriBuilder.setPath(SF_PATH_CREATE_INCIDENT_V2);
incidentURI = uriBuilder.build();
}
catch (URISyntaxException ex)
{
logger.error("Incident registration failed, "
+ "URI could not be built. Exception: {}", ex.getMessage());
return;
}
HttpPost postRequest = new HttpPost(incidentURI);
postRequest.setHeader(SFSession.SF_HEADER_AUTHORIZATION,
SFSession.SF_HEADER_SNOWFLAKE_AUTHTYPE + " "
+ SFSession.SF_HEADER_TOKEN_TAG + "=\""
+ this.sessionToken + "\"");
// Compress the payload.
ByteArrayEntity input = null;
try
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
GZIPOutputStream gzos = new GZIPOutputStream(baos);
byte[] bytes = dtoDump.getBytes(StandardCharsets.UTF_8);
gzos.write(bytes);
gzos.finish();
input = new ByteArrayEntity(baos.toByteArray());
input.setContentType("application/json");
}
catch (IOException exc)
{
logger.debug("Incident registration failed, could not compress"
+ " payload. Exception: {}", exc.getMessage());
}
postRequest.setEntity(input);
postRequest.addHeader("content-encoding", "gzip");
try
{
String response = HttpUtil.executeRequest(postRequest,
1000, 0,
null);
logger.debug("Incident registration was successful. Response: '{}'",
response);
}
catch (Exception ex)
{
// No much we can do here besides complain.
logger.error(
"Incident registration request failed, exception: {}",
ex.getMessage());
}
} }
|
public class class_name {
@Override
public void flush()
{
ObjectMapper mapper = ObjectMapperFactory.getObjectMapper();
String dtoDump;
URI incidentURI;
try
{
dtoDump = mapper.writeValueAsString(new IncidentV2DTO(this)); // depends on control dependency: [try], data = [none]
}
catch (JsonProcessingException ex)
{
logger.error("Incident registration failed, could not map "
+ "incident report to json string. Exception: {}", ex.getMessage());
return;
} // depends on control dependency: [catch], data = [none]
// Sanity check...
Preconditions.checkNotNull(dtoDump);
try
{
URIBuilder uriBuilder = new URIBuilder(this.serverUrl);
uriBuilder.setPath(SF_PATH_CREATE_INCIDENT_V2); // depends on control dependency: [try], data = [none]
incidentURI = uriBuilder.build(); // depends on control dependency: [try], data = [none]
}
catch (URISyntaxException ex)
{
logger.error("Incident registration failed, "
+ "URI could not be built. Exception: {}", ex.getMessage());
return;
} // depends on control dependency: [catch], data = [none]
HttpPost postRequest = new HttpPost(incidentURI);
postRequest.setHeader(SFSession.SF_HEADER_AUTHORIZATION,
SFSession.SF_HEADER_SNOWFLAKE_AUTHTYPE + " "
+ SFSession.SF_HEADER_TOKEN_TAG + "=\""
+ this.sessionToken + "\"");
// Compress the payload.
ByteArrayEntity input = null;
try
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
GZIPOutputStream gzos = new GZIPOutputStream(baos);
byte[] bytes = dtoDump.getBytes(StandardCharsets.UTF_8);
gzos.write(bytes); // depends on control dependency: [try], data = [none]
gzos.finish(); // depends on control dependency: [try], data = [none]
input = new ByteArrayEntity(baos.toByteArray()); // depends on control dependency: [try], data = [none]
input.setContentType("application/json"); // depends on control dependency: [try], data = [none]
}
catch (IOException exc)
{
logger.debug("Incident registration failed, could not compress"
+ " payload. Exception: {}", exc.getMessage());
} // depends on control dependency: [catch], data = [none]
postRequest.setEntity(input);
postRequest.addHeader("content-encoding", "gzip");
try
{
String response = HttpUtil.executeRequest(postRequest,
1000, 0,
null);
logger.debug("Incident registration was successful. Response: '{}'",
response); // depends on control dependency: [try], data = [none]
}
catch (Exception ex)
{
// No much we can do here besides complain.
logger.error(
"Incident registration request failed, exception: {}",
ex.getMessage());
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
protected Integer theCalculation(Bitmap image) {
Map histogram = new HashMap();
for(int i = 0; i < image.getWidth(); i++)
for(int j = 0; j < image.getHeight(); j++) {
int rgb = image.getPixel(i,j);
int rgbArray[] = getRGBArrayFromPixel(rgb);
if(!isGray(rgbArray)) {
Integer counter = (Integer) histogram.get(rgb);
if (counter == null)
counter = 0;
counter++;
histogram.put(rgb, counter);
}
}
return Color.parseColor("#"+getMostCommonColor(histogram));
} }
|
public class class_name {
@Override
protected Integer theCalculation(Bitmap image) {
Map histogram = new HashMap();
for(int i = 0; i < image.getWidth(); i++)
for(int j = 0; j < image.getHeight(); j++) {
int rgb = image.getPixel(i,j);
int rgbArray[] = getRGBArrayFromPixel(rgb);
if(!isGray(rgbArray)) {
Integer counter = (Integer) histogram.get(rgb);
if (counter == null)
counter = 0;
counter++; // depends on control dependency: [if], data = [none]
histogram.put(rgb, counter); // depends on control dependency: [if], data = [none]
}
}
return Color.parseColor("#"+getMostCommonColor(histogram));
} }
|
public class class_name {
private static void doCopyFile(final File srcFile, final File destFile, final boolean preserveFileDate) {
if (destFile.exists()) {
throw new IllegalArgumentException("The destination file already existed: " + destFile.getAbsolutePath());
}
FileInputStream fis = null;
FileOutputStream fos = null;
FileChannel input = null;
FileChannel output = null;
try {
fis = new FileInputStream(srcFile);
fos = new FileOutputStream(destFile);
input = fis.getChannel();
output = fos.getChannel();
long size = input.size();
long pos = 0;
long count = 0;
while (pos < size) {
count = ((size - pos) > FILE_COPY_BUFFER_SIZE) ? FILE_COPY_BUFFER_SIZE : (size - pos);
pos += output.transferFrom(input, pos, count);
}
} catch (IOException e) {
throw new UncheckedIOException(e);
} finally {
close(output);
close(fos);
close(input);
close(fis);
}
if (srcFile.length() != destFile.length()) {
deleteAllIfExists(destFile);
throw new UncheckedIOException(new IOException("Failed to copy full contents from '" + srcFile + "' to '" + destFile + "'"));
}
if (preserveFileDate) {
destFile.setLastModified(srcFile.lastModified());
}
} }
|
public class class_name {
private static void doCopyFile(final File srcFile, final File destFile, final boolean preserveFileDate) {
if (destFile.exists()) {
throw new IllegalArgumentException("The destination file already existed: " + destFile.getAbsolutePath());
}
FileInputStream fis = null;
FileOutputStream fos = null;
FileChannel input = null;
FileChannel output = null;
try {
fis = new FileInputStream(srcFile);
// depends on control dependency: [try], data = [none]
fos = new FileOutputStream(destFile);
// depends on control dependency: [try], data = [none]
input = fis.getChannel();
// depends on control dependency: [try], data = [none]
output = fos.getChannel();
// depends on control dependency: [try], data = [none]
long size = input.size();
long pos = 0;
long count = 0;
while (pos < size) {
count = ((size - pos) > FILE_COPY_BUFFER_SIZE) ? FILE_COPY_BUFFER_SIZE : (size - pos);
// depends on control dependency: [while], data = [none]
pos += output.transferFrom(input, pos, count);
// depends on control dependency: [while], data = [none]
}
} catch (IOException e) {
throw new UncheckedIOException(e);
} finally {
// depends on control dependency: [catch], data = [none]
close(output);
close(fos);
close(input);
close(fis);
}
if (srcFile.length() != destFile.length()) {
deleteAllIfExists(destFile);
// depends on control dependency: [if], data = [none]
throw new UncheckedIOException(new IOException("Failed to copy full contents from '" + srcFile + "' to '" + destFile + "'"));
}
if (preserveFileDate) {
destFile.setLastModified(srcFile.lastModified());
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void handleMesosFailure(String taskId) {
int attempt = TaskUtils.getAttemptForTaskId(taskId);
BaseContainer container = containersInfo.get(TaskUtils.getContainerIndexForTaskId(taskId));
boolean hasAttemptsLeft = attempt < container.retries;
if (hasAttemptsLeft) {
LOG.warning(String.format("Retrying task: %s, attempt: %d", container.name, attempt + 1));
String newTaskId = TaskUtils.getTaskId(container.name, attempt + 1);
scheduleNewTask(newTaskId);
} else {
LOG.severe("Would not restart the job since it is beyond retries: " + attempt);
}
} }
|
public class class_name {
protected void handleMesosFailure(String taskId) {
int attempt = TaskUtils.getAttemptForTaskId(taskId);
BaseContainer container = containersInfo.get(TaskUtils.getContainerIndexForTaskId(taskId));
boolean hasAttemptsLeft = attempt < container.retries;
if (hasAttemptsLeft) {
LOG.warning(String.format("Retrying task: %s, attempt: %d", container.name, attempt + 1)); // depends on control dependency: [if], data = [none]
String newTaskId = TaskUtils.getTaskId(container.name, attempt + 1);
scheduleNewTask(newTaskId); // depends on control dependency: [if], data = [none]
} else {
LOG.severe("Would not restart the job since it is beyond retries: " + attempt); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void eval(int predictedIdx, int actualIdx) {
// Add the number of rows to numRowCounter
numRowCounter++;
// If confusion is null, then Evaluation is instantiated without providing the classes
if (confusion == null) {
throw new UnsupportedOperationException(
"Cannot evaluate single example without initializing confusion matrix first");
}
addToConfusion(actualIdx, predictedIdx);
// If they are equal
if (predictedIdx == actualIdx) {
// Then add 1 to True Positive
// (For a particular label)
incrementTruePositives(predictedIdx);
// And add 1 for each negative class that is accurately predicted (True Negative)
//(For a particular label)
for (Integer clazz : confusion().getClasses()) {
if (clazz != predictedIdx)
trueNegatives.incrementCount(clazz, 1.0f);
}
} else {
// Otherwise the real label is predicted as negative (False Negative)
incrementFalseNegatives(actualIdx);
// Otherwise the prediction is predicted as falsely positive (False Positive)
incrementFalsePositives(predictedIdx);
// Otherwise true negatives
for (Integer clazz : confusion().getClasses()) {
if (clazz != predictedIdx && clazz != actualIdx)
trueNegatives.incrementCount(clazz, 1.0f);
}
}
} }
|
public class class_name {
public void eval(int predictedIdx, int actualIdx) {
// Add the number of rows to numRowCounter
numRowCounter++;
// If confusion is null, then Evaluation is instantiated without providing the classes
if (confusion == null) {
throw new UnsupportedOperationException(
"Cannot evaluate single example without initializing confusion matrix first");
}
addToConfusion(actualIdx, predictedIdx);
// If they are equal
if (predictedIdx == actualIdx) {
// Then add 1 to True Positive
// (For a particular label)
incrementTruePositives(predictedIdx); // depends on control dependency: [if], data = [(predictedIdx]
// And add 1 for each negative class that is accurately predicted (True Negative)
//(For a particular label)
for (Integer clazz : confusion().getClasses()) {
if (clazz != predictedIdx)
trueNegatives.incrementCount(clazz, 1.0f);
}
} else {
// Otherwise the real label is predicted as negative (False Negative)
incrementFalseNegatives(actualIdx); // depends on control dependency: [if], data = [actualIdx)]
// Otherwise the prediction is predicted as falsely positive (False Positive)
incrementFalsePositives(predictedIdx); // depends on control dependency: [if], data = [(predictedIdx]
// Otherwise true negatives
for (Integer clazz : confusion().getClasses()) {
if (clazz != predictedIdx && clazz != actualIdx)
trueNegatives.incrementCount(clazz, 1.0f);
}
}
} }
|
public class class_name {
@Override
public int compareTo(ZonalOffset obj) {
if (this.total < obj.total) {
return -1;
} else if (this.total > obj.total) {
return 1;
} else {
int delta = (this.fraction - obj.fraction);
return ((delta < 0) ? -1 : ((delta == 0) ? 0 : 1));
}
} }
|
public class class_name {
@Override
public int compareTo(ZonalOffset obj) {
if (this.total < obj.total) {
return -1; // depends on control dependency: [if], data = [none]
} else if (this.total > obj.total) {
return 1; // depends on control dependency: [if], data = [none]
} else {
int delta = (this.fraction - obj.fraction);
return ((delta < 0) ? -1 : ((delta == 0) ? 0 : 1)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected CmsResource getDefaultFileOrSelf(CmsResource res) {
CmsResource defaultfile = null;
if (res.isFolder()) {
try {
defaultfile = m_cms.readDefaultFile("" + res.getStructureId());
} catch (CmsSecurityException e) {
LOG.error(e.getLocalizedMessage(), e);
return null;
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
return null;
}
return defaultfile;
}
return res;
} }
|
public class class_name {
protected CmsResource getDefaultFileOrSelf(CmsResource res) {
CmsResource defaultfile = null;
if (res.isFolder()) {
try {
defaultfile = m_cms.readDefaultFile("" + res.getStructureId()); // depends on control dependency: [try], data = [none]
} catch (CmsSecurityException e) {
LOG.error(e.getLocalizedMessage(), e);
return null;
} catch (CmsException e) { // depends on control dependency: [catch], data = [none]
LOG.error(e.getLocalizedMessage(), e);
return null;
} // depends on control dependency: [catch], data = [none]
return defaultfile; // depends on control dependency: [if], data = [none]
}
return res;
} }
|
public class class_name {
private static Method getMethod(Class<?> clazz, String methodName)
{
try
{
char string[] = methodName.toCharArray();
string[0] = Character.toUpperCase(string[0]);
methodName = new String(string);
try
{
return clazz.getDeclaredMethod("get" + methodName);
}
catch (NoSuchMethodException e)
{
return clazz.getDeclaredMethod("is" + methodName);
}
}
catch (NoSuchMethodException e)
{
return null;
}
} }
|
public class class_name {
private static Method getMethod(Class<?> clazz, String methodName)
{
try
{
char string[] = methodName.toCharArray();
string[0] = Character.toUpperCase(string[0]); // depends on control dependency: [try], data = [none]
methodName = new String(string); // depends on control dependency: [try], data = [none]
try
{
return clazz.getDeclaredMethod("get" + methodName); // depends on control dependency: [try], data = [none]
}
catch (NoSuchMethodException e)
{
return clazz.getDeclaredMethod("is" + methodName);
} // depends on control dependency: [catch], data = [none]
}
catch (NoSuchMethodException e)
{
return null;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void setContextProperties(Map<String, String> contextProperties)
{
if (contextProperties != null) {
this.contextProperties = new HashMap<String, String>(4);
this.contextProperties.putAll(contextProperties);
}
} }
|
public class class_name {
public void setContextProperties(Map<String, String> contextProperties)
{
if (contextProperties != null) {
this.contextProperties = new HashMap<String, String>(4); // depends on control dependency: [if], data = [none]
this.contextProperties.putAll(contextProperties); // depends on control dependency: [if], data = [(contextProperties]
}
} }
|
public class class_name {
private void addResponsesToAction(ControllerRouteModel<Raml> elem, Action action) {
// get all mimeTypes defined in @Route.produces
LOGGER.debug("responsesMimes.size:"+elem.getResponseMimes().size());
List<String> mimes = new ArrayList<>();
mimes.addAll(elem.getResponseMimes());
// if no mimeTypes defined, no response specifications
if(mimes.isEmpty()){
return;
}
int i=0;
// iterate over @response.code javadoc annotation
for (String code : elem.getResponseCodes()) {
LOGGER.debug("code:"+code);
// get mimeType in order of declaration, else get first
String mime;
if(mimes.size()>i){
mime = mimes.get(i);
} else {
mime = mimes.get(0);
}
Response resp = new Response();
// add @response.description javadoc annotation if exist
if(elem.getResponseDescriptions().size()>i){
resp.setDescription(elem.getResponseDescriptions().get(i));
}
// add @response.body javadoc annotation if exist
if(elem.getResponseBodies().size()>i){
MimeType mimeType = new MimeType(mime);
mimeType.setExample(elem.getResponseBodies().get(i).toString());
resp.setBody(Collections.singletonMap(mime, mimeType));
}
action.getResponses().put(code, resp);
i++;
}
} }
|
public class class_name {
private void addResponsesToAction(ControllerRouteModel<Raml> elem, Action action) {
// get all mimeTypes defined in @Route.produces
LOGGER.debug("responsesMimes.size:"+elem.getResponseMimes().size());
List<String> mimes = new ArrayList<>();
mimes.addAll(elem.getResponseMimes());
// if no mimeTypes defined, no response specifications
if(mimes.isEmpty()){
return; // depends on control dependency: [if], data = [none]
}
int i=0;
// iterate over @response.code javadoc annotation
for (String code : elem.getResponseCodes()) {
LOGGER.debug("code:"+code); // depends on control dependency: [for], data = [code]
// get mimeType in order of declaration, else get first
String mime;
if(mimes.size()>i){
mime = mimes.get(i); // depends on control dependency: [if], data = [i)]
} else {
mime = mimes.get(0); // depends on control dependency: [if], data = [none]
}
Response resp = new Response();
// add @response.description javadoc annotation if exist
if(elem.getResponseDescriptions().size()>i){
resp.setDescription(elem.getResponseDescriptions().get(i)); // depends on control dependency: [if], data = [i)]
}
// add @response.body javadoc annotation if exist
if(elem.getResponseBodies().size()>i){
MimeType mimeType = new MimeType(mime);
mimeType.setExample(elem.getResponseBodies().get(i).toString()); // depends on control dependency: [if], data = [i)]
resp.setBody(Collections.singletonMap(mime, mimeType)); // depends on control dependency: [if], data = [none]
}
action.getResponses().put(code, resp); // depends on control dependency: [for], data = [code]
i++; // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
private TableAlias createTableAlias(String aTable, String aPath, String aUserAlias)
{
if (aUserAlias == null)
{
return createTableAlias(aTable, aPath);
}
else
{
return createTableAlias(aTable, aUserAlias + ALIAS_SEPARATOR + aPath);
}
} }
|
public class class_name {
private TableAlias createTableAlias(String aTable, String aPath, String aUserAlias)
{
if (aUserAlias == null)
{
return createTableAlias(aTable, aPath);
// depends on control dependency: [if], data = [none]
}
else
{
return createTableAlias(aTable, aUserAlias + ALIAS_SEPARATOR + aPath);
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public String[] synthesize(AnalyzedToken token, String posTag,
boolean posTagRegExp) throws IOException {
if (posTag != null && posTagRegExp) {
String myPosTag = posTag;
String det = "";
if (posTag.endsWith(ADD_IND_DETERMINER)) {
myPosTag = myPosTag.substring(0, myPosTag.indexOf(ADD_IND_DETERMINER) - "\\".length());
det = aVsAnRule.suggestAorAn(token.getLemma());
det = det.substring(0, det.indexOf(' ') + " ".length());
} else if (posTag.endsWith(ADD_DETERMINER)) {
myPosTag = myPosTag.substring(0, myPosTag.indexOf(ADD_DETERMINER) - "\\".length());
det = "the ";
}
initPossibleTags();
Pattern p = Pattern.compile(myPosTag);
List<String> results = new ArrayList<>();
for (String tag : possibleTags) {
Matcher m = p.matcher(tag);
if (m.matches()) {
lookup(token.getLemma(), tag, results, det);
}
}
return results.toArray(new String[results.size()]);
}
return synthesize(token, posTag);
} }
|
public class class_name {
@Override
public String[] synthesize(AnalyzedToken token, String posTag,
boolean posTagRegExp) throws IOException {
if (posTag != null && posTagRegExp) {
String myPosTag = posTag;
String det = "";
if (posTag.endsWith(ADD_IND_DETERMINER)) {
myPosTag = myPosTag.substring(0, myPosTag.indexOf(ADD_IND_DETERMINER) - "\\".length()); // depends on control dependency: [if], data = [none]
det = aVsAnRule.suggestAorAn(token.getLemma()); // depends on control dependency: [if], data = [none]
det = det.substring(0, det.indexOf(' ') + " ".length()); // depends on control dependency: [if], data = [none]
} else if (posTag.endsWith(ADD_DETERMINER)) {
myPosTag = myPosTag.substring(0, myPosTag.indexOf(ADD_DETERMINER) - "\\".length()); // depends on control dependency: [if], data = [none]
det = "the "; // depends on control dependency: [if], data = [none]
}
initPossibleTags();
Pattern p = Pattern.compile(myPosTag);
List<String> results = new ArrayList<>();
for (String tag : possibleTags) {
Matcher m = p.matcher(tag);
if (m.matches()) {
lookup(token.getLemma(), tag, results, det); // depends on control dependency: [if], data = [none]
}
}
return results.toArray(new String[results.size()]);
}
return synthesize(token, posTag);
} }
|
public class class_name {
@Nullable
public static String [] getAllMatchingGroupValues (@Nonnull @RegEx final String sRegEx, @Nonnull final String sValue)
{
final Matcher aMatcher = getMatcher (sRegEx, sValue);
if (!aMatcher.find ())
{
// Values does not match RegEx
return null;
}
// groupCount is excluding the .group(0) match!!!
final int nGroupCount = aMatcher.groupCount ();
final String [] ret = new String [nGroupCount];
for (int i = 0; i < nGroupCount; ++i)
ret[i] = aMatcher.group (i + 1);
return ret;
} }
|
public class class_name {
@Nullable
public static String [] getAllMatchingGroupValues (@Nonnull @RegEx final String sRegEx, @Nonnull final String sValue)
{
final Matcher aMatcher = getMatcher (sRegEx, sValue);
if (!aMatcher.find ())
{
// Values does not match RegEx
return null; // depends on control dependency: [if], data = [none]
}
// groupCount is excluding the .group(0) match!!!
final int nGroupCount = aMatcher.groupCount ();
final String [] ret = new String [nGroupCount];
for (int i = 0; i < nGroupCount; ++i)
ret[i] = aMatcher.group (i + 1);
return ret;
} }
|
public class class_name {
public static void registerMessageSourceIfNecessary(BeanDefinitionRegistry registry,
String[] messageBaseNames) {
if (!registry.containsBeanDefinition(MESSAGE_SOURCE_BEAN_NAME)) {
GenericBeanDefinition messageSource = new GenericBeanDefinition();
messageSource.setBeanClass(ReloadableResourceBundleMessageSource.class);
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.addPropertyValue("useCodeAsDefaultMessage", true);
propertyValues.addPropertyValue("defaultEncoding", "UTF-8"); // properties文件也将使用UTF-8编辑,而非默认的ISO-9959-1
propertyValues.addPropertyValue("cacheSeconds", 60); // 暂时hardcode! seconds
propertyValues.addPropertyValue("basenames", messageBaseNames);
messageSource.setPropertyValues(propertyValues);
registry.registerBeanDefinition(MESSAGE_SOURCE_BEAN_NAME, messageSource);
}
} }
|
public class class_name {
public static void registerMessageSourceIfNecessary(BeanDefinitionRegistry registry,
String[] messageBaseNames) {
if (!registry.containsBeanDefinition(MESSAGE_SOURCE_BEAN_NAME)) {
GenericBeanDefinition messageSource = new GenericBeanDefinition();
messageSource.setBeanClass(ReloadableResourceBundleMessageSource.class); // depends on control dependency: [if], data = [none]
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.addPropertyValue("useCodeAsDefaultMessage", true); // depends on control dependency: [if], data = [none]
propertyValues.addPropertyValue("defaultEncoding", "UTF-8"); // properties文件也将使用UTF-8编辑,而非默认的ISO-9959-1 // depends on control dependency: [if], data = [none]
propertyValues.addPropertyValue("cacheSeconds", 60); // 暂时hardcode! seconds // depends on control dependency: [if], data = [none]
propertyValues.addPropertyValue("basenames", messageBaseNames); // depends on control dependency: [if], data = [none]
messageSource.setPropertyValues(propertyValues); // depends on control dependency: [if], data = [none]
registry.registerBeanDefinition(MESSAGE_SOURCE_BEAN_NAME, messageSource); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setButtonDrawable(Drawable d) {
if (drawable != d) {
if (drawable != null) {
drawable.setCallback(null);
unscheduleDrawable(drawable);
}
drawable = d;
if (d != null) {
d.setCallback(this);
//d.setLayoutDirection(getLayoutDirection());
if (d.isStateful()) {
d.setState(getDrawableState());
}
d.setVisible(getVisibility() == VISIBLE, false);
setMinHeight(d.getIntrinsicHeight());
updateButtonTint();
}
}
} }
|
public class class_name {
public void setButtonDrawable(Drawable d) {
if (drawable != d) {
if (drawable != null) {
drawable.setCallback(null); // depends on control dependency: [if], data = [null)]
unscheduleDrawable(drawable); // depends on control dependency: [if], data = [(drawable]
}
drawable = d; // depends on control dependency: [if], data = [none]
if (d != null) {
d.setCallback(this); // depends on control dependency: [if], data = [none]
//d.setLayoutDirection(getLayoutDirection());
if (d.isStateful()) {
d.setState(getDrawableState()); // depends on control dependency: [if], data = [none]
}
d.setVisible(getVisibility() == VISIBLE, false); // depends on control dependency: [if], data = [none]
setMinHeight(d.getIntrinsicHeight()); // depends on control dependency: [if], data = [(d]
updateButtonTint(); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public GVRPose computeSkinPose()
{
if (mInverseBindPose == null)
{
return null;
}
mPose.sync();
if (mSkinPose == null)
{
mSkinPose = new GVRPose(mPose);
}
else
{
mSkinPose.copy(mPose);
}
mSkinPose.combine(mInverseBindPose);
return mSkinPose;
} }
|
public class class_name {
public GVRPose computeSkinPose()
{
if (mInverseBindPose == null)
{
return null; // depends on control dependency: [if], data = [none]
}
mPose.sync();
if (mSkinPose == null)
{
mSkinPose = new GVRPose(mPose); // depends on control dependency: [if], data = [none]
}
else
{
mSkinPose.copy(mPose); // depends on control dependency: [if], data = [none]
}
mSkinPose.combine(mInverseBindPose);
return mSkinPose;
} }
|
public class class_name {
@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity",
"checkstyle:nestedifdepth"})
public RoadPath addAndGetPath(RoadPath end) {
RoadPath selectedPath = null;
if (end != null && !end.isEmpty()) {
RoadConnection first = end.getFirstPoint();
RoadConnection last = end.getLastPoint();
assert first != null;
assert last != null;
first = first.getWrappedRoadConnection();
last = last.getWrappedRoadConnection();
assert first != null;
assert last != null;
if (this.paths.isEmpty()) {
this.paths.add(end);
selectedPath = end;
} else {
RoadPath connectToFirst = null;
RoadPath connectToLast = null;
final Iterator<RoadPath> pathIterator = this.paths.iterator();
RoadPath path;
while ((connectToFirst == null || connectToLast == null) && pathIterator.hasNext()) {
path = pathIterator.next();
if (connectToFirst == null) {
if (first.equals(path.getFirstPoint())) {
connectToFirst = path;
} else if (first.equals(path.getLastPoint())) {
connectToFirst = path;
}
}
if (connectToLast == null) {
if (last.equals(path.getFirstPoint())) {
connectToLast = path;
} else if (last.equals(path.getLastPoint())) {
connectToLast = path;
}
}
}
if (connectToFirst != null && connectToLast != null && !connectToLast.equals(connectToFirst)) {
// a) Select the biggest path as reference
// b) Remove the nonreference path that is connected to the new path
// c) Add the components of the new path into the reference path
// d) Reinject the components of the nonreference path.
// --
// a)
final RoadPath reference;
final RoadPath nonreference;
if (connectToFirst.size() > connectToLast.size()) {
reference = connectToFirst;
nonreference = connectToLast;
} else {
reference = connectToLast;
nonreference = connectToFirst;
}
// b)
if (this.paths.remove(nonreference)) {
// c)
if (!RoadPath.addPathToPath(reference, end)) {
// Reinject the remove elements.
this.paths.add(nonreference);
} else {
// d)
if (!RoadPath.addPathToPath(reference, nonreference)) {
// Reinject the remove elements.
this.paths.add(nonreference);
} else {
selectedPath = reference;
}
}
}
} else if (connectToFirst != null) {
if (RoadPath.addPathToPath(connectToFirst, end)) {
selectedPath = connectToFirst;
}
} else if (connectToLast != null) {
if (RoadPath.addPathToPath(connectToLast, end)) {
selectedPath = connectToLast;
}
} else if (this.paths.add(end)) {
selectedPath = end;
}
}
if (selectedPath != null) {
this.segmentCount += end.size();
}
}
return selectedPath;
} }
|
public class class_name {
@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity",
"checkstyle:nestedifdepth"})
public RoadPath addAndGetPath(RoadPath end) {
RoadPath selectedPath = null;
if (end != null && !end.isEmpty()) {
RoadConnection first = end.getFirstPoint();
RoadConnection last = end.getLastPoint();
assert first != null;
assert last != null;
first = first.getWrappedRoadConnection(); // depends on control dependency: [if], data = [none]
last = last.getWrappedRoadConnection(); // depends on control dependency: [if], data = [none]
assert first != null;
assert last != null;
if (this.paths.isEmpty()) {
this.paths.add(end); // depends on control dependency: [if], data = [none]
selectedPath = end; // depends on control dependency: [if], data = [none]
} else {
RoadPath connectToFirst = null;
RoadPath connectToLast = null;
final Iterator<RoadPath> pathIterator = this.paths.iterator();
RoadPath path;
while ((connectToFirst == null || connectToLast == null) && pathIterator.hasNext()) {
path = pathIterator.next(); // depends on control dependency: [while], data = [none]
if (connectToFirst == null) {
if (first.equals(path.getFirstPoint())) {
connectToFirst = path; // depends on control dependency: [if], data = [none]
} else if (first.equals(path.getLastPoint())) {
connectToFirst = path; // depends on control dependency: [if], data = [none]
}
}
if (connectToLast == null) {
if (last.equals(path.getFirstPoint())) {
connectToLast = path; // depends on control dependency: [if], data = [none]
} else if (last.equals(path.getLastPoint())) {
connectToLast = path; // depends on control dependency: [if], data = [none]
}
}
}
if (connectToFirst != null && connectToLast != null && !connectToLast.equals(connectToFirst)) {
// a) Select the biggest path as reference
// b) Remove the nonreference path that is connected to the new path
// c) Add the components of the new path into the reference path
// d) Reinject the components of the nonreference path.
// --
// a)
final RoadPath reference;
final RoadPath nonreference;
if (connectToFirst.size() > connectToLast.size()) {
reference = connectToFirst; // depends on control dependency: [if], data = [none]
nonreference = connectToLast; // depends on control dependency: [if], data = [none]
} else {
reference = connectToLast; // depends on control dependency: [if], data = [none]
nonreference = connectToFirst; // depends on control dependency: [if], data = [none]
}
// b)
if (this.paths.remove(nonreference)) {
// c)
if (!RoadPath.addPathToPath(reference, end)) {
// Reinject the remove elements.
this.paths.add(nonreference); // depends on control dependency: [if], data = [none]
} else {
// d)
if (!RoadPath.addPathToPath(reference, nonreference)) {
// Reinject the remove elements.
this.paths.add(nonreference); // depends on control dependency: [if], data = [none]
} else {
selectedPath = reference; // depends on control dependency: [if], data = [none]
}
}
}
} else if (connectToFirst != null) {
if (RoadPath.addPathToPath(connectToFirst, end)) {
selectedPath = connectToFirst; // depends on control dependency: [if], data = [none]
}
} else if (connectToLast != null) {
if (RoadPath.addPathToPath(connectToLast, end)) {
selectedPath = connectToLast; // depends on control dependency: [if], data = [none]
}
} else if (this.paths.add(end)) {
selectedPath = end; // depends on control dependency: [if], data = [none]
}
}
if (selectedPath != null) {
this.segmentCount += end.size(); // depends on control dependency: [if], data = [none]
}
}
return selectedPath;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.