code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public static Person createPerson(final JAASSystem _jaasSystem, final String _jaasKey, final String _userName, final String _uuid) throws EFapsException { long persId = 0; final Type persType = CIAdminUser.Person.getType(); Connection con = null; try { final Context context = Context.getThreadContext(); con = Context.getConnection(); PreparedStatement stmt = null; try { StringBuilder cmd = new StringBuilder(); // TODO: check for uniqueness! if (Context.getDbType().supportsGetGeneratedKeys()) { cmd.append("insert into ").append(persType.getMainTable().getSqlTable()).append( "(TYPEID,NAME,UUID,CREATOR,CREATED,MODIFIER,MODIFIED) ").append("values ("); } else { persId = Context.getDbType().getNewId(new ConnectionResource(con), persType.getMainTable().getSqlTable(), "ID"); cmd.append("insert into ").append(persType.getMainTable().getSqlTable()) .append("(ID,TYPEID,NAME,UUID,CREATOR,CREATED,MODIFIER,MODIFIED) ") .append("values (").append(persId).append(","); } cmd.append(persType.getId()).append(",") .append("'").append(_userName).append("',") .append("'").append(_uuid == null ? "" : _uuid).append("',") .append(context.getPersonId()) .append(",").append(Context.getDbType().getCurrentTimeStamp()).append(",") .append(context.getPersonId()).append(",") .append(Context.getDbType().getCurrentTimeStamp()).append(")"); if (persId == 0) { stmt = con.prepareStatement(cmd.toString(), new String[] { "ID" }); } else { stmt = con.prepareStatement(cmd.toString()); } int rows = stmt.executeUpdate(); if (rows == 0) { Person.LOG.error("could not execute '" + cmd.toString() + "' for JAAS system '" + _jaasSystem.getName() + "' person with key '" + _jaasKey + "' and user name '" + _userName + "'"); throw new EFapsException(Person.class, "createPerson.NotInserted", cmd.toString(), _jaasSystem .getName(), _jaasKey, _userName); } if (persId == 0) { final ResultSet resultset = stmt.getGeneratedKeys(); if (resultset.next()) { persId = resultset.getLong(1); } } stmt.close(); cmd = new StringBuilder(); cmd.append("insert into T_USERPERSON").append("(ID,FIRSTNAME,LASTNAME) ") .append("values (").append(persId).append(",'-','-')"); stmt = con.prepareStatement(cmd.toString()); rows = stmt.executeUpdate(); if (rows == 0) { Person.LOG.error("could not execute '" + cmd.toString() + "' for JAAS system '" + _jaasSystem.getName() + "' person with key '" + _jaasKey + "' and user name '" + _userName + "'"); throw new EFapsException(Person.class, "createPerson.NotInserted", cmd.toString(), _jaasSystem .getName(), _jaasKey, _userName); } cmd = new StringBuilder(); cmd.append("insert into T_CMGENINST").append("(INSTTYPEID,INSTID,EXID,EXSYSID) ") .append("values (").append(persType.getId()).append(",").append(persId).append(",0,0)"); stmt = con.prepareStatement(cmd.toString()); stmt.executeUpdate(); } catch (final SQLException e) { Person.LOG.error("could not create for JAAS system '" + _jaasSystem.getName() + "' person with key '" + _jaasKey + "' and user name '" + _userName + "'", e); throw new EFapsException(Person.class, "createPerson.SQLException", e, _jaasSystem.getName(), _jaasKey, _userName); } finally { try { if (stmt != null) { stmt.close(); con.commit(); } } catch (final SQLException e) { throw new EFapsException(Person.class, "createPerson.SQLException", e, _jaasSystem.getName(), _jaasKey); } } } finally { try { if (con != null && !con.isClosed()) { con.close(); } } catch (final SQLException e) { throw new EFapsException(Person.class, "updateLastLogin.SQLException", e); } } final Person ret = Person.get(persId); ret.assignToJAASSystem(_jaasSystem, _jaasKey); return ret; } }
public class class_name { public static Person createPerson(final JAASSystem _jaasSystem, final String _jaasKey, final String _userName, final String _uuid) throws EFapsException { long persId = 0; final Type persType = CIAdminUser.Person.getType(); Connection con = null; try { final Context context = Context.getThreadContext(); con = Context.getConnection(); PreparedStatement stmt = null; try { StringBuilder cmd = new StringBuilder(); // TODO: check for uniqueness! if (Context.getDbType().supportsGetGeneratedKeys()) { cmd.append("insert into ").append(persType.getMainTable().getSqlTable()).append( "(TYPEID,NAME,UUID,CREATOR,CREATED,MODIFIER,MODIFIED) ").append("values ("); // depends on control dependency: [if], data = [none] } else { persId = Context.getDbType().getNewId(new ConnectionResource(con), persType.getMainTable().getSqlTable(), "ID"); // depends on control dependency: [if], data = [none] cmd.append("insert into ").append(persType.getMainTable().getSqlTable()) .append("(ID,TYPEID,NAME,UUID,CREATOR,CREATED,MODIFIER,MODIFIED) ") .append("values (").append(persId).append(","); // depends on control dependency: [if], data = [none] } cmd.append(persType.getId()).append(",") .append("'").append(_userName).append("',") .append("'").append(_uuid == null ? "" : _uuid).append("',") .append(context.getPersonId()) .append(",").append(Context.getDbType().getCurrentTimeStamp()).append(",") .append(context.getPersonId()).append(",") .append(Context.getDbType().getCurrentTimeStamp()).append(")"); // depends on control dependency: [try], data = [none] if (persId == 0) { stmt = con.prepareStatement(cmd.toString(), new String[] { "ID" }); // depends on control dependency: [if], data = [none] } else { stmt = con.prepareStatement(cmd.toString()); // depends on control dependency: [if], data = [none] } int rows = stmt.executeUpdate(); if (rows == 0) { Person.LOG.error("could not execute '" + cmd.toString() + "' for JAAS system '" + _jaasSystem.getName() + "' person with key '" + _jaasKey + "' and user name '" + _userName + "'"); // depends on control dependency: [if], data = [none] throw new EFapsException(Person.class, "createPerson.NotInserted", cmd.toString(), _jaasSystem .getName(), _jaasKey, _userName); } if (persId == 0) { final ResultSet resultset = stmt.getGeneratedKeys(); if (resultset.next()) { persId = resultset.getLong(1); // depends on control dependency: [if], data = [none] } } stmt.close(); // depends on control dependency: [try], data = [none] cmd = new StringBuilder(); // depends on control dependency: [try], data = [none] cmd.append("insert into T_USERPERSON").append("(ID,FIRSTNAME,LASTNAME) ") .append("values (").append(persId).append(",'-','-')"); // depends on control dependency: [try], data = [none] stmt = con.prepareStatement(cmd.toString()); // depends on control dependency: [try], data = [none] rows = stmt.executeUpdate(); // depends on control dependency: [try], data = [none] if (rows == 0) { Person.LOG.error("could not execute '" + cmd.toString() + "' for JAAS system '" + _jaasSystem.getName() + "' person with key '" + _jaasKey + "' and user name '" + _userName + "'"); // depends on control dependency: [if], data = [none] throw new EFapsException(Person.class, "createPerson.NotInserted", cmd.toString(), _jaasSystem .getName(), _jaasKey, _userName); } cmd = new StringBuilder(); // depends on control dependency: [try], data = [none] cmd.append("insert into T_CMGENINST").append("(INSTTYPEID,INSTID,EXID,EXSYSID) ") .append("values (").append(persType.getId()).append(",").append(persId).append(",0,0)"); // depends on control dependency: [try], data = [none] stmt = con.prepareStatement(cmd.toString()); // depends on control dependency: [try], data = [none] stmt.executeUpdate(); // depends on control dependency: [try], data = [none] } catch (final SQLException e) { Person.LOG.error("could not create for JAAS system '" + _jaasSystem.getName() + "' person with key '" + _jaasKey + "' and user name '" + _userName + "'", e); throw new EFapsException(Person.class, "createPerson.SQLException", e, _jaasSystem.getName(), _jaasKey, _userName); } finally { // depends on control dependency: [catch], data = [none] try { if (stmt != null) { stmt.close(); // depends on control dependency: [if], data = [none] con.commit(); // depends on control dependency: [if], data = [none] } } catch (final SQLException e) { throw new EFapsException(Person.class, "createPerson.SQLException", e, _jaasSystem.getName(), _jaasKey); } // depends on control dependency: [catch], data = [none] } } finally { try { if (con != null && !con.isClosed()) { con.close(); // depends on control dependency: [if], data = [none] } } catch (final SQLException e) { throw new EFapsException(Person.class, "updateLastLogin.SQLException", e); } // depends on control dependency: [catch], data = [none] } final Person ret = Person.get(persId); ret.assignToJAASSystem(_jaasSystem, _jaasKey); return ret; } }
public class class_name { private void setupTempLists() { //synchronized(this){ //d173022.2 //d115597 if necessary create a new tempList // and list of currentBeanOs. Always delay this until actually needed //d115597 if (tempList == null) { tempList = new ArrayList<BeanO>(); currentBeanOs = new HashMap<BeanId, BeanO>();//should release old list } //} } }
public class class_name { private void setupTempLists() { //synchronized(this){ //d173022.2 //d115597 if necessary create a new tempList // and list of currentBeanOs. Always delay this until actually needed //d115597 if (tempList == null) { tempList = new ArrayList<BeanO>(); // depends on control dependency: [if], data = [none] currentBeanOs = new HashMap<BeanId, BeanO>();//should release old list // depends on control dependency: [if], data = [none] } //} } }
public class class_name { public static LocalFileDataWriter create(final FileSystemContext context, final WorkerNetAddress address, long blockId, OutStreamOptions options) throws IOException { AlluxioConfiguration conf = context.getClusterConf(); long chunkSize = conf.getBytes(PropertyKey.USER_LOCAL_WRITER_CHUNK_SIZE_BYTES); Closer closer = Closer.create(); try { final BlockWorkerClient blockWorker = context.acquireBlockWorkerClient(address); closer.register(() -> context.releaseBlockWorkerClient(address, blockWorker)); int writerBufferSizeMessages = conf.getInt(PropertyKey.USER_NETWORK_WRITER_BUFFER_SIZE_MESSAGES); long fileBufferByes = conf.getBytes(PropertyKey.USER_FILE_BUFFER_BYTES); long dataTimeout = conf.getMs(PropertyKey.USER_NETWORK_DATA_TIMEOUT_MS); CreateLocalBlockRequest.Builder builder = CreateLocalBlockRequest.newBuilder().setBlockId(blockId) .setTier(options.getWriteTier()).setSpaceToReserve(fileBufferByes); if (options.getWriteType() == WriteType.ASYNC_THROUGH && conf.getBoolean(PropertyKey.USER_FILE_UFS_TIER_ENABLED)) { builder.setCleanupOnFailure(false); } CreateLocalBlockRequest createRequest = builder.build(); GrpcBlockingStream<CreateLocalBlockRequest, CreateLocalBlockResponse> stream = new GrpcBlockingStream<>(blockWorker::createLocalBlock, writerBufferSizeMessages, MoreObjects.toStringHelper(LocalFileDataWriter.class) .add("request", createRequest) .add("address", address) .toString()); stream.send(createRequest, dataTimeout); CreateLocalBlockResponse response = stream.receive(dataTimeout); Preconditions.checkState(response != null && response.hasPath()); LocalFileBlockWriter writer = closer.register(new LocalFileBlockWriter(response.getPath())); return new LocalFileDataWriter(chunkSize, blockWorker, writer, createRequest, stream, closer, fileBufferByes, dataTimeout); } catch (Exception e) { throw CommonUtils.closeAndRethrow(closer, e); } } }
public class class_name { public static LocalFileDataWriter create(final FileSystemContext context, final WorkerNetAddress address, long blockId, OutStreamOptions options) throws IOException { AlluxioConfiguration conf = context.getClusterConf(); long chunkSize = conf.getBytes(PropertyKey.USER_LOCAL_WRITER_CHUNK_SIZE_BYTES); Closer closer = Closer.create(); try { final BlockWorkerClient blockWorker = context.acquireBlockWorkerClient(address); closer.register(() -> context.releaseBlockWorkerClient(address, blockWorker)); int writerBufferSizeMessages = conf.getInt(PropertyKey.USER_NETWORK_WRITER_BUFFER_SIZE_MESSAGES); long fileBufferByes = conf.getBytes(PropertyKey.USER_FILE_BUFFER_BYTES); long dataTimeout = conf.getMs(PropertyKey.USER_NETWORK_DATA_TIMEOUT_MS); CreateLocalBlockRequest.Builder builder = CreateLocalBlockRequest.newBuilder().setBlockId(blockId) .setTier(options.getWriteTier()).setSpaceToReserve(fileBufferByes); if (options.getWriteType() == WriteType.ASYNC_THROUGH && conf.getBoolean(PropertyKey.USER_FILE_UFS_TIER_ENABLED)) { builder.setCleanupOnFailure(false); // depends on control dependency: [if], data = [none] } CreateLocalBlockRequest createRequest = builder.build(); GrpcBlockingStream<CreateLocalBlockRequest, CreateLocalBlockResponse> stream = new GrpcBlockingStream<>(blockWorker::createLocalBlock, writerBufferSizeMessages, MoreObjects.toStringHelper(LocalFileDataWriter.class) .add("request", createRequest) .add("address", address) .toString()); stream.send(createRequest, dataTimeout); CreateLocalBlockResponse response = stream.receive(dataTimeout); Preconditions.checkState(response != null && response.hasPath()); LocalFileBlockWriter writer = closer.register(new LocalFileBlockWriter(response.getPath())); return new LocalFileDataWriter(chunkSize, blockWorker, writer, createRequest, stream, closer, fileBufferByes, dataTimeout); } catch (Exception e) { throw CommonUtils.closeAndRethrow(closer, e); } } }
public class class_name { protected int loadExpires(Scriptable cfg) { int expires = 0; Object oExpires = cfg.get(EXPIRES_CONFIGPARAM, cfg); if (oExpires != Scriptable.NOT_FOUND) { try { expires = Integer.parseInt(toString(oExpires)); } catch (NumberFormatException ignore) { throw new IllegalArgumentException(EXPIRES_CONFIGPARAM+"="+oExpires); //$NON-NLS-1$ } } return expires; } }
public class class_name { protected int loadExpires(Scriptable cfg) { int expires = 0; Object oExpires = cfg.get(EXPIRES_CONFIGPARAM, cfg); if (oExpires != Scriptable.NOT_FOUND) { try { expires = Integer.parseInt(toString(oExpires)); // depends on control dependency: [try], data = [none] } catch (NumberFormatException ignore) { throw new IllegalArgumentException(EXPIRES_CONFIGPARAM+"="+oExpires); //$NON-NLS-1$ } // depends on control dependency: [catch], data = [none] } return expires; } }
public class class_name { public void removeSuperfluousArtifacts(Set<String> recentlyCompiled) { // Nothing to do, if nothing was recompiled. if (recentlyCompiled.size() == 0) return; for (String pkg : now.packages().keySet()) { // If this package has not been recompiled, skip the check. if (!recentlyCompiled.contains(pkg)) continue; Collection<File> arts = now.artifacts().values(); for (File f : fetchPrevArtifacts(pkg).values()) { if (!arts.contains(f)) { Log.debug("Removing "+f.getPath()+" since it is now superfluous!"); if (f.exists()) f.delete(); } } } } }
public class class_name { public void removeSuperfluousArtifacts(Set<String> recentlyCompiled) { // Nothing to do, if nothing was recompiled. if (recentlyCompiled.size() == 0) return; for (String pkg : now.packages().keySet()) { // If this package has not been recompiled, skip the check. if (!recentlyCompiled.contains(pkg)) continue; Collection<File> arts = now.artifacts().values(); for (File f : fetchPrevArtifacts(pkg).values()) { if (!arts.contains(f)) { Log.debug("Removing "+f.getPath()+" since it is now superfluous!"); // depends on control dependency: [if], data = [none] if (f.exists()) f.delete(); } } } } }
public class class_name { public static boolean start(RootDoc root) { List<Object> objs = new ArrayList<>(); for (ClassDoc doc : root.specifiedClasses()) { // TODO: Class.forName() expects a binary name but doc.qualifiedName() // returns a fully qualified name. I do not know a good way to convert // between these two name formats. For now, we simply ignore inner // classes. This limitation can be removed when we figure out a better // way to go from ClassDoc to Class<?>. if (doc.containingClass() != null) { continue; } Class<?> clazz; try { @SuppressWarnings("signature") // Javadoc source code is not yet annotated @BinaryName String className = doc.qualifiedName(); clazz = Class.forName(className, true, Thread.currentThread().getContextClassLoader()); } catch (ClassNotFoundException e) { e.printStackTrace(); Options.printClassPath(); return false; } if (needsInstantiation(clazz)) { try { Constructor<?> c = clazz.getDeclaredConstructor(); c.setAccessible(true); objs.add(c.newInstance(new Object[0])); } catch (Exception e) { e.printStackTrace(); return false; } } else { objs.add(clazz); } } if (objs.isEmpty()) { System.out.println("Error: no classes found"); return false; } Object[] objarray = objs.toArray(); Options options = new Options(objarray); if (options.getOptions().size() < 1) { System.out.println("Error: no @Option-annotated fields found"); return false; } OptionsDoclet o = new OptionsDoclet(root, options); o.setOptions(root.options()); o.processJavadoc(); try { o.write(); } catch (Exception e) { e.printStackTrace(); return false; } return true; } }
public class class_name { public static boolean start(RootDoc root) { List<Object> objs = new ArrayList<>(); for (ClassDoc doc : root.specifiedClasses()) { // TODO: Class.forName() expects a binary name but doc.qualifiedName() // returns a fully qualified name. I do not know a good way to convert // between these two name formats. For now, we simply ignore inner // classes. This limitation can be removed when we figure out a better // way to go from ClassDoc to Class<?>. if (doc.containingClass() != null) { continue; } Class<?> clazz; try { @SuppressWarnings("signature") // Javadoc source code is not yet annotated @BinaryName String className = doc.qualifiedName(); clazz = Class.forName(className, true, Thread.currentThread().getContextClassLoader()); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException e) { e.printStackTrace(); Options.printClassPath(); return false; } // depends on control dependency: [catch], data = [none] if (needsInstantiation(clazz)) { try { Constructor<?> c = clazz.getDeclaredConstructor(); c.setAccessible(true); // depends on control dependency: [try], data = [none] objs.add(c.newInstance(new Object[0])); // depends on control dependency: [try], data = [none] } catch (Exception e) { e.printStackTrace(); return false; } // depends on control dependency: [catch], data = [none] } else { objs.add(clazz); // depends on control dependency: [if], data = [none] } } if (objs.isEmpty()) { System.out.println("Error: no classes found"); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } Object[] objarray = objs.toArray(); Options options = new Options(objarray); if (options.getOptions().size() < 1) { System.out.println("Error: no @Option-annotated fields found"); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } OptionsDoclet o = new OptionsDoclet(root, options); o.setOptions(root.options()); o.processJavadoc(); try { o.write(); // depends on control dependency: [try], data = [none] } catch (Exception e) { e.printStackTrace(); return false; } // depends on control dependency: [catch], data = [none] return true; } }
public class class_name { private ArrayList<String> getBuckets() { String bucketList = getString(KEY_BUCKETS); if (bucketList.equals(NO_STRING_VALUE)) { return new ArrayList<>(); } else { return deserializeString(bucketList); } } }
public class class_name { private ArrayList<String> getBuckets() { String bucketList = getString(KEY_BUCKETS); if (bucketList.equals(NO_STRING_VALUE)) { return new ArrayList<>(); // depends on control dependency: [if], data = [none] } else { return deserializeString(bucketList); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void setResourceAdapter(final ResourceAdapter resourceAdapter) { if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) { SibTr.debug(this, TRACE, "setResourceAdapter", resourceAdapter); } _resourceAdapter = resourceAdapter; } }
public class class_name { @Override public void setResourceAdapter(final ResourceAdapter resourceAdapter) { if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) { SibTr.debug(this, TRACE, "setResourceAdapter", resourceAdapter); // depends on control dependency: [if], data = [none] } _resourceAdapter = resourceAdapter; } }
public class class_name { protected final <R extends AbstractPutObjectRequest> R wrapWithCipher( final R request, ContentCryptoMaterial cekMaterial) { // Create a new metadata object if there is no metadata already. ObjectMetadata metadata = request.getMetadata(); if (metadata == null) { metadata = new ObjectMetadata(); } // Record the original Content MD5, if present, for the unencrypted data if (metadata.getContentMD5() != null) { metadata.addUserMetadata(Headers.UNENCRYPTED_CONTENT_MD5, metadata.getContentMD5()); } // Removes the original content MD5 if present from the meta data. metadata.setContentMD5(null); // Record the original, unencrypted content-length so it can be accessed // later final long plaintextLength = plaintextLength(request, metadata); if (plaintextLength >= 0) { metadata.addUserMetadata(Headers.UNENCRYPTED_CONTENT_LENGTH, Long.toString(plaintextLength)); // Put the ciphertext length in the metadata metadata.setContentLength(ciphertextLength(plaintextLength)); } request.setMetadata(metadata); request.setInputStream(newS3CipherLiteInputStream( request, cekMaterial, plaintextLength)); // Treat all encryption requests as input stream upload requests, not as // file upload requests. request.setFile(null); return request; } }
public class class_name { protected final <R extends AbstractPutObjectRequest> R wrapWithCipher( final R request, ContentCryptoMaterial cekMaterial) { // Create a new metadata object if there is no metadata already. ObjectMetadata metadata = request.getMetadata(); if (metadata == null) { metadata = new ObjectMetadata(); // depends on control dependency: [if], data = [none] } // Record the original Content MD5, if present, for the unencrypted data if (metadata.getContentMD5() != null) { metadata.addUserMetadata(Headers.UNENCRYPTED_CONTENT_MD5, metadata.getContentMD5()); // depends on control dependency: [if], data = [none] } // Removes the original content MD5 if present from the meta data. metadata.setContentMD5(null); // Record the original, unencrypted content-length so it can be accessed // later final long plaintextLength = plaintextLength(request, metadata); if (plaintextLength >= 0) { metadata.addUserMetadata(Headers.UNENCRYPTED_CONTENT_LENGTH, Long.toString(plaintextLength)); // depends on control dependency: [if], data = [none] // Put the ciphertext length in the metadata metadata.setContentLength(ciphertextLength(plaintextLength)); // depends on control dependency: [if], data = [(plaintextLength] } request.setMetadata(metadata); request.setInputStream(newS3CipherLiteInputStream( request, cekMaterial, plaintextLength)); // Treat all encryption requests as input stream upload requests, not as // file upload requests. request.setFile(null); return request; } }
public class class_name { public static String getEthernetAddress() { try { InetAddress ip = InetAddress.getLocalHost(); if (!ip.isLoopbackAddress()) { NetworkInterface network = NetworkInterface.getByInetAddress(ip); byte[] mac = network.getHardwareAddress(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < mac.length; i++) { sb.append(String.format("%02X%s", new Byte(mac[i]), (i < (mac.length - 1)) ? ":" : "")); } return sb.toString(); } } catch (Throwable t) { // if an exception occurred return a dummy address } // return a dummy ethernet address, if the ip is representing the loopback address or in case of exceptions return CmsUUID.getDummyEthernetAddress(); } }
public class class_name { public static String getEthernetAddress() { try { InetAddress ip = InetAddress.getLocalHost(); if (!ip.isLoopbackAddress()) { NetworkInterface network = NetworkInterface.getByInetAddress(ip); byte[] mac = network.getHardwareAddress(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < mac.length; i++) { sb.append(String.format("%02X%s", new Byte(mac[i]), (i < (mac.length - 1)) ? ":" : "")); // depends on control dependency: [for], data = [i] } return sb.toString(); // depends on control dependency: [if], data = [none] } } catch (Throwable t) { // if an exception occurred return a dummy address } // depends on control dependency: [catch], data = [none] // return a dummy ethernet address, if the ip is representing the loopback address or in case of exceptions return CmsUUID.getDummyEthernetAddress(); } }
public class class_name { public boolean isEquivalent(Plugin testPlugin) { // only do full check if an instance of this class if (testPlugin instanceof JMSReceiver) { JMSReceiver receiver = (JMSReceiver)testPlugin; // check for same topic name and super class equivalency return ( topicFactoryName.equals(receiver.getTopicFactoryName()) && (jndiPath == null || jndiPath.equals(receiver.getJndiPath())) && super.isEquivalent(testPlugin) ); } return false; } }
public class class_name { public boolean isEquivalent(Plugin testPlugin) { // only do full check if an instance of this class if (testPlugin instanceof JMSReceiver) { JMSReceiver receiver = (JMSReceiver)testPlugin; // check for same topic name and super class equivalency return ( topicFactoryName.equals(receiver.getTopicFactoryName()) && (jndiPath == null || jndiPath.equals(receiver.getJndiPath())) && super.isEquivalent(testPlugin) ); // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public void dropIndex(Session session, String indexname) { // find the array index for indexname and remove int todrop = getIndexIndex(indexname); indexList = (Index[]) ArrayUtil.toAdjustedArray(indexList, null, todrop, -1); for (int i = 0; i < indexList.length; i++) { indexList[i].setPosition(i); } setBestRowIdentifiers(); if (store != null) { store.resetAccessorKeys(indexList); } } }
public class class_name { public void dropIndex(Session session, String indexname) { // find the array index for indexname and remove int todrop = getIndexIndex(indexname); indexList = (Index[]) ArrayUtil.toAdjustedArray(indexList, null, todrop, -1); for (int i = 0; i < indexList.length; i++) { indexList[i].setPosition(i); // depends on control dependency: [for], data = [i] } setBestRowIdentifiers(); if (store != null) { store.resetAccessorKeys(indexList); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public StringBuffer getClientSideBundles(Map<String, String> variants, boolean useGzip) { StringBuffer sb = new StringBuffer(); addAllBundles(globalBundles, variants, sb, useGzip); if (!globalBundles.isEmpty() && !contextBundles.isEmpty()) { sb.append(","); } addAllBundles(contextBundles, variants, sb, useGzip); return sb; } }
public class class_name { @Override public StringBuffer getClientSideBundles(Map<String, String> variants, boolean useGzip) { StringBuffer sb = new StringBuffer(); addAllBundles(globalBundles, variants, sb, useGzip); if (!globalBundles.isEmpty() && !contextBundles.isEmpty()) { sb.append(","); // depends on control dependency: [if], data = [none] } addAllBundles(contextBundles, variants, sb, useGzip); return sb; } }
public class class_name { private static Type[] getExactDirectSuperTypes(Type type) { if (type instanceof ParameterizedType || type instanceof Class) { Class<?> clazz; if (type instanceof ParameterizedType) { clazz = (Class<?>)((ParameterizedType)type).getRawType(); } else { // TODO primitive types? clazz = (Class<?>)type; if (clazz.isArray()) return getArrayExactDirectSuperTypes(clazz); } Type[] superInterfaces = clazz.getGenericInterfaces(); Type superClass = clazz.getGenericSuperclass(); // the only supertype of an interface without superinterfaces is Object if (superClass == null && superInterfaces.length == 0 && clazz.isInterface()) { return new Type[] {Object.class}; } Type[] result; int resultIndex; if (superClass == null) { result = new Type[superInterfaces.length]; resultIndex = 0; } else { result = new Type[superInterfaces.length + 1]; resultIndex = 1; result[0] = mapTypeParameters(superClass, type); } for (Type superInterface : superInterfaces) { result[resultIndex++] = mapTypeParameters(superInterface, type); } return result; } else if (type instanceof TypeVariable) { TypeVariable<?> tv = (TypeVariable<?>) type; return tv.getBounds(); } else if (type instanceof WildcardType) { // This should be a rare case: normally this wildcard is already captured. // But it does happen if the upper bound of a type variable contains a wildcard // TODO shouldn't upper bound of type variable have been captured too? (making this case impossible?) return ((WildcardType) type).getUpperBounds(); } else if (type instanceof CaptureType) { return ((CaptureType)type).getUpperBounds(); } else if (type instanceof GenericArrayType) { return getArrayExactDirectSuperTypes(type); } else if (type == null) { throw new NullPointerException(); } else { throw new RuntimeException("not implemented type: " + type); } } }
public class class_name { private static Type[] getExactDirectSuperTypes(Type type) { if (type instanceof ParameterizedType || type instanceof Class) { Class<?> clazz; if (type instanceof ParameterizedType) { clazz = (Class<?>)((ParameterizedType)type).getRawType(); // depends on control dependency: [if], data = [none] } else { // TODO primitive types? clazz = (Class<?>)type; // depends on control dependency: [if], data = [none] if (clazz.isArray()) return getArrayExactDirectSuperTypes(clazz); } Type[] superInterfaces = clazz.getGenericInterfaces(); Type superClass = clazz.getGenericSuperclass(); // the only supertype of an interface without superinterfaces is Object if (superClass == null && superInterfaces.length == 0 && clazz.isInterface()) { return new Type[] {Object.class}; // depends on control dependency: [if], data = [none] } Type[] result; int resultIndex; if (superClass == null) { result = new Type[superInterfaces.length]; // depends on control dependency: [if], data = [none] resultIndex = 0; // depends on control dependency: [if], data = [none] } else { result = new Type[superInterfaces.length + 1]; // depends on control dependency: [if], data = [none] resultIndex = 1; // depends on control dependency: [if], data = [none] result[0] = mapTypeParameters(superClass, type); // depends on control dependency: [if], data = [(superClass] } for (Type superInterface : superInterfaces) { result[resultIndex++] = mapTypeParameters(superInterface, type); // depends on control dependency: [for], data = [superInterface] } return result; // depends on control dependency: [if], data = [none] } else if (type instanceof TypeVariable) { TypeVariable<?> tv = (TypeVariable<?>) type; return tv.getBounds(); // depends on control dependency: [if], data = [none] } else if (type instanceof WildcardType) { // This should be a rare case: normally this wildcard is already captured. // But it does happen if the upper bound of a type variable contains a wildcard // TODO shouldn't upper bound of type variable have been captured too? (making this case impossible?) return ((WildcardType) type).getUpperBounds(); // depends on control dependency: [if], data = [none] } else if (type instanceof CaptureType) { return ((CaptureType)type).getUpperBounds(); // depends on control dependency: [if], data = [none] } else if (type instanceof GenericArrayType) { return getArrayExactDirectSuperTypes(type); // depends on control dependency: [if], data = [none] } else if (type == null) { throw new NullPointerException(); } else { throw new RuntimeException("not implemented type: " + type); } } }
public class class_name { public static AetherResult asResult ( final Collection<ArtifactResult> results, final ImportConfiguration cfg, final Optional<DependencyResult> dependencyResult ) { final AetherResult result = new AetherResult (); // create set of requested coordinates final Set<String> requested = new HashSet<> ( cfg.getCoordinates ().size () ); for ( final MavenCoordinates mc : cfg.getCoordinates () ) { requested.add ( mc.toString () ); } // generate dependency map final Map<String, Boolean> optionalDeps = new HashMap<> (); fillOptionalDependenciesMap ( dependencyResult, optionalDeps ); // convert artifacts for ( final ArtifactResult ar : results ) { final AetherResult.Entry entry = new AetherResult.Entry (); final MavenCoordinates coordinates = MavenCoordinates.fromResult ( ar ); final String key = coordinates.toBase ().toString (); entry.setCoordinates ( coordinates ); entry.setResolved ( ar.isResolved () ); entry.setRequested ( requested.contains ( key ) ); entry.setOptional ( optionalDeps.getOrDefault ( key, Boolean.FALSE ) ); // convert error if ( ar.getExceptions () != null && !ar.getExceptions ().isEmpty () ) { final StringBuilder sb = new StringBuilder ( ar.getExceptions ().get ( 0 ).getMessage () ); if ( ar.getExceptions ().size () > 1 ) { sb.append ( " ..." ); } entry.setError ( sb.toString () ); } // add to list result.getArtifacts ().add ( entry ); } // sort by coordinates Collections.sort ( result.getArtifacts (), Comparator.comparing ( AetherResult.Entry::getCoordinates ) ); // set repo url result.setRepositoryUrl ( cfg.getRepositoryUrl () ); return result; } }
public class class_name { public static AetherResult asResult ( final Collection<ArtifactResult> results, final ImportConfiguration cfg, final Optional<DependencyResult> dependencyResult ) { final AetherResult result = new AetherResult (); // create set of requested coordinates final Set<String> requested = new HashSet<> ( cfg.getCoordinates ().size () ); for ( final MavenCoordinates mc : cfg.getCoordinates () ) { requested.add ( mc.toString () ); // depends on control dependency: [for], data = [mc] } // generate dependency map final Map<String, Boolean> optionalDeps = new HashMap<> (); fillOptionalDependenciesMap ( dependencyResult, optionalDeps ); // convert artifacts for ( final ArtifactResult ar : results ) { final AetherResult.Entry entry = new AetherResult.Entry (); final MavenCoordinates coordinates = MavenCoordinates.fromResult ( ar ); final String key = coordinates.toBase ().toString (); entry.setCoordinates ( coordinates ); // depends on control dependency: [for], data = [none] entry.setResolved ( ar.isResolved () ); // depends on control dependency: [for], data = [ar] entry.setRequested ( requested.contains ( key ) ); // depends on control dependency: [for], data = [none] entry.setOptional ( optionalDeps.getOrDefault ( key, Boolean.FALSE ) ); // depends on control dependency: [for], data = [none] // convert error if ( ar.getExceptions () != null && !ar.getExceptions ().isEmpty () ) { final StringBuilder sb = new StringBuilder ( ar.getExceptions ().get ( 0 ).getMessage () ); if ( ar.getExceptions ().size () > 1 ) { sb.append ( " ..." ); // depends on control dependency: [if], data = [none] } entry.setError ( sb.toString () ); // depends on control dependency: [if], data = [none] } // add to list result.getArtifacts ().add ( entry ); // depends on control dependency: [for], data = [none] } // sort by coordinates Collections.sort ( result.getArtifacts (), Comparator.comparing ( AetherResult.Entry::getCoordinates ) ); // set repo url result.setRepositoryUrl ( cfg.getRepositoryUrl () ); return result; } }
public class class_name { public final void start() { try { if (!_unlocked) { _log.info("Starting {}", getName()); doStart(); } _started = true; } catch (Exception ex) { throw new SystemException(ex); } finally { _unlocked = true; _interlock.countDown(); } } }
public class class_name { public final void start() { try { if (!_unlocked) { _log.info("Starting {}", getName()); // depends on control dependency: [if], data = [none] doStart(); // depends on control dependency: [if], data = [none] } _started = true; // depends on control dependency: [try], data = [none] } catch (Exception ex) { throw new SystemException(ex); } finally { // depends on control dependency: [catch], data = [none] _unlocked = true; _interlock.countDown(); } } }
public class class_name { static <T extends GridDialect> T getDialectFacetOrNull(GridDialect gridDialect, Class<T> facetType) { if ( hasFacet( gridDialect, facetType ) ) { @SuppressWarnings("unchecked") T asFacet = (T) gridDialect; return asFacet; } return null; } }
public class class_name { static <T extends GridDialect> T getDialectFacetOrNull(GridDialect gridDialect, Class<T> facetType) { if ( hasFacet( gridDialect, facetType ) ) { @SuppressWarnings("unchecked") T asFacet = (T) gridDialect; return asFacet; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public ConstructorInfo searchDeclaredConstructor(Class<?>... parameterTypes) { ConstructorInfo constructor = ExecutableUtils.getExecutable(declaredConstructorsGetter.get(), null, parameterTypes); if (constructor == null) { constructor = ExecutableUtils.searchExecutable(declaredConstructorsGetter.get(), null, parameterTypes); } return constructor; } }
public class class_name { public ConstructorInfo searchDeclaredConstructor(Class<?>... parameterTypes) { ConstructorInfo constructor = ExecutableUtils.getExecutable(declaredConstructorsGetter.get(), null, parameterTypes); if (constructor == null) { constructor = ExecutableUtils.searchExecutable(declaredConstructorsGetter.get(), null, parameterTypes); // depends on control dependency: [if], data = [none] } return constructor; } }
public class class_name { @Override public double getQuantile(double quantile) { if(isDeterministic()) { return valueIfNonStochastic; } if(size() == 0) { return Double.NaN; } double[] realizationsSorted = realizations.clone(); java.util.Arrays.sort(realizationsSorted); int indexOfQuantileValue = Math.min(Math.max((int)Math.round((size()+1) * quantile - 1), 0), size()-1); return realizationsSorted[indexOfQuantileValue]; } }
public class class_name { @Override public double getQuantile(double quantile) { if(isDeterministic()) { return valueIfNonStochastic; // depends on control dependency: [if], data = [none] } if(size() == 0) { return Double.NaN; // depends on control dependency: [if], data = [none] } double[] realizationsSorted = realizations.clone(); java.util.Arrays.sort(realizationsSorted); int indexOfQuantileValue = Math.min(Math.max((int)Math.round((size()+1) * quantile - 1), 0), size()-1); return realizationsSorted[indexOfQuantileValue]; } }
public class class_name { Set<Class<? extends TrailWriter>> findTrailWriters() { Set<Class<? extends TrailWriter>> trailWriters = auditConfig.getWriters(); if (trailWriters.isEmpty()) { LOGGER.info("No TrailWriter specified"); } return trailWriters; } }
public class class_name { Set<Class<? extends TrailWriter>> findTrailWriters() { Set<Class<? extends TrailWriter>> trailWriters = auditConfig.getWriters(); if (trailWriters.isEmpty()) { LOGGER.info("No TrailWriter specified"); // depends on control dependency: [if], data = [none] } return trailWriters; } }
public class class_name { protected String createIndexBackup() { if (!isBackupReindexing()) { // if no backup is generated we don't need to do anything return null; } // check if the target directory already exists File file = new File(getPath()); if (!file.exists()) { // index does not exist yet, so we can't backup it return null; } String backupPath = getPath() + "_backup"; FSDirectory oldDir = null; FSDirectory newDir = null; try { // open file directory for Lucene oldDir = FSDirectory.open(file.toPath()); newDir = FSDirectory.open(Paths.get(backupPath)); for (String fileName : oldDir.listAll()) { newDir.copyFrom(oldDir, fileName, fileName, IOContext.DEFAULT); } } catch (Exception e) { LOG.error( Messages.get().getBundle().key(Messages.LOG_IO_INDEX_BACKUP_CREATE_3, getName(), getPath(), backupPath), e); backupPath = null; } finally { if (oldDir != null) { try { oldDir.close(); } catch (IOException e) { e.printStackTrace(); } } if (newDir != null) { try { newDir.close(); } catch (IOException e) { e.printStackTrace(); } } } return backupPath; } }
public class class_name { protected String createIndexBackup() { if (!isBackupReindexing()) { // if no backup is generated we don't need to do anything return null; // depends on control dependency: [if], data = [none] } // check if the target directory already exists File file = new File(getPath()); if (!file.exists()) { // index does not exist yet, so we can't backup it return null; // depends on control dependency: [if], data = [none] } String backupPath = getPath() + "_backup"; FSDirectory oldDir = null; FSDirectory newDir = null; try { // open file directory for Lucene oldDir = FSDirectory.open(file.toPath()); // depends on control dependency: [try], data = [none] newDir = FSDirectory.open(Paths.get(backupPath)); // depends on control dependency: [try], data = [none] for (String fileName : oldDir.listAll()) { newDir.copyFrom(oldDir, fileName, fileName, IOContext.DEFAULT); // depends on control dependency: [for], data = [fileName] } } catch (Exception e) { LOG.error( Messages.get().getBundle().key(Messages.LOG_IO_INDEX_BACKUP_CREATE_3, getName(), getPath(), backupPath), e); backupPath = null; } finally { // depends on control dependency: [catch], data = [none] if (oldDir != null) { try { oldDir.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } if (newDir != null) { try { newDir.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } } return backupPath; } }
public class class_name { static BlockLocation[] fixBlockLocations(BlockLocation[] locations, long start, long len, long fileOffsetInHar) { // offset 1 past last byte of desired range long end = start + len; for (BlockLocation location : locations) { // offset of part block relative to beginning of desired file // (may be negative if file starts in this part block) long harBlockStart = location.getOffset() - fileOffsetInHar; // offset 1 past last byte of har block relative to beginning of // desired file long harBlockEnd = harBlockStart + location.getLength(); if (start > harBlockStart) { // desired range starts after beginning of this har block // fix offset to beginning of relevant range (relative to desired file) location.setOffset(start); // fix length to relevant portion of har block location.setLength(location.getLength() - (start - harBlockStart)); } else { // desired range includes beginning of this har block location.setOffset(harBlockStart); } if (harBlockEnd > end) { // range ends before end of this har block // fix length to remove irrelevant portion at the end location.setLength(location.getLength() - (harBlockEnd - end)); } } return locations; } }
public class class_name { static BlockLocation[] fixBlockLocations(BlockLocation[] locations, long start, long len, long fileOffsetInHar) { // offset 1 past last byte of desired range long end = start + len; for (BlockLocation location : locations) { // offset of part block relative to beginning of desired file // (may be negative if file starts in this part block) long harBlockStart = location.getOffset() - fileOffsetInHar; // offset 1 past last byte of har block relative to beginning of // desired file long harBlockEnd = harBlockStart + location.getLength(); if (start > harBlockStart) { // desired range starts after beginning of this har block // fix offset to beginning of relevant range (relative to desired file) location.setOffset(start); // depends on control dependency: [if], data = [(start] // fix length to relevant portion of har block location.setLength(location.getLength() - (start - harBlockStart)); // depends on control dependency: [if], data = [(start] } else { // desired range includes beginning of this har block location.setOffset(harBlockStart); // depends on control dependency: [if], data = [harBlockStart)] } if (harBlockEnd > end) { // range ends before end of this har block // fix length to remove irrelevant portion at the end location.setLength(location.getLength() - (harBlockEnd - end)); // depends on control dependency: [if], data = [(harBlockEnd] } } return locations; } }
public class class_name { protected void defineParameter(final StringBuilder query, String name, final Object value, final DbEntityColumnDescriptor dec) { if (name == null) { name = templateData.getNextParameterName(); } query.append(':').append(name); templateData.addParameter(name, value, dec); } }
public class class_name { protected void defineParameter(final StringBuilder query, String name, final Object value, final DbEntityColumnDescriptor dec) { if (name == null) { name = templateData.getNextParameterName(); // depends on control dependency: [if], data = [none] } query.append(':').append(name); templateData.addParameter(name, value, dec); } }
public class class_name { public static Failure copy(Failure failure) { if (failure == null) { return null; } Failure result = new Failure(); result.code = failure.code; result.details = failure.details; result.title = failure.title; return result; } }
public class class_name { public static Failure copy(Failure failure) { if (failure == null) { return null; // depends on control dependency: [if], data = [none] } Failure result = new Failure(); result.code = failure.code; result.details = failure.details; result.title = failure.title; return result; } }
public class class_name { public final String getOpeningTag() { if (isRebuild() || isModified()) { final Lock lock = sharedObject.getLock(ACCESS_OBJECT).writeLock(); try { lock.lock(); buildOpeningTag(true); } finally { lock.unlock(); } } return openingTag; } }
public class class_name { public final String getOpeningTag() { if (isRebuild() || isModified()) { final Lock lock = sharedObject.getLock(ACCESS_OBJECT).writeLock(); try { lock.lock(); // depends on control dependency: [try], data = [none] buildOpeningTag(true); // depends on control dependency: [try], data = [none] } finally { lock.unlock(); } } return openingTag; } }
public class class_name { public static Geometry offsetCurve(Geometry geometry, double offset, String parameters) { if(geometry == null){ return null; } String[] buffParemeters = parameters.split("\\s+"); BufferParameters bufferParameters = new BufferParameters(); for (String params : buffParemeters) { String[] keyValue = params.split("="); if (keyValue[0].equalsIgnoreCase("endcap")) { String param = keyValue[1]; if (param.equalsIgnoreCase("round")) { bufferParameters.setEndCapStyle(BufferParameters.CAP_ROUND); } else if (param.equalsIgnoreCase("flat") || param.equalsIgnoreCase("butt")) { bufferParameters.setEndCapStyle(BufferParameters.CAP_FLAT); } else if (param.equalsIgnoreCase("square")) { bufferParameters.setEndCapStyle(BufferParameters.CAP_SQUARE); } else { throw new IllegalArgumentException("Supported join values are round, flat, butt or square."); } } else if (keyValue[0].equalsIgnoreCase("join")) { String param = keyValue[1]; if (param.equalsIgnoreCase("bevel")) { bufferParameters.setJoinStyle(BufferParameters.JOIN_BEVEL); } else if (param.equalsIgnoreCase("mitre") || param.equalsIgnoreCase("miter")) { bufferParameters.setJoinStyle(BufferParameters.JOIN_MITRE); } else if (param.equalsIgnoreCase("round")) { bufferParameters.setJoinStyle(BufferParameters.JOIN_ROUND); } else { throw new IllegalArgumentException("Supported join values are bevel, mitre, miter or round."); } } else if (keyValue[0].equalsIgnoreCase("mitre_limit") || keyValue[0].equalsIgnoreCase("miter_limit")) { bufferParameters.setMitreLimit(Double.valueOf(keyValue[1])); } else if (keyValue[0].equalsIgnoreCase("quad_segs")) { bufferParameters.setQuadrantSegments(Integer.valueOf(keyValue[1])); } else { throw new IllegalArgumentException("Unknown parameters. Please read the documentation."); } } return computeOffsetCurve(geometry, offset, bufferParameters); } }
public class class_name { public static Geometry offsetCurve(Geometry geometry, double offset, String parameters) { if(geometry == null){ return null; // depends on control dependency: [if], data = [none] } String[] buffParemeters = parameters.split("\\s+"); BufferParameters bufferParameters = new BufferParameters(); for (String params : buffParemeters) { String[] keyValue = params.split("="); if (keyValue[0].equalsIgnoreCase("endcap")) { String param = keyValue[1]; if (param.equalsIgnoreCase("round")) { bufferParameters.setEndCapStyle(BufferParameters.CAP_ROUND); // depends on control dependency: [if], data = [none] } else if (param.equalsIgnoreCase("flat") || param.equalsIgnoreCase("butt")) { bufferParameters.setEndCapStyle(BufferParameters.CAP_FLAT); // depends on control dependency: [if], data = [none] } else if (param.equalsIgnoreCase("square")) { bufferParameters.setEndCapStyle(BufferParameters.CAP_SQUARE); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Supported join values are round, flat, butt or square."); } } else if (keyValue[0].equalsIgnoreCase("join")) { String param = keyValue[1]; if (param.equalsIgnoreCase("bevel")) { bufferParameters.setJoinStyle(BufferParameters.JOIN_BEVEL); // depends on control dependency: [if], data = [none] } else if (param.equalsIgnoreCase("mitre") || param.equalsIgnoreCase("miter")) { bufferParameters.setJoinStyle(BufferParameters.JOIN_MITRE); // depends on control dependency: [if], data = [none] } else if (param.equalsIgnoreCase("round")) { bufferParameters.setJoinStyle(BufferParameters.JOIN_ROUND); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Supported join values are bevel, mitre, miter or round."); } } else if (keyValue[0].equalsIgnoreCase("mitre_limit") || keyValue[0].equalsIgnoreCase("miter_limit")) { bufferParameters.setMitreLimit(Double.valueOf(keyValue[1])); // depends on control dependency: [if], data = [none] } else if (keyValue[0].equalsIgnoreCase("quad_segs")) { bufferParameters.setQuadrantSegments(Integer.valueOf(keyValue[1])); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Unknown parameters. Please read the documentation."); } } return computeOffsetCurve(geometry, offset, bufferParameters); } }
public class class_name { public void log(final Level level, final String msg, final Object... args) { String message = msg; if (null != args && 0 < args.length) { // Is it a java.text style format? // Ideally we could match with Pattern.compile("\\{\\d").matcher(format).find()) // However the cost is 14% higher, so we cheaply check for 1 of the first 4 parameters if (msg.indexOf("{0") >= 0 || msg.indexOf("{1") >= 0 || msg.indexOf("{2") >= 0 || msg.indexOf("{3") >= 0) { message = java.text.MessageFormat.format(msg, args); } } switch (level) { case ERROR: if (proxy.isErrorEnabled()) { if (proxy instanceof LocationAwareLogger) { ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.ERROR_INT, message, null, null); } else { proxy.error(message); } } break; case WARN: if (proxy.isWarnEnabled()) { if (proxy instanceof LocationAwareLogger) { ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.WARN_INT, message, null, null); } else { proxy.warn(message); } } break; case INFO: if (proxy.isInfoEnabled()) { if (proxy instanceof LocationAwareLogger) { ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.INFO_INT, message, null, null); } else { proxy.info(message); } } break; case DEBUG: if (proxy.isDebugEnabled()) { if (proxy instanceof LocationAwareLogger) { ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.DEBUG_INT, message, null, null); } else { proxy.debug(message); } } break; case TRACE: if (proxy.isTraceEnabled()) { if (proxy instanceof LocationAwareLogger) { ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.TRACE_INT, message, null, null); } else { proxy.trace(message); } } break; default: throw new IllegalStateException("Logging level [" + level + "] is invalid"); } } }
public class class_name { public void log(final Level level, final String msg, final Object... args) { String message = msg; if (null != args && 0 < args.length) { // Is it a java.text style format? // Ideally we could match with Pattern.compile("\\{\\d").matcher(format).find()) // However the cost is 14% higher, so we cheaply check for 1 of the first 4 parameters if (msg.indexOf("{0") >= 0 || msg.indexOf("{1") >= 0 || msg.indexOf("{2") >= 0 || msg.indexOf("{3") >= 0) { message = java.text.MessageFormat.format(msg, args); // depends on control dependency: [if], data = [none] } } switch (level) { case ERROR: if (proxy.isErrorEnabled()) { if (proxy instanceof LocationAwareLogger) { ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.ERROR_INT, message, null, null); // depends on control dependency: [if], data = [none] } else { proxy.error(message); // depends on control dependency: [if], data = [none] } } break; case WARN: if (proxy.isWarnEnabled()) { if (proxy instanceof LocationAwareLogger) { ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.WARN_INT, message, null, null); // depends on control dependency: [if], data = [none] } else { proxy.warn(message); // depends on control dependency: [if], data = [none] } } break; case INFO: if (proxy.isInfoEnabled()) { if (proxy instanceof LocationAwareLogger) { ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.INFO_INT, message, null, null); // depends on control dependency: [if], data = [none] } else { proxy.info(message); // depends on control dependency: [if], data = [none] } } break; case DEBUG: if (proxy.isDebugEnabled()) { if (proxy instanceof LocationAwareLogger) { ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.DEBUG_INT, message, null, null); // depends on control dependency: [if], data = [none] } else { proxy.debug(message); // depends on control dependency: [if], data = [none] } } break; case TRACE: if (proxy.isTraceEnabled()) { if (proxy instanceof LocationAwareLogger) { ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.TRACE_INT, message, null, null); // depends on control dependency: [if], data = [none] } else { proxy.trace(message); // depends on control dependency: [if], data = [none] } } break; default: throw new IllegalStateException("Logging level [" + level + "] is invalid"); } } }
public class class_name { public void setIndent(Integer indent) { if (indent == null) { remove(OutputKeys.INDENT); remove(INDENT_AMT); return; } if (indent < 0) { throw Messages.INSTANCE.getIllegalArgumentException(11); } put(OutputKeys.INDENT, "yes"); put(INDENT_AMT, indent.toString()); } }
public class class_name { public void setIndent(Integer indent) { if (indent == null) { remove(OutputKeys.INDENT); // depends on control dependency: [if], data = [none] remove(INDENT_AMT); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (indent < 0) { throw Messages.INSTANCE.getIllegalArgumentException(11); } put(OutputKeys.INDENT, "yes"); put(INDENT_AMT, indent.toString()); } }
public class class_name { private void handleHttpClientErrorsForBackend(final HttpRequest clientRequest, final Exception e) { /* Notify error handler that we got an error. */ errorHandler.accept(e); /* Increment our error count. */ errorCount.incrementAndGet(); /* Create the error message. */ final String errorMessage = String.format("Unable to make request %s ", clientRequest.address()); /* Log the error. */ logger.error(errorMessage, e); /* Don't send the error to the client if we already handled this, i.e., timedout already. */ if (!clientRequest.isHandled()) { clientRequest.handled(); /* Notify the client that there was an error. */ clientRequest.getReceiver().error(String.format("\"%s\"", errorMessage)); } } }
public class class_name { private void handleHttpClientErrorsForBackend(final HttpRequest clientRequest, final Exception e) { /* Notify error handler that we got an error. */ errorHandler.accept(e); /* Increment our error count. */ errorCount.incrementAndGet(); /* Create the error message. */ final String errorMessage = String.format("Unable to make request %s ", clientRequest.address()); /* Log the error. */ logger.error(errorMessage, e); /* Don't send the error to the client if we already handled this, i.e., timedout already. */ if (!clientRequest.isHandled()) { clientRequest.handled(); // depends on control dependency: [if], data = [none] /* Notify the client that there was an error. */ clientRequest.getReceiver().error(String.format("\"%s\"", errorMessage)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public EClass getIfcDirection() { if (ifcDirectionEClass == null) { ifcDirectionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(154); } return ifcDirectionEClass; } }
public class class_name { public EClass getIfcDirection() { if (ifcDirectionEClass == null) { ifcDirectionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(154); // depends on control dependency: [if], data = [none] } return ifcDirectionEClass; } }
public class class_name { public FSTStruct createStructPointer(Bytez b, long index, int clzId) { // synchronized (this) // FIXME FIXME FIXME: contention point // desynced expecting class registering happens on startup { Class clazz = mIntToClz.get(clzId); if (clazz==null) throw new RuntimeException("unregistered class "+clzId); try { return (FSTStruct) createWrapper(clazz, b, index); } catch (Exception e) { throw new RuntimeException(e); } } } }
public class class_name { public FSTStruct createStructPointer(Bytez b, long index, int clzId) { // synchronized (this) // FIXME FIXME FIXME: contention point // desynced expecting class registering happens on startup { Class clazz = mIntToClz.get(clzId); if (clazz==null) throw new RuntimeException("unregistered class "+clzId); try { return (FSTStruct) createWrapper(clazz, b, index); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { private Vec feedForward(Vec input) { Vec x = input; for(int i = 0; i < Ws.size(); i++) { Matrix W_i = Ws.get(i); Vec b_i = bs.get(i); Vec a_i = W_i.multiply(x); a_i.mutableAdd(b_i); a_i.applyFunction(f); x = a_i; } return x; } }
public class class_name { private Vec feedForward(Vec input) { Vec x = input; for(int i = 0; i < Ws.size(); i++) { Matrix W_i = Ws.get(i); Vec b_i = bs.get(i); Vec a_i = W_i.multiply(x); a_i.mutableAdd(b_i); // depends on control dependency: [for], data = [none] a_i.applyFunction(f); // depends on control dependency: [for], data = [none] x = a_i; // depends on control dependency: [for], data = [none] } return x; } }
public class class_name { public EClass getIfcDraughtingCallout() { if (ifcDraughtingCalloutEClass == null) { ifcDraughtingCalloutEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(174); } return ifcDraughtingCalloutEClass; } }
public class class_name { public EClass getIfcDraughtingCallout() { if (ifcDraughtingCalloutEClass == null) { ifcDraughtingCalloutEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(174); // depends on control dependency: [if], data = [none] } return ifcDraughtingCalloutEClass; } }
public class class_name { public <R> R reduce(final R initial, final BiFunction<R, ? super T, R> accumulator) { R returnValue = initial; while (iterator.hasNext()) { returnValue = accumulator.apply(returnValue, iterator.next()); } return returnValue; } }
public class class_name { public <R> R reduce(final R initial, final BiFunction<R, ? super T, R> accumulator) { R returnValue = initial; while (iterator.hasNext()) { returnValue = accumulator.apply(returnValue, iterator.next()); // depends on control dependency: [while], data = [none] } return returnValue; } }
public class class_name { public static <T> Collection<T> addAll(Collection<T> to, Collection<? extends T> what) { Collection<T> data = safeCollection(to); if (!isEmpty(what)) { data.addAll(what); } return data; } }
public class class_name { public static <T> Collection<T> addAll(Collection<T> to, Collection<? extends T> what) { Collection<T> data = safeCollection(to); if (!isEmpty(what)) { data.addAll(what); // depends on control dependency: [if], data = [none] } return data; } }
public class class_name { public void setLambdaResources(java.util.Collection<LambdaResource> lambdaResources) { if (lambdaResources == null) { this.lambdaResources = null; return; } this.lambdaResources = new java.util.ArrayList<LambdaResource>(lambdaResources); } }
public class class_name { public void setLambdaResources(java.util.Collection<LambdaResource> lambdaResources) { if (lambdaResources == null) { this.lambdaResources = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.lambdaResources = new java.util.ArrayList<LambdaResource>(lambdaResources); } }
public class class_name { public static Number parseNumber( String numberAsString ) throws InvalidSelectorException { if (numberAsString == null) return null; try { if (numberAsString.indexOf('.') != -1 || numberAsString.indexOf('e') != -1 || numberAsString.indexOf('E') != -1) { return new Double(numberAsString); } else return Long.valueOf(numberAsString); } catch (NumberFormatException e) { throw new InvalidSelectorException("Invalid numeric value : "+numberAsString); } } }
public class class_name { public static Number parseNumber( String numberAsString ) throws InvalidSelectorException { if (numberAsString == null) return null; try { if (numberAsString.indexOf('.') != -1 || numberAsString.indexOf('e') != -1 || numberAsString.indexOf('E') != -1) { return new Double(numberAsString); // depends on control dependency: [if], data = [none] } else return Long.valueOf(numberAsString); } catch (NumberFormatException e) { throw new InvalidSelectorException("Invalid numeric value : "+numberAsString); } } }
public class class_name { public String getHrefResolved() { if (Atom10Parser.isAbsoluteURI(href)) { return href; } else if (baseURI != null && categoriesElement != null) { return Atom10Parser.resolveURI(baseURI, categoriesElement, href); } return null; } }
public class class_name { public String getHrefResolved() { if (Atom10Parser.isAbsoluteURI(href)) { return href; // depends on control dependency: [if], data = [none] } else if (baseURI != null && categoriesElement != null) { return Atom10Parser.resolveURI(baseURI, categoriesElement, href); // depends on control dependency: [if], data = [(baseURI] } return null; } }
public class class_name { @SuppressWarnings("unchecked") @Override public PersistentVector<E> replace(int i, E val) { if (i >= 0 && i < size) { if (i >= tailoff()) { Object[] newTail = new Object[tail.length]; System.arraycopy(tail, 0, newTail, 0, tail.length); newTail[i & LOW_BITS] = val; return new PersistentVector<>(size, shift, root, (E[]) newTail); } return new PersistentVector<>(size, shift, doAssoc(shift, root, i, val), tail); } if (i == size) { return append(val); } throw new IndexOutOfBoundsException(); } }
public class class_name { @SuppressWarnings("unchecked") @Override public PersistentVector<E> replace(int i, E val) { if (i >= 0 && i < size) { if (i >= tailoff()) { Object[] newTail = new Object[tail.length]; System.arraycopy(tail, 0, newTail, 0, tail.length); // depends on control dependency: [if], data = [none] newTail[i & LOW_BITS] = val; // depends on control dependency: [if], data = [none] return new PersistentVector<>(size, shift, root, (E[]) newTail); // depends on control dependency: [if], data = [none] } return new PersistentVector<>(size, shift, doAssoc(shift, root, i, val), tail); // depends on control dependency: [if], data = [none] } if (i == size) { return append(val); // depends on control dependency: [if], data = [none] } throw new IndexOutOfBoundsException(); } }
public class class_name { public void marshall(Expression expression, ProtocolMarshaller protocolMarshaller) { if (expression == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(expression.getOr(), OR_BINDING); protocolMarshaller.marshall(expression.getAnd(), AND_BINDING); protocolMarshaller.marshall(expression.getNot(), NOT_BINDING); protocolMarshaller.marshall(expression.getDimensions(), DIMENSIONS_BINDING); protocolMarshaller.marshall(expression.getTags(), TAGS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(Expression expression, ProtocolMarshaller protocolMarshaller) { if (expression == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(expression.getOr(), OR_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(expression.getAnd(), AND_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(expression.getNot(), NOT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(expression.getDimensions(), DIMENSIONS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(expression.getTags(), TAGS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static List<Dashboard> findDashboardsByOwner(EntityManager em, PrincipalUser user, String version) { requireArgument(em != null, "Entity manager can not be null."); TypedQuery<Dashboard> query; if(version==null) { query = em.createNamedQuery("Dashboard.getDashboardsByOwner", Dashboard.class); } else { query = em.createNamedQuery("Dashboard.getDashboardsByOwnerAndByVersion", Dashboard.class); query.setParameter("version",version); } try { query.setParameter("owner", user); return query.getResultList(); } catch (NoResultException ex) { return new ArrayList<>(0); } } }
public class class_name { public static List<Dashboard> findDashboardsByOwner(EntityManager em, PrincipalUser user, String version) { requireArgument(em != null, "Entity manager can not be null."); TypedQuery<Dashboard> query; if(version==null) { query = em.createNamedQuery("Dashboard.getDashboardsByOwner", Dashboard.class); // depends on control dependency: [if], data = [none] } else { query = em.createNamedQuery("Dashboard.getDashboardsByOwnerAndByVersion", Dashboard.class); // depends on control dependency: [if], data = [none] query.setParameter("version",version); // depends on control dependency: [if], data = [none] } try { query.setParameter("owner", user); // depends on control dependency: [try], data = [none] return query.getResultList(); // depends on control dependency: [try], data = [none] } catch (NoResultException ex) { return new ArrayList<>(0); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void setLocaterInfo(SourceLocator locator) { if (null != locator) { m_publicId = locator.getPublicId(); m_systemId = locator.getSystemId(); if (null != m_systemId) { try { m_href = SystemIDResolver.getAbsoluteURI(m_systemId, null); } catch (TransformerException se) { // Ignore this for right now } } super.setLocaterInfo(locator); } } }
public class class_name { public void setLocaterInfo(SourceLocator locator) { if (null != locator) { m_publicId = locator.getPublicId(); // depends on control dependency: [if], data = [none] m_systemId = locator.getSystemId(); // depends on control dependency: [if], data = [none] if (null != m_systemId) { try { m_href = SystemIDResolver.getAbsoluteURI(m_systemId, null); // depends on control dependency: [try], data = [none] } catch (TransformerException se) { // Ignore this for right now } // depends on control dependency: [catch], data = [none] } super.setLocaterInfo(locator); // depends on control dependency: [if], data = [locator)] } } }
public class class_name { public CharSequence generate(Context context) { Object attribute = context.getAttribute(getName()); if (attribute == null) { return "null"; } else { CharSequence seq; if (attribute instanceof CharSequence) { seq = (CharSequence) attribute; } else { seq = attribute.toString(); } if (function == Function.value) { return seq; } else { return String.valueOf(seq.length()); } } } }
public class class_name { public CharSequence generate(Context context) { Object attribute = context.getAttribute(getName()); if (attribute == null) { return "null"; // depends on control dependency: [if], data = [none] } else { CharSequence seq; if (attribute instanceof CharSequence) { seq = (CharSequence) attribute; // depends on control dependency: [if], data = [none] } else { seq = attribute.toString(); // depends on control dependency: [if], data = [none] } if (function == Function.value) { return seq; // depends on control dependency: [if], data = [none] } else { return String.valueOf(seq.length()); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static void main (String[] args) { try { h2omapper m = new h2omapper(); m.run(null); } catch (Exception e) { e.printStackTrace(); } } }
public class class_name { public static void main (String[] args) { try { h2omapper m = new h2omapper(); m.run(null); // depends on control dependency: [try], data = [none] } catch (Exception e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void removeAllListeners() { if (mListeners != null) { mListeners.clear(); mListeners = null; mAnimator.removeListener(mProxyListener); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (mPauseListeners != null) { mPauseListeners.clear(); mPauseListeners = null; mAnimator.removePauseListener((Animator.AnimatorPauseListener) mProxyPauseListener); } } } }
public class class_name { public void removeAllListeners() { if (mListeners != null) { mListeners.clear(); // depends on control dependency: [if], data = [none] mListeners = null; // depends on control dependency: [if], data = [none] mAnimator.removeListener(mProxyListener); // depends on control dependency: [if], data = [none] } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (mPauseListeners != null) { mPauseListeners.clear(); // depends on control dependency: [if], data = [none] mPauseListeners = null; // depends on control dependency: [if], data = [none] mAnimator.removePauseListener((Animator.AnimatorPauseListener) mProxyPauseListener); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @SuppressWarnings("ConstantConditions") public boolean isPossibleType(Type abstractType, Type possibleObjectType) { if (!isInterfaceOrUnion(abstractType)) { return false; } if (!isObjectType(possibleObjectType)) { return false; } ObjectTypeDefinition targetObjectTypeDef = getType(possibleObjectType, ObjectTypeDefinition.class).get(); TypeDefinition abstractTypeDef = getType(abstractType).get(); if (abstractTypeDef instanceof UnionTypeDefinition) { List<Type> memberTypes = ((UnionTypeDefinition) abstractTypeDef).getMemberTypes(); for (Type memberType : memberTypes) { Optional<ObjectTypeDefinition> checkType = getType(memberType, ObjectTypeDefinition.class); if (checkType.isPresent()) { if (checkType.get().getName().equals(targetObjectTypeDef.getName())) { return true; } } } return false; } else { InterfaceTypeDefinition iFace = (InterfaceTypeDefinition) abstractTypeDef; List<ObjectTypeDefinition> objectTypeDefinitions = getImplementationsOf(iFace); return objectTypeDefinitions.stream() .anyMatch(od -> od.getName().equals(targetObjectTypeDef.getName())); } } }
public class class_name { @SuppressWarnings("ConstantConditions") public boolean isPossibleType(Type abstractType, Type possibleObjectType) { if (!isInterfaceOrUnion(abstractType)) { return false; // depends on control dependency: [if], data = [none] } if (!isObjectType(possibleObjectType)) { return false; // depends on control dependency: [if], data = [none] } ObjectTypeDefinition targetObjectTypeDef = getType(possibleObjectType, ObjectTypeDefinition.class).get(); TypeDefinition abstractTypeDef = getType(abstractType).get(); if (abstractTypeDef instanceof UnionTypeDefinition) { List<Type> memberTypes = ((UnionTypeDefinition) abstractTypeDef).getMemberTypes(); for (Type memberType : memberTypes) { Optional<ObjectTypeDefinition> checkType = getType(memberType, ObjectTypeDefinition.class); if (checkType.isPresent()) { if (checkType.get().getName().equals(targetObjectTypeDef.getName())) { return true; // depends on control dependency: [if], data = [none] } } } return false; // depends on control dependency: [if], data = [none] } else { InterfaceTypeDefinition iFace = (InterfaceTypeDefinition) abstractTypeDef; List<ObjectTypeDefinition> objectTypeDefinitions = getImplementationsOf(iFace); return objectTypeDefinitions.stream() .anyMatch(od -> od.getName().equals(targetObjectTypeDef.getName())); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public EClass getIfcRepresentationContext() { if (ifcRepresentationContextEClass == null) { ifcRepresentationContextEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(567); } return ifcRepresentationContextEClass; } }
public class class_name { @Override public EClass getIfcRepresentationContext() { if (ifcRepresentationContextEClass == null) { ifcRepresentationContextEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(567); // depends on control dependency: [if], data = [none] } return ifcRepresentationContextEClass; } }
public class class_name { private ReturnCode createDumps(Set<JavaDumpAction> javaDumpActions, boolean introspect, String dumpTimestamp) { ServerLock serverLock = ServerLock.createTestLock(bootProps); ReturnCode dumpRc = ReturnCode.OK; // The lock file may have been (erroneously) deleted: this can happen on linux boolean lockExists = serverLock.lockFileExists(); if (lockExists) { if (serverLock.testServerRunning()) { // server is running ServerCommandClient scc = new ServerCommandClient(bootProps); if (scc.isValid()) { //check .sCommand exist if (introspect) { dumpRc = scc.introspectServer(dumpTimestamp, javaDumpActions); } else { dumpRc = scc.javaDump(javaDumpActions); } } else { // we have a server holding a lock that we can't talk to... // the dump is likely fine.. but we don't know / can't tell dumpRc = ReturnCode.SERVER_UNKNOWN_STATUS; } } else { // nope: lock not held, we're not running dumpRc = ReturnCode.SERVER_INACTIVE_STATUS; } } else { // no lock file: we assume the server is not running. dumpRc = ReturnCode.SERVER_INACTIVE_STATUS; } return dumpRc; } }
public class class_name { private ReturnCode createDumps(Set<JavaDumpAction> javaDumpActions, boolean introspect, String dumpTimestamp) { ServerLock serverLock = ServerLock.createTestLock(bootProps); ReturnCode dumpRc = ReturnCode.OK; // The lock file may have been (erroneously) deleted: this can happen on linux boolean lockExists = serverLock.lockFileExists(); if (lockExists) { if (serverLock.testServerRunning()) { // server is running ServerCommandClient scc = new ServerCommandClient(bootProps); if (scc.isValid()) { //check .sCommand exist if (introspect) { dumpRc = scc.introspectServer(dumpTimestamp, javaDumpActions); // depends on control dependency: [if], data = [none] } else { dumpRc = scc.javaDump(javaDumpActions); // depends on control dependency: [if], data = [none] } } else { // we have a server holding a lock that we can't talk to... // the dump is likely fine.. but we don't know / can't tell dumpRc = ReturnCode.SERVER_UNKNOWN_STATUS; // depends on control dependency: [if], data = [none] } } else { // nope: lock not held, we're not running dumpRc = ReturnCode.SERVER_INACTIVE_STATUS; // depends on control dependency: [if], data = [none] } } else { // no lock file: we assume the server is not running. dumpRc = ReturnCode.SERVER_INACTIVE_STATUS; // depends on control dependency: [if], data = [none] } return dumpRc; } }
public class class_name { private void sendDiscoveryRequest() { try { if (requests.isEmpty()) { // Do nothing if no request has been set return; } for (DiscoveryRequest req : requests) { if (req.getServiceTypes() == null || req.getServiceTypes().isEmpty()) { clientSocket.send(SsdpDiscovery.getDatagram(null)); } else { for (String st : req.getServiceTypes()) { clientSocket.send(SsdpDiscovery.getDatagram(st)); } } } } catch (IOException e) { if (clientSocket.isClosed() && !State.ACTIVE.equals(state)) { // This could happen when closing socket. In that case, this is not an issue. return; } callback.onFailed(e); } } }
public class class_name { private void sendDiscoveryRequest() { try { if (requests.isEmpty()) { // Do nothing if no request has been set return; // depends on control dependency: [if], data = [none] } for (DiscoveryRequest req : requests) { if (req.getServiceTypes() == null || req.getServiceTypes().isEmpty()) { clientSocket.send(SsdpDiscovery.getDatagram(null)); // depends on control dependency: [if], data = [none] } else { for (String st : req.getServiceTypes()) { clientSocket.send(SsdpDiscovery.getDatagram(st)); // depends on control dependency: [for], data = [st] } } } } catch (IOException e) { if (clientSocket.isClosed() && !State.ACTIVE.equals(state)) { // This could happen when closing socket. In that case, this is not an issue. return; // depends on control dependency: [if], data = [none] } callback.onFailed(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @SuppressWarnings("unchecked") protected Map<String, IPortletPreference> getSessionPreferences( IPortletEntityId portletEntityId, HttpServletRequest httpServletRequest) { final HttpSession session = httpServletRequest.getSession(); final Map<IPortletEntityId, Map<String, IPortletPreference>> portletPreferences; // Sync on the session to ensure the Map isn't in the process of being created synchronized (session) { portletPreferences = (Map<IPortletEntityId, Map<String, IPortletPreference>>) session.getAttribute(PORTLET_PREFERENCES_MAP_ATTRIBUTE); } if (portletPreferences == null) { return null; } return portletPreferences.get(portletEntityId); } }
public class class_name { @SuppressWarnings("unchecked") protected Map<String, IPortletPreference> getSessionPreferences( IPortletEntityId portletEntityId, HttpServletRequest httpServletRequest) { final HttpSession session = httpServletRequest.getSession(); final Map<IPortletEntityId, Map<String, IPortletPreference>> portletPreferences; // Sync on the session to ensure the Map isn't in the process of being created synchronized (session) { portletPreferences = (Map<IPortletEntityId, Map<String, IPortletPreference>>) session.getAttribute(PORTLET_PREFERENCES_MAP_ATTRIBUTE); } if (portletPreferences == null) { return null; // depends on control dependency: [if], data = [none] } return portletPreferences.get(portletEntityId); } }
public class class_name { void setFilters(Map<Object, Object> filters) { for (Object column : filters.keySet()) { Object filterValue = filters.get(column); if ((filterValue != null) && !filterValue.toString().isEmpty() && !m_table.isColumnCollapsed(column)) { m_table.setFilterFieldValue(column, filterValue); } } } }
public class class_name { void setFilters(Map<Object, Object> filters) { for (Object column : filters.keySet()) { Object filterValue = filters.get(column); if ((filterValue != null) && !filterValue.toString().isEmpty() && !m_table.isColumnCollapsed(column)) { m_table.setFilterFieldValue(column, filterValue); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void unregister(ZKMBeanInfo bean) { if(bean==null) return; String path=mapBean2Path.get(bean); try { unregister(path,bean); } catch (InstanceNotFoundException e) { LOG.warn("InstanceNotFoundException during unregister usually means more than one Zookeeper server has been running in a single JVM"); LOG.warn("InstanceNotFoundException during unregister can be safely ignored during automated tests."); } catch (JMException e) { LOG.warn("Error during unregister", e); } mapBean2Path.remove(bean); mapName2Bean.remove(bean.getName()); } }
public class class_name { public void unregister(ZKMBeanInfo bean) { if(bean==null) return; String path=mapBean2Path.get(bean); try { unregister(path,bean); // depends on control dependency: [try], data = [none] } catch (InstanceNotFoundException e) { LOG.warn("InstanceNotFoundException during unregister usually means more than one Zookeeper server has been running in a single JVM"); LOG.warn("InstanceNotFoundException during unregister can be safely ignored during automated tests."); } // depends on control dependency: [catch], data = [none] catch (JMException e) { LOG.warn("Error during unregister", e); } // depends on control dependency: [catch], data = [none] mapBean2Path.remove(bean); mapName2Bean.remove(bean.getName()); } }
public class class_name { @Override public DescriptorValue calculate(IAtomContainer atomContainer) { IAtomContainer ac; try { ac = (IAtomContainer) atomContainer.clone(); AtomContainerManipulator.percieveAtomTypesAndConfigureUnsetProperties(ac); CDKHydrogenAdder hAdder = CDKHydrogenAdder.getInstance(ac.getBuilder()); hAdder.addImplicitHydrogens(ac); AtomContainerManipulator.convertImplicitToExplicitHydrogens(ac); } catch (CloneNotSupportedException e) { return getDummyDescriptorValue(e); } catch (CDKException e) { return getDummyDescriptorValue(e); } IRingSet rs = Cycles.sssr(ac).toRingSet(); IRingSet atomRingSet = null; if (checkAromaticity) { try { Aromaticity.cdkLegacy().apply(ac); } catch (CDKException e) { return getDummyDescriptorValue(e); } } double xlogP = 0; // SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); String symbol = ""; int bondCount = 0; int atomCount = ac.getAtomCount(); int hsCount = 0; double xlogPOld = 0; IBond.Order maxBondOrder = IBond.Order.SINGLE; List<Integer> hBondAcceptors = new ArrayList<Integer>(); List<Integer> hBondDonors = new ArrayList<Integer>(); int checkAminoAcid = 1;//if 0 no check, if >1 check IAtom atomi = null; for (int i = 0; i < atomCount; i++) { atomi = (IAtom) ac.getAtom(i); // Problem fused ring systems atomRingSet = rs.getRings(atomi); atomi.setProperty("IS_IN_AROMATIC_RING", false); atomi.setProperty(CDKConstants.PART_OF_RING_OF_SIZE, 0); //logger.debug("atomRingSet.size "+atomRingSet.size()); if (atomRingSet.getAtomContainerCount() > 0) { if (atomRingSet.getAtomContainerCount() > 1) { Iterator<IAtomContainer> containers = RingSetManipulator.getAllAtomContainers(atomRingSet) .iterator(); atomRingSet = rs.getBuilder().newInstance(IRingSet.class); while (containers.hasNext()) { // XXX: we're already in the SSSR, but then get the esential cycles // of this atomRingSet... this code doesn't seem to make sense as // essential cycles are a subset of SSSR and can be found directly atomRingSet.add(Cycles.essential(containers.next()).toRingSet()); } //logger.debug(" SSSRatomRingSet.size "+atomRingSet.size()); } for (int j = 0; j < atomRingSet.getAtomContainerCount(); j++) { if (j == 0) { atomi.setProperty(CDKConstants.PART_OF_RING_OF_SIZE, ((IRing) atomRingSet.getAtomContainer(j)).getRingSize()); } if (((IRing) atomRingSet.getAtomContainer(j)).contains(atomi)) { if (((IRing) atomRingSet.getAtomContainer(j)).getRingSize() >= 6 && atomi.getFlag(CDKConstants.ISAROMATIC)) { atomi.setProperty("IS_IN_AROMATIC_RING", true); } if (((IRing) atomRingSet.getAtomContainer(j)).getRingSize() < (Integer) atomi .getProperty(CDKConstants.PART_OF_RING_OF_SIZE)) { atomi.setProperty(CDKConstants.PART_OF_RING_OF_SIZE, ((IRing) atomRingSet.getAtomContainer(j)).getRingSize()); } } } }//else{ //logger.debug(); //} } for (int i = 0; i < atomCount; i++) { atomi = (IAtom) ac.getAtom(i); if (xlogPOld == xlogP & i > 0 & !symbol.equals("H")) { //logger.debug("\nXlogPAssignmentError: Could not assign atom number:"+(i-1)); } xlogPOld = xlogP; symbol = atomi.getSymbol(); bondCount = ac.getConnectedBondsCount(atomi); hsCount = getHydrogenCount(ac, atomi); maxBondOrder = ac.getMaximumBondOrder(atomi); if (!symbol.equals("H")) { //logger.debug("i:"+i+" Symbol:"+symbol+" "+" bondC:"+bondCount+" Charge:"+atoms[i].getFormalCharge()+" hsC:"+hsCount+" maxBO:"+maxBondOrder+" Arom:"+atoms[i].getFlag(CDKConstants.ISAROMATIC)+" AtomTypeX:"+getAtomTypeXCount(ac, atoms[i])+" PiSys:"+getPiSystemsCount(ac, atoms[i])+" C=:"+getDoubleBondedCarbonsCount(ac, atoms[i])+" AromCc:"+getAromaticCarbonsCount(ac,atoms[i])+" RS:"+((Integer)atoms[i].getProperty(CDKConstants.PART_OF_RING_OF_SIZE)).intValue()+"\t"); } if (symbol.equals("C")) { if (bondCount == 2) { // C sp if (hsCount >= 1) { xlogP += 0.209; //logger.debug("XLOGP: 38 0.209"); } else { if (maxBondOrder == IBond.Order.DOUBLE) { xlogP += 2.073; //logger.debug("XLOGP: 40 2.037"); } else if (maxBondOrder == IBond.Order.TRIPLE) { xlogP += 0.33; //logger.debug("XLOGP: 39 0.33"); } } } if (bondCount == 3) { // C sp2 if ((Boolean) atomi.getProperty("IS_IN_AROMATIC_RING")) { if (getAromaticCarbonsCount(ac, atomi) >= 2 && getAromaticNitrogensCount(ac, atomi) == 0) { if (hsCount == 0) { if (getAtomTypeXCount(ac, atomi) == 0) { xlogP += 0.296; //logger.debug("XLOGP: 34 0.296"); } else { xlogP -= 0.151; //logger.debug("XLOGP: 35 C.ar.x -0.151"); } } else { xlogP += 0.337; //logger.debug("XLOGP: 32 0.337"); } //} else if (getAromaticCarbonsCount(ac, atoms[i]) < 2 && getAromaticNitrogensCount(ac, atoms[i]) > 1) { } else if (getAromaticNitrogensCount(ac, atomi) >= 1) { if (hsCount == 0) { if (getAtomTypeXCount(ac, atomi) == 0) { xlogP += 0.174; //logger.debug("XLOGP: 36 C.ar.(X) 0.174"); } else { xlogP += 0.366; //logger.debug("XLOGP: 37 0.366"); } } else if (getHydrogenCount(ac, atomi) == 1) { xlogP += 0.126; //logger.debug("XLOGP: 33 0.126"); } } //NOT aromatic, but sp2 } else { if (hsCount == 0) { if (getAtomTypeXCount(ac, atomi) == 0) { if (getPiSystemsCount(ac, atomi) <= 1) { xlogP += 0.05; //logger.debug("XLOGP: 26 0.05"); } else { xlogP += 0.013; //logger.debug("XLOGP: 27 0.013"); } } else if (getAtomTypeXCount(ac, atomi) == 1) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP -= 0.03; //logger.debug("XLOGP: 28 -0.03"); } else { xlogP -= 0.027; //logger.debug("XLOGP: 29 -0.027"); } } else if (getAtomTypeXCount(ac, atomi) == 2) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.005; //logger.debug("XLOGP: 30 0.005"); } else { xlogP -= 0.315; //logger.debug("XLOGP: 31 -0.315"); } } } if (hsCount == 1) { if (getAtomTypeXCount(ac, atomi) == 0) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.466; //logger.debug("XLOGP: 22 0.466"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP += 0.136; //logger.debug("XLOGP: 23 0.136"); } } else { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.001; //logger.debug("XLOGP: 24 0.001"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP -= 0.31; //logger.debug("XLOGP: 25 -0.31"); } } } if (hsCount == 2) { xlogP += 0.42; //logger.debug("XLOGP: 21 0.42"); } if (getIfCarbonIsHydrophobic(ac, atomi)) { xlogP += 0.211; //logger.debug("XLOGP: Hydrophobic Carbon 0.211"); } }//sp2 NOT aromatic } if (bondCount == 4) { // C sp3 if (hsCount == 0) { if (getAtomTypeXCount(ac, atomi) == 0) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP -= 0.006; //logger.debug("XLOGP: 16 -0.006"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP -= 0.57; //logger.debug("XLOGP: 17 -0.57"); } if (getPiSystemsCount(ac, atomi) >= 2) { xlogP -= 0.317; //logger.debug("XLOGP: 18 -0.317"); } } else { if (getPiSystemsCount(ac, atomi) == 0) { xlogP -= 0.316; //logger.debug("XLOGP: 19 -0.316"); } else { xlogP -= 0.723; //logger.debug("XLOGP: 20 -0.723"); } } } if (hsCount == 1) { if (getAtomTypeXCount(ac, atomi) == 0) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.127; //logger.debug("XLOGP: 10 0.127"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP -= 0.243; //logger.debug("XLOGP: 11 -0.243"); } if (getPiSystemsCount(ac, atomi) >= 2) { xlogP -= 0.499; //logger.debug("XLOGP: 12 -0.499"); } } else { if (getPiSystemsCount(ac, atomi) == 0) { xlogP -= 0.205; //logger.debug("XLOGP: 13 -0.205"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP -= 0.305; //logger.debug("XLOGP: 14 -0.305"); } if (getPiSystemsCount(ac, atomi) >= 2) { xlogP -= 0.709; //logger.debug("XLOGP: 15 -0.709"); } } } if (hsCount == 2) { if (getAtomTypeXCount(ac, atomi) == 0) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.358; //logger.debug("XLOGP: 4 0.358"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP -= 0.008; //logger.debug("XLOGP: 5 -0.008"); } if (getPiSystemsCount(ac, atomi) == 2) { xlogP -= 0.185; //logger.debug("XLOGP: 6 -0.185"); } } else { if (getPiSystemsCount(ac, atomi) == 0) { xlogP -= 0.137; //logger.debug("XLOGP: 7 -0.137"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP -= 0.303; //logger.debug("XLOGP: 8 -0.303"); } if (getPiSystemsCount(ac, atomi) == 2) { xlogP -= 0.815; //logger.debug("XLOGP: 9 -0.815"); } } } if (hsCount > 2) { if (getAtomTypeXCount(ac, atomi) == 0) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.528; //logger.debug("XLOGP: 1 0.528"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP += 0.267; //logger.debug("XLOGP: 2 0.267"); } } else { //if (getNitrogenOrOxygenCount(ac, atomi) == 1) { xlogP -= 0.032; //logger.debug("XLOGP: 3 -0.032"); } } if (getIfCarbonIsHydrophobic(ac, atomi)) { xlogP += 0.211; //logger.debug("XLOGP: Hydrophobic Carbon 0.211"); } }//csp3 }//C if (symbol.equals("N")) { //NO2 if (ac.getBondOrderSum(atomi) >= 3.0 && getOxygenCount(ac, atomi) >= 2 && maxBondOrder == IBond.Order.DOUBLE) { xlogP += 1.178; //logger.debug("XLOGP: 66 1.178"); } else { if (getPresenceOfCarbonil(ac, atomi) >= 1) { // amidic nitrogen if (hsCount == 0) { if (getAtomTypeXCount(ac, atomi) == 0) { xlogP += 0.078; //logger.debug("XLOGP: 57 0.078"); } if (getAtomTypeXCount(ac, atomi) == 1) { xlogP -= 0.118; //logger.debug("XLOGP: 58 -0.118"); } } if (hsCount == 1) { if (getAtomTypeXCount(ac, atomi) == 0) { xlogP -= 0.096; hBondDonors.add(i); //logger.debug("XLOGP: 55 -0.096"); } else { xlogP -= 0.044; hBondDonors.add(i); //logger.debug("XLOGP: 56 -0.044"); } } if (hsCount == 2) { xlogP -= 0.646; hBondDonors.add(i); //logger.debug("XLOGP: 54 -0.646"); } } else {//NO amidic nitrogen if (bondCount == 1) { // -C#N if (getCarbonsCount(ac, atomi) == 1) { xlogP -= 0.566; //logger.debug("XLOGP: 68 -0.566"); } } else if (bondCount == 2) { // N sp2 if ((Boolean) atomi.getProperty("IS_IN_AROMATIC_RING")) { xlogP -= 0.493; //logger.debug("XLOGP: 67 -0.493"); if (checkAminoAcid != 0) { checkAminoAcid += 1; } } else { if (getDoubleBondedCarbonsCount(ac, atomi) == 0) { if (getDoubleBondedNitrogenCount(ac, atomi) == 0) { if (getDoubleBondedOxygenCount(ac, atomi) == 1) { xlogP += 0.427; //logger.debug("XLOGP: 65 0.427"); } } if (getDoubleBondedNitrogenCount(ac, atomi) == 1) { if (getAtomTypeXCount(ac, atomi) == 0) { xlogP += 0.536; //logger.debug("XLOGP: 63 0.536"); } if (getAtomTypeXCount(ac, atomi) == 1) { xlogP -= 0.597; //logger.debug("XLOGP: 64 -0.597"); } } } else if (getDoubleBondedCarbonsCount(ac, atomi) == 1) { if (getAtomTypeXCount(ac, atomi) == 0) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.007; //logger.debug("XLOGP: 59 0.007"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP -= 0.275; //logger.debug("XLOGP: 60 -0.275"); } } else if (getAtomTypeXCount(ac, atomi) == 1) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.366; //logger.debug("XLOGP: 61 0.366"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP += 0.251; //logger.debug("XLOGP: 62 0.251"); } } } } } else if (bondCount == 3) { // N sp3 if (hsCount == 0) { //if (rs.contains(atomi)&&ringSize>3) { if (atomi.getFlag(CDKConstants.ISAROMATIC) || (rs.contains(atomi) && (Integer) atomi.getProperty(CDKConstants.PART_OF_RING_OF_SIZE) > 3 && getPiSystemsCount( ac, atomi) >= 1)) { if (getAtomTypeXCount(ac, atomi) == 0) { xlogP += 0.881; //logger.debug("XLOGP: 51 0.881"); } else { xlogP -= 0.01; //logger.debug("XLOGP: 53 -0.01"); } } else { if (getAtomTypeXCount(ac, atomi) == 0) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.159; //logger.debug("XLOGP: 49 0.159"); } if (getPiSystemsCount(ac, atomi) > 0) { xlogP += 0.761; //logger.debug("XLOGP: 50 0.761"); } } else { xlogP -= 0.239; //logger.debug("XLOGP: 52 -0.239"); } } } else if (hsCount == 1) { if (getAtomTypeXCount(ac, atomi) == 0) { // like pyrrole if (atomi.getFlag(CDKConstants.ISAROMATIC) || (rs.contains(atomi) && (Integer) atomi.getProperty(CDKConstants.PART_OF_RING_OF_SIZE) > 3 && getPiSystemsCount( ac, atomi) >= 2)) { xlogP += 0.545; hBondDonors.add(i); //logger.debug("XLOGP: 46 0.545"); } else { if (getPiSystemsCount(ac, atomi) == 0) { xlogP -= 0.112; hBondDonors.add(i); //logger.debug("XLOGP: 44 -0.112"); } if (getPiSystemsCount(ac, atomi) > 0) { xlogP += 0.166; hBondDonors.add(i); //logger.debug("XLOGP: 45 0.166"); } } } else { if (rs.contains(atomi)) { xlogP += 0.153; hBondDonors.add(i); //logger.debug("XLOGP: 48 0.153"); } else { xlogP += 0.324; hBondDonors.add(i); //logger.debug("XLOGP: 47 0.324"); } } } else if (hsCount == 2) { if (getAtomTypeXCount(ac, atomi) == 0) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP -= 0.534; hBondDonors.add(i); //logger.debug("XLOGP: 41 -0.534"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP -= 0.329; hBondDonors.add(i); //logger.debug("XLOGP: 42 -0.329"); } if (checkAminoAcid != 0) { checkAminoAcid += 1; } } else { xlogP -= 1.082; hBondDonors.add(i); //logger.debug("XLOGP: 43 -1.082"); } } } } } } if (symbol.equals("O")) { if (bondCount == 1 && maxBondOrder == IBond.Order.DOUBLE) { xlogP -= 0.399; if (!getPresenceOfHydroxy(ac, atomi)) { hBondAcceptors.add(i); } //logger.debug("XLOGP: 75 A=O -0.399"); } else if (bondCount == 1 && hsCount == 0 && (getPresenceOfNitro(ac, atomi) || getPresenceOfCarbonil(ac, atomi) == 1) || getPresenceOfSulfat(ac, atomi)) { xlogP -= 0.399; if (!getPresenceOfHydroxy(ac, atomi)) { hBondAcceptors.add(i); } //logger.debug("XLOGP: 75 A=O -0.399"); } else if (bondCount >= 1) { if (hsCount == 0 && bondCount == 2) { if (getAtomTypeXCount(ac, atomi) == 0) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.084; //logger.debug("XLOGP: 72 R-O-R 0.084"); } if (getPiSystemsCount(ac, atomi) > 0) { xlogP += 0.435; //logger.debug("XLOGP: 73 R-O-R.1 0.435"); } } else if (getAtomTypeXCount(ac, atomi) == 1) { xlogP += 0.105; //logger.debug("XLOGP: 74 R-O-X 0.105"); } } else { if (getAtomTypeXCount(ac, atomi) == 0) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP -= 0.467; hBondDonors.add(i); hBondAcceptors.add(i); //logger.debug("XLOGP: 69 R-OH -0.467"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP += 0.082; hBondDonors.add(i); hBondAcceptors.add(i); //logger.debug("XLOGP: 70 R-OH.1 0.082"); } } else if (getAtomTypeXCount(ac, atomi) == 1) { xlogP -= 0.522; hBondDonors.add(i); hBondAcceptors.add(i); //logger.debug("XLOGP: 71 X-OH -0.522"); } } } } if (symbol.equals("S")) { if ((bondCount == 1 && maxBondOrder == IBond.Order.DOUBLE) || (bondCount == 1 && atomi.getFormalCharge() == -1)) { xlogP -= 0.148; //logger.debug("XLOGP: 78 A=S -0.148"); } else if (bondCount == 2) { if (hsCount == 0) { xlogP += 0.255; //logger.debug("XLOGP: 77 A-S-A 0.255"); } else { xlogP += 0.419; //logger.debug("XLOGP: 76 A-SH 0.419"); } } else if (bondCount == 3) { if (getOxygenCount(ac, atomi) >= 1) { xlogP -= 1.375; //logger.debug("XLOGP: 79 A-SO-A -1.375"); } } else if (bondCount == 4) { if (getDoubleBondedOxygenCount(ac, atomi) >= 2) { xlogP -= 0.168; //logger.debug("XLOGP: 80 A-SO2-A -0.168"); } } } if (symbol.equals("P")) { if (getDoubleBondedSulfurCount(ac, atomi) >= 1 && bondCount >= 4) { xlogP += 1.253; //logger.debug("XLOGP: 82 S=PA3 1.253"); } else if (getOxygenCount(ac, atomi) >= 1 || getDoubleBondedOxygenCount(ac, atomi) == 1 && bondCount >= 4) { xlogP -= 0.447; //logger.debug("XLOGP: 81 O=PA3 -0.447"); } } if (symbol.equals("F")) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.375; //logger.debug("XLOGP: 83 F.0 0.512"); } else if (getPiSystemsCount(ac, atomi) == 1) { xlogP += 0.202; //logger.debug("XLOGP: 84 F.1 0.202"); } } if (symbol.equals("Cl")) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.512; //logger.debug("XLOGP: 85 Cl.0 0.512"); } else if (getPiSystemsCount(ac, atomi) >= 1) { xlogP += 0.663; //logger.debug("XLOGP: 86 Cl.1 0.663"); } } if (symbol.equals("Br")) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.85; //logger.debug("XLOGP: 87 Br.0 0.85"); } else if (getPiSystemsCount(ac, atomi) == 1) { xlogP += 0.839; //logger.debug("XLOGP: 88 Br.1 0.839"); } } if (symbol.equals("I")) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 1.05; //logger.debug("XLOGP: 89 I.0 1.05"); } else if (getPiSystemsCount(ac, atomi) == 1) { xlogP += 1.109; //logger.debug("XLOGP: 90 I.1 1.109"); } } // Halogen pair 1-3 int halcount = getHalogenCount(ac, atomi); if (halcount == 2) { xlogP += 0.137; //logger.debug("XLOGP: Halogen 1-3 pair 0.137"); } else if (halcount == 3) { xlogP += (3 * 0.137); //logger.debug("XLOGP: Halogen 1-3 pair 0.411"); } else if (halcount == 4) { xlogP += (6 * 0.137); //logger.debug("XLOGP: Halogen 1-3 pair 1.902"); } // sp2 Oxygen 1-5 pair if (getPresenceOfCarbonil(ac, atomi) == 2) {// sp2 oxygen 1-5 pair if (!rs.contains(atomi)) { xlogP += 0.580; //logger.debug("XLOGP: sp2 Oxygen 1-5 pair 0.580"); } } } //logger.debug("XLOGP: Before Correction:"+xlogP); int[][] pairCheck = null; // //logger.debug("Acceptors:"+hBondAcceptors.size()+" Donors:"+hBondDonors.size()); if (hBondAcceptors.size() > 0 && hBondDonors.size() > 0) { pairCheck = initializeHydrogenPairCheck(new int[atomCount][atomCount]); } AllPairsShortestPaths apsp = new AllPairsShortestPaths(ac); for (int i = 0; i < hBondAcceptors.size(); i++) { for (int j = 0; j < hBondDonors.size(); j++) { if (checkRingLink(rs, ac, ac.getAtom(hBondAcceptors.get(i))) || checkRingLink(rs, ac, ac.getAtom(hBondDonors.get(j).intValue()))) { int dist = apsp.from(ac.getAtom(hBondAcceptors.get(i))).distanceTo(ac.getAtom(hBondDonors.get(j))); // //logger.debug(" Acc:"+checkRingLink(rs,ac,atoms[((Integer)hBondAcceptors.get(i)).intValue()]) // +" S:"+atoms[((Integer)hBondAcceptors.get(i)).intValue()].getSymbol() // +" Nr:"+((Integer)hBondAcceptors.get(i)).intValue() // +" Don:"+checkRingLink(rs,ac,atoms[((Integer)hBondDonors.get(j)).intValue()]) // +" S:"+atoms[((Integer)hBondDonors.get(j)).intValue()].getSymbol() // +" Nr:"+((Integer)hBondDonors.get(j)).intValue() // +" i:"+i+" j:"+j+" path:"+path.size()); if (checkRingLink(rs, ac, ac.getAtom(hBondAcceptors.get(i))) && checkRingLink(rs, ac, ac.getAtom(hBondDonors.get(j).intValue()))) { if (dist == 3 && pairCheck[hBondAcceptors.get(i)][hBondDonors.get(j)] == 0) { xlogP += 0.429; pairCheck[hBondAcceptors.get(i)][hBondDonors.get(j)] = 1; pairCheck[hBondDonors.get(j)][hBondAcceptors.get(i)] = 1; //logger.debug("XLOGP: Internal HBonds 1-4 0.429"); } } else { if (dist == 4 && pairCheck[hBondAcceptors.get(i)][hBondDonors.get(j)] == 0) { xlogP += 0.429; pairCheck[hBondAcceptors.get(i)][hBondDonors.get(j)] = 1; pairCheck[hBondDonors.get(j)][hBondAcceptors.get(i)] = 1; //logger.debug("XLOGP: Internal HBonds 1-5 0.429"); } } } } } UniversalIsomorphismTester universalIsomorphismTester = new UniversalIsomorphismTester(); if (checkAminoAcid > 1) { // alpha amino acid QueryAtomContainer aminoAcid = QueryAtomContainerCreator.createBasicQueryContainer(createAminoAcid(ac .getBuilder())); Iterator bonds = aminoAcid.bonds().iterator(); IAtom bondAtom0 = null; IAtom bondAtom1 = null; while (bonds.hasNext()) { IBond bond = (IBond) bonds.next(); bondAtom0 = bond.getBegin(); bondAtom1 = bond.getEnd(); if ((bondAtom0.getSymbol().equals("C") && bondAtom1.getSymbol().equals("N")) || (bondAtom0.getSymbol().equals("N") && bondAtom1.getSymbol().equals("C")) && bond.getOrder() == IBond.Order.SINGLE) { aminoAcid.removeBond(bondAtom0, bondAtom1); QueryBond qbond = new QueryBond(bondAtom0, bondAtom1, Expr.Type.SINGLE_OR_AROMATIC); aminoAcid.addBond(qbond); break; } } //AtomContainer aminoacid = sp.parseSmiles("NCC(=O)O"); try { if (universalIsomorphismTester.isSubgraph(ac, aminoAcid)) { List list = universalIsomorphismTester.getSubgraphAtomsMap(ac, aminoAcid); RMap map = null; IAtom atom1 = null; for (int j = 0; j < list.size(); j++) { map = (RMap) list.get(j); atom1 = ac.getAtom(map.getId1()); if (atom1.getSymbol().equals("O") && ac.getMaximumBondOrder(atom1) == IBond.Order.SINGLE) { if (ac.getConnectedBondsCount(atom1) == 2 && getHydrogenCount(ac, atom1) == 0) { } else { xlogP -= 2.166; //logger.debug("XLOGP: alpha amino acid -2.166"); break; } } } } } catch (CDKException e) { return getDummyDescriptorValue(e); } } IAtomContainer paba = createPaba(ac.getBuilder()); // p-amino sulphonic acid try { if (universalIsomorphismTester.isSubgraph(ac, paba)) { xlogP -= 0.501; //logger.debug("XLOGP: p-amino sulphonic acid -0.501"); } } catch (CDKException e) { return getDummyDescriptorValue(e); } // salicylic acid if (salicylFlag) { IAtomContainer salicilic = createSalicylicAcid(ac.getBuilder()); try { if (universalIsomorphismTester.isSubgraph(ac, salicilic)) { xlogP += 0.554; //logger.debug("XLOGP: salicylic acid 0.554"); } } catch (CDKException e) { return getDummyDescriptorValue(e); } } // ortho oxygen pair SmartsPattern orthopair = SmartsPattern.create("OccO"); if (orthopair.matches(ac)) { xlogP -= 0.268; //logger.debug("XLOGP: Ortho oxygen pair -0.268"); } return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(xlogP), getDescriptorNames()); } }
public class class_name { @Override public DescriptorValue calculate(IAtomContainer atomContainer) { IAtomContainer ac; try { ac = (IAtomContainer) atomContainer.clone(); // depends on control dependency: [try], data = [none] AtomContainerManipulator.percieveAtomTypesAndConfigureUnsetProperties(ac); // depends on control dependency: [try], data = [none] CDKHydrogenAdder hAdder = CDKHydrogenAdder.getInstance(ac.getBuilder()); hAdder.addImplicitHydrogens(ac); // depends on control dependency: [try], data = [none] AtomContainerManipulator.convertImplicitToExplicitHydrogens(ac); // depends on control dependency: [try], data = [none] } catch (CloneNotSupportedException e) { return getDummyDescriptorValue(e); } catch (CDKException e) { // depends on control dependency: [catch], data = [none] return getDummyDescriptorValue(e); } // depends on control dependency: [catch], data = [none] IRingSet rs = Cycles.sssr(ac).toRingSet(); IRingSet atomRingSet = null; if (checkAromaticity) { try { Aromaticity.cdkLegacy().apply(ac); // depends on control dependency: [try], data = [none] } catch (CDKException e) { return getDummyDescriptorValue(e); } // depends on control dependency: [catch], data = [none] } double xlogP = 0; // SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); String symbol = ""; int bondCount = 0; int atomCount = ac.getAtomCount(); int hsCount = 0; double xlogPOld = 0; IBond.Order maxBondOrder = IBond.Order.SINGLE; List<Integer> hBondAcceptors = new ArrayList<Integer>(); List<Integer> hBondDonors = new ArrayList<Integer>(); int checkAminoAcid = 1;//if 0 no check, if >1 check IAtom atomi = null; for (int i = 0; i < atomCount; i++) { atomi = (IAtom) ac.getAtom(i); // depends on control dependency: [for], data = [i] // Problem fused ring systems atomRingSet = rs.getRings(atomi); // depends on control dependency: [for], data = [none] atomi.setProperty("IS_IN_AROMATIC_RING", false); // depends on control dependency: [for], data = [none] atomi.setProperty(CDKConstants.PART_OF_RING_OF_SIZE, 0); // depends on control dependency: [for], data = [none] //logger.debug("atomRingSet.size "+atomRingSet.size()); if (atomRingSet.getAtomContainerCount() > 0) { if (atomRingSet.getAtomContainerCount() > 1) { Iterator<IAtomContainer> containers = RingSetManipulator.getAllAtomContainers(atomRingSet) .iterator(); atomRingSet = rs.getBuilder().newInstance(IRingSet.class); // depends on control dependency: [if], data = [none] while (containers.hasNext()) { // XXX: we're already in the SSSR, but then get the esential cycles // of this atomRingSet... this code doesn't seem to make sense as // essential cycles are a subset of SSSR and can be found directly atomRingSet.add(Cycles.essential(containers.next()).toRingSet()); // depends on control dependency: [while], data = [none] } //logger.debug(" SSSRatomRingSet.size "+atomRingSet.size()); } for (int j = 0; j < atomRingSet.getAtomContainerCount(); j++) { if (j == 0) { atomi.setProperty(CDKConstants.PART_OF_RING_OF_SIZE, ((IRing) atomRingSet.getAtomContainer(j)).getRingSize()); // depends on control dependency: [if], data = [none] } if (((IRing) atomRingSet.getAtomContainer(j)).contains(atomi)) { if (((IRing) atomRingSet.getAtomContainer(j)).getRingSize() >= 6 && atomi.getFlag(CDKConstants.ISAROMATIC)) { atomi.setProperty("IS_IN_AROMATIC_RING", true); // depends on control dependency: [if], data = [none] } if (((IRing) atomRingSet.getAtomContainer(j)).getRingSize() < (Integer) atomi .getProperty(CDKConstants.PART_OF_RING_OF_SIZE)) { atomi.setProperty(CDKConstants.PART_OF_RING_OF_SIZE, ((IRing) atomRingSet.getAtomContainer(j)).getRingSize()); // depends on control dependency: [if], data = [none] } } } }//else{ //logger.debug(); //} } for (int i = 0; i < atomCount; i++) { atomi = (IAtom) ac.getAtom(i); // depends on control dependency: [for], data = [i] if (xlogPOld == xlogP & i > 0 & !symbol.equals("H")) { //logger.debug("\nXlogPAssignmentError: Could not assign atom number:"+(i-1)); } xlogPOld = xlogP; // depends on control dependency: [for], data = [none] symbol = atomi.getSymbol(); // depends on control dependency: [for], data = [none] bondCount = ac.getConnectedBondsCount(atomi); // depends on control dependency: [for], data = [none] hsCount = getHydrogenCount(ac, atomi); // depends on control dependency: [for], data = [none] maxBondOrder = ac.getMaximumBondOrder(atomi); // depends on control dependency: [for], data = [none] if (!symbol.equals("H")) { //logger.debug("i:"+i+" Symbol:"+symbol+" "+" bondC:"+bondCount+" Charge:"+atoms[i].getFormalCharge()+" hsC:"+hsCount+" maxBO:"+maxBondOrder+" Arom:"+atoms[i].getFlag(CDKConstants.ISAROMATIC)+" AtomTypeX:"+getAtomTypeXCount(ac, atoms[i])+" PiSys:"+getPiSystemsCount(ac, atoms[i])+" C=:"+getDoubleBondedCarbonsCount(ac, atoms[i])+" AromCc:"+getAromaticCarbonsCount(ac,atoms[i])+" RS:"+((Integer)atoms[i].getProperty(CDKConstants.PART_OF_RING_OF_SIZE)).intValue()+"\t"); } if (symbol.equals("C")) { if (bondCount == 2) { // C sp if (hsCount >= 1) { xlogP += 0.209; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 38 0.209"); } else { if (maxBondOrder == IBond.Order.DOUBLE) { xlogP += 2.073; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 40 2.037"); } else if (maxBondOrder == IBond.Order.TRIPLE) { xlogP += 0.33; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 39 0.33"); } } } if (bondCount == 3) { // C sp2 if ((Boolean) atomi.getProperty("IS_IN_AROMATIC_RING")) { if (getAromaticCarbonsCount(ac, atomi) >= 2 && getAromaticNitrogensCount(ac, atomi) == 0) { if (hsCount == 0) { if (getAtomTypeXCount(ac, atomi) == 0) { xlogP += 0.296; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 34 0.296"); } else { xlogP -= 0.151; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 35 C.ar.x -0.151"); } } else { xlogP += 0.337; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 32 0.337"); } //} else if (getAromaticCarbonsCount(ac, atoms[i]) < 2 && getAromaticNitrogensCount(ac, atoms[i]) > 1) { } else if (getAromaticNitrogensCount(ac, atomi) >= 1) { if (hsCount == 0) { if (getAtomTypeXCount(ac, atomi) == 0) { xlogP += 0.174; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 36 C.ar.(X) 0.174"); } else { xlogP += 0.366; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 37 0.366"); } } else if (getHydrogenCount(ac, atomi) == 1) { xlogP += 0.126; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 33 0.126"); } } //NOT aromatic, but sp2 } else { if (hsCount == 0) { if (getAtomTypeXCount(ac, atomi) == 0) { if (getPiSystemsCount(ac, atomi) <= 1) { xlogP += 0.05; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 26 0.05"); } else { xlogP += 0.013; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 27 0.013"); } } else if (getAtomTypeXCount(ac, atomi) == 1) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP -= 0.03; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 28 -0.03"); } else { xlogP -= 0.027; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 29 -0.027"); } } else if (getAtomTypeXCount(ac, atomi) == 2) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.005; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 30 0.005"); } else { xlogP -= 0.315; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 31 -0.315"); } } } if (hsCount == 1) { if (getAtomTypeXCount(ac, atomi) == 0) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.466; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 22 0.466"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP += 0.136; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 23 0.136"); } } else { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.001; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 24 0.001"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP -= 0.31; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 25 -0.31"); } } } if (hsCount == 2) { xlogP += 0.42; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 21 0.42"); } if (getIfCarbonIsHydrophobic(ac, atomi)) { xlogP += 0.211; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: Hydrophobic Carbon 0.211"); } }//sp2 NOT aromatic } if (bondCount == 4) { // C sp3 if (hsCount == 0) { if (getAtomTypeXCount(ac, atomi) == 0) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP -= 0.006; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 16 -0.006"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP -= 0.57; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 17 -0.57"); } if (getPiSystemsCount(ac, atomi) >= 2) { xlogP -= 0.317; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 18 -0.317"); } } else { if (getPiSystemsCount(ac, atomi) == 0) { xlogP -= 0.316; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 19 -0.316"); } else { xlogP -= 0.723; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 20 -0.723"); } } } if (hsCount == 1) { if (getAtomTypeXCount(ac, atomi) == 0) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.127; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 10 0.127"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP -= 0.243; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 11 -0.243"); } if (getPiSystemsCount(ac, atomi) >= 2) { xlogP -= 0.499; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 12 -0.499"); } } else { if (getPiSystemsCount(ac, atomi) == 0) { xlogP -= 0.205; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 13 -0.205"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP -= 0.305; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 14 -0.305"); } if (getPiSystemsCount(ac, atomi) >= 2) { xlogP -= 0.709; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 15 -0.709"); } } } if (hsCount == 2) { if (getAtomTypeXCount(ac, atomi) == 0) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.358; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 4 0.358"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP -= 0.008; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 5 -0.008"); } if (getPiSystemsCount(ac, atomi) == 2) { xlogP -= 0.185; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 6 -0.185"); } } else { if (getPiSystemsCount(ac, atomi) == 0) { xlogP -= 0.137; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 7 -0.137"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP -= 0.303; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 8 -0.303"); } if (getPiSystemsCount(ac, atomi) == 2) { xlogP -= 0.815; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 9 -0.815"); } } } if (hsCount > 2) { if (getAtomTypeXCount(ac, atomi) == 0) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.528; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 1 0.528"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP += 0.267; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 2 0.267"); } } else { //if (getNitrogenOrOxygenCount(ac, atomi) == 1) { xlogP -= 0.032; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 3 -0.032"); } } if (getIfCarbonIsHydrophobic(ac, atomi)) { xlogP += 0.211; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: Hydrophobic Carbon 0.211"); } }//csp3 }//C if (symbol.equals("N")) { //NO2 if (ac.getBondOrderSum(atomi) >= 3.0 && getOxygenCount(ac, atomi) >= 2 && maxBondOrder == IBond.Order.DOUBLE) { xlogP += 1.178; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 66 1.178"); } else { if (getPresenceOfCarbonil(ac, atomi) >= 1) { // amidic nitrogen if (hsCount == 0) { if (getAtomTypeXCount(ac, atomi) == 0) { xlogP += 0.078; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 57 0.078"); } if (getAtomTypeXCount(ac, atomi) == 1) { xlogP -= 0.118; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 58 -0.118"); } } if (hsCount == 1) { if (getAtomTypeXCount(ac, atomi) == 0) { xlogP -= 0.096; // depends on control dependency: [if], data = [none] hBondDonors.add(i); // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 55 -0.096"); } else { xlogP -= 0.044; // depends on control dependency: [if], data = [none] hBondDonors.add(i); // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 56 -0.044"); } } if (hsCount == 2) { xlogP -= 0.646; // depends on control dependency: [if], data = [none] hBondDonors.add(i); // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 54 -0.646"); } } else {//NO amidic nitrogen if (bondCount == 1) { // -C#N if (getCarbonsCount(ac, atomi) == 1) { xlogP -= 0.566; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 68 -0.566"); } } else if (bondCount == 2) { // N sp2 if ((Boolean) atomi.getProperty("IS_IN_AROMATIC_RING")) { xlogP -= 0.493; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 67 -0.493"); if (checkAminoAcid != 0) { checkAminoAcid += 1; // depends on control dependency: [if], data = [none] } } else { if (getDoubleBondedCarbonsCount(ac, atomi) == 0) { if (getDoubleBondedNitrogenCount(ac, atomi) == 0) { if (getDoubleBondedOxygenCount(ac, atomi) == 1) { xlogP += 0.427; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 65 0.427"); } } if (getDoubleBondedNitrogenCount(ac, atomi) == 1) { if (getAtomTypeXCount(ac, atomi) == 0) { xlogP += 0.536; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 63 0.536"); } if (getAtomTypeXCount(ac, atomi) == 1) { xlogP -= 0.597; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 64 -0.597"); } } } else if (getDoubleBondedCarbonsCount(ac, atomi) == 1) { if (getAtomTypeXCount(ac, atomi) == 0) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.007; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 59 0.007"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP -= 0.275; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 60 -0.275"); } } else if (getAtomTypeXCount(ac, atomi) == 1) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.366; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 61 0.366"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP += 0.251; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 62 0.251"); } } } } } else if (bondCount == 3) { // N sp3 if (hsCount == 0) { //if (rs.contains(atomi)&&ringSize>3) { if (atomi.getFlag(CDKConstants.ISAROMATIC) || (rs.contains(atomi) && (Integer) atomi.getProperty(CDKConstants.PART_OF_RING_OF_SIZE) > 3 && getPiSystemsCount( ac, atomi) >= 1)) { if (getAtomTypeXCount(ac, atomi) == 0) { xlogP += 0.881; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 51 0.881"); } else { xlogP -= 0.01; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 53 -0.01"); } } else { if (getAtomTypeXCount(ac, atomi) == 0) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.159; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 49 0.159"); } if (getPiSystemsCount(ac, atomi) > 0) { xlogP += 0.761; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 50 0.761"); } } else { xlogP -= 0.239; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 52 -0.239"); } } } else if (hsCount == 1) { if (getAtomTypeXCount(ac, atomi) == 0) { // like pyrrole if (atomi.getFlag(CDKConstants.ISAROMATIC) || (rs.contains(atomi) && (Integer) atomi.getProperty(CDKConstants.PART_OF_RING_OF_SIZE) > 3 && getPiSystemsCount( ac, atomi) >= 2)) { xlogP += 0.545; // depends on control dependency: [if], data = [none] hBondDonors.add(i); // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 46 0.545"); } else { if (getPiSystemsCount(ac, atomi) == 0) { xlogP -= 0.112; // depends on control dependency: [if], data = [none] hBondDonors.add(i); // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 44 -0.112"); } if (getPiSystemsCount(ac, atomi) > 0) { xlogP += 0.166; // depends on control dependency: [if], data = [none] hBondDonors.add(i); // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 45 0.166"); } } } else { if (rs.contains(atomi)) { xlogP += 0.153; // depends on control dependency: [if], data = [none] hBondDonors.add(i); // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 48 0.153"); } else { xlogP += 0.324; // depends on control dependency: [if], data = [none] hBondDonors.add(i); // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 47 0.324"); } } } else if (hsCount == 2) { if (getAtomTypeXCount(ac, atomi) == 0) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP -= 0.534; // depends on control dependency: [if], data = [none] hBondDonors.add(i); // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 41 -0.534"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP -= 0.329; // depends on control dependency: [if], data = [none] hBondDonors.add(i); // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 42 -0.329"); } if (checkAminoAcid != 0) { checkAminoAcid += 1; // depends on control dependency: [if], data = [none] } } else { xlogP -= 1.082; // depends on control dependency: [if], data = [none] hBondDonors.add(i); // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 43 -1.082"); } } } } } } if (symbol.equals("O")) { if (bondCount == 1 && maxBondOrder == IBond.Order.DOUBLE) { xlogP -= 0.399; // depends on control dependency: [if], data = [none] if (!getPresenceOfHydroxy(ac, atomi)) { hBondAcceptors.add(i); // depends on control dependency: [if], data = [none] } //logger.debug("XLOGP: 75 A=O -0.399"); } else if (bondCount == 1 && hsCount == 0 && (getPresenceOfNitro(ac, atomi) || getPresenceOfCarbonil(ac, atomi) == 1) || getPresenceOfSulfat(ac, atomi)) { xlogP -= 0.399; // depends on control dependency: [if], data = [none] if (!getPresenceOfHydroxy(ac, atomi)) { hBondAcceptors.add(i); // depends on control dependency: [if], data = [none] } //logger.debug("XLOGP: 75 A=O -0.399"); } else if (bondCount >= 1) { if (hsCount == 0 && bondCount == 2) { if (getAtomTypeXCount(ac, atomi) == 0) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.084; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 72 R-O-R 0.084"); } if (getPiSystemsCount(ac, atomi) > 0) { xlogP += 0.435; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 73 R-O-R.1 0.435"); } } else if (getAtomTypeXCount(ac, atomi) == 1) { xlogP += 0.105; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 74 R-O-X 0.105"); } } else { if (getAtomTypeXCount(ac, atomi) == 0) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP -= 0.467; // depends on control dependency: [if], data = [none] hBondDonors.add(i); // depends on control dependency: [if], data = [none] hBondAcceptors.add(i); // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 69 R-OH -0.467"); } if (getPiSystemsCount(ac, atomi) == 1) { xlogP += 0.082; // depends on control dependency: [if], data = [none] hBondDonors.add(i); // depends on control dependency: [if], data = [none] hBondAcceptors.add(i); // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 70 R-OH.1 0.082"); } } else if (getAtomTypeXCount(ac, atomi) == 1) { xlogP -= 0.522; // depends on control dependency: [if], data = [none] hBondDonors.add(i); // depends on control dependency: [if], data = [none] hBondAcceptors.add(i); // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 71 X-OH -0.522"); } } } } if (symbol.equals("S")) { if ((bondCount == 1 && maxBondOrder == IBond.Order.DOUBLE) || (bondCount == 1 && atomi.getFormalCharge() == -1)) { xlogP -= 0.148; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 78 A=S -0.148"); } else if (bondCount == 2) { if (hsCount == 0) { xlogP += 0.255; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 77 A-S-A 0.255"); } else { xlogP += 0.419; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 76 A-SH 0.419"); } } else if (bondCount == 3) { if (getOxygenCount(ac, atomi) >= 1) { xlogP -= 1.375; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 79 A-SO-A -1.375"); } } else if (bondCount == 4) { if (getDoubleBondedOxygenCount(ac, atomi) >= 2) { xlogP -= 0.168; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 80 A-SO2-A -0.168"); } } } if (symbol.equals("P")) { if (getDoubleBondedSulfurCount(ac, atomi) >= 1 && bondCount >= 4) { xlogP += 1.253; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 82 S=PA3 1.253"); } else if (getOxygenCount(ac, atomi) >= 1 || getDoubleBondedOxygenCount(ac, atomi) == 1 && bondCount >= 4) { xlogP -= 0.447; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 81 O=PA3 -0.447"); } } if (symbol.equals("F")) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.375; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 83 F.0 0.512"); } else if (getPiSystemsCount(ac, atomi) == 1) { xlogP += 0.202; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 84 F.1 0.202"); } } if (symbol.equals("Cl")) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.512; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 85 Cl.0 0.512"); } else if (getPiSystemsCount(ac, atomi) >= 1) { xlogP += 0.663; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 86 Cl.1 0.663"); } } if (symbol.equals("Br")) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 0.85; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 87 Br.0 0.85"); } else if (getPiSystemsCount(ac, atomi) == 1) { xlogP += 0.839; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 88 Br.1 0.839"); } } if (symbol.equals("I")) { if (getPiSystemsCount(ac, atomi) == 0) { xlogP += 1.05; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 89 I.0 1.05"); } else if (getPiSystemsCount(ac, atomi) == 1) { xlogP += 1.109; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: 90 I.1 1.109"); } } // Halogen pair 1-3 int halcount = getHalogenCount(ac, atomi); if (halcount == 2) { xlogP += 0.137; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: Halogen 1-3 pair 0.137"); } else if (halcount == 3) { xlogP += (3 * 0.137); // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: Halogen 1-3 pair 0.411"); } else if (halcount == 4) { xlogP += (6 * 0.137); // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: Halogen 1-3 pair 1.902"); } // sp2 Oxygen 1-5 pair if (getPresenceOfCarbonil(ac, atomi) == 2) {// sp2 oxygen 1-5 pair if (!rs.contains(atomi)) { xlogP += 0.580; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: sp2 Oxygen 1-5 pair 0.580"); } } } //logger.debug("XLOGP: Before Correction:"+xlogP); int[][] pairCheck = null; // //logger.debug("Acceptors:"+hBondAcceptors.size()+" Donors:"+hBondDonors.size()); if (hBondAcceptors.size() > 0 && hBondDonors.size() > 0) { pairCheck = initializeHydrogenPairCheck(new int[atomCount][atomCount]); // depends on control dependency: [if], data = [none] } AllPairsShortestPaths apsp = new AllPairsShortestPaths(ac); for (int i = 0; i < hBondAcceptors.size(); i++) { for (int j = 0; j < hBondDonors.size(); j++) { if (checkRingLink(rs, ac, ac.getAtom(hBondAcceptors.get(i))) || checkRingLink(rs, ac, ac.getAtom(hBondDonors.get(j).intValue()))) { int dist = apsp.from(ac.getAtom(hBondAcceptors.get(i))).distanceTo(ac.getAtom(hBondDonors.get(j))); // //logger.debug(" Acc:"+checkRingLink(rs,ac,atoms[((Integer)hBondAcceptors.get(i)).intValue()]) // +" S:"+atoms[((Integer)hBondAcceptors.get(i)).intValue()].getSymbol() // +" Nr:"+((Integer)hBondAcceptors.get(i)).intValue() // +" Don:"+checkRingLink(rs,ac,atoms[((Integer)hBondDonors.get(j)).intValue()]) // +" S:"+atoms[((Integer)hBondDonors.get(j)).intValue()].getSymbol() // +" Nr:"+((Integer)hBondDonors.get(j)).intValue() // +" i:"+i+" j:"+j+" path:"+path.size()); if (checkRingLink(rs, ac, ac.getAtom(hBondAcceptors.get(i))) && checkRingLink(rs, ac, ac.getAtom(hBondDonors.get(j).intValue()))) { if (dist == 3 && pairCheck[hBondAcceptors.get(i)][hBondDonors.get(j)] == 0) { xlogP += 0.429; // depends on control dependency: [if], data = [none] pairCheck[hBondAcceptors.get(i)][hBondDonors.get(j)] = 1; // depends on control dependency: [if], data = [none] pairCheck[hBondDonors.get(j)][hBondAcceptors.get(i)] = 1; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: Internal HBonds 1-4 0.429"); } } else { if (dist == 4 && pairCheck[hBondAcceptors.get(i)][hBondDonors.get(j)] == 0) { xlogP += 0.429; // depends on control dependency: [if], data = [none] pairCheck[hBondAcceptors.get(i)][hBondDonors.get(j)] = 1; // depends on control dependency: [if], data = [none] pairCheck[hBondDonors.get(j)][hBondAcceptors.get(i)] = 1; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: Internal HBonds 1-5 0.429"); } } } } } UniversalIsomorphismTester universalIsomorphismTester = new UniversalIsomorphismTester(); if (checkAminoAcid > 1) { // alpha amino acid QueryAtomContainer aminoAcid = QueryAtomContainerCreator.createBasicQueryContainer(createAminoAcid(ac .getBuilder())); Iterator bonds = aminoAcid.bonds().iterator(); IAtom bondAtom0 = null; IAtom bondAtom1 = null; while (bonds.hasNext()) { IBond bond = (IBond) bonds.next(); bondAtom0 = bond.getBegin(); // depends on control dependency: [while], data = [none] bondAtom1 = bond.getEnd(); // depends on control dependency: [while], data = [none] if ((bondAtom0.getSymbol().equals("C") && bondAtom1.getSymbol().equals("N")) || (bondAtom0.getSymbol().equals("N") && bondAtom1.getSymbol().equals("C")) && bond.getOrder() == IBond.Order.SINGLE) { aminoAcid.removeBond(bondAtom0, bondAtom1); // depends on control dependency: [if], data = [bondAto] QueryBond qbond = new QueryBond(bondAtom0, bondAtom1, Expr.Type.SINGLE_OR_AROMATIC); aminoAcid.addBond(qbond); // depends on control dependency: [if], data = [none] break; } } //AtomContainer aminoacid = sp.parseSmiles("NCC(=O)O"); try { if (universalIsomorphismTester.isSubgraph(ac, aminoAcid)) { List list = universalIsomorphismTester.getSubgraphAtomsMap(ac, aminoAcid); RMap map = null; IAtom atom1 = null; for (int j = 0; j < list.size(); j++) { map = (RMap) list.get(j); // depends on control dependency: [for], data = [j] atom1 = ac.getAtom(map.getId1()); // depends on control dependency: [for], data = [none] if (atom1.getSymbol().equals("O") && ac.getMaximumBondOrder(atom1) == IBond.Order.SINGLE) { if (ac.getConnectedBondsCount(atom1) == 2 && getHydrogenCount(ac, atom1) == 0) { } else { xlogP -= 2.166; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: alpha amino acid -2.166"); break; } } } } } catch (CDKException e) { return getDummyDescriptorValue(e); } // depends on control dependency: [catch], data = [none] } IAtomContainer paba = createPaba(ac.getBuilder()); // p-amino sulphonic acid try { if (universalIsomorphismTester.isSubgraph(ac, paba)) { xlogP -= 0.501; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: p-amino sulphonic acid -0.501"); } } catch (CDKException e) { return getDummyDescriptorValue(e); } // depends on control dependency: [catch], data = [none] // salicylic acid if (salicylFlag) { IAtomContainer salicilic = createSalicylicAcid(ac.getBuilder()); try { if (universalIsomorphismTester.isSubgraph(ac, salicilic)) { xlogP += 0.554; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: salicylic acid 0.554"); } } catch (CDKException e) { return getDummyDescriptorValue(e); } // depends on control dependency: [catch], data = [none] } // ortho oxygen pair SmartsPattern orthopair = SmartsPattern.create("OccO"); if (orthopair.matches(ac)) { xlogP -= 0.268; // depends on control dependency: [if], data = [none] //logger.debug("XLOGP: Ortho oxygen pair -0.268"); } return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(xlogP), getDescriptorNames()); } }
public class class_name { public String getLHSBindingType(final String var) { if (this.lhs == null) { return null; } for (int i = 0; i < this.lhs.length; i++) { String type = getLHSBindingType(this.lhs[i], var); if (type != null) { return type; } } return null; } }
public class class_name { public String getLHSBindingType(final String var) { if (this.lhs == null) { return null; // depends on control dependency: [if], data = [none] } for (int i = 0; i < this.lhs.length; i++) { String type = getLHSBindingType(this.lhs[i], var); if (type != null) { return type; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { private Collection<Field> getFilteredFields(Class<?> refClass) { SoftReference<Collection<Field>> ref = fieldCache.get(refClass); Collection<Field> fieldList = ref != null ? ref.get() : null; if (fieldList != null) { return fieldList; } else { Collection<Field> result; result = sizeOfFilter.filterFields(refClass, getAllFields(refClass)); if (USE_VERBOSE_DEBUG_LOGGING && LOG.isDebugEnabled()) { for (Field field : result) { if (Modifier.isTransient(field.getModifiers())) { LOG.debug("SizeOf engine walking transient field '{}' of class {}", field.getName(), refClass.getName()); } } } fieldCache.put(refClass, new SoftReference<>(result)); return result; } } }
public class class_name { private Collection<Field> getFilteredFields(Class<?> refClass) { SoftReference<Collection<Field>> ref = fieldCache.get(refClass); Collection<Field> fieldList = ref != null ? ref.get() : null; if (fieldList != null) { return fieldList; // depends on control dependency: [if], data = [none] } else { Collection<Field> result; result = sizeOfFilter.filterFields(refClass, getAllFields(refClass)); // depends on control dependency: [if], data = [none] if (USE_VERBOSE_DEBUG_LOGGING && LOG.isDebugEnabled()) { for (Field field : result) { if (Modifier.isTransient(field.getModifiers())) { LOG.debug("SizeOf engine walking transient field '{}' of class {}", field.getName(), refClass.getName()); // depends on control dependency: [if], data = [none] } } } fieldCache.put(refClass, new SoftReference<>(result)); // depends on control dependency: [if], data = [none] return result; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String getMergedNestedText(Node n) { StringBuilder sb = new StringBuilder(); for (Node child : new IterableNodeList(n.getChildNodes())) { if (child instanceof Text || child instanceof CDATASection) { String s = child.getNodeValue(); if (s != null) { sb.append(s); } } } return sb.toString(); } }
public class class_name { public static String getMergedNestedText(Node n) { StringBuilder sb = new StringBuilder(); for (Node child : new IterableNodeList(n.getChildNodes())) { if (child instanceof Text || child instanceof CDATASection) { String s = child.getNodeValue(); if (s != null) { sb.append(s); // depends on control dependency: [if], data = [(s] } } } return sb.toString(); } }
public class class_name { public String getString(String name) { Object value = get(name); if (value instanceof String || value instanceof Boolean || value instanceof Integer) { return value.toString(); } if (value instanceof String[]) { String[] list = getStrings(name); return StringUtils.join(list, ","); } return get(name).toString(); } }
public class class_name { public String getString(String name) { Object value = get(name); if (value instanceof String || value instanceof Boolean || value instanceof Integer) { return value.toString(); // depends on control dependency: [if], data = [none] } if (value instanceof String[]) { String[] list = getStrings(name); return StringUtils.join(list, ","); // depends on control dependency: [if], data = [none] } return get(name).toString(); } }
public class class_name { public static String getParentLoggerName(String loggerName) { int dotIndex = loggerName.lastIndexOf("."); if (dotIndex < 0) { return null; } else { return loggerName.substring(0, dotIndex); } } }
public class class_name { public static String getParentLoggerName(String loggerName) { int dotIndex = loggerName.lastIndexOf("."); if (dotIndex < 0) { return null; // depends on control dependency: [if], data = [none] } else { return loggerName.substring(0, dotIndex); // depends on control dependency: [if], data = [none] } } }
public class class_name { private String makeAlias(String prefix) { int i = 0; String result; do { if (i == 0) { result = prefix; } else { result = prefix + i; } } while (m_usedAliases.contains(result)); m_usedAliases.add(result); return result; } }
public class class_name { private String makeAlias(String prefix) { int i = 0; String result; do { if (i == 0) { result = prefix; // depends on control dependency: [if], data = [none] } else { result = prefix + i; // depends on control dependency: [if], data = [none] } } while (m_usedAliases.contains(result)); m_usedAliases.add(result); return result; } }
public class class_name { public boolean createOrUpdate(GeometryMetadata metadata) { boolean success = false; if (exists(metadata)) { success = update(metadata); } else { create(metadata); success = true; } return success; } }
public class class_name { public boolean createOrUpdate(GeometryMetadata metadata) { boolean success = false; if (exists(metadata)) { success = update(metadata); // depends on control dependency: [if], data = [none] } else { create(metadata); // depends on control dependency: [if], data = [none] success = true; // depends on control dependency: [if], data = [none] } return success; } }
public class class_name { public void marshall(GetResolverRequest getResolverRequest, ProtocolMarshaller protocolMarshaller) { if (getResolverRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getResolverRequest.getApiId(), APIID_BINDING); protocolMarshaller.marshall(getResolverRequest.getTypeName(), TYPENAME_BINDING); protocolMarshaller.marshall(getResolverRequest.getFieldName(), FIELDNAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetResolverRequest getResolverRequest, ProtocolMarshaller protocolMarshaller) { if (getResolverRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getResolverRequest.getApiId(), APIID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getResolverRequest.getTypeName(), TYPENAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getResolverRequest.getFieldName(), FIELDNAME_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 { protected boolean thresholdBinaryNumber() { int lower = (int) (N * (ambiguityThreshold / 2.0)); int upper = (int) (N * (1 - ambiguityThreshold / 2.0)); final int totalElements = getTotalGridElements(); for (int i = 0; i < totalElements; i++) { if (counts[i] < lower) { classified[i] = 0; } else if (counts[i] > upper) { classified[i] = 1; } else { // it's ambiguous so just fail return true; } } return false; } }
public class class_name { protected boolean thresholdBinaryNumber() { int lower = (int) (N * (ambiguityThreshold / 2.0)); int upper = (int) (N * (1 - ambiguityThreshold / 2.0)); final int totalElements = getTotalGridElements(); for (int i = 0; i < totalElements; i++) { if (counts[i] < lower) { classified[i] = 0; // depends on control dependency: [if], data = [none] } else if (counts[i] > upper) { classified[i] = 1; // depends on control dependency: [if], data = [none] } else { // it's ambiguous so just fail return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { @Override public <T> T get(final String key, final T defaultValue, DomainResolver resolver) { final String trimmedKey = trimKey(key); KeyValues keyValues = valuesStore.getKeyValuesFromMapOrPersistence(trimmedKey); T result; if (keyValues == null) { result = defaultValue; } else { result = keyValues.get(domains, defaultValue, resolver); } if (LOGGER.isDebugEnabled()) { LOGGER.debug("Getting value for key: '{}' with given default: '{}'. Returning value: '{}'", trimmedKey, defaultValue, result); StringBuilder builder = new StringBuilder("DomainValues: "); for (String domain : domains) { builder.append(domain).append(" => ").append(resolver.getDomainValue(domain)).append("; "); } LOGGER.debug(builder.toString()); } return result; } }
public class class_name { @Override public <T> T get(final String key, final T defaultValue, DomainResolver resolver) { final String trimmedKey = trimKey(key); KeyValues keyValues = valuesStore.getKeyValuesFromMapOrPersistence(trimmedKey); T result; if (keyValues == null) { result = defaultValue; // depends on control dependency: [if], data = [none] } else { result = keyValues.get(domains, defaultValue, resolver); // depends on control dependency: [if], data = [none] } if (LOGGER.isDebugEnabled()) { LOGGER.debug("Getting value for key: '{}' with given default: '{}'. Returning value: '{}'", trimmedKey, defaultValue, result); // depends on control dependency: [if], data = [none] StringBuilder builder = new StringBuilder("DomainValues: "); for (String domain : domains) { builder.append(domain).append(" => ").append(resolver.getDomainValue(domain)).append("; "); // depends on control dependency: [for], data = [domain] } LOGGER.debug(builder.toString()); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { private static boolean maybeReadTimeOut(Throwable e) { do { if (IOException.class.isInstance(e)) { String message = e.getMessage().toLowerCase(); Matcher matcher = READ_TIME_OUT_PATTERN.matcher(message); if(matcher.find()) { return true; } } e = e.getCause(); } while (e != null); return false; } }
public class class_name { private static boolean maybeReadTimeOut(Throwable e) { do { if (IOException.class.isInstance(e)) { String message = e.getMessage().toLowerCase(); Matcher matcher = READ_TIME_OUT_PATTERN.matcher(message); if(matcher.find()) { return true; // depends on control dependency: [if], data = [none] } } e = e.getCause(); } while (e != null); return false; } }
public class class_name { private static EndpointReferenceType createEPR(String address, SLProperties props) { EndpointReferenceType epr = WSAEndpointReferenceUtils.getEndpointReference(address); if (props != null) { addProperties(epr, props); } return epr; } }
public class class_name { private static EndpointReferenceType createEPR(String address, SLProperties props) { EndpointReferenceType epr = WSAEndpointReferenceUtils.getEndpointReference(address); if (props != null) { addProperties(epr, props); // depends on control dependency: [if], data = [none] } return epr; } }
public class class_name { private void doConfigure() { Undertow.Builder builder = Undertow.builder(); // if no configuration method change root handler, simple path->HttpHandler will be used // where each HttpHandler is created in separate org.ops4j.pax.web.service.undertow.internal.Context HttpHandler rootHandler = path; URL undertowResource = detectUndertowConfiguration(); ConfigSource source = ConfigSource.kind(undertowResource); switch (source) { case XML: LOG.info("Using \"" + undertowResource + "\" to configure Undertow"); rootHandler = configureUndertow(configuration, builder, rootHandler, undertowResource); break; case PROPERTIES: LOG.info("Using \"" + undertowResource + "\" to read additional configuration for Undertow"); configureIdentityManager(undertowResource); // do not break - go to standard PID configuration case PID: LOG.info("Using \"org.ops4j.pax.url.web\" PID to configure Undertow"); rootHandler = configureUndertow(configuration, builder, rootHandler); break; } for (Context context : contextMap.values()) { try { context.setSessionPersistenceManager(sessionPersistenceManager); context.setDefaultSessionTimeoutInMinutes(defaultSessionTimeoutInMinutes); context.start(); } catch (Exception e) { LOG.error("Could not start the servlet context for context path [" + context.getContextModel().getContextName() + "]", e); } } builder.setHandler(rootHandler); server = builder.build(); } }
public class class_name { private void doConfigure() { Undertow.Builder builder = Undertow.builder(); // if no configuration method change root handler, simple path->HttpHandler will be used // where each HttpHandler is created in separate org.ops4j.pax.web.service.undertow.internal.Context HttpHandler rootHandler = path; URL undertowResource = detectUndertowConfiguration(); ConfigSource source = ConfigSource.kind(undertowResource); switch (source) { case XML: LOG.info("Using \"" + undertowResource + "\" to configure Undertow"); rootHandler = configureUndertow(configuration, builder, rootHandler, undertowResource); break; case PROPERTIES: LOG.info("Using \"" + undertowResource + "\" to read additional configuration for Undertow"); configureIdentityManager(undertowResource); // do not break - go to standard PID configuration case PID: LOG.info("Using \"org.ops4j.pax.url.web\" PID to configure Undertow"); rootHandler = configureUndertow(configuration, builder, rootHandler); break; } for (Context context : contextMap.values()) { try { context.setSessionPersistenceManager(sessionPersistenceManager); // depends on control dependency: [try], data = [none] context.setDefaultSessionTimeoutInMinutes(defaultSessionTimeoutInMinutes); // depends on control dependency: [try], data = [none] context.start(); // depends on control dependency: [try], data = [none] } catch (Exception e) { LOG.error("Could not start the servlet context for context path [" + context.getContextModel().getContextName() + "]", e); } // depends on control dependency: [catch], data = [none] } builder.setHandler(rootHandler); server = builder.build(); } }
public class class_name { @Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); MainActivity.updateStoragePrefreneces(this); //needed for unit tests registerReceiver(networkReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); this.setContentView(org.osmdroid.R.layout.activity_starter_main); FragmentManager fm = this.getSupportFragmentManager(); if (fm.findFragmentByTag(MAP_FRAGMENT_TAG) == null) { starterMapFragment = StarterMapFragment.newInstance(); fm.beginTransaction().add(org.osmdroid.R.id.map_container, starterMapFragment, MAP_FRAGMENT_TAG).commit(); } } }
public class class_name { @Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); MainActivity.updateStoragePrefreneces(this); //needed for unit tests registerReceiver(networkReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); this.setContentView(org.osmdroid.R.layout.activity_starter_main); FragmentManager fm = this.getSupportFragmentManager(); if (fm.findFragmentByTag(MAP_FRAGMENT_TAG) == null) { starterMapFragment = StarterMapFragment.newInstance(); // depends on control dependency: [if], data = [none] fm.beginTransaction().add(org.osmdroid.R.id.map_container, starterMapFragment, MAP_FRAGMENT_TAG).commit(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static boolean allowCustomClass(DataSchema schema) { boolean result = false; final DataSchema.Type type = schema.getType(); if (type == DataSchema.Type.TYPEREF || type == DataSchema.Type.RECORD) { // allow custom class only if the dereferenced type is a record or a primitive types that are not enums final DataSchema dereferencedSchema = schema.getDereferencedDataSchema(); if (dereferencedSchema.getType() == DataSchema.Type.RECORD || (CodeUtil.isDirectType(dereferencedSchema) && dereferencedSchema.getType() != DataSchema.Type.ENUM)) { result = true; } } return result; } }
public class class_name { private static boolean allowCustomClass(DataSchema schema) { boolean result = false; final DataSchema.Type type = schema.getType(); if (type == DataSchema.Type.TYPEREF || type == DataSchema.Type.RECORD) { // allow custom class only if the dereferenced type is a record or a primitive types that are not enums final DataSchema dereferencedSchema = schema.getDereferencedDataSchema(); if (dereferencedSchema.getType() == DataSchema.Type.RECORD || (CodeUtil.isDirectType(dereferencedSchema) && dereferencedSchema.getType() != DataSchema.Type.ENUM)) { result = true; // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { public void resolveFactoryBeanClass(BeanRule beanRule) throws IllegalRuleException { String beanIdOrClass = beanRule.getFactoryBeanId(); if (beanRule.isFactoryOffered() && beanIdOrClass != null) { Class<?> beanClass = resolveBeanClass(beanIdOrClass, beanRule); if (beanClass != null) { beanRule.setFactoryBeanClass(beanClass); reserveBeanReference(beanClass, beanRule); } else { reserveBeanReference(beanIdOrClass, beanRule); } } } }
public class class_name { public void resolveFactoryBeanClass(BeanRule beanRule) throws IllegalRuleException { String beanIdOrClass = beanRule.getFactoryBeanId(); if (beanRule.isFactoryOffered() && beanIdOrClass != null) { Class<?> beanClass = resolveBeanClass(beanIdOrClass, beanRule); if (beanClass != null) { beanRule.setFactoryBeanClass(beanClass); // depends on control dependency: [if], data = [(beanClass] reserveBeanReference(beanClass, beanRule); // depends on control dependency: [if], data = [(beanClass] } else { reserveBeanReference(beanIdOrClass, beanRule); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static Class<?> classForName(String name, ClassLoader... classLoaders) throws ClassNotFoundException { ClassLoader[] cls = getClassLoaders(classLoaders); for (ClassLoader cl : cls) { try { if (cl != null) { return cl.loadClass(name); } } catch (ClassNotFoundException e) { // Ignore } } // Try using Class.forName() return Class.forName(name); } }
public class class_name { public static Class<?> classForName(String name, ClassLoader... classLoaders) throws ClassNotFoundException { ClassLoader[] cls = getClassLoaders(classLoaders); for (ClassLoader cl : cls) { try { if (cl != null) { return cl.loadClass(name); // depends on control dependency: [if], data = [none] } } catch (ClassNotFoundException e) { // Ignore } // depends on control dependency: [catch], data = [none] } // Try using Class.forName() return Class.forName(name); } }
public class class_name { public EClass getIfcPointOnSurface() { if (ifcPointOnSurfaceEClass == null) { ifcPointOnSurfaceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(366); } return ifcPointOnSurfaceEClass; } }
public class class_name { public EClass getIfcPointOnSurface() { if (ifcPointOnSurfaceEClass == null) { ifcPointOnSurfaceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(366); // depends on control dependency: [if], data = [none] } return ifcPointOnSurfaceEClass; } }
public class class_name { private static Multimap<Long, Integer> getFeedMapping(AdWordsServicesInterface adWordsServices, AdWordsSession session, Feed feed, long placeholderType) throws RemoteException { // Get the FeedMappingService. FeedMappingServiceInterface feedMappingService = adWordsServices.get(session, FeedMappingServiceInterface.class); String query = String.format( "SELECT FeedMappingId, AttributeFieldMappings WHERE FeedId = %d and PlaceholderType = %d " + "AND Status = 'ENABLED'", feed.getId(), placeholderType); Multimap<Long, Integer> attributeMappings = HashMultimap.create(); int offset = 0; FeedMappingPage feedMappingPage; do { String pageQuery = String.format(query + " LIMIT %d, %d", offset, PAGE_SIZE); feedMappingPage = feedMappingService.query(pageQuery); if (feedMappingPage.getEntries() != null) { // Normally, a feed attribute is mapped only to one field. However, you may map it to more // than one field if needed. for (FeedMapping feedMapping : feedMappingPage.getEntries()) { for (AttributeFieldMapping attributeMapping : feedMapping.getAttributeFieldMappings()) { attributeMappings.put(attributeMapping.getFeedAttributeId(), attributeMapping.getFieldId()); } } } offset += PAGE_SIZE; } while (offset < feedMappingPage.getTotalNumEntries()); return attributeMappings; } }
public class class_name { private static Multimap<Long, Integer> getFeedMapping(AdWordsServicesInterface adWordsServices, AdWordsSession session, Feed feed, long placeholderType) throws RemoteException { // Get the FeedMappingService. FeedMappingServiceInterface feedMappingService = adWordsServices.get(session, FeedMappingServiceInterface.class); String query = String.format( "SELECT FeedMappingId, AttributeFieldMappings WHERE FeedId = %d and PlaceholderType = %d " + "AND Status = 'ENABLED'", feed.getId(), placeholderType); Multimap<Long, Integer> attributeMappings = HashMultimap.create(); int offset = 0; FeedMappingPage feedMappingPage; do { String pageQuery = String.format(query + " LIMIT %d, %d", offset, PAGE_SIZE); feedMappingPage = feedMappingService.query(pageQuery); if (feedMappingPage.getEntries() != null) { // Normally, a feed attribute is mapped only to one field. However, you may map it to more // than one field if needed. for (FeedMapping feedMapping : feedMappingPage.getEntries()) { for (AttributeFieldMapping attributeMapping : feedMapping.getAttributeFieldMappings()) { attributeMappings.put(attributeMapping.getFeedAttributeId(), attributeMapping.getFieldId()); // depends on control dependency: [for], data = [attributeMapping] } } } offset += PAGE_SIZE; } while (offset < feedMappingPage.getTotalNumEntries()); return attributeMappings; } }
public class class_name { public void marshall(UpdateSubnetGroupRequest updateSubnetGroupRequest, ProtocolMarshaller protocolMarshaller) { if (updateSubnetGroupRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateSubnetGroupRequest.getSubnetGroupName(), SUBNETGROUPNAME_BINDING); protocolMarshaller.marshall(updateSubnetGroupRequest.getDescription(), DESCRIPTION_BINDING); protocolMarshaller.marshall(updateSubnetGroupRequest.getSubnetIds(), SUBNETIDS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(UpdateSubnetGroupRequest updateSubnetGroupRequest, ProtocolMarshaller protocolMarshaller) { if (updateSubnetGroupRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateSubnetGroupRequest.getSubnetGroupName(), SUBNETGROUPNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateSubnetGroupRequest.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateSubnetGroupRequest.getSubnetIds(), SUBNETIDS_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 { protected CmsEntityAttribute createEmptyAttribute( CmsEntity parentEntity, String attributeName, CmsAttributeHandler handler, int minOccurrence) { CmsEntityAttribute result = null; CmsType attributeType = m_entityBackEnd.getType(parentEntity.getTypeName()).getAttributeType(attributeName); if (attributeType.isSimpleType()) { for (int i = 0; i < minOccurrence; i++) { parentEntity.addAttributeValue( attributeName, m_widgetService.getDefaultAttributeValue(attributeName, handler.getSimplePath(i))); } result = parentEntity.getAttribute(attributeName); } else { for (int i = 0; i < minOccurrence; i++) { parentEntity.addAttributeValue( attributeName, m_entityBackEnd.createEntity(null, attributeType.getId())); } result = parentEntity.getAttribute(attributeName); } return result; } }
public class class_name { protected CmsEntityAttribute createEmptyAttribute( CmsEntity parentEntity, String attributeName, CmsAttributeHandler handler, int minOccurrence) { CmsEntityAttribute result = null; CmsType attributeType = m_entityBackEnd.getType(parentEntity.getTypeName()).getAttributeType(attributeName); if (attributeType.isSimpleType()) { for (int i = 0; i < minOccurrence; i++) { parentEntity.addAttributeValue( attributeName, m_widgetService.getDefaultAttributeValue(attributeName, handler.getSimplePath(i))); // depends on control dependency: [for], data = [none] } result = parentEntity.getAttribute(attributeName); // depends on control dependency: [if], data = [none] } else { for (int i = 0; i < minOccurrence; i++) { parentEntity.addAttributeValue( attributeName, m_entityBackEnd.createEntity(null, attributeType.getId())); // depends on control dependency: [for], data = [none] } result = parentEntity.getAttribute(attributeName); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { @Override public void updateHandlerMaxFailureCount(String name, int count) { config.lock(); try { AuditLogHandler handler = config.getConfiguredHandler(name); handler.setMaxFailureCount(count); } finally { config.unlock(); } } }
public class class_name { @Override public void updateHandlerMaxFailureCount(String name, int count) { config.lock(); try { AuditLogHandler handler = config.getConfiguredHandler(name); handler.setMaxFailureCount(count); // depends on control dependency: [try], data = [none] } finally { config.unlock(); } } }
public class class_name { private static void addRecentlyCalledMethods(WarningPropertySet<WarningProperty> propertySet, ClassContext classContext, Method method, Location location) { try { CallListDataflow dataflow = classContext.getCallListDataflow(method); CallList callList = dataflow.getFactAtLocation(location); if (!callList.isValid()) { return; } int count = 0; for (Iterator<Call> i = callList.callIterator(); count < 4 && i.hasNext(); ++count) { Call call = i.next(); WarningProperty prop = null; switch (count) { case 0: prop = GeneralWarningProperty.CALLED_METHOD_1; break; case 1: prop = GeneralWarningProperty.CALLED_METHOD_2; break; case 2: prop = GeneralWarningProperty.CALLED_METHOD_3; break; case 3: prop = GeneralWarningProperty.CALLED_METHOD_4; break; default: continue; } propertySet.setProperty(prop, call.getMethodName()); } } catch (CFGBuilderException e) { // Ignore } catch (DataflowAnalysisException e) { // Ignore } } }
public class class_name { private static void addRecentlyCalledMethods(WarningPropertySet<WarningProperty> propertySet, ClassContext classContext, Method method, Location location) { try { CallListDataflow dataflow = classContext.getCallListDataflow(method); CallList callList = dataflow.getFactAtLocation(location); if (!callList.isValid()) { return; // depends on control dependency: [if], data = [none] } int count = 0; for (Iterator<Call> i = callList.callIterator(); count < 4 && i.hasNext(); ++count) { Call call = i.next(); WarningProperty prop = null; switch (count) { case 0: prop = GeneralWarningProperty.CALLED_METHOD_1; break; case 1: prop = GeneralWarningProperty.CALLED_METHOD_2; break; case 2: prop = GeneralWarningProperty.CALLED_METHOD_3; break; case 3: prop = GeneralWarningProperty.CALLED_METHOD_4; break; default: continue; } propertySet.setProperty(prop, call.getMethodName()); // depends on control dependency: [for], data = [none] } } catch (CFGBuilderException e) { // Ignore } catch (DataflowAnalysisException e) { // depends on control dependency: [catch], data = [none] // Ignore } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static final void run(final Class<? extends Jawn> jawn, final String ... args) { Jawn instance = DynamicClassFactory.createInstance(jawn); if (instance.mode == Modes.DEV) { // load the instance with a non-caching classloader final Jawn dynamicInstance = DynamicClassFactory .createInstance( DynamicClassFactory.getCompiledClass(jawn.getName(), false), Jawn.class ); // look for changes to reload final Consumer<Jawn> reloader = (newJawnInstance) -> dynamicInstance.bootstrap.reboot___strap(newJawnInstance.routePopulator()); PackageWatcher watcher = new PackageWatcher(jawn, reloader); // start the watcher try { watcher.start(); } catch (IOException | InterruptedException e) { logger.error("Starting " + PackageWatcher.class, e); } // clean up when shutting the whole thing down dynamicInstance.onShutdown(() -> { try { watcher.close(); } catch (IOException e) { logger.error("Closing " + PackageWatcher.class, e); } }); instance = dynamicInstance; } run(instance, args); } }
public class class_name { public static final void run(final Class<? extends Jawn> jawn, final String ... args) { Jawn instance = DynamicClassFactory.createInstance(jawn); if (instance.mode == Modes.DEV) { // load the instance with a non-caching classloader final Jawn dynamicInstance = DynamicClassFactory .createInstance( DynamicClassFactory.getCompiledClass(jawn.getName(), false), Jawn.class ); // look for changes to reload final Consumer<Jawn> reloader = (newJawnInstance) -> dynamicInstance.bootstrap.reboot___strap(newJawnInstance.routePopulator()); PackageWatcher watcher = new PackageWatcher(jawn, reloader); // start the watcher try { watcher.start(); // depends on control dependency: [try], data = [none] } catch (IOException | InterruptedException e) { logger.error("Starting " + PackageWatcher.class, e); } // depends on control dependency: [catch], data = [none] // clean up when shutting the whole thing down dynamicInstance.onShutdown(() -> { try { watcher.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { logger.error("Closing " + PackageWatcher.class, e); } // depends on control dependency: [catch], data = [none] }); instance = dynamicInstance; // depends on control dependency: [if], data = [none] } run(instance, args); } }
public class class_name { protected List<String> getSpringBeanNames() { List<String> names = new ArrayList<>(); for (String name : applicationContext.getBeanDefinitionNames()) { if (name.startsWith(selfName + ".")) { names.add(name); } } return names; } }
public class class_name { protected List<String> getSpringBeanNames() { List<String> names = new ArrayList<>(); for (String name : applicationContext.getBeanDefinitionNames()) { if (name.startsWith(selfName + ".")) { names.add(name); // depends on control dependency: [if], data = [none] } } return names; } }
public class class_name { public String link(String target, String baseUri) { if (isNotInitialized()) { return getMessage(NOT_INITIALIZED); } try { return CmsJspTagLink.linkTagAction(target, getRequest(), baseUri); } catch (Throwable t) { handleException(t); } CmsMessageContainer msgContainer = Messages.get().container(Messages.GUI_ERR_GEN_LINK_1, target); return getMessage(msgContainer); } }
public class class_name { public String link(String target, String baseUri) { if (isNotInitialized()) { return getMessage(NOT_INITIALIZED); // depends on control dependency: [if], data = [none] } try { return CmsJspTagLink.linkTagAction(target, getRequest(), baseUri); // depends on control dependency: [try], data = [none] } catch (Throwable t) { handleException(t); } // depends on control dependency: [catch], data = [none] CmsMessageContainer msgContainer = Messages.get().container(Messages.GUI_ERR_GEN_LINK_1, target); return getMessage(msgContainer); } }
public class class_name { @Override public void setState(MotorState state) { switch(state) { case STOP: { // set internal tracking state currentState = MotorState.STOP; // turn all GPIO pins to OFF state for(GpioPinDigitalOutput pin : pins) pin.setState(offState); break; } case FORWARD: { // set internal tracking state currentState = MotorState.FORWARD; // start control thread if not already running if(!controlThread.isAlive()) { controlThread = new GpioStepperMotorControl(); controlThread.start(); } break; } case REVERSE: { // set internal tracking state currentState = MotorState.REVERSE; // start control thread if not already running if(!controlThread.isAlive()) { controlThread = new GpioStepperMotorControl(); controlThread.start(); } break; } default: { throw new UnsupportedOperationException("Cannot set motor state: " + state.toString()); } } } }
public class class_name { @Override public void setState(MotorState state) { switch(state) { case STOP: { // set internal tracking state currentState = MotorState.STOP; // turn all GPIO pins to OFF state for(GpioPinDigitalOutput pin : pins) pin.setState(offState); break; } case FORWARD: { // set internal tracking state currentState = MotorState.FORWARD; // start control thread if not already running if(!controlThread.isAlive()) { controlThread = new GpioStepperMotorControl(); // depends on control dependency: [if], data = [none] controlThread.start(); // depends on control dependency: [if], data = [none] } break; } case REVERSE: { // set internal tracking state currentState = MotorState.REVERSE; // start control thread if not already running if(!controlThread.isAlive()) { controlThread = new GpioStepperMotorControl(); controlThread.start(); } break; } default: { throw new UnsupportedOperationException("Cannot set motor state: " + state.toString()); } } } }
public class class_name { @Override public int countByC_C(long classNameId, long classPK) { FinderPath finderPath = FINDER_PATH_COUNT_BY_C_C; Object[] finderArgs = new Object[] { classNameId, classPK }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_COMMERCEADDRESSRESTRICTION_WHERE); query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2); query.append(_FINDER_COLUMN_C_C_CLASSPK_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(classNameId); qPos.add(classPK); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } }
public class class_name { @Override public int countByC_C(long classNameId, long classPK) { FinderPath finderPath = FINDER_PATH_COUNT_BY_C_C; Object[] finderArgs = new Object[] { classNameId, classPK }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_COMMERCEADDRESSRESTRICTION_WHERE); // depends on control dependency: [if], data = [none] query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2); // depends on control dependency: [if], data = [none] query.append(_FINDER_COLUMN_C_C_CLASSPK_2); // depends on control dependency: [if], data = [none] String sql = query.toString(); Session session = null; try { session = openSession(); // depends on control dependency: [try], data = [none] Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(classNameId); // depends on control dependency: [try], data = [none] qPos.add(classPK); // depends on control dependency: [try], data = [none] count = (Long)q.uniqueResult(); // depends on control dependency: [try], data = [none] finderCache.putResult(finderPath, finderArgs, count); // depends on control dependency: [try], data = [none] } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } // depends on control dependency: [catch], data = [none] finally { closeSession(session); } } return count.intValue(); } }
public class class_name { public static String getElasticsearchPid(String baseDir) { try { String pid = new String(Files.readAllBytes(Paths.get(baseDir, "pid"))); return pid; } catch (IOException e) { throw new IllegalStateException( String.format( "Cannot read the PID of the Elasticsearch process from the pid file in directory '%s'", baseDir), e); } } }
public class class_name { public static String getElasticsearchPid(String baseDir) { try { String pid = new String(Files.readAllBytes(Paths.get(baseDir, "pid"))); return pid; // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new IllegalStateException( String.format( "Cannot read the PID of the Elasticsearch process from the pid file in directory '%s'", baseDir), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void updateRelations(CmsObject cms, CmsResource importResource, List<RelationData> relations) throws CmsException { Map<String, CmsRelationType> relTypes = new HashMap<>(); for (CmsRelationType relType : OpenCms.getResourceManager().getRelationTypes()) { relTypes.put(relType.getName(), relType); } Set<CmsRelation> existingRelations = Sets.newHashSet( cms.readRelations(CmsRelationFilter.relationsFromStructureId(importResource.getStructureId()))); List<CmsRelation> noContentRelations = existingRelations.stream().filter( rel -> !rel.getType().isDefinedInContent()).collect(Collectors.toList()); Set<CmsRelation> newRelations = new HashSet<>(); for (RelationData rel : relations) { if (!rel.getType().isDefinedInContent()) { newRelations.add( new CmsRelation( importResource.getStructureId(), importResource.getRootPath(), rel.getTargetId(), rel.getTarget(), rel.getType())); } } if (!newRelations.equals(noContentRelations)) { CmsRelationFilter relFilter = CmsRelationFilter.TARGETS.filterNotDefinedInContent(); cms.deleteRelationsFromResource(importResource, relFilter); for (CmsRelation newRel : newRelations) { cms.addRelationToResource( importResource, cms.readResource(newRel.getTargetId(), CmsResourceFilter.IGNORE_EXPIRATION), newRel.getType().getName()); } } } }
public class class_name { private void updateRelations(CmsObject cms, CmsResource importResource, List<RelationData> relations) throws CmsException { Map<String, CmsRelationType> relTypes = new HashMap<>(); for (CmsRelationType relType : OpenCms.getResourceManager().getRelationTypes()) { relTypes.put(relType.getName(), relType); } Set<CmsRelation> existingRelations = Sets.newHashSet( cms.readRelations(CmsRelationFilter.relationsFromStructureId(importResource.getStructureId()))); List<CmsRelation> noContentRelations = existingRelations.stream().filter( rel -> !rel.getType().isDefinedInContent()).collect(Collectors.toList()); Set<CmsRelation> newRelations = new HashSet<>(); for (RelationData rel : relations) { if (!rel.getType().isDefinedInContent()) { newRelations.add( new CmsRelation( importResource.getStructureId(), importResource.getRootPath(), rel.getTargetId(), rel.getTarget(), rel.getType())); // depends on control dependency: [if], data = [none] } } if (!newRelations.equals(noContentRelations)) { CmsRelationFilter relFilter = CmsRelationFilter.TARGETS.filterNotDefinedInContent(); cms.deleteRelationsFromResource(importResource, relFilter); for (CmsRelation newRel : newRelations) { cms.addRelationToResource( importResource, cms.readResource(newRel.getTargetId(), CmsResourceFilter.IGNORE_EXPIRATION), newRel.getType().getName()); // depends on control dependency: [for], data = [none] } } } }
public class class_name { public Map<String, String> getRoleMap() { if (mapAllMethods != null) { return getRoleMapFromAllMap(); } Map<String, List<String>> outputRTMNormal = null; Map<String, List<String>> outputRTMOmission = null; if (mapMethod != null) { outputRTMNormal = getRoleToMethodMap(getMethod(mapMethod, ROLE, true)); if (tc.isDebugEnabled()) Tr.debug(tc, "outputRTMNormal: " + outputRTMNormal); } if (mapMethodOmission != null) { // it genereate output only following condition: // 1.role is assigned. // 2.neither unchecked or excluded. Map<String, MethodConstraint> omissionRole = getMethod(mapMethodOmission, ROLE_NO_CHECK, true); Map<String, MethodConstraint> validRole = getMethod(mapMethodOmission, EXCLUDED_OR_UNCHECKED_NO_ROLE, true); Map<String, MethodConstraint> uncheckedOrExcluded = getMethod(mapMethodOmission, EXCLUDED_OR_UNCHECKED, true); if (tc.isDebugEnabled()) Tr.debug(tc, "omissionRole: " + omissionRole + " validRole : " + validRole + " uncheckedOrExcluded : " + uncheckedOrExcluded); if (omissionRole != null && ((uncheckedOrExcluded != null && validRole != null) || uncheckedOrExcluded == null)) { outputRTMOmission = getRoleToMethodMap(omissionRole); if (tc.isDebugEnabled()) Tr.debug(tc, "outputRTMOmission: " + outputRTMOmission); } } // now merge both tables and generate method strings. Map<String, String> output = mergeRTM(outputRTMNormal, outputRTMOmission); if (tc.isDebugEnabled()) Tr.debug(tc, "getRoleMap: output: " + output); return output; } }
public class class_name { public Map<String, String> getRoleMap() { if (mapAllMethods != null) { return getRoleMapFromAllMap(); // depends on control dependency: [if], data = [none] } Map<String, List<String>> outputRTMNormal = null; Map<String, List<String>> outputRTMOmission = null; if (mapMethod != null) { outputRTMNormal = getRoleToMethodMap(getMethod(mapMethod, ROLE, true)); // depends on control dependency: [if], data = [(mapMethod] if (tc.isDebugEnabled()) Tr.debug(tc, "outputRTMNormal: " + outputRTMNormal); } if (mapMethodOmission != null) { // it genereate output only following condition: // 1.role is assigned. // 2.neither unchecked or excluded. Map<String, MethodConstraint> omissionRole = getMethod(mapMethodOmission, ROLE_NO_CHECK, true); Map<String, MethodConstraint> validRole = getMethod(mapMethodOmission, EXCLUDED_OR_UNCHECKED_NO_ROLE, true); Map<String, MethodConstraint> uncheckedOrExcluded = getMethod(mapMethodOmission, EXCLUDED_OR_UNCHECKED, true); if (tc.isDebugEnabled()) Tr.debug(tc, "omissionRole: " + omissionRole + " validRole : " + validRole + " uncheckedOrExcluded : " + uncheckedOrExcluded); if (omissionRole != null && ((uncheckedOrExcluded != null && validRole != null) || uncheckedOrExcluded == null)) { outputRTMOmission = getRoleToMethodMap(omissionRole); // depends on control dependency: [if], data = [none] if (tc.isDebugEnabled()) Tr.debug(tc, "outputRTMOmission: " + outputRTMOmission); } } // now merge both tables and generate method strings. Map<String, String> output = mergeRTM(outputRTMNormal, outputRTMOmission); if (tc.isDebugEnabled()) Tr.debug(tc, "getRoleMap: output: " + output); return output; } }
public class class_name { @Override public long getMaximumTimeInStore() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getMaximumTimeInStore"); JsMessage localMsg = getJSMessage(true); long timeToLive = localMsg.getTimeToLive().longValue(); long maxTime = NEVER_EXPIRES; // 180921 if (timeToLive > 0) { maxTime = timeToLive - getAggregateWaitTime(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getMaximumTimeInStore", Long.valueOf(maxTime)); return maxTime; } }
public class class_name { @Override public long getMaximumTimeInStore() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getMaximumTimeInStore"); JsMessage localMsg = getJSMessage(true); long timeToLive = localMsg.getTimeToLive().longValue(); long maxTime = NEVER_EXPIRES; // 180921 if (timeToLive > 0) { maxTime = timeToLive - getAggregateWaitTime(); // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getMaximumTimeInStore", Long.valueOf(maxTime)); return maxTime; } }
public class class_name { public void activateOptions() { if (!isActive()) { setActive(true); if (advertiseViaMulticastDNS) { zeroConf = new ZeroConfSupport(ZONE, port, getName()); zeroConf.advertise(); } fireConnector(false); } } }
public class class_name { public void activateOptions() { if (!isActive()) { setActive(true); // depends on control dependency: [if], data = [none] if (advertiseViaMulticastDNS) { zeroConf = new ZeroConfSupport(ZONE, port, getName()); // depends on control dependency: [if], data = [none] zeroConf.advertise(); // depends on control dependency: [if], data = [none] } fireConnector(false); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setExportDataFormat(java.util.Collection<String> exportDataFormat) { if (exportDataFormat == null) { this.exportDataFormat = null; return; } this.exportDataFormat = new java.util.ArrayList<String>(exportDataFormat); } }
public class class_name { public void setExportDataFormat(java.util.Collection<String> exportDataFormat) { if (exportDataFormat == null) { this.exportDataFormat = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.exportDataFormat = new java.util.ArrayList<String>(exportDataFormat); } }
public class class_name { @VisibleForTesting protected BulkProcessor buildBulkProcessor(BulkProcessor.Listener listener) { checkNotNull(listener); BulkProcessor.Builder bulkProcessorBuilder = callBridge.createBulkProcessorBuilder(client, listener); // This makes flush() blocking bulkProcessorBuilder.setConcurrentRequests(0); if (bulkProcessorFlushMaxActions != null) { bulkProcessorBuilder.setBulkActions(bulkProcessorFlushMaxActions); } if (bulkProcessorFlushMaxSizeMb != null) { bulkProcessorBuilder.setBulkSize(new ByteSizeValue(bulkProcessorFlushMaxSizeMb, ByteSizeUnit.MB)); } if (bulkProcessorFlushIntervalMillis != null) { bulkProcessorBuilder.setFlushInterval(TimeValue.timeValueMillis(bulkProcessorFlushIntervalMillis)); } // if backoff retrying is disabled, bulkProcessorFlushBackoffPolicy will be null callBridge.configureBulkProcessorBackoff(bulkProcessorBuilder, bulkProcessorFlushBackoffPolicy); return bulkProcessorBuilder.build(); } }
public class class_name { @VisibleForTesting protected BulkProcessor buildBulkProcessor(BulkProcessor.Listener listener) { checkNotNull(listener); BulkProcessor.Builder bulkProcessorBuilder = callBridge.createBulkProcessorBuilder(client, listener); // This makes flush() blocking bulkProcessorBuilder.setConcurrentRequests(0); if (bulkProcessorFlushMaxActions != null) { bulkProcessorBuilder.setBulkActions(bulkProcessorFlushMaxActions); // depends on control dependency: [if], data = [(bulkProcessorFlushMaxActions] } if (bulkProcessorFlushMaxSizeMb != null) { bulkProcessorBuilder.setBulkSize(new ByteSizeValue(bulkProcessorFlushMaxSizeMb, ByteSizeUnit.MB)); // depends on control dependency: [if], data = [(bulkProcessorFlushMaxSizeMb] } if (bulkProcessorFlushIntervalMillis != null) { bulkProcessorBuilder.setFlushInterval(TimeValue.timeValueMillis(bulkProcessorFlushIntervalMillis)); // depends on control dependency: [if], data = [(bulkProcessorFlushIntervalMillis] } // if backoff retrying is disabled, bulkProcessorFlushBackoffPolicy will be null callBridge.configureBulkProcessorBackoff(bulkProcessorBuilder, bulkProcessorFlushBackoffPolicy); return bulkProcessorBuilder.build(); } }
public class class_name { public static ExpressionException invalidKey(Config config, Struct sct, Key key, String in) { String appendix = StringUtil.isEmpty(in, true) ? "" : " in the " + in; Iterator<Key> it = sct.keyIterator(); Key k; while (it.hasNext()) { k = it.next(); if (k.equals(key)) return new ExpressionException("the value from key [" + key.getString() + "] " + appendix + " is NULL, which is the same as not existing in CFML"); } config = ThreadLocalPageContext.getConfig(config); if (config != null && config.debug()) return new ExpressionException(ExceptionUtil.similarKeyMessage(sct, key.getString(), "key", "keys", in, true)); return new ExpressionException("key [" + key.getString() + "] doesn't exist" + appendix); } }
public class class_name { public static ExpressionException invalidKey(Config config, Struct sct, Key key, String in) { String appendix = StringUtil.isEmpty(in, true) ? "" : " in the " + in; Iterator<Key> it = sct.keyIterator(); Key k; while (it.hasNext()) { k = it.next(); // depends on control dependency: [while], data = [none] if (k.equals(key)) return new ExpressionException("the value from key [" + key.getString() + "] " + appendix + " is NULL, which is the same as not existing in CFML"); } config = ThreadLocalPageContext.getConfig(config); if (config != null && config.debug()) return new ExpressionException(ExceptionUtil.similarKeyMessage(sct, key.getString(), "key", "keys", in, true)); return new ExpressionException("key [" + key.getString() + "] doesn't exist" + appendix); } }
public class class_name { public static Map<String, Object> getParametersMap(ContainerRequestContext requestContext,HttpServletRequest request) throws IOException { if(isMultipartContent(request)){ return buildQueryParamsMap(request); } Map<String, Object> parameters = buildQueryParamsMap(request); if (RestConst.GET_METHOD.equals(request.getMethod())) { return parameters; }else if (RestConst.POST_METHOD.equals(request.getMethod())) { byte[] byteArray = IOUtils.toByteArray(requestContext.getEntityStream()); //reset InputStream requestContext.setEntityStream(new ByteArrayInputStream(byteArray)); if(byteArray == null || byteArray.length == 0)return parameters; String content = new String(byteArray); //JSON // try { // return JsonUtils.toObject(content, Map.class); // } catch (Exception e) {} if(content.contains("{")){ content = StringUtils.left(content, 2048).trim(); if(!content.endsWith("}"))content = content + "...\n}"; parameters.put("data", content); return parameters; } String[] split = content.split("\\&"); for (String s : split) { String[] split2 = s.split("="); if (split2.length == 2 && StringUtils.isNotBlank(split2[1])) { parameters.put(split2[0], split2[1]); } } return parameters; } return null; } }
public class class_name { public static Map<String, Object> getParametersMap(ContainerRequestContext requestContext,HttpServletRequest request) throws IOException { if(isMultipartContent(request)){ return buildQueryParamsMap(request); } Map<String, Object> parameters = buildQueryParamsMap(request); if (RestConst.GET_METHOD.equals(request.getMethod())) { return parameters; }else if (RestConst.POST_METHOD.equals(request.getMethod())) { byte[] byteArray = IOUtils.toByteArray(requestContext.getEntityStream()); //reset InputStream requestContext.setEntityStream(new ByteArrayInputStream(byteArray)); if(byteArray == null || byteArray.length == 0)return parameters; String content = new String(byteArray); //JSON // try { // return JsonUtils.toObject(content, Map.class); // } catch (Exception e) {} if(content.contains("{")){ content = StringUtils.left(content, 2048).trim(); // depends on control dependency: [if], data = [none] if(!content.endsWith("}"))content = content + "...\n}"; parameters.put("data", content); // depends on control dependency: [if], data = [none] return parameters; // depends on control dependency: [if], data = [none] } String[] split = content.split("\\&"); for (String s : split) { String[] split2 = s.split("="); if (split2.length == 2 && StringUtils.isNotBlank(split2[1])) { parameters.put(split2[0], split2[1]); // depends on control dependency: [if], data = [none] } } return parameters; } return null; } }
public class class_name { @Override public Map<K, V> peekAll(final Iterable<? extends K> keys) { Map<K, CacheEntry<K, V>> map = new HashMap<K, CacheEntry<K, V>>(); for (K k : keys) { CacheEntry<K, V> e = execute(k, SPEC.peekEntry(k)); if (e != null) { map.put(k, e); } } return heapCache.convertCacheEntry2ValueMap(map); } }
public class class_name { @Override public Map<K, V> peekAll(final Iterable<? extends K> keys) { Map<K, CacheEntry<K, V>> map = new HashMap<K, CacheEntry<K, V>>(); for (K k : keys) { CacheEntry<K, V> e = execute(k, SPEC.peekEntry(k)); if (e != null) { map.put(k, e); // depends on control dependency: [if], data = [none] } } return heapCache.convertCacheEntry2ValueMap(map); } }
public class class_name { public ListHealthChecksResult withHealthChecks(HealthCheck... healthChecks) { if (this.healthChecks == null) { setHealthChecks(new com.amazonaws.internal.SdkInternalList<HealthCheck>(healthChecks.length)); } for (HealthCheck ele : healthChecks) { this.healthChecks.add(ele); } return this; } }
public class class_name { public ListHealthChecksResult withHealthChecks(HealthCheck... healthChecks) { if (this.healthChecks == null) { setHealthChecks(new com.amazonaws.internal.SdkInternalList<HealthCheck>(healthChecks.length)); // depends on control dependency: [if], data = [none] } for (HealthCheck ele : healthChecks) { this.healthChecks.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { @Override public boolean union(int x, int y) { int rx = x; int ry = y; int px = p[rx]; int py = p[ry]; while (px != py) { if (px < py) { if (rx == px) { p[rx] = py; return true; } p[rx] = py; rx = px; px = p[rx]; } else { if (ry == py) { p[ry] = px; return true; } p[ry] = px; ry = py; py = p[ry]; } } return false; } }
public class class_name { @Override public boolean union(int x, int y) { int rx = x; int ry = y; int px = p[rx]; int py = p[ry]; while (px != py) { if (px < py) { if (rx == px) { p[rx] = py; // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } p[rx] = py; // depends on control dependency: [if], data = [none] rx = px; // depends on control dependency: [if], data = [none] px = p[rx]; // depends on control dependency: [if], data = [none] } else { if (ry == py) { p[ry] = px; // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } p[ry] = px; // depends on control dependency: [if], data = [none] ry = py; // depends on control dependency: [if], data = [none] py = p[ry]; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public final void shiftOp() throws RecognitionException { try { // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:465:5: ( ( LESS LESS | GREATER GREATER GREATER | GREATER GREATER ) ) // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:465:7: ( LESS LESS | GREATER GREATER GREATER | GREATER GREATER ) { // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:465:7: ( LESS LESS | GREATER GREATER GREATER | GREATER GREATER ) int alt46=3; int LA46_0 = input.LA(1); if ( (LA46_0==LESS) ) { alt46=1; } else if ( (LA46_0==GREATER) ) { int LA46_2 = input.LA(2); if ( (LA46_2==GREATER) ) { int LA46_3 = input.LA(3); if ( (LA46_3==GREATER) ) { alt46=2; } else if ( (LA46_3==EOF||LA46_3==BOOL||(LA46_3 >= DECIMAL && LA46_3 <= DIV)||LA46_3==DOT||LA46_3==FLOAT||LA46_3==HEX||(LA46_3 >= ID && LA46_3 <= INCR)||(LA46_3 >= LEFT_PAREN && LA46_3 <= LESS)||LA46_3==MINUS||LA46_3==NEGATION||LA46_3==NULL||LA46_3==PLUS||LA46_3==QUESTION_DIV||(LA46_3 >= STAR && LA46_3 <= TIME_INTERVAL)) ) { alt46=3; } else { if (state.backtracking>0) {state.failed=true; return;} int nvaeMark = input.mark(); try { for (int nvaeConsume = 0; nvaeConsume < 3 - 1; nvaeConsume++) { input.consume(); } NoViableAltException nvae = new NoViableAltException("", 46, 3, input); throw nvae; } finally { input.rewind(nvaeMark); } } } else { if (state.backtracking>0) {state.failed=true; return;} int nvaeMark = input.mark(); try { input.consume(); NoViableAltException nvae = new NoViableAltException("", 46, 2, input); throw nvae; } finally { input.rewind(nvaeMark); } } } else { if (state.backtracking>0) {state.failed=true; return;} NoViableAltException nvae = new NoViableAltException("", 46, 0, input); throw nvae; } switch (alt46) { case 1 : // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:465:9: LESS LESS { match(input,LESS,FOLLOW_LESS_in_shiftOp2182); if (state.failed) return; match(input,LESS,FOLLOW_LESS_in_shiftOp2184); if (state.failed) return; } break; case 2 : // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:466:11: GREATER GREATER GREATER { match(input,GREATER,FOLLOW_GREATER_in_shiftOp2196); if (state.failed) return; match(input,GREATER,FOLLOW_GREATER_in_shiftOp2198); if (state.failed) return; match(input,GREATER,FOLLOW_GREATER_in_shiftOp2200); if (state.failed) return; } break; case 3 : // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:467:11: GREATER GREATER { match(input,GREATER,FOLLOW_GREATER_in_shiftOp2212); if (state.failed) return; match(input,GREATER,FOLLOW_GREATER_in_shiftOp2214); if (state.failed) return; } break; } } } catch (RecognitionException re) { throw re; } finally { // do for sure before leaving } } }
public class class_name { public final void shiftOp() throws RecognitionException { try { // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:465:5: ( ( LESS LESS | GREATER GREATER GREATER | GREATER GREATER ) ) // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:465:7: ( LESS LESS | GREATER GREATER GREATER | GREATER GREATER ) { // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:465:7: ( LESS LESS | GREATER GREATER GREATER | GREATER GREATER ) int alt46=3; int LA46_0 = input.LA(1); if ( (LA46_0==LESS) ) { alt46=1; } else if ( (LA46_0==GREATER) ) { int LA46_2 = input.LA(2); if ( (LA46_2==GREATER) ) { int LA46_3 = input.LA(3); if ( (LA46_3==GREATER) ) { alt46=2; // depends on control dependency: [if], data = [none] } else if ( (LA46_3==EOF||LA46_3==BOOL||(LA46_3 >= DECIMAL && LA46_3 <= DIV)||LA46_3==DOT||LA46_3==FLOAT||LA46_3==HEX||(LA46_3 >= ID && LA46_3 <= INCR)||(LA46_3 >= LEFT_PAREN && LA46_3 <= LESS)||LA46_3==MINUS||LA46_3==NEGATION||LA46_3==NULL||LA46_3==PLUS||LA46_3==QUESTION_DIV||(LA46_3 >= STAR && LA46_3 <= TIME_INTERVAL)) ) { alt46=3; // depends on control dependency: [if], data = [none] } else { if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] int nvaeMark = input.mark(); try { for (int nvaeConsume = 0; nvaeConsume < 3 - 1; nvaeConsume++) { input.consume(); // depends on control dependency: [for], data = [none] } NoViableAltException nvae = new NoViableAltException("", 46, 3, input); throw nvae; } finally { input.rewind(nvaeMark); } } } else { if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] int nvaeMark = input.mark(); try { input.consume(); // depends on control dependency: [try], data = [none] NoViableAltException nvae = new NoViableAltException("", 46, 2, input); throw nvae; } finally { input.rewind(nvaeMark); } } } else { if (state.backtracking>0) {state.failed=true; return;} NoViableAltException nvae = new NoViableAltException("", 46, 0, input); throw nvae; } switch (alt46) { case 1 : // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:465:9: LESS LESS { match(input,LESS,FOLLOW_LESS_in_shiftOp2182); if (state.failed) return; match(input,LESS,FOLLOW_LESS_in_shiftOp2184); if (state.failed) return; } break; case 2 : // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:466:11: GREATER GREATER GREATER { match(input,GREATER,FOLLOW_GREATER_in_shiftOp2196); if (state.failed) return; match(input,GREATER,FOLLOW_GREATER_in_shiftOp2198); if (state.failed) return; match(input,GREATER,FOLLOW_GREATER_in_shiftOp2200); if (state.failed) return; } break; case 3 : // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:467:11: GREATER GREATER { match(input,GREATER,FOLLOW_GREATER_in_shiftOp2212); if (state.failed) return; match(input,GREATER,FOLLOW_GREATER_in_shiftOp2214); if (state.failed) return; } break; } } } catch (RecognitionException re) { throw re; } finally { // do for sure before leaving } } }
public class class_name { @Nonnull private <T> T getInstance(@Nonnull Key<T> key) { try { return getInstanceInternal(key); } catch (UnsatisfiedDependencyException e) { throw e.asInjectionException(key); } } }
public class class_name { @Nonnull private <T> T getInstance(@Nonnull Key<T> key) { try { return getInstanceInternal(key); // depends on control dependency: [try], data = [none] } catch (UnsatisfiedDependencyException e) { throw e.asInjectionException(key); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static void mergeAllRowsIfPossible(ArrayList<Row> rows) { // use fixed seed in order to get consistent results (with random properties) Random rand = new Random(5711l); int tries = 0; // this should be enough to be quite sure we don't miss any optimalization // possibility final int maxTries = rows.size() * 2; // do this loop until we successfully merged everything into one row // or we give up until too much tries while (rows.size() > 1 && tries < maxTries) { // choose two random entries int oneIdx = rand.nextInt(rows.size()); int secondIdx = rand.nextInt(rows.size()); if (oneIdx == secondIdx) { // try again if we choose the same rows by accident continue; } Row one = rows.get(oneIdx); Row second = rows.get(secondIdx); if (one.merge(second)) { // remove the second one since it is merged into the first rows.remove(secondIdx); // success: reset counter tries = 0; } else { // increase counter to avoid endless loops if no improvement is possible tries++; } } } }
public class class_name { private static void mergeAllRowsIfPossible(ArrayList<Row> rows) { // use fixed seed in order to get consistent results (with random properties) Random rand = new Random(5711l); int tries = 0; // this should be enough to be quite sure we don't miss any optimalization // possibility final int maxTries = rows.size() * 2; // do this loop until we successfully merged everything into one row // or we give up until too much tries while (rows.size() > 1 && tries < maxTries) { // choose two random entries int oneIdx = rand.nextInt(rows.size()); int secondIdx = rand.nextInt(rows.size()); if (oneIdx == secondIdx) { // try again if we choose the same rows by accident continue; } Row one = rows.get(oneIdx); Row second = rows.get(secondIdx); if (one.merge(second)) { // remove the second one since it is merged into the first rows.remove(secondIdx); // depends on control dependency: [if], data = [none] // success: reset counter tries = 0; // depends on control dependency: [if], data = [none] } else { // increase counter to avoid endless loops if no improvement is possible tries++; // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void performDelay() { try { TimeUnit.MILLISECONDS.sleep(crawlDelayMechanism.getDelay()); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); isStopping = true; } } }
public class class_name { private void performDelay() { try { TimeUnit.MILLISECONDS.sleep(crawlDelayMechanism.getDelay()); // depends on control dependency: [try], data = [none] } catch (InterruptedException ex) { Thread.currentThread().interrupt(); isStopping = true; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private ReceiveQueueListener<Response<Object>> createResponseQueueListener() { return new ReceiveQueueListener<Response<Object>>() { @Override public void receive(final Response<Object> response) { if (debug) { logger.debug("createResponseQueueListener() Received a response: " + response); } handleResponseFromServiceBundle(response, response.request().originatingRequest()); } @Override public void limit() { httpRequestServerHandler.checkTimeoutsForRequests(); webSocketHandler.checkResponseBatchSend(); } @Override public void empty() { httpRequestServerHandler.checkTimeoutsForRequests(); webSocketHandler.checkResponseBatchSend(); } @Override public void idle() { httpRequestServerHandler.checkTimeoutsForRequests(); webSocketHandler.checkResponseBatchSend(); } }; } }
public class class_name { private ReceiveQueueListener<Response<Object>> createResponseQueueListener() { return new ReceiveQueueListener<Response<Object>>() { @Override public void receive(final Response<Object> response) { if (debug) { logger.debug("createResponseQueueListener() Received a response: " + response); // depends on control dependency: [if], data = [none] } handleResponseFromServiceBundle(response, response.request().originatingRequest()); } @Override public void limit() { httpRequestServerHandler.checkTimeoutsForRequests(); webSocketHandler.checkResponseBatchSend(); } @Override public void empty() { httpRequestServerHandler.checkTimeoutsForRequests(); webSocketHandler.checkResponseBatchSend(); } @Override public void idle() { httpRequestServerHandler.checkTimeoutsForRequests(); webSocketHandler.checkResponseBatchSend(); } }; } }
public class class_name { public static boolean matchPattern(String path, String pattern) { // Normalize the argument strings if ((path == null) || (path.length() == 0)) { path = "/"; } if ((pattern == null) || (pattern.length() == 0)) { pattern = "/"; } // Check for exact match if (path.equals(pattern)) { return (true); } // Check for path prefix matching if (pattern.startsWith("/") && pattern.endsWith("/*")) { pattern = pattern.substring(0, pattern.length() - 2); if (pattern.length() == 0) { return (true); // "/*" is the same as "/" } if (path.endsWith("/")) { path = path.substring(0, path.length() - 1); } while (true) { if (pattern.equals(path)) { return (true); } int slash = path.lastIndexOf('/'); if (slash <= 0) { break; } path = path.substring(0, slash); } return (false); } // Check for suffix matching if (pattern.startsWith("*.")) { int slash = path.lastIndexOf('/'); int period = path.lastIndexOf('.'); if ((slash >= 0) && (period > slash) && path.endsWith(pattern.substring(1))) { return (true); } return (false); } // Check for universal mapping if (pattern.equals("/")) { return (true); } return (false); } }
public class class_name { public static boolean matchPattern(String path, String pattern) { // Normalize the argument strings if ((path == null) || (path.length() == 0)) { path = "/"; // depends on control dependency: [if], data = [none] } if ((pattern == null) || (pattern.length() == 0)) { pattern = "/"; // depends on control dependency: [if], data = [none] } // Check for exact match if (path.equals(pattern)) { return (true); // depends on control dependency: [if], data = [none] } // Check for path prefix matching if (pattern.startsWith("/") && pattern.endsWith("/*")) { pattern = pattern.substring(0, pattern.length() - 2); // depends on control dependency: [if], data = [none] if (pattern.length() == 0) { return (true); // "/*" is the same as "/" // depends on control dependency: [if], data = [none] } if (path.endsWith("/")) { path = path.substring(0, path.length() - 1); // depends on control dependency: [if], data = [none] } while (true) { if (pattern.equals(path)) { return (true); // depends on control dependency: [if], data = [none] } int slash = path.lastIndexOf('/'); if (slash <= 0) { break; } path = path.substring(0, slash); // depends on control dependency: [while], data = [none] } return (false); // depends on control dependency: [if], data = [none] } // Check for suffix matching if (pattern.startsWith("*.")) { int slash = path.lastIndexOf('/'); int period = path.lastIndexOf('.'); if ((slash >= 0) && (period > slash) && path.endsWith(pattern.substring(1))) { return (true); // depends on control dependency: [if], data = [none] } return (false); // depends on control dependency: [if], data = [none] } // Check for universal mapping if (pattern.equals("/")) { return (true); // depends on control dependency: [if], data = [none] } return (false); } }
public class class_name { private List<RegexRule> readRules(ArrayNode rulesList) { List<RegexRule> rules = new ArrayList<>(); for (JsonNode urlFilterNode : rulesList) { try { RegexRule rule = createRule(urlFilterNode.asText()); if (rule != null) { rules.add(rule); } } catch (IOException e) { LOG.error("There was an error reading regex filter {}", urlFilterNode.asText(), e); } } return rules; } }
public class class_name { private List<RegexRule> readRules(ArrayNode rulesList) { List<RegexRule> rules = new ArrayList<>(); for (JsonNode urlFilterNode : rulesList) { try { RegexRule rule = createRule(urlFilterNode.asText()); if (rule != null) { rules.add(rule); // depends on control dependency: [if], data = [(rule] } } catch (IOException e) { LOG.error("There was an error reading regex filter {}", urlFilterNode.asText(), e); } // depends on control dependency: [catch], data = [none] } return rules; } }