code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public void shutdown() { ClassLoader origClassLoader = Thread.currentThread().getContextClassLoader(); try { ClassLoader orientClassLoader = OIndexes.class.getClassLoader(); Thread.currentThread().setContextClassLoader(orientClassLoader); graph.close(); } finally { Thread.currentThread().setContextClassLoader(origClassLoader); } } }
public class class_name { public void shutdown() { ClassLoader origClassLoader = Thread.currentThread().getContextClassLoader(); try { ClassLoader orientClassLoader = OIndexes.class.getClassLoader(); Thread.currentThread().setContextClassLoader(orientClassLoader); // depends on control dependency: [try], data = [none] graph.close(); // depends on control dependency: [try], data = [none] } finally { Thread.currentThread().setContextClassLoader(origClassLoader); } } }
public class class_name { private TransactionException labelTaken(SchemaConcept schemaConcept) { if (Schema.MetaSchema.isMetaLabel(schemaConcept.label())) { return TransactionException.reservedLabel(schemaConcept.label()); } return PropertyNotUniqueException.cannotCreateProperty(schemaConcept, Schema.VertexProperty.SCHEMA_LABEL, schemaConcept.label()); } }
public class class_name { private TransactionException labelTaken(SchemaConcept schemaConcept) { if (Schema.MetaSchema.isMetaLabel(schemaConcept.label())) { return TransactionException.reservedLabel(schemaConcept.label()); // depends on control dependency: [if], data = [none] } return PropertyNotUniqueException.cannotCreateProperty(schemaConcept, Schema.VertexProperty.SCHEMA_LABEL, schemaConcept.label()); } }
public class class_name { public static Class<?> loadClass(String className) throws ClassNotFoundException { try { return Thread.currentThread().getContextClassLoader().loadClass(className); } catch (ClassNotFoundException e) { try { return Class.forName(className); } catch (ClassNotFoundException ex) { try { return ClassLoader.class.getClassLoader().loadClass(className); } catch (ClassNotFoundException exc) { throw exc; } } } } }
public class class_name { public static Class<?> loadClass(String className) throws ClassNotFoundException { try { return Thread.currentThread().getContextClassLoader().loadClass(className); } catch (ClassNotFoundException e) { try { return Class.forName(className); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException ex) { try { return ClassLoader.class.getClassLoader().loadClass(className); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException exc) { throw exc; } // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] } } }
public class class_name { protected void closeLocalConnection(Connection connection) { try { if (connection != null && !connection.isClosed()) { connection.close(); } } catch (SQLException e) { if (logger.isTraceEnabled()) { logger.trace(e.getMessage()); } } } }
public class class_name { protected void closeLocalConnection(Connection connection) { try { if (connection != null && !connection.isClosed()) { connection.close(); // depends on control dependency: [if], data = [none] } } catch (SQLException e) { if (logger.isTraceEnabled()) { logger.trace(e.getMessage()); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } }
public class class_name { public int compareToPositional(ResidueNumber other) { // sequence number if (seqNum != null && other.seqNum != null) { if (!seqNum.equals(other.seqNum)) return seqNum.compareTo(other.seqNum); } if (seqNum != null && other.seqNum == null) { return 1; } else if (seqNum == null && other.seqNum != null) { return -1; } // insertion code if (insCode != null && other.insCode != null) { if (!insCode.equals(other.insCode)) return insCode.compareTo(other.insCode); } if (insCode != null && other.insCode == null) { return 1; } else if (insCode == null && other.insCode != null) { return -1; } return 0; } }
public class class_name { public int compareToPositional(ResidueNumber other) { // sequence number if (seqNum != null && other.seqNum != null) { if (!seqNum.equals(other.seqNum)) return seqNum.compareTo(other.seqNum); } if (seqNum != null && other.seqNum == null) { return 1; // depends on control dependency: [if], data = [none] } else if (seqNum == null && other.seqNum != null) { return -1; // depends on control dependency: [if], data = [none] } // insertion code if (insCode != null && other.insCode != null) { if (!insCode.equals(other.insCode)) return insCode.compareTo(other.insCode); } if (insCode != null && other.insCode == null) { return 1; // depends on control dependency: [if], data = [none] } else if (insCode == null && other.insCode != null) { return -1; // depends on control dependency: [if], data = [none] } return 0; } }
public class class_name { @Override public void clear() throws IOException { boolean rollback = false; final OAtomicOperation atomicOperation = startAtomicOperation(true); try { final Lock lock = FILE_LOCK_MANAGER.acquireExclusiveLock(fileId); try { final Queue<OBonsaiBucketPointer> subTreesToDelete = new LinkedList<>(); final OCacheEntry cacheEntry = loadPageForWrite(atomicOperation, fileId, rootBucketPointer.getPageIndex(), false, true); try { OSBTreeBonsaiBucket<K, V> rootBucket = new OSBTreeBonsaiBucket<>(cacheEntry, rootBucketPointer.getPageOffset(), keySerializer, valueSerializer, this); addChildrenToQueue(subTreesToDelete, rootBucket); rootBucket.shrink(0); rootBucket = new OSBTreeBonsaiBucket<>(cacheEntry, rootBucketPointer.getPageOffset(), true, keySerializer, valueSerializer, this); rootBucket.setTreeSize(0); } finally { releasePageFromWrite(atomicOperation, cacheEntry); } recycleSubTrees(subTreesToDelete, atomicOperation); } finally { lock.unlock(); } } catch (final Exception e) { rollback = true; throw e; } finally { endAtomicOperation(rollback); } } }
public class class_name { @Override public void clear() throws IOException { boolean rollback = false; final OAtomicOperation atomicOperation = startAtomicOperation(true); try { final Lock lock = FILE_LOCK_MANAGER.acquireExclusiveLock(fileId); try { final Queue<OBonsaiBucketPointer> subTreesToDelete = new LinkedList<>(); final OCacheEntry cacheEntry = loadPageForWrite(atomicOperation, fileId, rootBucketPointer.getPageIndex(), false, true); try { OSBTreeBonsaiBucket<K, V> rootBucket = new OSBTreeBonsaiBucket<>(cacheEntry, rootBucketPointer.getPageOffset(), keySerializer, valueSerializer, this); addChildrenToQueue(subTreesToDelete, rootBucket); // depends on control dependency: [try], data = [none] rootBucket.shrink(0); // depends on control dependency: [try], data = [none] rootBucket = new OSBTreeBonsaiBucket<>(cacheEntry, rootBucketPointer.getPageOffset(), true, keySerializer, valueSerializer, this); // depends on control dependency: [try], data = [none] rootBucket.setTreeSize(0); // depends on control dependency: [try], data = [none] } finally { releasePageFromWrite(atomicOperation, cacheEntry); } recycleSubTrees(subTreesToDelete, atomicOperation); // depends on control dependency: [try], data = [none] } finally { lock.unlock(); } } catch (final Exception e) { rollback = true; throw e; } finally { endAtomicOperation(rollback); } } }
public class class_name { public void setVpcSecurityGroupIds(java.util.Collection<String> vpcSecurityGroupIds) { if (vpcSecurityGroupIds == null) { this.vpcSecurityGroupIds = null; return; } this.vpcSecurityGroupIds = new com.amazonaws.internal.SdkInternalList<String>(vpcSecurityGroupIds); } }
public class class_name { public void setVpcSecurityGroupIds(java.util.Collection<String> vpcSecurityGroupIds) { if (vpcSecurityGroupIds == null) { this.vpcSecurityGroupIds = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.vpcSecurityGroupIds = new com.amazonaws.internal.SdkInternalList<String>(vpcSecurityGroupIds); } }
public class class_name { public void close() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "close"); } synchronized (closeSync) { if (closeCalled) { return; } closeCalled = true; // Release the buffer used to store results of encryption, and given to // device channel for writing. if (null != this.encryptedAppBuffer) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Releasing ssl output buffer during close. " + SSLUtils.getBufferTraceInfo(this.encryptedAppBuffer)); } this.encryptedAppBuffer.release(); this.encryptedAppBuffer = null; } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "close"); } } }
public class class_name { public void close() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "close"); // depends on control dependency: [if], data = [none] } synchronized (closeSync) { if (closeCalled) { return; // depends on control dependency: [if], data = [none] } closeCalled = true; // Release the buffer used to store results of encryption, and given to // device channel for writing. if (null != this.encryptedAppBuffer) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Releasing ssl output buffer during close. " + SSLUtils.getBufferTraceInfo(this.encryptedAppBuffer)); // depends on control dependency: [if], data = [none] } this.encryptedAppBuffer.release(); // depends on control dependency: [if], data = [none] this.encryptedAppBuffer = null; // depends on control dependency: [if], data = [none] } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "close"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void main(final String[] args) { /*- * use one of the pre-defined amis * (all amis are pre-defined in aws-mock-default.properties or aws-mock.properties) */ String imageId = "ami-12345678"; final int runCount = 10; List<Instance> startedInstances = runInstances(imageId, runCount); System.out.println("Started instances: "); for (Instance i : startedInstances) { System.out.println(i.getInstanceId() + " - " + i.getState().getName()); } } }
public class class_name { public static void main(final String[] args) { /*- * use one of the pre-defined amis * (all amis are pre-defined in aws-mock-default.properties or aws-mock.properties) */ String imageId = "ami-12345678"; final int runCount = 10; List<Instance> startedInstances = runInstances(imageId, runCount); System.out.println("Started instances: "); for (Instance i : startedInstances) { System.out.println(i.getInstanceId() + " - " + i.getState().getName()); // depends on control dependency: [for], data = [i] } } }
public class class_name { public DescribeReplicationSubnetGroupsResult withReplicationSubnetGroups(ReplicationSubnetGroup... replicationSubnetGroups) { if (this.replicationSubnetGroups == null) { setReplicationSubnetGroups(new java.util.ArrayList<ReplicationSubnetGroup>(replicationSubnetGroups.length)); } for (ReplicationSubnetGroup ele : replicationSubnetGroups) { this.replicationSubnetGroups.add(ele); } return this; } }
public class class_name { public DescribeReplicationSubnetGroupsResult withReplicationSubnetGroups(ReplicationSubnetGroup... replicationSubnetGroups) { if (this.replicationSubnetGroups == null) { setReplicationSubnetGroups(new java.util.ArrayList<ReplicationSubnetGroup>(replicationSubnetGroups.length)); // depends on control dependency: [if], data = [none] } for (ReplicationSubnetGroup ele : replicationSubnetGroups) { this.replicationSubnetGroups.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { static Optional<DistributerException> checkCode(Code code, String format, Object...args) { if (code != Code.OK) { KeeperException kex = KeeperException.create(code); return Optional.of(loggedDistributerException(kex, format, args)); } else { return Optional.absent(); } } }
public class class_name { static Optional<DistributerException> checkCode(Code code, String format, Object...args) { if (code != Code.OK) { KeeperException kex = KeeperException.create(code); return Optional.of(loggedDistributerException(kex, format, args)); // depends on control dependency: [if], data = [none] } else { return Optional.absent(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private String getPath(CmsObject cms, HttpSession session) { CmsQuickLaunchLocationCache locationCache = CmsQuickLaunchLocationCache.getLocationCache(session); String page = locationCache.getPageEditorLocation(cms.getRequestContext().getSiteRoot()); if (page == null) { try { CmsResource mainDefaultFile = cms.readDefaultFile("/"); if (mainDefaultFile != null) { page = cms.getSitePath(mainDefaultFile); } } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); } } return page; } }
public class class_name { private String getPath(CmsObject cms, HttpSession session) { CmsQuickLaunchLocationCache locationCache = CmsQuickLaunchLocationCache.getLocationCache(session); String page = locationCache.getPageEditorLocation(cms.getRequestContext().getSiteRoot()); if (page == null) { try { CmsResource mainDefaultFile = cms.readDefaultFile("/"); if (mainDefaultFile != null) { page = cms.getSitePath(mainDefaultFile); // depends on control dependency: [if], data = [(mainDefaultFile] } } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); } // depends on control dependency: [catch], data = [none] } return page; } }
public class class_name { public static void close() { if (storedClient == null) { return; } storedClient.closeConnection(); storedClient = null; // Allow the client to be auto initialized on the next use. autoInitAttempted.set(false); } }
public class class_name { public static void close() { if (storedClient == null) { return; // depends on control dependency: [if], data = [none] } storedClient.closeConnection(); storedClient = null; // Allow the client to be auto initialized on the next use. autoInitAttempted.set(false); } }
public class class_name { public void removeAllBusHalts() { for (final BusItineraryHalt bushalt : this.invalidHalts) { bushalt.setContainer(null); bushalt.setRoadSegmentIndex(-1); bushalt.setPositionOnSegment(Float.NaN); bushalt.checkPrimitiveValidity(); } final BusItineraryHalt[] halts = new BusItineraryHalt[this.validHalts.size()]; this.validHalts.toArray(halts); this.validHalts.clear(); this.invalidHalts.clear(); for (final BusItineraryHalt bushalt : halts) { bushalt.setContainer(null); bushalt.setRoadSegmentIndex(-1); bushalt.setPositionOnSegment(Float.NaN); bushalt.checkPrimitiveValidity(); } fireShapeChanged(new BusChangeEvent(this, BusChangeEventType.ALL_ITINERARY_HALTS_REMOVED, null, -1, "shape", //$NON-NLS-1$ null, null)); checkPrimitiveValidity(); } }
public class class_name { public void removeAllBusHalts() { for (final BusItineraryHalt bushalt : this.invalidHalts) { bushalt.setContainer(null); // depends on control dependency: [for], data = [bushalt] bushalt.setRoadSegmentIndex(-1); // depends on control dependency: [for], data = [bushalt] bushalt.setPositionOnSegment(Float.NaN); // depends on control dependency: [for], data = [bushalt] bushalt.checkPrimitiveValidity(); // depends on control dependency: [for], data = [bushalt] } final BusItineraryHalt[] halts = new BusItineraryHalt[this.validHalts.size()]; this.validHalts.toArray(halts); this.validHalts.clear(); this.invalidHalts.clear(); for (final BusItineraryHalt bushalt : halts) { bushalt.setContainer(null); // depends on control dependency: [for], data = [bushalt] bushalt.setRoadSegmentIndex(-1); // depends on control dependency: [for], data = [bushalt] bushalt.setPositionOnSegment(Float.NaN); // depends on control dependency: [for], data = [bushalt] bushalt.checkPrimitiveValidity(); // depends on control dependency: [for], data = [bushalt] } fireShapeChanged(new BusChangeEvent(this, BusChangeEventType.ALL_ITINERARY_HALTS_REMOVED, null, -1, "shape", //$NON-NLS-1$ null, null)); checkPrimitiveValidity(); } }
public class class_name { @FFDCIgnore(Exception.class) protected void initSigningKey(BuilderImpl jwtBuilder, JwtConfig jwtConfig) throws JwtTokenException { String keyType = Constants.SIGNING_KEY_X509; try { if (jwtConfig.isJwkEnabled() && SIGNATURE_ALG_RS256.equals(signatureAlgorithm)) { keyType = Constants.SIGNING_KEY_JWK; if (tc.isDebugEnabled()) { Tr.debug(tc, "Signing key type is " + keyType); } JSONWebKey jwk = jwtConfig.getJSONWebKey(); if (jwk == null) { if (tc.isDebugEnabled()) { Tr.debug(tc, "Did not succcessfully build a JWK"); } _signingKey = null; _keyId = null; } else { _signingKey = jwk.getPrivateKey(); _keyId = jwk.getKeyID(); } } else { if (SIGNATURE_ALG_HS256.equals(signatureAlgorithm)) { keyType = Constants.SIGNING_KEY_SECRET; if (tc.isDebugEnabled()) { Tr.debug(tc, "Signing key type is " + keyType); } String sharedKey = jwtBuilder.getSharedKey(); if (JwtUtils.isNullEmpty(sharedKey)) { sharedKey = jwtConfig.getSharedKey(); } if (!JwtUtils.isNullEmpty(sharedKey)) { _signingKey = new HmacKey(sharedKey.getBytes("UTF-8")); } else { _signingKey = null; } } else if (SIGNATURE_ALG_RS256.equals(signatureAlgorithm)) { _signingKey = jwtBuilder.getKey(); if (tc.isDebugEnabled()) { Tr.debug(tc, "Signing key type is " + keyType); } if (_signingKey == null) { String keyAlias = null; String keyStoreRef = null; keyAlias = jwtConfig.getKeyAlias(); keyStoreRef = jwtConfig.getKeyStoreRef(); _signingKey = JwtUtils.getPrivateKey(keyAlias, keyStoreRef); _keyId = buildKidFromPublicKey(JwtUtils.getPublicKey(keyAlias, keyStoreRef)); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Key alias: " + keyAlias + ", Keystore: " + keyStoreRef+ ", kid: " + _keyId); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "RSAPrivateKey: " + (_signingKey instanceof RSAPrivateKey)); } if (_signingKey != null && !(_signingKey instanceof RSAPrivateKey)) { // error handling // String errorMsg = Tr.formatMessage(tc, "SIGNING_KEY_NOT_RSA", new Object[] { signatureAlgorithm }); // Object[] objs = new Object[] { signatureAlgorithm, errorMsg }; // noKeyException = JWTTokenException.newInstance(false, "JWT_BAD_SIGNING_KEY", objs); _signingKey = null; // we will catch this later in jwtSigner _keyId = null; } } } } catch (Exception e) { // UnsupportedEncodingException e (won't happen) // if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { // Tr.debug(tc, "Exception obtaining the signing key: " + e); // } // error messages // JWT_BAD_SIGNING_KEY=CWWKS1455E: A signing key was not available. The signature algorithm is [{0}]. {1} Object[] objs = new Object[] { signatureAlgorithm, jwtConfig.isJwkEnabled(), e.getLocalizedMessage() }; // let JWTTokenException handle the exception JwtTokenException jte = JwtTokenException.newInstance(false, "JWT_NO_SIGNING_KEY_WITH_ERROR", objs); jte.initCause(e); throw jte; } if (_signingKey == null) { Object[] objs = new Object[] { signatureAlgorithm, jwtConfig.isJwkEnabled(), "" }; // let JWTTokenException handle the exception throw JwtTokenException.newInstance(true, "JWT_NO_SIGNING_KEY_WITH_ERROR", objs); } } }
public class class_name { @FFDCIgnore(Exception.class) protected void initSigningKey(BuilderImpl jwtBuilder, JwtConfig jwtConfig) throws JwtTokenException { String keyType = Constants.SIGNING_KEY_X509; try { if (jwtConfig.isJwkEnabled() && SIGNATURE_ALG_RS256.equals(signatureAlgorithm)) { keyType = Constants.SIGNING_KEY_JWK; // depends on control dependency: [if], data = [none] if (tc.isDebugEnabled()) { Tr.debug(tc, "Signing key type is " + keyType); // depends on control dependency: [if], data = [none] } JSONWebKey jwk = jwtConfig.getJSONWebKey(); if (jwk == null) { if (tc.isDebugEnabled()) { Tr.debug(tc, "Did not succcessfully build a JWK"); // depends on control dependency: [if], data = [none] } _signingKey = null; // depends on control dependency: [if], data = [none] _keyId = null; // depends on control dependency: [if], data = [none] } else { _signingKey = jwk.getPrivateKey(); // depends on control dependency: [if], data = [none] _keyId = jwk.getKeyID(); // depends on control dependency: [if], data = [none] } } else { if (SIGNATURE_ALG_HS256.equals(signatureAlgorithm)) { keyType = Constants.SIGNING_KEY_SECRET; // depends on control dependency: [if], data = [none] if (tc.isDebugEnabled()) { Tr.debug(tc, "Signing key type is " + keyType); // depends on control dependency: [if], data = [none] } String sharedKey = jwtBuilder.getSharedKey(); if (JwtUtils.isNullEmpty(sharedKey)) { sharedKey = jwtConfig.getSharedKey(); // depends on control dependency: [if], data = [none] } if (!JwtUtils.isNullEmpty(sharedKey)) { _signingKey = new HmacKey(sharedKey.getBytes("UTF-8")); // depends on control dependency: [if], data = [none] } else { _signingKey = null; // depends on control dependency: [if], data = [none] } } else if (SIGNATURE_ALG_RS256.equals(signatureAlgorithm)) { _signingKey = jwtBuilder.getKey(); // depends on control dependency: [if], data = [none] if (tc.isDebugEnabled()) { Tr.debug(tc, "Signing key type is " + keyType); // depends on control dependency: [if], data = [none] } if (_signingKey == null) { String keyAlias = null; String keyStoreRef = null; keyAlias = jwtConfig.getKeyAlias(); // depends on control dependency: [if], data = [none] keyStoreRef = jwtConfig.getKeyStoreRef(); // depends on control dependency: [if], data = [none] _signingKey = JwtUtils.getPrivateKey(keyAlias, keyStoreRef); // depends on control dependency: [if], data = [none] _keyId = buildKidFromPublicKey(JwtUtils.getPublicKey(keyAlias, keyStoreRef)); // depends on control dependency: [if], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Key alias: " + keyAlias + ", Keystore: " + keyStoreRef+ ", kid: " + _keyId); // depends on control dependency: [if], data = [none] } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "RSAPrivateKey: " + (_signingKey instanceof RSAPrivateKey)); // depends on control dependency: [if], data = [none] } if (_signingKey != null && !(_signingKey instanceof RSAPrivateKey)) { // error handling // String errorMsg = Tr.formatMessage(tc, "SIGNING_KEY_NOT_RSA", new Object[] { signatureAlgorithm }); // Object[] objs = new Object[] { signatureAlgorithm, errorMsg }; // noKeyException = JWTTokenException.newInstance(false, "JWT_BAD_SIGNING_KEY", objs); _signingKey = null; // we will catch this later in jwtSigner // depends on control dependency: [if], data = [none] _keyId = null; // depends on control dependency: [if], data = [none] } } } } catch (Exception e) { // UnsupportedEncodingException e (won't happen) // if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { // Tr.debug(tc, "Exception obtaining the signing key: " + e); // } // error messages // JWT_BAD_SIGNING_KEY=CWWKS1455E: A signing key was not available. The signature algorithm is [{0}]. {1} Object[] objs = new Object[] { signatureAlgorithm, jwtConfig.isJwkEnabled(), e.getLocalizedMessage() }; // let JWTTokenException handle the exception JwtTokenException jte = JwtTokenException.newInstance(false, "JWT_NO_SIGNING_KEY_WITH_ERROR", objs); jte.initCause(e); throw jte; } if (_signingKey == null) { Object[] objs = new Object[] { signatureAlgorithm, jwtConfig.isJwkEnabled(), "" }; // let JWTTokenException handle the exception throw JwtTokenException.newInstance(true, "JWT_NO_SIGNING_KEY_WITH_ERROR", objs); } } }
public class class_name { protected Resource<?> generateNavigation(final String targetDir) throws IOException { WebResourcesFacet web = this.project.getFacet(WebResourcesFacet.class); HtmlTag unorderedList = new HtmlTag("ul"); ResourceFilter filter = new ResourceFilter() { @Override public boolean accept(Resource<?> resource) { FileResource<?> file = (FileResource<?>) resource; if (!file.isDirectory() || file.getName().equals("resources") || file.getName().equals("WEB-INF") || file.getName().equals("META-INF")) { return false; } return true; } }; for (Resource<?> resource : web.getWebResource(targetDir + "/").listResources(filter)) { HtmlOutcomeTargetLink outcomeTargetLink = new HtmlOutcomeTargetLink(); String outcome = targetDir.isEmpty() || targetDir.startsWith("/") ? targetDir : "/" + targetDir; outcomeTargetLink.putAttribute("outcome", outcome + "/" + resource.getName() + "/search"); outcomeTargetLink.setValue(StringUtils.uncamelCase(resource.getName())); HtmlTag listItem = new HtmlTag("li"); listItem.getChildren().add(outcomeTargetLink); unorderedList.getChildren().add(listItem); } Writer writer = new IndentedWriter(new StringWriter(), this.navigationTemplateIndent); unorderedList.write(writer); Map<Object, Object> context = CollectionUtils.newHashMap(); context.put("appName", StringUtils.uncamelCase(this.project.getRoot().getName())); context.put("navigation", writer.toString().trim()); context.put("targetDir", targetDir); if (this.navigationTemplate == null) { loadTemplates(); } try { return ScaffoldUtil.createOrOverwrite((FileResource<?>) getTemplateStrategy() .getDefaultTemplate(), FreemarkerTemplateProcessor.processTemplate(context, navigationTemplate)); } finally { writer.close(); } } }
public class class_name { protected Resource<?> generateNavigation(final String targetDir) throws IOException { WebResourcesFacet web = this.project.getFacet(WebResourcesFacet.class); HtmlTag unorderedList = new HtmlTag("ul"); ResourceFilter filter = new ResourceFilter() { @Override public boolean accept(Resource<?> resource) { FileResource<?> file = (FileResource<?>) resource; if (!file.isDirectory() || file.getName().equals("resources") || file.getName().equals("WEB-INF") || file.getName().equals("META-INF")) { return false; // depends on control dependency: [if], data = [none] } return true; } }; for (Resource<?> resource : web.getWebResource(targetDir + "/").listResources(filter)) { HtmlOutcomeTargetLink outcomeTargetLink = new HtmlOutcomeTargetLink(); String outcome = targetDir.isEmpty() || targetDir.startsWith("/") ? targetDir : "/" + targetDir; outcomeTargetLink.putAttribute("outcome", outcome + "/" + resource.getName() + "/search"); outcomeTargetLink.setValue(StringUtils.uncamelCase(resource.getName())); HtmlTag listItem = new HtmlTag("li"); listItem.getChildren().add(outcomeTargetLink); unorderedList.getChildren().add(listItem); } Writer writer = new IndentedWriter(new StringWriter(), this.navigationTemplateIndent); unorderedList.write(writer); Map<Object, Object> context = CollectionUtils.newHashMap(); context.put("appName", StringUtils.uncamelCase(this.project.getRoot().getName())); context.put("navigation", writer.toString().trim()); context.put("targetDir", targetDir); if (this.navigationTemplate == null) { loadTemplates(); } try { return ScaffoldUtil.createOrOverwrite((FileResource<?>) getTemplateStrategy() .getDefaultTemplate(), FreemarkerTemplateProcessor.processTemplate(context, navigationTemplate)); } finally { writer.close(); } } }
public class class_name { public List<TagFileType<TldTaglibType<T>>> getAllTagFile() { List<TagFileType<TldTaglibType<T>>> list = new ArrayList<TagFileType<TldTaglibType<T>>>(); List<Node> nodeList = childNode.get("tag-file"); for(Node node: nodeList) { TagFileType<TldTaglibType<T>> type = new TagFileTypeImpl<TldTaglibType<T>>(this, "tag-file", childNode, node); list.add(type); } return list; } }
public class class_name { public List<TagFileType<TldTaglibType<T>>> getAllTagFile() { List<TagFileType<TldTaglibType<T>>> list = new ArrayList<TagFileType<TldTaglibType<T>>>(); List<Node> nodeList = childNode.get("tag-file"); for(Node node: nodeList) { TagFileType<TldTaglibType<T>> type = new TagFileTypeImpl<TldTaglibType<T>>(this, "tag-file", childNode, node); list.add(type); // depends on control dependency: [for], data = [none] } return list; } }
public class class_name { public static byte[] s2n(String string) { if (string == null) { return null; } byte[] stringBytes = string.getBytes(UTF8); byte[] allBytes = new byte[stringBytes.length + 1]; System.arraycopy(stringBytes, 0, allBytes, 0, stringBytes.length); return allBytes; } }
public class class_name { public static byte[] s2n(String string) { if (string == null) { return null; // depends on control dependency: [if], data = [none] } byte[] stringBytes = string.getBytes(UTF8); byte[] allBytes = new byte[stringBytes.length + 1]; System.arraycopy(stringBytes, 0, allBytes, 0, stringBytes.length); return allBytes; } }
public class class_name { public void hubHeartbeat(UpdateServerHeartbeat updateServer, UpdateRackHeartbeat updateRack, UpdatePodSystem updatePod, long sourceTime) { RackHeartbeat rack = getCluster().findRack(updateRack.getId()); if (rack == null) { rack = getRack(); } updateRack(updateRack); updateServerStart(updateServer); // XXX: _podService.onUpdateFromPeer(updatePod); // rack.update(); updateTargetServers(); PodHeartbeatService podHeartbeat = getPodHeartbeat(); if (podHeartbeat != null && updatePod != null) { podHeartbeat.updatePodSystem(updatePod); } _joinState = _joinState.onHubHeartbeat(this); // updateHubHeartbeat(); updateHeartbeats(); } }
public class class_name { public void hubHeartbeat(UpdateServerHeartbeat updateServer, UpdateRackHeartbeat updateRack, UpdatePodSystem updatePod, long sourceTime) { RackHeartbeat rack = getCluster().findRack(updateRack.getId()); if (rack == null) { rack = getRack(); // depends on control dependency: [if], data = [none] } updateRack(updateRack); updateServerStart(updateServer); // XXX: _podService.onUpdateFromPeer(updatePod); // rack.update(); updateTargetServers(); PodHeartbeatService podHeartbeat = getPodHeartbeat(); if (podHeartbeat != null && updatePod != null) { podHeartbeat.updatePodSystem(updatePod); // depends on control dependency: [if], data = [none] } _joinState = _joinState.onHubHeartbeat(this); // updateHubHeartbeat(); updateHeartbeats(); } }
public class class_name { @Benchmark public ExampleClass benchmarkCglib() { Enhancer enhancer = new Enhancer(); enhancer.setUseCache(false); enhancer.setUseFactory(false); enhancer.setInterceptDuringConstruction(true); enhancer.setClassLoader(newClassLoader()); enhancer.setSuperclass(baseClass); CallbackHelper callbackHelper = new CallbackHelper(baseClass, new Class[0]) { protected Object getCallback(Method method) { if (method.getDeclaringClass() == baseClass) { return new MethodInterceptor() { public Object intercept(Object object, Method method, Object[] arguments, MethodProxy methodProxy) throws Throwable { return methodProxy.invokeSuper(object, arguments); } }; } else { return NoOp.INSTANCE; } } }; enhancer.setCallbackFilter(callbackHelper); enhancer.setCallbacks(callbackHelper.getCallbacks()); return (ExampleClass) enhancer.create(); } }
public class class_name { @Benchmark public ExampleClass benchmarkCglib() { Enhancer enhancer = new Enhancer(); enhancer.setUseCache(false); enhancer.setUseFactory(false); enhancer.setInterceptDuringConstruction(true); enhancer.setClassLoader(newClassLoader()); enhancer.setSuperclass(baseClass); CallbackHelper callbackHelper = new CallbackHelper(baseClass, new Class[0]) { protected Object getCallback(Method method) { if (method.getDeclaringClass() == baseClass) { return new MethodInterceptor() { public Object intercept(Object object, Method method, Object[] arguments, MethodProxy methodProxy) throws Throwable { return methodProxy.invokeSuper(object, arguments); } }; // depends on control dependency: [if], data = [none] } else { return NoOp.INSTANCE; // depends on control dependency: [if], data = [none] } } }; enhancer.setCallbackFilter(callbackHelper); enhancer.setCallbacks(callbackHelper.getCallbacks()); return (ExampleClass) enhancer.create(); } }
public class class_name { public void setIps(java.util.Collection<String> ips) { if (ips == null) { this.ips = null; return; } this.ips = new com.amazonaws.internal.SdkInternalList<String>(ips); } }
public class class_name { public void setIps(java.util.Collection<String> ips) { if (ips == null) { this.ips = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.ips = new com.amazonaws.internal.SdkInternalList<String>(ips); } }
public class class_name { void setEndPoint(StandardRoadConnection desiredConnection) { final StandardRoadConnection oldPoint = getEndPoint(StandardRoadConnection.class); if (oldPoint != null) { oldPoint.removeConnectedSegment(this, false); } this.lastConnection = desiredConnection; if (desiredConnection != null) { final Point2d pts = desiredConnection.getPoint(); if (pts != null) { setPointAt(-1, pts, true); } desiredConnection.addConnectedSegment(this, false); } } }
public class class_name { void setEndPoint(StandardRoadConnection desiredConnection) { final StandardRoadConnection oldPoint = getEndPoint(StandardRoadConnection.class); if (oldPoint != null) { oldPoint.removeConnectedSegment(this, false); // depends on control dependency: [if], data = [none] } this.lastConnection = desiredConnection; if (desiredConnection != null) { final Point2d pts = desiredConnection.getPoint(); if (pts != null) { setPointAt(-1, pts, true); // depends on control dependency: [if], data = [none] } desiredConnection.addConnectedSegment(this, false); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String encode(Serializable o) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { ObjectOutputStream oos = new ObjectOutputStream(bos); try { oos.writeObject(o); oos.flush(); } finally { oos.close(); } return Base64.encodeBytes(bos.toByteArray()); } catch (IOException e) { throw new RuntimeException(e); } } }
public class class_name { public static String encode(Serializable o) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { ObjectOutputStream oos = new ObjectOutputStream(bos); try { oos.writeObject(o); // depends on control dependency: [try], data = [none] oos.flush(); // depends on control dependency: [try], data = [none] } finally { oos.close(); } return Base64.encodeBytes(bos.toByteArray()); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void up(MessageBatch batch) { for(Message msg: batch) { if(msg.isFlagSet(Message.Flag.NO_TOTAL_ORDER) || msg.isFlagSet(Message.Flag.OOB) || msg.getHeader(id) == null) continue; batch.remove(msg); // simplistic implementation try { up(msg); } catch(Throwable t) { log.error(Util.getMessage("FailedPassingUpMessage"), t); } } if(!batch.isEmpty()) up_prot.up(batch); } }
public class class_name { public void up(MessageBatch batch) { for(Message msg: batch) { if(msg.isFlagSet(Message.Flag.NO_TOTAL_ORDER) || msg.isFlagSet(Message.Flag.OOB) || msg.getHeader(id) == null) continue; batch.remove(msg); // depends on control dependency: [for], data = [msg] // simplistic implementation try { up(msg); // depends on control dependency: [try], data = [none] } catch(Throwable t) { log.error(Util.getMessage("FailedPassingUpMessage"), t); } // depends on control dependency: [catch], data = [none] } if(!batch.isEmpty()) up_prot.up(batch); } }
public class class_name { public void marshall(ListTagsForCertificateRequest listTagsForCertificateRequest, ProtocolMarshaller protocolMarshaller) { if (listTagsForCertificateRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listTagsForCertificateRequest.getCertificateArn(), CERTIFICATEARN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ListTagsForCertificateRequest listTagsForCertificateRequest, ProtocolMarshaller protocolMarshaller) { if (listTagsForCertificateRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listTagsForCertificateRequest.getCertificateArn(), CERTIFICATEARN_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 void computeOBBCenterAxisExtents( Iterable<? extends Point3D> points, Vector3f R, Vector3f S, Vector3f T, Point3f center, double[] extents) { assert (points != null); assert (center != null); assert (extents != null && extents.length >= 3); Vector3f vecNull = new Vector3f(); if (R.equals(vecNull) && S.equals(vecNull) && T.equals(vecNull)) { // Determining the covariance matrix of the points // and set the center of the box Matrix3f cov = new Matrix3f(); cov.cov(points); // Determining eigenvectors of covariance matrix and defines RST axis Matrix3f rst = new Matrix3f();// eigenvectors cov.eigenVectorsOfSymmetricMatrix(rst); rst.getColumn(0, R); rst.getColumn(1, S); rst.getColumn(2, T); }//else we have already set some constraints on OBB axis, dosen't need to compute them again double minR = Double.POSITIVE_INFINITY; double maxR = Double.NEGATIVE_INFINITY; double minS = Double.POSITIVE_INFINITY; double maxS = Double.NEGATIVE_INFINITY; double minT = Double.POSITIVE_INFINITY; double maxT = Double.NEGATIVE_INFINITY; double PdotR; double PdotS; double PdotT; Vector3f v = new Vector3f(); for (Point3D tuple : points) { v.set(tuple); PdotR = v.dot(R); PdotS = v.dot(S); PdotT = v.dot(T); if (PdotR < minR) minR = PdotR; if (PdotR > maxR) maxR = PdotR; if (PdotS < minS) minS = PdotS; if (PdotS > maxS) maxS = PdotS; if (PdotT < minT) minT = PdotT; if (PdotT > maxT) maxT = PdotT; } double a = (maxR + minR) / 2.f; double b = (maxS + minS) / 2.f; double c = (maxT + minT) / 2.f; // Set the center of the OBB center.set(a * R.getX() + b * S.getX() + c * T.getX(), a * R.getY() + b * S.getY() + c * T.getY(), a * R.getZ() + b * S.getZ() + c * T.getZ()); // Compute extents extents[0] = (maxR - minR) / 2.f; extents[1] = (maxS - minS) / 2.f; extents[2] = (maxT - minT) / 2.f; // Normalize axis R.normalize(); S.normalize(); T.normalize(); // Selection with largest magnitude eigenvalue to identify R int max = -1; for (int i = 0; i < 3; i++) { if (extents[i] > max) { max = i; } } switch (max) { case 0: { // do nothing, right order } break; case 1: { Vector3f tmpVec = new Vector3f(R); R.set(S); S.set(T); T.set(tmpVec); double tmpD = extents[0]; extents[0] = extents[1]; extents[1] = extents[2]; extents[2] = tmpD; } break; case 2: { Vector3f tmpVec = new Vector3f(S); S.set(R); R.set(T); T.set(tmpVec); double tmpD = extents[1]; extents[1] = extents[0]; extents[0] = extents[2]; extents[2] = tmpD; } break; default: } } }
public class class_name { public static void computeOBBCenterAxisExtents( Iterable<? extends Point3D> points, Vector3f R, Vector3f S, Vector3f T, Point3f center, double[] extents) { assert (points != null); assert (center != null); assert (extents != null && extents.length >= 3); Vector3f vecNull = new Vector3f(); if (R.equals(vecNull) && S.equals(vecNull) && T.equals(vecNull)) { // Determining the covariance matrix of the points // and set the center of the box Matrix3f cov = new Matrix3f(); cov.cov(points); // depends on control dependency: [if], data = [none] // Determining eigenvectors of covariance matrix and defines RST axis Matrix3f rst = new Matrix3f();// eigenvectors cov.eigenVectorsOfSymmetricMatrix(rst); // depends on control dependency: [if], data = [none] rst.getColumn(0, R); // depends on control dependency: [if], data = [none] rst.getColumn(1, S); // depends on control dependency: [if], data = [none] rst.getColumn(2, T); // depends on control dependency: [if], data = [none] }//else we have already set some constraints on OBB axis, dosen't need to compute them again double minR = Double.POSITIVE_INFINITY; double maxR = Double.NEGATIVE_INFINITY; double minS = Double.POSITIVE_INFINITY; double maxS = Double.NEGATIVE_INFINITY; double minT = Double.POSITIVE_INFINITY; double maxT = Double.NEGATIVE_INFINITY; double PdotR; double PdotS; double PdotT; Vector3f v = new Vector3f(); for (Point3D tuple : points) { v.set(tuple); // depends on control dependency: [for], data = [tuple] PdotR = v.dot(R); // depends on control dependency: [for], data = [none] PdotS = v.dot(S); // depends on control dependency: [for], data = [none] PdotT = v.dot(T); // depends on control dependency: [for], data = [none] if (PdotR < minR) minR = PdotR; if (PdotR > maxR) maxR = PdotR; if (PdotS < minS) minS = PdotS; if (PdotS > maxS) maxS = PdotS; if (PdotT < minT) minT = PdotT; if (PdotT > maxT) maxT = PdotT; } double a = (maxR + minR) / 2.f; double b = (maxS + minS) / 2.f; double c = (maxT + minT) / 2.f; // Set the center of the OBB center.set(a * R.getX() + b * S.getX() + c * T.getX(), a * R.getY() + b * S.getY() + c * T.getY(), a * R.getZ() + b * S.getZ() + c * T.getZ()); // Compute extents extents[0] = (maxR - minR) / 2.f; extents[1] = (maxS - minS) / 2.f; extents[2] = (maxT - minT) / 2.f; // Normalize axis R.normalize(); S.normalize(); T.normalize(); // Selection with largest magnitude eigenvalue to identify R int max = -1; for (int i = 0; i < 3; i++) { if (extents[i] > max) { max = i; // depends on control dependency: [if], data = [none] } } switch (max) { case 0: { // do nothing, right order } break; case 1: { Vector3f tmpVec = new Vector3f(R); R.set(S); S.set(T); T.set(tmpVec); double tmpD = extents[0]; extents[0] = extents[1]; extents[1] = extents[2]; extents[2] = tmpD; } break; case 2: { Vector3f tmpVec = new Vector3f(S); S.set(R); R.set(T); T.set(tmpVec); double tmpD = extents[1]; extents[1] = extents[0]; extents[0] = extents[2]; extents[2] = tmpD; } break; default: } } }
public class class_name { public static MethodInvoker getMethodInvokerForInterface(Class<?> cls, String methodName, Object object, Class<?>... paramTypes) { if (cls.isAssignableFrom(object.getClass())) { return MethodInvokerUtils.getMethodInvokerByName(object, methodName, true, paramTypes); } else { return null; } } }
public class class_name { public static MethodInvoker getMethodInvokerForInterface(Class<?> cls, String methodName, Object object, Class<?>... paramTypes) { if (cls.isAssignableFrom(object.getClass())) { return MethodInvokerUtils.getMethodInvokerByName(object, methodName, true, paramTypes); // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { private static int hexToInt(char c) { if ('0' <= c && c <= '9') { return c - '0'; } else if ('a' <= c && c <= 'f') { return 10 + (c - 'a'); } else if ('A' <= c && c <= 'F') { return 10 + (c - 'A'); } else { return -1; } } }
public class class_name { private static int hexToInt(char c) { if ('0' <= c && c <= '9') { return c - '0'; // depends on control dependency: [if], data = [none] } else if ('a' <= c && c <= 'f') { return 10 + (c - 'a'); // depends on control dependency: [if], data = [none] } else if ('A' <= c && c <= 'F') { return 10 + (c - 'A'); // depends on control dependency: [if], data = [none] } else { return -1; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void getXMLCMCLockAccessTimeout(long[] accessTimeouts, Method[] ejbMethods, Session sessionBean) throws EJBConfigurationException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "getXMLCMCLockAccessTimeout: " + sessionBean.getEjbClassName() + " methods = " + Arrays.toString(ejbMethods)); //F743-7027.1 // Create an array of ints that will hold the highest priority // style of <access-timeout> stanza configured for each method. The priority // from lowest to highest is as follows: // // 1 - style one is the case where method name is "*" which indicates // a access timeout value configured for all methods of the singleton SB. // 2 - style two is the case where method name is specified, but not the // method parameters. This must override any style 1 configuration. // 3 - style three is the case where both method name and parameters are specified. // This style is required by spec to override any style 1 or 2 configured for the bean. int numberOfEjbMethods = ejbMethods.length; //F743-7027CodRev int[] highestStyleOnMethod = new int[numberOfEjbMethods]; //F743-7027CodRev // Get the list of WCCM ConcurrentMethod objects configured for this // singleton session bean and its enterprise bean name. There is one ConcurrentMethod // object created for each <lock> stanza that exists in DD. String enterpriseBeanName = sessionBean.getName(); //F00743.9717 List<ConcurrentMethod> cmcMethodList = sessionBean.getConcurrentMethods(); // For each of WCCM ConcurrentMethod objects, determine which EJB methods this // ConcurrentMethod object applies to and set the access timeout in the array // passed to this method by the caller. int numberOfCmcMethods = cmcMethodList.size(); //F743-7027CodRev for (int i = 0; i < numberOfCmcMethods; i++) //F743-7027CodRev { // Get the WCCM AccessTimeout, NamedMethod, and MethodParams objects // from the WCCM ConcurrentMethod object being processed in this iteration. //F00743.9717 ConcurrentMethod cmcMethod = cmcMethodList.get(i); com.ibm.ws.javaee.dd.ejb.AccessTimeout accessTimeout = cmcMethod.getAccessTimeout(); NamedMethod namedMethod = cmcMethod.getMethod(); List<String> parms = namedMethod.getMethodParamList(); // If access timeout configured via xml, then process it. if (accessTimeout != null) { long timeout; long value = accessTimeout.getTimeout(); String cmcMethodName = namedMethod.getMethodName().trim(); if (isTraceOn && tc.isDebugEnabled()) //F743-7027.1 Tr.debug(tc, cmcMethodName + " AccessTimeout value = " + value); //F743-7027.1 // Validate configured value and process it. if (value < -1 || value == Long.MAX_VALUE) { // CNTR0192E: The access timeout value {0} is not valid for the enterprise // bean {1} method of the {2} class. The value must be -1 or greater and // less than java.lang.Long.MAX_VALUE (9223372036854775807). String className = sessionBean.getEjbClassName(); Tr.error(tc, "SINGLETON_INVALID_ACCESS_TIMEOUT_CNTR0192E" , new Object[] { value, cmcMethodName, className }); throw new EJBConfigurationException("CNTR0192E: The access timeout value " + value + " is not valid for the enterprise bean " + cmcMethodName + " method of the " + className + " class. The value must be -1 or greater and less" + " than java.lang.Long.MAX_VALUE (9223372036854775807)."); } else if (value > 0) { //F00743.9717 // Map the access timeout unit into a milli-second unit. TimeUnit tu = accessTimeout.getUnitValue(); timeout = TimeUnit.MILLISECONDS.convert(value, tu); // F743-6605.1 // begin F743-6605.1 if (timeout == Long.MAX_VALUE || timeout == Long.MIN_VALUE) { // CNTR0196E: The conversion of access timeout value {0} from {1} time // unit to milliseconds time unit resulted in an overflow. Tr.error(tc, "SINGLETON_ACCESS_TIMEOUT_OVERFLOW_CNTR0196E", new Object[] { value, tu }); if (isTraceOn && tc.isEntryEnabled()) { Tr.exit(tc, "convertToMilliSeconds: " + value + tu + " overflow"); } throw new EJBConfigurationException("Conversion of access timeout value of " + value + " " + tu + " to milliseconds resulted in overflow."); } // end F743-6605.1 } else { timeout = value; // special value -1 or 0 F743-21028.5 } // Determine if ConcurrentMethod is a style 1, 2, or 3 configuration and update // access timeout array with the method access timeout value specified. // The EJB spec is silent on whether more than one style 1 can be specified // for the singleton session bean. Our assumption is the last style 1 is used. if (cmcMethodName.equals("*")) { // style type 1 -- update all entries in access timeout array that was not // previously set by either a style 2 or 3 configuration. for (int j = 0; j < numberOfEjbMethods; ++j) //F743-7027CodRev { Method m = ejbMethods[j]; if (highestStyleOnMethod[j] <= 1) { if (isTraceOn && tc.isDebugEnabled()) trace(m, enterpriseBeanName, "Style 1 - replacing access timeout value of " + accessTimeouts[j] + " with " + timeout); accessTimeouts[j] = timeout; highestStyleOnMethod[j] = 1; } } } else if (parms == null) { // style type 2 -- update all entries in access timeout array for a method // with matching method name that was not previously set by a style 3 configuration. // The EJB spec is silent on whether more than one style 2 can be specified // for the same method name. Our assumption is the last style 2 is used. for (int j = 0; j < numberOfEjbMethods; ++j) //F743-7027CodRev { if (highestStyleOnMethod[j] <= 2) { Method m = ejbMethods[j]; String methodName = m.getName(); //F743-7027.1 if (cmcMethodName.equals(methodName)) //F743-7027.1 { if (isTraceOn && tc.isDebugEnabled()) trace(m, enterpriseBeanName, "Style 2 - replacing access timeout value of " + accessTimeouts[j] + " with " + timeout); accessTimeouts[j] = timeout; highestStyleOnMethod[j] = 2; } } } } else { // style type 3 -- update only the access timeout array entry with a // matching method signature. style 3 always overrides style 1 and 2. // The EJB spec is silent on whether more than one style 3 can be specified // for the same method. Our assumption is the last style 3 is used. Method style3Method = DDUtil.findMethod(namedMethod, ejbMethods); if (style3Method != null) //F743-7027.1 { for (int j = 0; j < numberOfEjbMethods; ++j) //F743-7027CodRev { Method m = ejbMethods[j]; if (style3Method.equals(m)) { if (isTraceOn && tc.isDebugEnabled()) trace(m, enterpriseBeanName, "Style 3 - replacing access timeout value of " + accessTimeouts[j] + " with " + timeout); accessTimeouts[j] = timeout; highestStyleOnMethod[j] = 3; // break out of for loop since there can only be 1 EJB method that // matches the signature. break; } } } } } // end if ( accessTimeout != null ) } // end for if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "getXMLCMCLockAccessTimeout: " + sessionBean.getEjbClassName(), Arrays.toString(accessTimeouts)); } }
public class class_name { public static void getXMLCMCLockAccessTimeout(long[] accessTimeouts, Method[] ejbMethods, Session sessionBean) throws EJBConfigurationException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "getXMLCMCLockAccessTimeout: " + sessionBean.getEjbClassName() + " methods = " + Arrays.toString(ejbMethods)); //F743-7027.1 // Create an array of ints that will hold the highest priority // style of <access-timeout> stanza configured for each method. The priority // from lowest to highest is as follows: // // 1 - style one is the case where method name is "*" which indicates // a access timeout value configured for all methods of the singleton SB. // 2 - style two is the case where method name is specified, but not the // method parameters. This must override any style 1 configuration. // 3 - style three is the case where both method name and parameters are specified. // This style is required by spec to override any style 1 or 2 configured for the bean. int numberOfEjbMethods = ejbMethods.length; //F743-7027CodRev int[] highestStyleOnMethod = new int[numberOfEjbMethods]; //F743-7027CodRev // Get the list of WCCM ConcurrentMethod objects configured for this // singleton session bean and its enterprise bean name. There is one ConcurrentMethod // object created for each <lock> stanza that exists in DD. String enterpriseBeanName = sessionBean.getName(); //F00743.9717 List<ConcurrentMethod> cmcMethodList = sessionBean.getConcurrentMethods(); // For each of WCCM ConcurrentMethod objects, determine which EJB methods this // ConcurrentMethod object applies to and set the access timeout in the array // passed to this method by the caller. int numberOfCmcMethods = cmcMethodList.size(); //F743-7027CodRev for (int i = 0; i < numberOfCmcMethods; i++) //F743-7027CodRev { // Get the WCCM AccessTimeout, NamedMethod, and MethodParams objects // from the WCCM ConcurrentMethod object being processed in this iteration. //F00743.9717 ConcurrentMethod cmcMethod = cmcMethodList.get(i); com.ibm.ws.javaee.dd.ejb.AccessTimeout accessTimeout = cmcMethod.getAccessTimeout(); NamedMethod namedMethod = cmcMethod.getMethod(); List<String> parms = namedMethod.getMethodParamList(); // If access timeout configured via xml, then process it. if (accessTimeout != null) { long timeout; long value = accessTimeout.getTimeout(); String cmcMethodName = namedMethod.getMethodName().trim(); if (isTraceOn && tc.isDebugEnabled()) //F743-7027.1 Tr.debug(tc, cmcMethodName + " AccessTimeout value = " + value); //F743-7027.1 // Validate configured value and process it. if (value < -1 || value == Long.MAX_VALUE) { // CNTR0192E: The access timeout value {0} is not valid for the enterprise // bean {1} method of the {2} class. The value must be -1 or greater and // less than java.lang.Long.MAX_VALUE (9223372036854775807). String className = sessionBean.getEjbClassName(); Tr.error(tc, "SINGLETON_INVALID_ACCESS_TIMEOUT_CNTR0192E" , new Object[] { value, cmcMethodName, className }); throw new EJBConfigurationException("CNTR0192E: The access timeout value " + value + " is not valid for the enterprise bean " + cmcMethodName + " method of the " + className + " class. The value must be -1 or greater and less" + " than java.lang.Long.MAX_VALUE (9223372036854775807)."); } else if (value > 0) { //F00743.9717 // Map the access timeout unit into a milli-second unit. TimeUnit tu = accessTimeout.getUnitValue(); timeout = TimeUnit.MILLISECONDS.convert(value, tu); // F743-6605.1 // begin F743-6605.1 if (timeout == Long.MAX_VALUE || timeout == Long.MIN_VALUE) { // CNTR0196E: The conversion of access timeout value {0} from {1} time // unit to milliseconds time unit resulted in an overflow. Tr.error(tc, "SINGLETON_ACCESS_TIMEOUT_OVERFLOW_CNTR0196E", new Object[] { value, tu }); if (isTraceOn && tc.isEntryEnabled()) { Tr.exit(tc, "convertToMilliSeconds: " + value + tu + " overflow"); // depends on control dependency: [if], data = [none] } throw new EJBConfigurationException("Conversion of access timeout value of " + value + " " + tu + " to milliseconds resulted in overflow."); } // end F743-6605.1 } else { timeout = value; // special value -1 or 0 F743-21028.5 } // Determine if ConcurrentMethod is a style 1, 2, or 3 configuration and update // access timeout array with the method access timeout value specified. // The EJB spec is silent on whether more than one style 1 can be specified // for the singleton session bean. Our assumption is the last style 1 is used. if (cmcMethodName.equals("*")) { // style type 1 -- update all entries in access timeout array that was not // previously set by either a style 2 or 3 configuration. for (int j = 0; j < numberOfEjbMethods; ++j) //F743-7027CodRev { Method m = ejbMethods[j]; if (highestStyleOnMethod[j] <= 1) { if (isTraceOn && tc.isDebugEnabled()) trace(m, enterpriseBeanName, "Style 1 - replacing access timeout value of " + accessTimeouts[j] + " with " + timeout); accessTimeouts[j] = timeout; highestStyleOnMethod[j] = 1; } } } else if (parms == null) { // style type 2 -- update all entries in access timeout array for a method // with matching method name that was not previously set by a style 3 configuration. // The EJB spec is silent on whether more than one style 2 can be specified // for the same method name. Our assumption is the last style 2 is used. for (int j = 0; j < numberOfEjbMethods; ++j) //F743-7027CodRev { if (highestStyleOnMethod[j] <= 2) { Method m = ejbMethods[j]; String methodName = m.getName(); //F743-7027.1 if (cmcMethodName.equals(methodName)) //F743-7027.1 { if (isTraceOn && tc.isDebugEnabled()) trace(m, enterpriseBeanName, "Style 2 - replacing access timeout value of " + accessTimeouts[j] + " with " + timeout); accessTimeouts[j] = timeout; highestStyleOnMethod[j] = 2; } } } } else { // style type 3 -- update only the access timeout array entry with a // matching method signature. style 3 always overrides style 1 and 2. // The EJB spec is silent on whether more than one style 3 can be specified // for the same method. Our assumption is the last style 3 is used. Method style3Method = DDUtil.findMethod(namedMethod, ejbMethods); if (style3Method != null) //F743-7027.1 { for (int j = 0; j < numberOfEjbMethods; ++j) //F743-7027CodRev { Method m = ejbMethods[j]; if (style3Method.equals(m)) { if (isTraceOn && tc.isDebugEnabled()) trace(m, enterpriseBeanName, "Style 3 - replacing access timeout value of " + accessTimeouts[j] + " with " + timeout); accessTimeouts[j] = timeout; highestStyleOnMethod[j] = 3; // break out of for loop since there can only be 1 EJB method that // matches the signature. break; } } } } } // end if ( accessTimeout != null ) } // end for if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "getXMLCMCLockAccessTimeout: " + sessionBean.getEjbClassName(), Arrays.toString(accessTimeouts)); } }
public class class_name { protected BufferedImage create_TICKMARKS_Image(final int WIDTH, final double FREE_AREA_ANGLE, final double OFFSET, final double MIN_VALUE, final double MAX_VALUE, final double ANGLE_STEP, final int TICK_LABEL_PERIOD, final int SCALE_DIVIDER_POWER, final boolean DRAW_TICKS, final boolean DRAW_TICK_LABELS, ArrayList<Section> tickmarkSections, BufferedImage image) { if (WIDTH <= 0) { return null; } if (image == null) { image = UTIL.createImage(WIDTH, (int) (1.0 * WIDTH), Transparency.TRANSLUCENT); } final Graphics2D G2 = image.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); G2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); G2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); final int IMAGE_WIDTH = image.getWidth(); final int IMAGE_HEIGHT = image.getHeight(); final Font STD_FONT = new Font("Verdana", 0, (int) (0.04 * WIDTH)); final BasicStroke MEDIUM_STROKE = new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL); final BasicStroke THIN_STROKE = new BasicStroke(0.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL); final int TEXT_DISTANCE = (int) (0.08 * WIDTH); //final int MIN_LENGTH = (int) (0.0133333333 * WIDTH); final int MED_LENGTH = (int) (0.02 * WIDTH); final int MAX_LENGTH = (int) (0.04 * WIDTH); //final int MIN_DIAMETER = (int) (0.0093457944 * WIDTH); //final int MED_DIAMETER = (int) (0.0186915888 * WIDTH); //final int MAX_DIAMETER = (int) (0.0280373832 * WIDTH); // Create the ticks itself final float RADIUS = IMAGE_WIDTH * 0.38f; final Point2D GAUGE_CENTER = new Point2D.Double(IMAGE_WIDTH / 2.0f, IMAGE_HEIGHT / 2.0f); // Draw ticks final Point2D INNER_POINT = new Point2D.Double(0, 0); final Point2D OUTER_POINT = new Point2D.Double(0, 0); final Point2D TEXT_POINT = new Point2D.Double(0, 0); final Line2D TICK_LINE = new Line2D.Double(0, 0, 1, 1); final Ellipse2D TICK_CIRCLE = new Ellipse2D.Double(0, 0, 1, 1); //final Rectangle2D TICK_RECT = new Rectangle2D.Double(0, 0, 1, 1); //final int MINI_DIAMETER = (int) (0.0093457944 * WIDTH); final int MINOR_DIAMETER = (int) (0.0186915888 * WIDTH); final int MAJOR_DIAMETER = (int) (0.03 * WIDTH); int counter = 0; int tickCounter = 0; float valueCounter = 90; boolean countUp = false; float valueStep = 1; G2.setFont(STD_FONT); double sinValue = 0; double cosValue = 0; final double STEP = (2.0 * Math.PI) / (360.0); for (double alpha = (2.0 * Math.PI); alpha >= STEP; alpha -= STEP) { G2.setStroke(THIN_STROKE); sinValue = Math.sin(alpha - Math.PI / 2); cosValue = Math.cos(alpha - Math.PI / 2); // Different tickmark every 5 units if (counter % 5 == 0) { G2.setColor(super.getBackgroundColor().LABEL_COLOR); G2.setStroke(THIN_STROKE); INNER_POINT.setLocation(GAUGE_CENTER.getX() + (RADIUS - MED_LENGTH) * sinValue, GAUGE_CENTER.getY() + (RADIUS - MED_LENGTH) * cosValue); OUTER_POINT.setLocation(GAUGE_CENTER.getX() + RADIUS * sinValue, GAUGE_CENTER.getY() + RADIUS * cosValue); // Draw ticks switch (getMinorTickmarkType()) { case LINE: TICK_LINE.setLine(INNER_POINT, OUTER_POINT); G2.draw(TICK_LINE); break; case CIRCLE: TICK_CIRCLE.setFrame(OUTER_POINT.getX() - MINOR_DIAMETER / 2.0, OUTER_POINT.getY() - MINOR_DIAMETER / 2.0, MINOR_DIAMETER, MINOR_DIAMETER); G2.fill(TICK_CIRCLE); break; default: TICK_LINE.setLine(INNER_POINT, OUTER_POINT); G2.draw(TICK_LINE); break; } } // Different tickmark every 45 units plus text if (counter == 30 || counter == 0) { G2.setColor(super.getBackgroundColor().LABEL_COLOR); G2.setStroke(MEDIUM_STROKE); INNER_POINT.setLocation(GAUGE_CENTER.getX() + (RADIUS - MAX_LENGTH) * sinValue, GAUGE_CENTER.getY() + (RADIUS - MAX_LENGTH) * cosValue); OUTER_POINT.setLocation(GAUGE_CENTER.getX() + RADIUS * sinValue, GAUGE_CENTER.getY() + RADIUS * cosValue); // Draw outer text TEXT_POINT.setLocation(GAUGE_CENTER.getX() + (RADIUS - TEXT_DISTANCE) * sinValue, GAUGE_CENTER.getY() + (RADIUS - TEXT_DISTANCE) * cosValue); G2.setFont(STD_FONT); G2.fill(UTIL.rotateTextAroundCenter(G2, String.valueOf((int) valueCounter), (int) TEXT_POINT.getX(), (int) TEXT_POINT.getY(), 0)); counter = 0; tickCounter++; // Draw ticks switch (getMajorTickmarkType()) { case LINE: TICK_LINE.setLine(INNER_POINT, OUTER_POINT); G2.draw(TICK_LINE); break; case CIRCLE: TICK_CIRCLE.setFrame(OUTER_POINT.getX() - MAJOR_DIAMETER / 2.0, OUTER_POINT.getY() - MAJOR_DIAMETER / 2.0, MAJOR_DIAMETER, MAJOR_DIAMETER); G2.fill(TICK_CIRCLE); break; default: TICK_LINE.setLine(INNER_POINT, OUTER_POINT); G2.draw(TICK_LINE); break; } } counter++; if (valueCounter == 0) { countUp = true; } if (valueCounter == 180) { countUp = false; } if (countUp) { valueCounter += valueStep; } else { valueCounter -= valueStep; } } G2.dispose(); return image; } }
public class class_name { protected BufferedImage create_TICKMARKS_Image(final int WIDTH, final double FREE_AREA_ANGLE, final double OFFSET, final double MIN_VALUE, final double MAX_VALUE, final double ANGLE_STEP, final int TICK_LABEL_PERIOD, final int SCALE_DIVIDER_POWER, final boolean DRAW_TICKS, final boolean DRAW_TICK_LABELS, ArrayList<Section> tickmarkSections, BufferedImage image) { if (WIDTH <= 0) { return null; // depends on control dependency: [if], data = [none] } if (image == null) { image = UTIL.createImage(WIDTH, (int) (1.0 * WIDTH), Transparency.TRANSLUCENT); // depends on control dependency: [if], data = [none] } final Graphics2D G2 = image.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); G2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); G2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); final int IMAGE_WIDTH = image.getWidth(); final int IMAGE_HEIGHT = image.getHeight(); final Font STD_FONT = new Font("Verdana", 0, (int) (0.04 * WIDTH)); final BasicStroke MEDIUM_STROKE = new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL); final BasicStroke THIN_STROKE = new BasicStroke(0.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL); final int TEXT_DISTANCE = (int) (0.08 * WIDTH); //final int MIN_LENGTH = (int) (0.0133333333 * WIDTH); final int MED_LENGTH = (int) (0.02 * WIDTH); final int MAX_LENGTH = (int) (0.04 * WIDTH); //final int MIN_DIAMETER = (int) (0.0093457944 * WIDTH); //final int MED_DIAMETER = (int) (0.0186915888 * WIDTH); //final int MAX_DIAMETER = (int) (0.0280373832 * WIDTH); // Create the ticks itself final float RADIUS = IMAGE_WIDTH * 0.38f; final Point2D GAUGE_CENTER = new Point2D.Double(IMAGE_WIDTH / 2.0f, IMAGE_HEIGHT / 2.0f); // Draw ticks final Point2D INNER_POINT = new Point2D.Double(0, 0); final Point2D OUTER_POINT = new Point2D.Double(0, 0); final Point2D TEXT_POINT = new Point2D.Double(0, 0); final Line2D TICK_LINE = new Line2D.Double(0, 0, 1, 1); final Ellipse2D TICK_CIRCLE = new Ellipse2D.Double(0, 0, 1, 1); //final Rectangle2D TICK_RECT = new Rectangle2D.Double(0, 0, 1, 1); //final int MINI_DIAMETER = (int) (0.0093457944 * WIDTH); final int MINOR_DIAMETER = (int) (0.0186915888 * WIDTH); final int MAJOR_DIAMETER = (int) (0.03 * WIDTH); int counter = 0; int tickCounter = 0; float valueCounter = 90; boolean countUp = false; float valueStep = 1; G2.setFont(STD_FONT); double sinValue = 0; double cosValue = 0; final double STEP = (2.0 * Math.PI) / (360.0); for (double alpha = (2.0 * Math.PI); alpha >= STEP; alpha -= STEP) { G2.setStroke(THIN_STROKE); // depends on control dependency: [for], data = [none] sinValue = Math.sin(alpha - Math.PI / 2); // depends on control dependency: [for], data = [alpha] cosValue = Math.cos(alpha - Math.PI / 2); // depends on control dependency: [for], data = [alpha] // Different tickmark every 5 units if (counter % 5 == 0) { G2.setColor(super.getBackgroundColor().LABEL_COLOR); // depends on control dependency: [if], data = [none] G2.setStroke(THIN_STROKE); // depends on control dependency: [if], data = [none] INNER_POINT.setLocation(GAUGE_CENTER.getX() + (RADIUS - MED_LENGTH) * sinValue, GAUGE_CENTER.getY() + (RADIUS - MED_LENGTH) * cosValue); // depends on control dependency: [if], data = [none] OUTER_POINT.setLocation(GAUGE_CENTER.getX() + RADIUS * sinValue, GAUGE_CENTER.getY() + RADIUS * cosValue); // depends on control dependency: [if], data = [none] // Draw ticks switch (getMinorTickmarkType()) { case LINE: TICK_LINE.setLine(INNER_POINT, OUTER_POINT); G2.draw(TICK_LINE); // depends on control dependency: [if], data = [none] break; case CIRCLE: TICK_CIRCLE.setFrame(OUTER_POINT.getX() - MINOR_DIAMETER / 2.0, OUTER_POINT.getY() - MINOR_DIAMETER / 2.0, MINOR_DIAMETER, MINOR_DIAMETER); // depends on control dependency: [if], data = [none] G2.fill(TICK_CIRCLE); // depends on control dependency: [if], data = [none] break; default: TICK_LINE.setLine(INNER_POINT, OUTER_POINT); G2.draw(TICK_LINE); // depends on control dependency: [if], data = [none] break; } } // Different tickmark every 45 units plus text if (counter == 30 || counter == 0) { G2.setColor(super.getBackgroundColor().LABEL_COLOR); // depends on control dependency: [if], data = [none] G2.setStroke(MEDIUM_STROKE); // depends on control dependency: [if], data = [none] INNER_POINT.setLocation(GAUGE_CENTER.getX() + (RADIUS - MAX_LENGTH) * sinValue, GAUGE_CENTER.getY() + (RADIUS - MAX_LENGTH) * cosValue); // depends on control dependency: [if], data = [none] OUTER_POINT.setLocation(GAUGE_CENTER.getX() + RADIUS * sinValue, GAUGE_CENTER.getY() + RADIUS * cosValue); // depends on control dependency: [if], data = [none] // Draw outer text TEXT_POINT.setLocation(GAUGE_CENTER.getX() + (RADIUS - TEXT_DISTANCE) * sinValue, GAUGE_CENTER.getY() + (RADIUS - TEXT_DISTANCE) * cosValue); // depends on control dependency: [if], data = [none] G2.setFont(STD_FONT); // depends on control dependency: [if], data = [none] G2.fill(UTIL.rotateTextAroundCenter(G2, String.valueOf((int) valueCounter), (int) TEXT_POINT.getX(), (int) TEXT_POINT.getY(), 0)); // depends on control dependency: [if], data = [none] counter = 0; // depends on control dependency: [if], data = [none] tickCounter++; // depends on control dependency: [if], data = [none] // Draw ticks switch (getMajorTickmarkType()) { case LINE: TICK_LINE.setLine(INNER_POINT, OUTER_POINT); G2.draw(TICK_LINE); // depends on control dependency: [if], data = [none] break; case CIRCLE: TICK_CIRCLE.setFrame(OUTER_POINT.getX() - MAJOR_DIAMETER / 2.0, OUTER_POINT.getY() - MAJOR_DIAMETER / 2.0, MAJOR_DIAMETER, MAJOR_DIAMETER); // depends on control dependency: [if], data = [none] G2.fill(TICK_CIRCLE); // depends on control dependency: [if], data = [none] break; default: TICK_LINE.setLine(INNER_POINT, OUTER_POINT); G2.draw(TICK_LINE); // depends on control dependency: [if], data = [none] break; } } counter++; if (valueCounter == 0) { countUp = true; } if (valueCounter == 180) { countUp = false; } if (countUp) { valueCounter += valueStep; } else { valueCounter -= valueStep; } } G2.dispose(); return image; } }
public class class_name { private final void evictIfNeeded() { if ( list.size() > evictSize ) { final List<CacheEntry<KEY, VALUE>> killList = list.sortAndReturnPurgeList( 0.1f ); for ( CacheEntry<KEY, VALUE> cacheEntry : killList ) { map.remove( cacheEntry.key ); } } } }
public class class_name { private final void evictIfNeeded() { if ( list.size() > evictSize ) { final List<CacheEntry<KEY, VALUE>> killList = list.sortAndReturnPurgeList( 0.1f ); for ( CacheEntry<KEY, VALUE> cacheEntry : killList ) { map.remove( cacheEntry.key ); // depends on control dependency: [for], data = [cacheEntry] } } } }
public class class_name { protected Properties initDefaultOptions() { Properties defaultValues = new Properties(); defaultValues.putAll(defaults); // See if there's an aggregator.properties in the class loader's root ClassLoader cl = OptionsImpl.class.getClassLoader(); URL url = cl.getResource(getPropsFilename()); if (url != null) { loadFromUrl(defaultValues, url); } // If the bundle defines properties, then load those too if(aggregator != null){ url = aggregator.getPlatformServices().getResource(getPropsFilename()); if (url != null) { loadFromUrl(defaultValues, url); } } Map<String, String> map = new HashMap<String, String>(); for (String name : defaultValues.stringPropertyNames()) { map.put(name, (String)defaultValues.getProperty(name)); } defaultOptionsMap = Collections.unmodifiableMap(map); return defaultValues; } }
public class class_name { protected Properties initDefaultOptions() { Properties defaultValues = new Properties(); defaultValues.putAll(defaults); // See if there's an aggregator.properties in the class loader's root ClassLoader cl = OptionsImpl.class.getClassLoader(); URL url = cl.getResource(getPropsFilename()); if (url != null) { loadFromUrl(defaultValues, url); // depends on control dependency: [if], data = [none] } // If the bundle defines properties, then load those too if(aggregator != null){ url = aggregator.getPlatformServices().getResource(getPropsFilename()); // depends on control dependency: [if], data = [none] if (url != null) { loadFromUrl(defaultValues, url); // depends on control dependency: [if], data = [none] } } Map<String, String> map = new HashMap<String, String>(); for (String name : defaultValues.stringPropertyNames()) { map.put(name, (String)defaultValues.getProperty(name)); // depends on control dependency: [for], data = [name] } defaultOptionsMap = Collections.unmodifiableMap(map); return defaultValues; } }
public class class_name { @Override public InputStream getResourceAsStream(String name) { byte[] b = null; try { Asset resource = AssetCache.getAsset(mdwPackage.getName() + "/" + name); if (resource != null) b = resource.getRawContent(); if (b == null) b = findInJarAssets(name); if (b == null) b = findInFileSystem(name); } catch (Exception ex) { logger.severeException(ex.getMessage(), ex); } if (b == null) return super.getResourceAsStream(name); else return new ByteArrayInputStream(b); } }
public class class_name { @Override public InputStream getResourceAsStream(String name) { byte[] b = null; try { Asset resource = AssetCache.getAsset(mdwPackage.getName() + "/" + name); if (resource != null) b = resource.getRawContent(); if (b == null) b = findInJarAssets(name); if (b == null) b = findInFileSystem(name); } catch (Exception ex) { logger.severeException(ex.getMessage(), ex); } // depends on control dependency: [catch], data = [none] if (b == null) return super.getResourceAsStream(name); else return new ByteArrayInputStream(b); } }
public class class_name { private void reconfigureAllConnectionsLocked() { if (mAvailablePrimaryConnection != null) { try { mAvailablePrimaryConnection.reconfigure(mConfiguration); // might throw } catch (RuntimeException ex) { Log.e(TAG, "Failed to reconfigure available primary connection, closing it: " + mAvailablePrimaryConnection, ex); closeConnectionAndLogExceptionsLocked(mAvailablePrimaryConnection); mAvailablePrimaryConnection = null; } } int count = mAvailableNonPrimaryConnections.size(); for (int i = 0; i < count; i++) { final SQLiteConnection connection = mAvailableNonPrimaryConnections.get(i); try { connection.reconfigure(mConfiguration); // might throw } catch (RuntimeException ex) { Log.e(TAG, "Failed to reconfigure available non-primary connection, closing it: " + connection, ex); closeConnectionAndLogExceptionsLocked(connection); mAvailableNonPrimaryConnections.remove(i--); count -= 1; } } markAcquiredConnectionsLocked(AcquiredConnectionStatus.RECONFIGURE); } }
public class class_name { private void reconfigureAllConnectionsLocked() { if (mAvailablePrimaryConnection != null) { try { mAvailablePrimaryConnection.reconfigure(mConfiguration); // might throw // depends on control dependency: [try], data = [none] } catch (RuntimeException ex) { Log.e(TAG, "Failed to reconfigure available primary connection, closing it: " + mAvailablePrimaryConnection, ex); closeConnectionAndLogExceptionsLocked(mAvailablePrimaryConnection); mAvailablePrimaryConnection = null; } // depends on control dependency: [catch], data = [none] } int count = mAvailableNonPrimaryConnections.size(); for (int i = 0; i < count; i++) { final SQLiteConnection connection = mAvailableNonPrimaryConnections.get(i); try { connection.reconfigure(mConfiguration); // might throw // depends on control dependency: [try], data = [none] } catch (RuntimeException ex) { Log.e(TAG, "Failed to reconfigure available non-primary connection, closing it: " + connection, ex); closeConnectionAndLogExceptionsLocked(connection); mAvailableNonPrimaryConnections.remove(i--); count -= 1; } // depends on control dependency: [catch], data = [none] } markAcquiredConnectionsLocked(AcquiredConnectionStatus.RECONFIGURE); } }
public class class_name { public static void setObjectToReadyOnly(Object target, SessionFactory sessionFactory) { Object resource = TransactionSynchronizationManager.getResource(sessionFactory); if(resource != null) { Session session = sessionFactory.getCurrentSession(); if (canModifyReadWriteState(session, target)) { if (target instanceof HibernateProxy) { target = ((HibernateProxy)target).getHibernateLazyInitializer().getImplementation(); } session.setReadOnly(target, true); session.setHibernateFlushMode(FlushMode.MANUAL); } } } }
public class class_name { public static void setObjectToReadyOnly(Object target, SessionFactory sessionFactory) { Object resource = TransactionSynchronizationManager.getResource(sessionFactory); if(resource != null) { Session session = sessionFactory.getCurrentSession(); if (canModifyReadWriteState(session, target)) { if (target instanceof HibernateProxy) { target = ((HibernateProxy)target).getHibernateLazyInitializer().getImplementation(); // depends on control dependency: [if], data = [none] } session.setReadOnly(target, true); // depends on control dependency: [if], data = [none] session.setHibernateFlushMode(FlushMode.MANUAL); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private List<PROCLUSCluster> finalAssignment(List<Pair<double[], long[]>> dimensions, Relation<V> database) { Map<Integer, ModifiableDBIDs> clusterIDs = new HashMap<>(); for(int i = 0; i < dimensions.size(); i++) { clusterIDs.put(i, DBIDUtil.newHashSet()); } for(DBIDIter it = database.iterDBIDs(); it.valid(); it.advance()) { V p = database.get(it); double minDist = Double.POSITIVE_INFINITY; int best = -1; for(int i = 0; i < dimensions.size(); i++) { Pair<double[], long[]> pair_i = dimensions.get(i); double currentDist = manhattanSegmentalDistance(p, pair_i.first, pair_i.second); if(best < 0 || currentDist < minDist) { minDist = currentDist; best = i; } } // add p to cluster with mindist assert minDist >= 0.; clusterIDs.get(best).add(it); } List<PROCLUSCluster> clusters = new ArrayList<>(); for(int i = 0; i < dimensions.size(); i++) { ModifiableDBIDs objectIDs = clusterIDs.get(i); if(!objectIDs.isEmpty()) { long[] clusterDimensions = dimensions.get(i).second; double[] centroid = Centroid.make(database, objectIDs).getArrayRef(); clusters.add(new PROCLUSCluster(objectIDs, clusterDimensions, centroid)); } } if(LOG.isDebugging()) { LOG.debugFine(new StringBuilder().append("clusters ").append(clusters).toString()); } return clusters; } }
public class class_name { private List<PROCLUSCluster> finalAssignment(List<Pair<double[], long[]>> dimensions, Relation<V> database) { Map<Integer, ModifiableDBIDs> clusterIDs = new HashMap<>(); for(int i = 0; i < dimensions.size(); i++) { clusterIDs.put(i, DBIDUtil.newHashSet()); // depends on control dependency: [for], data = [i] } for(DBIDIter it = database.iterDBIDs(); it.valid(); it.advance()) { V p = database.get(it); double minDist = Double.POSITIVE_INFINITY; int best = -1; for(int i = 0; i < dimensions.size(); i++) { Pair<double[], long[]> pair_i = dimensions.get(i); double currentDist = manhattanSegmentalDistance(p, pair_i.first, pair_i.second); if(best < 0 || currentDist < minDist) { minDist = currentDist; // depends on control dependency: [if], data = [none] best = i; // depends on control dependency: [if], data = [none] } } // add p to cluster with mindist assert minDist >= 0.; clusterIDs.get(best).add(it); // depends on control dependency: [for], data = [it] } List<PROCLUSCluster> clusters = new ArrayList<>(); for(int i = 0; i < dimensions.size(); i++) { ModifiableDBIDs objectIDs = clusterIDs.get(i); if(!objectIDs.isEmpty()) { long[] clusterDimensions = dimensions.get(i).second; double[] centroid = Centroid.make(database, objectIDs).getArrayRef(); clusters.add(new PROCLUSCluster(objectIDs, clusterDimensions, centroid)); // depends on control dependency: [if], data = [none] } } if(LOG.isDebugging()) { LOG.debugFine(new StringBuilder().append("clusters ").append(clusters).toString()); // depends on control dependency: [if], data = [none] } return clusters; } }
public class class_name { public static int hash(Object key[], FieldType fieldType[]) { int hash = 0; for (int i = 0; i < key.length; i++) { hash *= 31; hash ^= hash(key[i], fieldType[i]); } return hash; } }
public class class_name { public static int hash(Object key[], FieldType fieldType[]) { int hash = 0; for (int i = 0; i < key.length; i++) { hash *= 31; // depends on control dependency: [for], data = [none] hash ^= hash(key[i], fieldType[i]); // depends on control dependency: [for], data = [i] } return hash; } }
public class class_name { private void setOfflinePresences() { Presence packetUnavailable; for (String user : presenceMap.keySet()) { Map<String, Presence> resources = presenceMap.get(user); if (resources != null) { for (String resource : resources.keySet()) { packetUnavailable = new Presence(Presence.Type.unavailable); packetUnavailable.setFrom(user + "/" + resource); presencePacketListener.processPacket(packetUnavailable); } } } } }
public class class_name { private void setOfflinePresences() { Presence packetUnavailable; for (String user : presenceMap.keySet()) { Map<String, Presence> resources = presenceMap.get(user); if (resources != null) { for (String resource : resources.keySet()) { packetUnavailable = new Presence(Presence.Type.unavailable); // depends on control dependency: [for], data = [none] packetUnavailable.setFrom(user + "/" + resource); // depends on control dependency: [for], data = [resource] presencePacketListener.processPacket(packetUnavailable); // depends on control dependency: [for], data = [none] } } } } }
public class class_name { public void setContainerDefinitions(java.util.Collection<ContainerDefinition> containerDefinitions) { if (containerDefinitions == null) { this.containerDefinitions = null; return; } this.containerDefinitions = new com.amazonaws.internal.SdkInternalList<ContainerDefinition>(containerDefinitions); } }
public class class_name { public void setContainerDefinitions(java.util.Collection<ContainerDefinition> containerDefinitions) { if (containerDefinitions == null) { this.containerDefinitions = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.containerDefinitions = new com.amazonaws.internal.SdkInternalList<ContainerDefinition>(containerDefinitions); } }
public class class_name { public static BoxResourceIterable<Info> getAllFileCollaborations(final BoxAPIConnection api, String fileID, int pageSize, String... fields) { QueryStringBuilder builder = new QueryStringBuilder(); if (fields.length > 0) { builder.appendParam("fields", fields); } return new BoxResourceIterable<BoxCollaboration.Info>( api, GET_ALL_FILE_COLLABORATIONS_URL.buildWithQuery(api.getBaseURL(), builder.toString(), fileID), pageSize) { @Override protected BoxCollaboration.Info factory(JsonObject jsonObject) { String id = jsonObject.get("id").asString(); return new BoxCollaboration(api, id).new Info(jsonObject); } }; } }
public class class_name { public static BoxResourceIterable<Info> getAllFileCollaborations(final BoxAPIConnection api, String fileID, int pageSize, String... fields) { QueryStringBuilder builder = new QueryStringBuilder(); if (fields.length > 0) { builder.appendParam("fields", fields); // depends on control dependency: [if], data = [none] } return new BoxResourceIterable<BoxCollaboration.Info>( api, GET_ALL_FILE_COLLABORATIONS_URL.buildWithQuery(api.getBaseURL(), builder.toString(), fileID), pageSize) { @Override protected BoxCollaboration.Info factory(JsonObject jsonObject) { String id = jsonObject.get("id").asString(); return new BoxCollaboration(api, id).new Info(jsonObject); } }; } }
public class class_name { @Override public Atom getAtom(int position) { if ((position < 0)|| ( position >= atoms.size())) { //throw new StructureException("No atom found at position "+position); return null; } return atoms.get(position); } }
public class class_name { @Override public Atom getAtom(int position) { if ((position < 0)|| ( position >= atoms.size())) { //throw new StructureException("No atom found at position "+position); return null; // depends on control dependency: [if], data = [none] } return atoms.get(position); } }
public class class_name { public final EObject ruleRichString() throws RecognitionException { EObject current = null; EObject lv_expressions_1_0 = null; EObject lv_expressions_2_0 = null; EObject lv_expressions_3_0 = null; EObject lv_expressions_4_0 = null; EObject lv_expressions_5_0 = null; EObject lv_expressions_6_0 = null; enterRule(); try { // InternalSARL.g:10680:2: ( ( () ( ( (lv_expressions_1_0= ruleRichStringLiteral ) ) | ( ( (lv_expressions_2_0= ruleRichStringLiteralStart ) ) ( (lv_expressions_3_0= ruleRichStringPart ) )? ( ( (lv_expressions_4_0= ruleRichStringLiteralInbetween ) ) ( (lv_expressions_5_0= ruleRichStringPart ) )? )* ( (lv_expressions_6_0= ruleRichStringLiteralEnd ) ) ) ) ) ) // InternalSARL.g:10681:2: ( () ( ( (lv_expressions_1_0= ruleRichStringLiteral ) ) | ( ( (lv_expressions_2_0= ruleRichStringLiteralStart ) ) ( (lv_expressions_3_0= ruleRichStringPart ) )? ( ( (lv_expressions_4_0= ruleRichStringLiteralInbetween ) ) ( (lv_expressions_5_0= ruleRichStringPart ) )? )* ( (lv_expressions_6_0= ruleRichStringLiteralEnd ) ) ) ) ) { // InternalSARL.g:10681:2: ( () ( ( (lv_expressions_1_0= ruleRichStringLiteral ) ) | ( ( (lv_expressions_2_0= ruleRichStringLiteralStart ) ) ( (lv_expressions_3_0= ruleRichStringPart ) )? ( ( (lv_expressions_4_0= ruleRichStringLiteralInbetween ) ) ( (lv_expressions_5_0= ruleRichStringPart ) )? )* ( (lv_expressions_6_0= ruleRichStringLiteralEnd ) ) ) ) ) // InternalSARL.g:10682:3: () ( ( (lv_expressions_1_0= ruleRichStringLiteral ) ) | ( ( (lv_expressions_2_0= ruleRichStringLiteralStart ) ) ( (lv_expressions_3_0= ruleRichStringPart ) )? ( ( (lv_expressions_4_0= ruleRichStringLiteralInbetween ) ) ( (lv_expressions_5_0= ruleRichStringPart ) )? )* ( (lv_expressions_6_0= ruleRichStringLiteralEnd ) ) ) ) { // InternalSARL.g:10682:3: () // InternalSARL.g:10683:4: { if ( state.backtracking==0 ) { current = forceCreateModelElement( grammarAccess.getRichStringAccess().getRichStringAction_0(), current); } } // InternalSARL.g:10689:3: ( ( (lv_expressions_1_0= ruleRichStringLiteral ) ) | ( ( (lv_expressions_2_0= ruleRichStringLiteralStart ) ) ( (lv_expressions_3_0= ruleRichStringPart ) )? ( ( (lv_expressions_4_0= ruleRichStringLiteralInbetween ) ) ( (lv_expressions_5_0= ruleRichStringPart ) )? )* ( (lv_expressions_6_0= ruleRichStringLiteralEnd ) ) ) ) int alt275=2; int LA275_0 = input.LA(1); if ( (LA275_0==RULE_RICH_TEXT) ) { alt275=1; } else if ( (LA275_0==RULE_RICH_TEXT_START) ) { alt275=2; } else { if (state.backtracking>0) {state.failed=true; return current;} NoViableAltException nvae = new NoViableAltException("", 275, 0, input); throw nvae; } switch (alt275) { case 1 : // InternalSARL.g:10690:4: ( (lv_expressions_1_0= ruleRichStringLiteral ) ) { // InternalSARL.g:10690:4: ( (lv_expressions_1_0= ruleRichStringLiteral ) ) // InternalSARL.g:10691:5: (lv_expressions_1_0= ruleRichStringLiteral ) { // InternalSARL.g:10691:5: (lv_expressions_1_0= ruleRichStringLiteral ) // InternalSARL.g:10692:6: lv_expressions_1_0= ruleRichStringLiteral { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getRichStringAccess().getExpressionsRichStringLiteralParserRuleCall_1_0_0()); } pushFollow(FOLLOW_2); lv_expressions_1_0=ruleRichStringLiteral(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { if (current==null) { current = createModelElementForParent(grammarAccess.getRichStringRule()); } add( current, "expressions", lv_expressions_1_0, "org.eclipse.xtend.core.Xtend.RichStringLiteral"); afterParserOrEnumRuleCall(); } } } } break; case 2 : // InternalSARL.g:10710:4: ( ( (lv_expressions_2_0= ruleRichStringLiteralStart ) ) ( (lv_expressions_3_0= ruleRichStringPart ) )? ( ( (lv_expressions_4_0= ruleRichStringLiteralInbetween ) ) ( (lv_expressions_5_0= ruleRichStringPart ) )? )* ( (lv_expressions_6_0= ruleRichStringLiteralEnd ) ) ) { // InternalSARL.g:10710:4: ( ( (lv_expressions_2_0= ruleRichStringLiteralStart ) ) ( (lv_expressions_3_0= ruleRichStringPart ) )? ( ( (lv_expressions_4_0= ruleRichStringLiteralInbetween ) ) ( (lv_expressions_5_0= ruleRichStringPart ) )? )* ( (lv_expressions_6_0= ruleRichStringLiteralEnd ) ) ) // InternalSARL.g:10711:5: ( (lv_expressions_2_0= ruleRichStringLiteralStart ) ) ( (lv_expressions_3_0= ruleRichStringPart ) )? ( ( (lv_expressions_4_0= ruleRichStringLiteralInbetween ) ) ( (lv_expressions_5_0= ruleRichStringPart ) )? )* ( (lv_expressions_6_0= ruleRichStringLiteralEnd ) ) { // InternalSARL.g:10711:5: ( (lv_expressions_2_0= ruleRichStringLiteralStart ) ) // InternalSARL.g:10712:6: (lv_expressions_2_0= ruleRichStringLiteralStart ) { // InternalSARL.g:10712:6: (lv_expressions_2_0= ruleRichStringLiteralStart ) // InternalSARL.g:10713:7: lv_expressions_2_0= ruleRichStringLiteralStart { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getRichStringAccess().getExpressionsRichStringLiteralStartParserRuleCall_1_1_0_0()); } pushFollow(FOLLOW_101); lv_expressions_2_0=ruleRichStringLiteralStart(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { if (current==null) { current = createModelElementForParent(grammarAccess.getRichStringRule()); } add( current, "expressions", lv_expressions_2_0, "org.eclipse.xtend.core.Xtend.RichStringLiteralStart"); afterParserOrEnumRuleCall(); } } } // InternalSARL.g:10730:5: ( (lv_expressions_3_0= ruleRichStringPart ) )? int alt272=2; int LA272_0 = input.LA(1); if ( ((LA272_0>=RULE_STRING && LA272_0<=RULE_RICH_TEXT_START)||(LA272_0>=RULE_HEX && LA272_0<=RULE_DECIMAL)||LA272_0==25||(LA272_0>=28 && LA272_0<=29)||LA272_0==36||(LA272_0>=39 && LA272_0<=40)||(LA272_0>=42 && LA272_0<=45)||(LA272_0>=48 && LA272_0<=49)||LA272_0==51||LA272_0==55||(LA272_0>=60 && LA272_0<=63)||(LA272_0>=65 && LA272_0<=68)||(LA272_0>=73 && LA272_0<=75)||(LA272_0>=78 && LA272_0<=96)||LA272_0==99||LA272_0==101||LA272_0==106||LA272_0==129||(LA272_0>=131 && LA272_0<=140)) ) { alt272=1; } switch (alt272) { case 1 : // InternalSARL.g:10731:6: (lv_expressions_3_0= ruleRichStringPart ) { // InternalSARL.g:10731:6: (lv_expressions_3_0= ruleRichStringPart ) // InternalSARL.g:10732:7: lv_expressions_3_0= ruleRichStringPart { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getRichStringAccess().getExpressionsRichStringPartParserRuleCall_1_1_1_0()); } pushFollow(FOLLOW_101); lv_expressions_3_0=ruleRichStringPart(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { if (current==null) { current = createModelElementForParent(grammarAccess.getRichStringRule()); } add( current, "expressions", lv_expressions_3_0, "org.eclipse.xtend.core.Xtend.RichStringPart"); afterParserOrEnumRuleCall(); } } } break; } // InternalSARL.g:10749:5: ( ( (lv_expressions_4_0= ruleRichStringLiteralInbetween ) ) ( (lv_expressions_5_0= ruleRichStringPart ) )? )* loop274: do { int alt274=2; int LA274_0 = input.LA(1); if ( ((LA274_0>=RULE_RICH_TEXT_INBETWEEN && LA274_0<=RULE_COMMENT_RICH_TEXT_INBETWEEN)) ) { alt274=1; } switch (alt274) { case 1 : // InternalSARL.g:10750:6: ( (lv_expressions_4_0= ruleRichStringLiteralInbetween ) ) ( (lv_expressions_5_0= ruleRichStringPart ) )? { // InternalSARL.g:10750:6: ( (lv_expressions_4_0= ruleRichStringLiteralInbetween ) ) // InternalSARL.g:10751:7: (lv_expressions_4_0= ruleRichStringLiteralInbetween ) { // InternalSARL.g:10751:7: (lv_expressions_4_0= ruleRichStringLiteralInbetween ) // InternalSARL.g:10752:8: lv_expressions_4_0= ruleRichStringLiteralInbetween { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getRichStringAccess().getExpressionsRichStringLiteralInbetweenParserRuleCall_1_1_2_0_0()); } pushFollow(FOLLOW_101); lv_expressions_4_0=ruleRichStringLiteralInbetween(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { if (current==null) { current = createModelElementForParent(grammarAccess.getRichStringRule()); } add( current, "expressions", lv_expressions_4_0, "org.eclipse.xtend.core.Xtend.RichStringLiteralInbetween"); afterParserOrEnumRuleCall(); } } } // InternalSARL.g:10769:6: ( (lv_expressions_5_0= ruleRichStringPart ) )? int alt273=2; int LA273_0 = input.LA(1); if ( ((LA273_0>=RULE_STRING && LA273_0<=RULE_RICH_TEXT_START)||(LA273_0>=RULE_HEX && LA273_0<=RULE_DECIMAL)||LA273_0==25||(LA273_0>=28 && LA273_0<=29)||LA273_0==36||(LA273_0>=39 && LA273_0<=40)||(LA273_0>=42 && LA273_0<=45)||(LA273_0>=48 && LA273_0<=49)||LA273_0==51||LA273_0==55||(LA273_0>=60 && LA273_0<=63)||(LA273_0>=65 && LA273_0<=68)||(LA273_0>=73 && LA273_0<=75)||(LA273_0>=78 && LA273_0<=96)||LA273_0==99||LA273_0==101||LA273_0==106||LA273_0==129||(LA273_0>=131 && LA273_0<=140)) ) { alt273=1; } switch (alt273) { case 1 : // InternalSARL.g:10770:7: (lv_expressions_5_0= ruleRichStringPart ) { // InternalSARL.g:10770:7: (lv_expressions_5_0= ruleRichStringPart ) // InternalSARL.g:10771:8: lv_expressions_5_0= ruleRichStringPart { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getRichStringAccess().getExpressionsRichStringPartParserRuleCall_1_1_2_1_0()); } pushFollow(FOLLOW_101); lv_expressions_5_0=ruleRichStringPart(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { if (current==null) { current = createModelElementForParent(grammarAccess.getRichStringRule()); } add( current, "expressions", lv_expressions_5_0, "org.eclipse.xtend.core.Xtend.RichStringPart"); afterParserOrEnumRuleCall(); } } } break; } } break; default : break loop274; } } while (true); // InternalSARL.g:10789:5: ( (lv_expressions_6_0= ruleRichStringLiteralEnd ) ) // InternalSARL.g:10790:6: (lv_expressions_6_0= ruleRichStringLiteralEnd ) { // InternalSARL.g:10790:6: (lv_expressions_6_0= ruleRichStringLiteralEnd ) // InternalSARL.g:10791:7: lv_expressions_6_0= ruleRichStringLiteralEnd { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getRichStringAccess().getExpressionsRichStringLiteralEndParserRuleCall_1_1_3_0()); } pushFollow(FOLLOW_2); lv_expressions_6_0=ruleRichStringLiteralEnd(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { if (current==null) { current = createModelElementForParent(grammarAccess.getRichStringRule()); } add( current, "expressions", lv_expressions_6_0, "org.eclipse.xtend.core.Xtend.RichStringLiteralEnd"); afterParserOrEnumRuleCall(); } } } } } break; } } } if ( state.backtracking==0 ) { leaveRule(); } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; } }
public class class_name { public final EObject ruleRichString() throws RecognitionException { EObject current = null; EObject lv_expressions_1_0 = null; EObject lv_expressions_2_0 = null; EObject lv_expressions_3_0 = null; EObject lv_expressions_4_0 = null; EObject lv_expressions_5_0 = null; EObject lv_expressions_6_0 = null; enterRule(); try { // InternalSARL.g:10680:2: ( ( () ( ( (lv_expressions_1_0= ruleRichStringLiteral ) ) | ( ( (lv_expressions_2_0= ruleRichStringLiteralStart ) ) ( (lv_expressions_3_0= ruleRichStringPart ) )? ( ( (lv_expressions_4_0= ruleRichStringLiteralInbetween ) ) ( (lv_expressions_5_0= ruleRichStringPart ) )? )* ( (lv_expressions_6_0= ruleRichStringLiteralEnd ) ) ) ) ) ) // InternalSARL.g:10681:2: ( () ( ( (lv_expressions_1_0= ruleRichStringLiteral ) ) | ( ( (lv_expressions_2_0= ruleRichStringLiteralStart ) ) ( (lv_expressions_3_0= ruleRichStringPart ) )? ( ( (lv_expressions_4_0= ruleRichStringLiteralInbetween ) ) ( (lv_expressions_5_0= ruleRichStringPart ) )? )* ( (lv_expressions_6_0= ruleRichStringLiteralEnd ) ) ) ) ) { // InternalSARL.g:10681:2: ( () ( ( (lv_expressions_1_0= ruleRichStringLiteral ) ) | ( ( (lv_expressions_2_0= ruleRichStringLiteralStart ) ) ( (lv_expressions_3_0= ruleRichStringPart ) )? ( ( (lv_expressions_4_0= ruleRichStringLiteralInbetween ) ) ( (lv_expressions_5_0= ruleRichStringPart ) )? )* ( (lv_expressions_6_0= ruleRichStringLiteralEnd ) ) ) ) ) // InternalSARL.g:10682:3: () ( ( (lv_expressions_1_0= ruleRichStringLiteral ) ) | ( ( (lv_expressions_2_0= ruleRichStringLiteralStart ) ) ( (lv_expressions_3_0= ruleRichStringPart ) )? ( ( (lv_expressions_4_0= ruleRichStringLiteralInbetween ) ) ( (lv_expressions_5_0= ruleRichStringPart ) )? )* ( (lv_expressions_6_0= ruleRichStringLiteralEnd ) ) ) ) { // InternalSARL.g:10682:3: () // InternalSARL.g:10683:4: { if ( state.backtracking==0 ) { current = forceCreateModelElement( grammarAccess.getRichStringAccess().getRichStringAction_0(), current); // depends on control dependency: [if], data = [none] } } // InternalSARL.g:10689:3: ( ( (lv_expressions_1_0= ruleRichStringLiteral ) ) | ( ( (lv_expressions_2_0= ruleRichStringLiteralStart ) ) ( (lv_expressions_3_0= ruleRichStringPart ) )? ( ( (lv_expressions_4_0= ruleRichStringLiteralInbetween ) ) ( (lv_expressions_5_0= ruleRichStringPart ) )? )* ( (lv_expressions_6_0= ruleRichStringLiteralEnd ) ) ) ) int alt275=2; int LA275_0 = input.LA(1); if ( (LA275_0==RULE_RICH_TEXT) ) { alt275=1; // depends on control dependency: [if], data = [none] } else if ( (LA275_0==RULE_RICH_TEXT_START) ) { alt275=2; // depends on control dependency: [if], data = [none] } else { if (state.backtracking>0) {state.failed=true; return current;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] NoViableAltException nvae = new NoViableAltException("", 275, 0, input); throw nvae; } switch (alt275) { case 1 : // InternalSARL.g:10690:4: ( (lv_expressions_1_0= ruleRichStringLiteral ) ) { // InternalSARL.g:10690:4: ( (lv_expressions_1_0= ruleRichStringLiteral ) ) // InternalSARL.g:10691:5: (lv_expressions_1_0= ruleRichStringLiteral ) { // InternalSARL.g:10691:5: (lv_expressions_1_0= ruleRichStringLiteral ) // InternalSARL.g:10692:6: lv_expressions_1_0= ruleRichStringLiteral { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getRichStringAccess().getExpressionsRichStringLiteralParserRuleCall_1_0_0()); // depends on control dependency: [if], data = [none] } pushFollow(FOLLOW_2); lv_expressions_1_0=ruleRichStringLiteral(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { if (current==null) { current = createModelElementForParent(grammarAccess.getRichStringRule()); // depends on control dependency: [if], data = [none] } add( current, "expressions", lv_expressions_1_0, "org.eclipse.xtend.core.Xtend.RichStringLiteral"); // depends on control dependency: [if], data = [none] afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none] } } } } break; case 2 : // InternalSARL.g:10710:4: ( ( (lv_expressions_2_0= ruleRichStringLiteralStart ) ) ( (lv_expressions_3_0= ruleRichStringPart ) )? ( ( (lv_expressions_4_0= ruleRichStringLiteralInbetween ) ) ( (lv_expressions_5_0= ruleRichStringPart ) )? )* ( (lv_expressions_6_0= ruleRichStringLiteralEnd ) ) ) { // InternalSARL.g:10710:4: ( ( (lv_expressions_2_0= ruleRichStringLiteralStart ) ) ( (lv_expressions_3_0= ruleRichStringPart ) )? ( ( (lv_expressions_4_0= ruleRichStringLiteralInbetween ) ) ( (lv_expressions_5_0= ruleRichStringPart ) )? )* ( (lv_expressions_6_0= ruleRichStringLiteralEnd ) ) ) // InternalSARL.g:10711:5: ( (lv_expressions_2_0= ruleRichStringLiteralStart ) ) ( (lv_expressions_3_0= ruleRichStringPart ) )? ( ( (lv_expressions_4_0= ruleRichStringLiteralInbetween ) ) ( (lv_expressions_5_0= ruleRichStringPart ) )? )* ( (lv_expressions_6_0= ruleRichStringLiteralEnd ) ) { // InternalSARL.g:10711:5: ( (lv_expressions_2_0= ruleRichStringLiteralStart ) ) // InternalSARL.g:10712:6: (lv_expressions_2_0= ruleRichStringLiteralStart ) { // InternalSARL.g:10712:6: (lv_expressions_2_0= ruleRichStringLiteralStart ) // InternalSARL.g:10713:7: lv_expressions_2_0= ruleRichStringLiteralStart { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getRichStringAccess().getExpressionsRichStringLiteralStartParserRuleCall_1_1_0_0()); // depends on control dependency: [if], data = [none] } pushFollow(FOLLOW_101); lv_expressions_2_0=ruleRichStringLiteralStart(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { if (current==null) { current = createModelElementForParent(grammarAccess.getRichStringRule()); // depends on control dependency: [if], data = [none] } add( current, "expressions", lv_expressions_2_0, "org.eclipse.xtend.core.Xtend.RichStringLiteralStart"); // depends on control dependency: [if], data = [none] afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none] } } } // InternalSARL.g:10730:5: ( (lv_expressions_3_0= ruleRichStringPart ) )? int alt272=2; int LA272_0 = input.LA(1); if ( ((LA272_0>=RULE_STRING && LA272_0<=RULE_RICH_TEXT_START)||(LA272_0>=RULE_HEX && LA272_0<=RULE_DECIMAL)||LA272_0==25||(LA272_0>=28 && LA272_0<=29)||LA272_0==36||(LA272_0>=39 && LA272_0<=40)||(LA272_0>=42 && LA272_0<=45)||(LA272_0>=48 && LA272_0<=49)||LA272_0==51||LA272_0==55||(LA272_0>=60 && LA272_0<=63)||(LA272_0>=65 && LA272_0<=68)||(LA272_0>=73 && LA272_0<=75)||(LA272_0>=78 && LA272_0<=96)||LA272_0==99||LA272_0==101||LA272_0==106||LA272_0==129||(LA272_0>=131 && LA272_0<=140)) ) { alt272=1; // depends on control dependency: [if], data = [none] } switch (alt272) { case 1 : // InternalSARL.g:10731:6: (lv_expressions_3_0= ruleRichStringPart ) { // InternalSARL.g:10731:6: (lv_expressions_3_0= ruleRichStringPart ) // InternalSARL.g:10732:7: lv_expressions_3_0= ruleRichStringPart { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getRichStringAccess().getExpressionsRichStringPartParserRuleCall_1_1_1_0()); // depends on control dependency: [if], data = [none] } pushFollow(FOLLOW_101); lv_expressions_3_0=ruleRichStringPart(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { if (current==null) { current = createModelElementForParent(grammarAccess.getRichStringRule()); // depends on control dependency: [if], data = [none] } add( current, "expressions", lv_expressions_3_0, "org.eclipse.xtend.core.Xtend.RichStringPart"); // depends on control dependency: [if], data = [none] afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none] } } } break; } // InternalSARL.g:10749:5: ( ( (lv_expressions_4_0= ruleRichStringLiteralInbetween ) ) ( (lv_expressions_5_0= ruleRichStringPart ) )? )* loop274: do { int alt274=2; int LA274_0 = input.LA(1); if ( ((LA274_0>=RULE_RICH_TEXT_INBETWEEN && LA274_0<=RULE_COMMENT_RICH_TEXT_INBETWEEN)) ) { alt274=1; // depends on control dependency: [if], data = [none] } switch (alt274) { case 1 : // InternalSARL.g:10750:6: ( (lv_expressions_4_0= ruleRichStringLiteralInbetween ) ) ( (lv_expressions_5_0= ruleRichStringPart ) )? { // InternalSARL.g:10750:6: ( (lv_expressions_4_0= ruleRichStringLiteralInbetween ) ) // InternalSARL.g:10751:7: (lv_expressions_4_0= ruleRichStringLiteralInbetween ) { // InternalSARL.g:10751:7: (lv_expressions_4_0= ruleRichStringLiteralInbetween ) // InternalSARL.g:10752:8: lv_expressions_4_0= ruleRichStringLiteralInbetween { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getRichStringAccess().getExpressionsRichStringLiteralInbetweenParserRuleCall_1_1_2_0_0()); // depends on control dependency: [if], data = [none] } pushFollow(FOLLOW_101); lv_expressions_4_0=ruleRichStringLiteralInbetween(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { if (current==null) { current = createModelElementForParent(grammarAccess.getRichStringRule()); // depends on control dependency: [if], data = [none] } add( current, "expressions", lv_expressions_4_0, "org.eclipse.xtend.core.Xtend.RichStringLiteralInbetween"); // depends on control dependency: [if], data = [none] afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none] } } } // InternalSARL.g:10769:6: ( (lv_expressions_5_0= ruleRichStringPart ) )? int alt273=2; int LA273_0 = input.LA(1); if ( ((LA273_0>=RULE_STRING && LA273_0<=RULE_RICH_TEXT_START)||(LA273_0>=RULE_HEX && LA273_0<=RULE_DECIMAL)||LA273_0==25||(LA273_0>=28 && LA273_0<=29)||LA273_0==36||(LA273_0>=39 && LA273_0<=40)||(LA273_0>=42 && LA273_0<=45)||(LA273_0>=48 && LA273_0<=49)||LA273_0==51||LA273_0==55||(LA273_0>=60 && LA273_0<=63)||(LA273_0>=65 && LA273_0<=68)||(LA273_0>=73 && LA273_0<=75)||(LA273_0>=78 && LA273_0<=96)||LA273_0==99||LA273_0==101||LA273_0==106||LA273_0==129||(LA273_0>=131 && LA273_0<=140)) ) { alt273=1; // depends on control dependency: [if], data = [none] } switch (alt273) { case 1 : // InternalSARL.g:10770:7: (lv_expressions_5_0= ruleRichStringPart ) { // InternalSARL.g:10770:7: (lv_expressions_5_0= ruleRichStringPart ) // InternalSARL.g:10771:8: lv_expressions_5_0= ruleRichStringPart { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getRichStringAccess().getExpressionsRichStringPartParserRuleCall_1_1_2_1_0()); // depends on control dependency: [if], data = [none] } pushFollow(FOLLOW_101); lv_expressions_5_0=ruleRichStringPart(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { if (current==null) { current = createModelElementForParent(grammarAccess.getRichStringRule()); // depends on control dependency: [if], data = [none] } add( current, "expressions", lv_expressions_5_0, "org.eclipse.xtend.core.Xtend.RichStringPart"); // depends on control dependency: [if], data = [none] afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none] } } } break; } } break; default : break loop274; } } while (true); // InternalSARL.g:10789:5: ( (lv_expressions_6_0= ruleRichStringLiteralEnd ) ) // InternalSARL.g:10790:6: (lv_expressions_6_0= ruleRichStringLiteralEnd ) { // InternalSARL.g:10790:6: (lv_expressions_6_0= ruleRichStringLiteralEnd ) // InternalSARL.g:10791:7: lv_expressions_6_0= ruleRichStringLiteralEnd { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getRichStringAccess().getExpressionsRichStringLiteralEndParserRuleCall_1_1_3_0()); // depends on control dependency: [if], data = [none] } pushFollow(FOLLOW_2); lv_expressions_6_0=ruleRichStringLiteralEnd(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { if (current==null) { current = createModelElementForParent(grammarAccess.getRichStringRule()); // depends on control dependency: [if], data = [none] } add( current, "expressions", lv_expressions_6_0, "org.eclipse.xtend.core.Xtend.RichStringLiteralEnd"); // depends on control dependency: [if], data = [none] afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none] } } } } } break; } } } if ( state.backtracking==0 ) { leaveRule(); // depends on control dependency: [if], data = [none] } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; } }
public class class_name { private String spaces(int nb) { StringBuilder sb = new StringBuilder(); for( int i=0; i<nb; i++ ) { sb.append( ' ' ); } return sb.toString(); } }
public class class_name { private String spaces(int nb) { StringBuilder sb = new StringBuilder(); for( int i=0; i<nb; i++ ) { sb.append( ' ' ); // depends on control dependency: [for], data = [none] } return sb.toString(); } }
public class class_name { protected static Object convertBasicValue(String value, Class<?> type) { if (type == null) { throw new IllegalArgumentException("Type cannot be null"); } if (String.class.equals(type)) { return value; } if (value == null || value.trim().isEmpty()) { return null; } try { value = value.trim(); if (Byte.class.equals(type)) { return Byte.parseByte(value); } else if (Short.class.equals(type)) { return Short.parseShort(value); } else if (Integer.class.equals(type)) { return Integer.parseInt(value); } else if (Long.class.equals(type)) { return Long.parseLong(value); } else if (BigInteger.class.equals(type)) { return new BigInteger(value); } else if (Float.class.equals(type)) { return Float.parseFloat(value); } else if (Double.class.equals(type)) { return Double.parseDouble(value); } else if (BigDecimal.class.equals(type)) { return new BigDecimal(value); } else if (Boolean.class.equals(type)) { return Boolean.parseBoolean(value); } } catch (Exception e) { throw new UniformException(String.format("Error while converting value %s to data type %s. Make sure the element has correct values and/or validators", value, type.getName()), e); } throw new UnsupportedOperationException("Could not convert value to unknown type: " + type.getName()); } }
public class class_name { protected static Object convertBasicValue(String value, Class<?> type) { if (type == null) { throw new IllegalArgumentException("Type cannot be null"); } if (String.class.equals(type)) { return value; // depends on control dependency: [if], data = [none] } if (value == null || value.trim().isEmpty()) { return null; // depends on control dependency: [if], data = [none] } try { value = value.trim(); // depends on control dependency: [try], data = [none] if (Byte.class.equals(type)) { return Byte.parseByte(value); // depends on control dependency: [if], data = [none] } else if (Short.class.equals(type)) { return Short.parseShort(value); // depends on control dependency: [if], data = [none] } else if (Integer.class.equals(type)) { return Integer.parseInt(value); // depends on control dependency: [if], data = [none] } else if (Long.class.equals(type)) { return Long.parseLong(value); // depends on control dependency: [if], data = [none] } else if (BigInteger.class.equals(type)) { return new BigInteger(value); // depends on control dependency: [if], data = [none] } else if (Float.class.equals(type)) { return Float.parseFloat(value); // depends on control dependency: [if], data = [none] } else if (Double.class.equals(type)) { return Double.parseDouble(value); // depends on control dependency: [if], data = [none] } else if (BigDecimal.class.equals(type)) { return new BigDecimal(value); // depends on control dependency: [if], data = [none] } else if (Boolean.class.equals(type)) { return Boolean.parseBoolean(value); // depends on control dependency: [if], data = [none] } } catch (Exception e) { throw new UniformException(String.format("Error while converting value %s to data type %s. Make sure the element has correct values and/or validators", value, type.getName()), e); } // depends on control dependency: [catch], data = [none] throw new UnsupportedOperationException("Could not convert value to unknown type: " + type.getName()); } }
public class class_name { String[] split(String line, int assertLen, String usage) { String[] ret = split(line); if (ret.length != assertLen) { error(usage); return null; } return ret; } }
public class class_name { String[] split(String line, int assertLen, String usage) { String[] ret = split(line); if (ret.length != assertLen) { error(usage); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } return ret; } }
public class class_name { public Set<Node> find(String host) { Set<Node> resultSet = new HashSet<Node>(); if (host != null) { for (Node node : socketToNodeMap.values()) { if (host.equals(node.getHost())) { resultSet.add(node); } } } return resultSet; } }
public class class_name { public Set<Node> find(String host) { Set<Node> resultSet = new HashSet<Node>(); if (host != null) { for (Node node : socketToNodeMap.values()) { if (host.equals(node.getHost())) { resultSet.add(node); // depends on control dependency: [if], data = [none] } } } return resultSet; } }
public class class_name { @Override public void prepare(final AbstractSQLInsertUpdate<?> _insertUpdate, final Attribute _attribute, final Object... _values) throws SQLException { if (_attribute.getSqlColNames().size() == 3) { checkSQLColumnSize(_attribute, 3); } else { checkSQLColumnSize(_attribute, 2); } final IntegerWithUoM value = eval(_values); _insertUpdate.column(_attribute.getSqlColNames().get(0), value.getValue()); _insertUpdate.column(_attribute.getSqlColNames().get(1), value.getUoM().getId()); if (_attribute.getSqlColNames().size() == 3) { _insertUpdate.column(_attribute.getSqlColNames().get(2), value.getBaseDouble()); } } }
public class class_name { @Override public void prepare(final AbstractSQLInsertUpdate<?> _insertUpdate, final Attribute _attribute, final Object... _values) throws SQLException { if (_attribute.getSqlColNames().size() == 3) { checkSQLColumnSize(_attribute, 3); // depends on control dependency: [if], data = [3)] } else { checkSQLColumnSize(_attribute, 2); // depends on control dependency: [if], data = [none] } final IntegerWithUoM value = eval(_values); _insertUpdate.column(_attribute.getSqlColNames().get(0), value.getValue()); _insertUpdate.column(_attribute.getSqlColNames().get(1), value.getUoM().getId()); if (_attribute.getSqlColNames().size() == 3) { _insertUpdate.column(_attribute.getSqlColNames().get(2), value.getBaseDouble()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public int nextSetBit(int fromIndex) { if(fromIndex < 0) throw new IndexOutOfBoundsException("fromIndex: " + fromIndex); if(fromIndex >= size) return -1; int u=wordIndex(fromIndex); long word=words[u] & (WORD_MASK << fromIndex); while(true) { if(word != 0) return (u * BITS_PER_WORD) + Long.numberOfTrailingZeros(word); if(++u == words.length) return -1; word=words[u]; } } }
public class class_name { public int nextSetBit(int fromIndex) { if(fromIndex < 0) throw new IndexOutOfBoundsException("fromIndex: " + fromIndex); if(fromIndex >= size) return -1; int u=wordIndex(fromIndex); long word=words[u] & (WORD_MASK << fromIndex); while(true) { if(word != 0) return (u * BITS_PER_WORD) + Long.numberOfTrailingZeros(word); if(++u == words.length) return -1; word=words[u]; // depends on control dependency: [while], data = [none] } } }
public class class_name { private void readRelationships() { for (MapRow row : getTable("CONTAB")) { Task task1 = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID_1")); Task task2 = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID_2")); if (task1 != null && task2 != null) { RelationType type = row.getRelationType("TYPE"); Duration lag = row.getDuration("LAG"); Relation relation = task2.addPredecessor(task1, type, lag); m_eventManager.fireRelationReadEvent(relation); } } } }
public class class_name { private void readRelationships() { for (MapRow row : getTable("CONTAB")) { Task task1 = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID_1")); Task task2 = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID_2")); if (task1 != null && task2 != null) { RelationType type = row.getRelationType("TYPE"); Duration lag = row.getDuration("LAG"); Relation relation = task2.addPredecessor(task1, type, lag); m_eventManager.fireRelationReadEvent(relation); // depends on control dependency: [if], data = [none] } } } }
public class class_name { protected synchronized void unsetPermission(ServiceReference<JavaPermissionsConfiguration> permission) { permissions.removeReference(permission); if (wsjarUrlStreamHandlerAvailable) { clearPermissions(); initializePermissions(); } } }
public class class_name { protected synchronized void unsetPermission(ServiceReference<JavaPermissionsConfiguration> permission) { permissions.removeReference(permission); if (wsjarUrlStreamHandlerAvailable) { clearPermissions(); // depends on control dependency: [if], data = [none] initializePermissions(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void addFilesToArchive(ZipArchiver archiver, File sourceDir, File packageXml) throws Exception { Collection<String> documentNames; getLog().info(String.format("Using the existing package.xml descriptor at [%s]", packageXml.getPath())); try { documentNames = getDocumentNamesFromXML(packageXml); } catch (Exception e) { getLog().error(String.format("The existing [%s] is invalid.", PACKAGE_XML)); throw e; } // Next, we scan the hole directory and subdirectories for documents. Queue<File> fileQueue = new LinkedList<>(); addContentsToQueue(fileQueue, sourceDir); while (!fileQueue.isEmpty() && !documentNames.isEmpty()) { File currentFile = fileQueue.poll(); if (currentFile.isDirectory()) { addContentsToQueue(fileQueue, currentFile); } else { String documentReference = XWikiDocument.getReference(currentFile); if (documentNames.contains(documentReference)) { // building the path the current file will have within the archive // // Note: DO NOT USE String.split since it requires a regexp. Under Windows XP, the FileSeparator is // '\' when not escaped is a special character of the regexp // String archivedFilePath = // currentFile.getAbsolutePath().split(sourceDir.getAbsolutePath() + File.separator)[1]; String archivedFilePath = currentFile.getAbsolutePath() .substring((sourceDir.getAbsolutePath() + File.separator).length()); archivedFilePath = archivedFilePath.replace(File.separatorChar, '/'); archiver.addFile(currentFile, archivedFilePath); documentNames.remove(documentReference); } } } if (!documentNames.isEmpty()) { StringBuilder errorMessage = new StringBuilder("The following documents could not be found: "); for (String name : documentNames) { errorMessage.append(name); errorMessage.append(" "); } throw new Exception(errorMessage.toString()); } archiver.addFile(packageXml, PACKAGE_XML); } }
public class class_name { private void addFilesToArchive(ZipArchiver archiver, File sourceDir, File packageXml) throws Exception { Collection<String> documentNames; getLog().info(String.format("Using the existing package.xml descriptor at [%s]", packageXml.getPath())); try { documentNames = getDocumentNamesFromXML(packageXml); } catch (Exception e) { getLog().error(String.format("The existing [%s] is invalid.", PACKAGE_XML)); throw e; } // Next, we scan the hole directory and subdirectories for documents. Queue<File> fileQueue = new LinkedList<>(); addContentsToQueue(fileQueue, sourceDir); while (!fileQueue.isEmpty() && !documentNames.isEmpty()) { File currentFile = fileQueue.poll(); if (currentFile.isDirectory()) { addContentsToQueue(fileQueue, currentFile); // depends on control dependency: [if], data = [none] } else { String documentReference = XWikiDocument.getReference(currentFile); if (documentNames.contains(documentReference)) { // building the path the current file will have within the archive // // Note: DO NOT USE String.split since it requires a regexp. Under Windows XP, the FileSeparator is // '\' when not escaped is a special character of the regexp // String archivedFilePath = // currentFile.getAbsolutePath().split(sourceDir.getAbsolutePath() + File.separator)[1]; String archivedFilePath = currentFile.getAbsolutePath() .substring((sourceDir.getAbsolutePath() + File.separator).length()); archivedFilePath = archivedFilePath.replace(File.separatorChar, '/'); // depends on control dependency: [if], data = [none] archiver.addFile(currentFile, archivedFilePath); // depends on control dependency: [if], data = [none] documentNames.remove(documentReference); // depends on control dependency: [if], data = [none] } } } if (!documentNames.isEmpty()) { StringBuilder errorMessage = new StringBuilder("The following documents could not be found: "); for (String name : documentNames) { errorMessage.append(name); errorMessage.append(" "); } throw new Exception(errorMessage.toString()); } archiver.addFile(packageXml, PACKAGE_XML); } }
public class class_name { private Map<String, Object> sortColumns(Map<String, Object> next) { Map<String, Object> sortedColumns = new LinkedHashMap<>(); if ( this.columns != null ) { for ( String column : this.columns ) { sortedColumns.put( column, next.get( column ) ); } } return sortedColumns; } }
public class class_name { private Map<String, Object> sortColumns(Map<String, Object> next) { Map<String, Object> sortedColumns = new LinkedHashMap<>(); if ( this.columns != null ) { for ( String column : this.columns ) { sortedColumns.put( column, next.get( column ) ); // depends on control dependency: [for], data = [column] } } return sortedColumns; } }
public class class_name { public final void register(final TimeZone timezone, boolean update) { if (update) { try { // load any available updates for the timezone.. timezones.put(timezone.getID(), new TimeZone(timeZoneLoader.loadVTimeZone(timezone.getID()))); } catch (IOException | ParserException | ParseException e) { Logger log = LoggerFactory.getLogger(TimeZoneRegistryImpl.class); log.warn("Error occurred loading VTimeZone", e); } } else { timezones.put(timezone.getID(), timezone); } } }
public class class_name { public final void register(final TimeZone timezone, boolean update) { if (update) { try { // load any available updates for the timezone.. timezones.put(timezone.getID(), new TimeZone(timeZoneLoader.loadVTimeZone(timezone.getID()))); // depends on control dependency: [try], data = [none] } catch (IOException | ParserException | ParseException e) { Logger log = LoggerFactory.getLogger(TimeZoneRegistryImpl.class); log.warn("Error occurred loading VTimeZone", e); } // depends on control dependency: [catch], data = [none] } else { timezones.put(timezone.getID(), timezone); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void addOptions(final ParserData parserData, final IOptionsNode node, final String[] vars, final int startPos, final String originalInput, int lineNumber) throws ParsingException { // Process each variable in vars starting from the start position for (int i = startPos; i < vars.length; i++) { String str = vars[i]; // If the variable contains a "=" then it isn't a tag so process it separately if (StringUtilities.indexOf(str, '=') != -1) { String temp[] = StringUtilities.split(str, '=', 2); temp = CollectionUtilities.trimStringArray(temp); if (temp.length == 2) { if (temp[0].equalsIgnoreCase("description")) { if (node.getDescription(false) == null) { node.setDescription(ProcessorUtilities.replaceEscapeChars(temp[1])); } else { throw new ParsingException( String.format(ProcessorConstants.ERROR_DUPLICATE_ATTRIBUTE_MSG, lineNumber, "description", originalInput)); } } else if (temp[0].equalsIgnoreCase("writer")) { if (node.getAssignedWriter(false) == null) { node.setAssignedWriter(ProcessorUtilities.replaceEscapeChars(temp[1])); } else { throw new ParsingException( String.format(ProcessorConstants.ERROR_DUPLICATE_ATTRIBUTE_MSG, lineNumber, "writer", originalInput)); } } else if (temp[0].equalsIgnoreCase("condition")) { if (node.getConditionStatement() == null) { final String condition = temp[1]; node.setConditionStatement(condition); try { Pattern.compile(condition); } catch (PatternSyntaxException exception) { throw new ParsingException( format(ProcessorConstants.ERROR_INVALID_CONDITION_MSG, lineNumber, originalInput)); } } else { throw new ParsingException( String.format(ProcessorConstants.ERROR_DUPLICATE_ATTRIBUTE_MSG, lineNumber, "condition", originalInput)); } } else if (temp[0].equalsIgnoreCase("URL") && node instanceof SpecNode) { ((SpecNode) node).addSourceUrl(ProcessorUtilities.replaceEscapeChars(temp[1])); } else if (temp[0].equalsIgnoreCase("Fixed URL") && node instanceof SpecNode) { ((SpecNode) node).setFixedUrl(ProcessorUtilities.replaceEscapeChars(temp[1])); } else { throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_ATTRIBUTE_MSG, lineNumber, originalInput)); } } else { throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_ATTRIB_FORMAT_MSG, lineNumber, originalInput)); } } // The variable is a tag with a category specified else if (StringUtilities.indexOf(str, ':') != -1) { String temp[] = StringUtilities.split(str, ':', 2); temp = CollectionUtilities.trimStringArray(temp); if (temp.length == 2) { // Check if the category has an array of tags if (StringUtilities.indexOf(temp[1], '(') != -1) { String[] tempTags; final StringBuilder input = new StringBuilder(temp[1]); if (StringUtilities.indexOf(temp[1], ')') == -1) { for (int j = i + 1; j < vars.length; j++) { i++; if (StringUtilities.indexOf(vars[j], ')') != -1) { input.append(", ").append(vars[j]); break; } else { input.append(", ").append(vars[j]); } } } // Get the mapping of variables final HashMap<ParserType, String[]> variableMap = getLineVariables(parserData, input.toString(), lineNumber, '(', ')', ',', false); if (variableMap.containsKey(ParserType.NONE)) { tempTags = variableMap.get(ParserType.NONE); } else { tempTags = null; } if (tempTags != null && tempTags.length >= 2) { final String tags[] = new String[tempTags.length]; System.arraycopy(tempTags, 0, tags, 0, tempTags.length); if (!node.addTags(Arrays.asList(tags))) { throw new ParsingException( format(ProcessorConstants.ERROR_MULTI_TAG_DUPLICATED_MSG, lineNumber, originalInput)); } } else { throw new ParsingException( format(ProcessorConstants.ERROR_INVALID_TAG_ATTRIB_FORMAT_MSG, lineNumber, originalInput)); } } // Just a single tag so add it straight away else { if (!node.addTag(ProcessorUtilities.replaceEscapeChars(temp[1]))) { throw new ParsingException(format(ProcessorConstants.ERROR_TAG_DUPLICATED_MSG, lineNumber, originalInput)); } } } else { throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_TAG_ATTRIB_FORMAT_MSG, lineNumber, originalInput)); } } // Variable is a tag with no category specified else { if (str.matches(CSConstants.ALL_TOPIC_ID_REGEX)) { throw new ParsingException(format(ProcessorConstants.ERROR_INCORRECT_TOPIC_ID_LOCATION_MSG, lineNumber, originalInput)); } if (!node.addTag(str)) { throw new ParsingException(format(ProcessorConstants.ERROR_TAG_DUPLICATED_MSG, lineNumber, originalInput)); } } } } }
public class class_name { protected void addOptions(final ParserData parserData, final IOptionsNode node, final String[] vars, final int startPos, final String originalInput, int lineNumber) throws ParsingException { // Process each variable in vars starting from the start position for (int i = startPos; i < vars.length; i++) { String str = vars[i]; // If the variable contains a "=" then it isn't a tag so process it separately if (StringUtilities.indexOf(str, '=') != -1) { String temp[] = StringUtilities.split(str, '=', 2); temp = CollectionUtilities.trimStringArray(temp); if (temp.length == 2) { if (temp[0].equalsIgnoreCase("description")) { if (node.getDescription(false) == null) { node.setDescription(ProcessorUtilities.replaceEscapeChars(temp[1])); // depends on control dependency: [if], data = [none] } else { throw new ParsingException( String.format(ProcessorConstants.ERROR_DUPLICATE_ATTRIBUTE_MSG, lineNumber, "description", originalInput)); } } else if (temp[0].equalsIgnoreCase("writer")) { if (node.getAssignedWriter(false) == null) { node.setAssignedWriter(ProcessorUtilities.replaceEscapeChars(temp[1])); // depends on control dependency: [if], data = [none] } else { throw new ParsingException( String.format(ProcessorConstants.ERROR_DUPLICATE_ATTRIBUTE_MSG, lineNumber, "writer", originalInput)); } } else if (temp[0].equalsIgnoreCase("condition")) { if (node.getConditionStatement() == null) { final String condition = temp[1]; node.setConditionStatement(condition); // depends on control dependency: [if], data = [none] try { Pattern.compile(condition); // depends on control dependency: [try], data = [none] } catch (PatternSyntaxException exception) { throw new ParsingException( format(ProcessorConstants.ERROR_INVALID_CONDITION_MSG, lineNumber, originalInput)); } // depends on control dependency: [catch], data = [none] } else { throw new ParsingException( String.format(ProcessorConstants.ERROR_DUPLICATE_ATTRIBUTE_MSG, lineNumber, "condition", originalInput)); } } else if (temp[0].equalsIgnoreCase("URL") && node instanceof SpecNode) { ((SpecNode) node).addSourceUrl(ProcessorUtilities.replaceEscapeChars(temp[1])); // depends on control dependency: [if], data = [none] } else if (temp[0].equalsIgnoreCase("Fixed URL") && node instanceof SpecNode) { ((SpecNode) node).setFixedUrl(ProcessorUtilities.replaceEscapeChars(temp[1])); // depends on control dependency: [if], data = [none] } else { throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_ATTRIBUTE_MSG, lineNumber, originalInput)); } } else { throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_ATTRIB_FORMAT_MSG, lineNumber, originalInput)); } } // The variable is a tag with a category specified else if (StringUtilities.indexOf(str, ':') != -1) { String temp[] = StringUtilities.split(str, ':', 2); temp = CollectionUtilities.trimStringArray(temp); if (temp.length == 2) { // Check if the category has an array of tags if (StringUtilities.indexOf(temp[1], '(') != -1) { String[] tempTags; final StringBuilder input = new StringBuilder(temp[1]); if (StringUtilities.indexOf(temp[1], ')') == -1) { for (int j = i + 1; j < vars.length; j++) { i++; // depends on control dependency: [for], data = [none] if (StringUtilities.indexOf(vars[j], ')') != -1) { input.append(", ").append(vars[j]); // depends on control dependency: [if], data = [none] break; } else { input.append(", ").append(vars[j]); // depends on control dependency: [if], data = [none] } } } // Get the mapping of variables final HashMap<ParserType, String[]> variableMap = getLineVariables(parserData, input.toString(), lineNumber, '(', ')', ',', false); if (variableMap.containsKey(ParserType.NONE)) { tempTags = variableMap.get(ParserType.NONE); // depends on control dependency: [if], data = [none] } else { tempTags = null; // depends on control dependency: [if], data = [none] } if (tempTags != null && tempTags.length >= 2) { final String tags[] = new String[tempTags.length]; System.arraycopy(tempTags, 0, tags, 0, tempTags.length); // depends on control dependency: [if], data = [(tempTags] if (!node.addTags(Arrays.asList(tags))) { throw new ParsingException( format(ProcessorConstants.ERROR_MULTI_TAG_DUPLICATED_MSG, lineNumber, originalInput)); } } else { throw new ParsingException( format(ProcessorConstants.ERROR_INVALID_TAG_ATTRIB_FORMAT_MSG, lineNumber, originalInput)); } } // Just a single tag so add it straight away else { if (!node.addTag(ProcessorUtilities.replaceEscapeChars(temp[1]))) { throw new ParsingException(format(ProcessorConstants.ERROR_TAG_DUPLICATED_MSG, lineNumber, originalInput)); } } } else { throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_TAG_ATTRIB_FORMAT_MSG, lineNumber, originalInput)); } } // Variable is a tag with no category specified else { if (str.matches(CSConstants.ALL_TOPIC_ID_REGEX)) { throw new ParsingException(format(ProcessorConstants.ERROR_INCORRECT_TOPIC_ID_LOCATION_MSG, lineNumber, originalInput)); } if (!node.addTag(str)) { throw new ParsingException(format(ProcessorConstants.ERROR_TAG_DUPLICATED_MSG, lineNumber, originalInput)); } } } } }
public class class_name { public void clear() { for (int i = 0; i < values.length; i++) { keys[i] = DEAD_KEY; flags[i] = 0; values[i] = null; } size = 0; } }
public class class_name { public void clear() { for (int i = 0; i < values.length; i++) { keys[i] = DEAD_KEY; // depends on control dependency: [for], data = [i] flags[i] = 0; // depends on control dependency: [for], data = [i] values[i] = null; // depends on control dependency: [for], data = [i] } size = 0; } }
public class class_name { void changeState(String propertyName, Object newValue) { try { ObjectUtils.setField(this, getFieldName(propertyName), newValue); } catch (IllegalArgumentException e) { throw new PropertyNotFoundException(String.format( "The property (%1$s) corresponding to field (%2$s) was not found in this Bean (%3$s)!", propertyName, getFieldName(propertyName), getClass().getName()), e); } } }
public class class_name { void changeState(String propertyName, Object newValue) { try { ObjectUtils.setField(this, getFieldName(propertyName), newValue); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException e) { throw new PropertyNotFoundException(String.format( "The property (%1$s) corresponding to field (%2$s) was not found in this Bean (%3$s)!", propertyName, getFieldName(propertyName), getClass().getName()), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static int getPosition(Term subTerm, Term term) { int startingIndex = -1; int j = 0; for(int i=0; i<term.getWords().size(); i++) { if(term.getWords().get(i).equals(subTerm.getWords().get(j))) { j++; if(startingIndex == -1) startingIndex = i; } else { startingIndex = -1; j = 0; } if(j == subTerm.getWords().size()) return startingIndex; } return -1; } }
public class class_name { public static int getPosition(Term subTerm, Term term) { int startingIndex = -1; int j = 0; for(int i=0; i<term.getWords().size(); i++) { if(term.getWords().get(i).equals(subTerm.getWords().get(j))) { j++; // depends on control dependency: [if], data = [none] if(startingIndex == -1) startingIndex = i; } else { startingIndex = -1; // depends on control dependency: [if], data = [none] j = 0; // depends on control dependency: [if], data = [none] } if(j == subTerm.getWords().size()) return startingIndex; } return -1; } }
public class class_name { private static String getSetterName(Method m) { String name = m.getName(); if (name.startsWith("set") && (name.length() >= 4) && m.getReturnType().equals(void.class) && (m.getParameterTypes().length == 1) ) { return Character.toLowerCase(name.charAt(3)) + name.substring(4); } return null; } }
public class class_name { private static String getSetterName(Method m) { String name = m.getName(); if (name.startsWith("set") && (name.length() >= 4) && m.getReturnType().equals(void.class) && (m.getParameterTypes().length == 1) ) { return Character.toLowerCase(name.charAt(3)) + name.substring(4); // depends on control dependency: [if], data = [] } return null; } }
public class class_name { @Override protected void setProperty(final String _name, final String _value) throws CacheReloadException { if ("AskUser".equals(_name)) { askUser = "true".equalsIgnoreCase(_value); } else if ("DefaultSelected".equals(_name)) { defaultSelected = "true".equalsIgnoreCase(_value); } else if ("HRef".equals(_name)) { reference = _value; } else if ("Label".equals(_name)) { label = _value; } else if ("Submit".equals(_name)) { submit = "true".equalsIgnoreCase(_value); } else if ("SubmitSelectedRows".equals(_name)) { submitSelectedRows = Integer.parseInt(_value); } else if ("Target".equals(_name)) { if ("content".equals(_value)) { target = AbstractCommand.Target.CONTENT; } else if ("hidden".equals(_value)) { target = AbstractCommand.Target.HIDDEN; } else if ("popup".equals(_value)) { target = AbstractCommand.Target.POPUP; } else if ("modal".equals(_value)) { target = AbstractCommand.Target.MODAL; } } else if ("TargetBottomHeight".equals(_name)) { targetBottomHeight = Integer.parseInt(_value); } else if ("TargetCmdRevise".equals(_name)) { targetCmdRevise = "TRUE".equalsIgnoreCase(_value); } else if ("TargetConnectAttribute".equals(_name)) { final Attribute attr = Attribute.get(_value); targetConnectAttributeId = attr == null ? 0 : attr.getId(); } else if ("TargetCreateType".equals(_name)) { final Type type = Type.get(_value); targetCreateTypeId = type == null ? 0 : type.getId(); } else if (_name != null && _name.startsWith("TargetCreateClassifications")) { setTargetCreateClassifications(_value); } else if ("TargetDefaultMenu".equals(_name)) { targetDefaultMenu = "none".equalsIgnoreCase(_value); } else if ("TargetMode".equals(_name)) { if ("create".equals(_value)) { targetMode = TargetMode.CREATE; } else if ("edit".equals(_value)) { targetMode = TargetMode.EDIT; } else if ("connect".equals(_value)) { targetMode = TargetMode.CONNECT; } else if ("search".equals(_value)) { targetMode = TargetMode.SEARCH; } else if ("view".equals(_value)) { targetMode = TargetMode.VIEW; } } else if ("TargetShowCheckBoxes".equals(_name)) { targetShowCheckBoxes = "true".equalsIgnoreCase(_value); } else if ("TargetTableSortKey".equals(_name)) { targetTableSortKey = _value; targetTableSortDirection = AbstractCommand.SortDirection.ASCENDING; } else if ("TargetTableSortDirection".equals(_name)) { if (AbstractCommand.SortDirection.DESCENDING.value.equals(_value)) { targetTableSortDirection = AbstractCommand.SortDirection.DESCENDING; } else { targetTableSortDirection = AbstractCommand.SortDirection.ASCENDING; } } else if ("TargetTitle".equals(_name)) { targetTitle = _value; } else if ("TargetShowFile".equals(_name)) { targetShowFile = "true".equalsIgnoreCase(_value); } else if ("NoUpdateAfterCOMMAND".equals(_name)) { noUpdateAfterCmd = "true".equalsIgnoreCase(_value); } else if ("TargetStructurBrowserField".equals(_name)) { targetStructurBrowserField = _value.trim(); } else if ("WindowHeight".equals(_name)) { windowHeight = Integer.parseInt(_value); } else if ("WindowWidth".equals(_name)) { windowWidth = Integer.parseInt(_value); } else { super.setProperty(_name, _value); } } }
public class class_name { @Override protected void setProperty(final String _name, final String _value) throws CacheReloadException { if ("AskUser".equals(_name)) { askUser = "true".equalsIgnoreCase(_value); } else if ("DefaultSelected".equals(_name)) { defaultSelected = "true".equalsIgnoreCase(_value); } else if ("HRef".equals(_name)) { reference = _value; } else if ("Label".equals(_name)) { label = _value; } else if ("Submit".equals(_name)) { submit = "true".equalsIgnoreCase(_value); } else if ("SubmitSelectedRows".equals(_name)) { submitSelectedRows = Integer.parseInt(_value); } else if ("Target".equals(_name)) { if ("content".equals(_value)) { target = AbstractCommand.Target.CONTENT; // depends on control dependency: [if], data = [none] } else if ("hidden".equals(_value)) { target = AbstractCommand.Target.HIDDEN; // depends on control dependency: [if], data = [none] } else if ("popup".equals(_value)) { target = AbstractCommand.Target.POPUP; // depends on control dependency: [if], data = [none] } else if ("modal".equals(_value)) { target = AbstractCommand.Target.MODAL; // depends on control dependency: [if], data = [none] } } else if ("TargetBottomHeight".equals(_name)) { targetBottomHeight = Integer.parseInt(_value); } else if ("TargetCmdRevise".equals(_name)) { targetCmdRevise = "TRUE".equalsIgnoreCase(_value); } else if ("TargetConnectAttribute".equals(_name)) { final Attribute attr = Attribute.get(_value); targetConnectAttributeId = attr == null ? 0 : attr.getId(); } else if ("TargetCreateType".equals(_name)) { final Type type = Type.get(_value); targetCreateTypeId = type == null ? 0 : type.getId(); } else if (_name != null && _name.startsWith("TargetCreateClassifications")) { setTargetCreateClassifications(_value); } else if ("TargetDefaultMenu".equals(_name)) { targetDefaultMenu = "none".equalsIgnoreCase(_value); } else if ("TargetMode".equals(_name)) { if ("create".equals(_value)) { targetMode = TargetMode.CREATE; // depends on control dependency: [if], data = [none] } else if ("edit".equals(_value)) { targetMode = TargetMode.EDIT; // depends on control dependency: [if], data = [none] } else if ("connect".equals(_value)) { targetMode = TargetMode.CONNECT; // depends on control dependency: [if], data = [none] } else if ("search".equals(_value)) { targetMode = TargetMode.SEARCH; // depends on control dependency: [if], data = [none] } else if ("view".equals(_value)) { targetMode = TargetMode.VIEW; // depends on control dependency: [if], data = [none] } } else if ("TargetShowCheckBoxes".equals(_name)) { targetShowCheckBoxes = "true".equalsIgnoreCase(_value); } else if ("TargetTableSortKey".equals(_name)) { targetTableSortKey = _value; targetTableSortDirection = AbstractCommand.SortDirection.ASCENDING; } else if ("TargetTableSortDirection".equals(_name)) { if (AbstractCommand.SortDirection.DESCENDING.value.equals(_value)) { targetTableSortDirection = AbstractCommand.SortDirection.DESCENDING; // depends on control dependency: [if], data = [none] } else { targetTableSortDirection = AbstractCommand.SortDirection.ASCENDING; // depends on control dependency: [if], data = [none] } } else if ("TargetTitle".equals(_name)) { targetTitle = _value; } else if ("TargetShowFile".equals(_name)) { targetShowFile = "true".equalsIgnoreCase(_value); } else if ("NoUpdateAfterCOMMAND".equals(_name)) { noUpdateAfterCmd = "true".equalsIgnoreCase(_value); } else if ("TargetStructurBrowserField".equals(_name)) { targetStructurBrowserField = _value.trim(); } else if ("WindowHeight".equals(_name)) { windowHeight = Integer.parseInt(_value); } else if ("WindowWidth".equals(_name)) { windowWidth = Integer.parseInt(_value); } else { super.setProperty(_name, _value); } } }
public class class_name { private static void moveMarkedWeakSources(JSModule weakModule, Iterable<CompilerInput> inputs) { checkNotNull(weakModule); ImmutableList<CompilerInput> allInputs = ImmutableList.copyOf(inputs); for (CompilerInput i : allInputs) { if (i.getSourceFile().isWeak()) { JSModule existingModule = i.getModule(); if (existingModule == weakModule) { continue; } if (existingModule != null) { existingModule.remove(i); } weakModule.add(i); } } } }
public class class_name { private static void moveMarkedWeakSources(JSModule weakModule, Iterable<CompilerInput> inputs) { checkNotNull(weakModule); ImmutableList<CompilerInput> allInputs = ImmutableList.copyOf(inputs); for (CompilerInput i : allInputs) { if (i.getSourceFile().isWeak()) { JSModule existingModule = i.getModule(); if (existingModule == weakModule) { continue; } if (existingModule != null) { existingModule.remove(i); // depends on control dependency: [if], data = [none] } weakModule.add(i); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private SeaGlassContext getContext(JComponent c, Region subregion, int state) { SynthStyle style = null; Class klass = SeaGlassContext.class; if (subregion == Region.TABBED_PANE_TAB) { style = tabStyle; } else if (subregion == Region.TABBED_PANE_TAB_AREA) { style = tabAreaStyle; } else if (subregion == Region.TABBED_PANE_CONTENT) { style = tabContentStyle; } else if (subregion == SeaGlassRegion.TABBED_PANE_TAB_CLOSE_BUTTON) { style = tabCloseStyle; } return SeaGlassContext.getContext(klass, c, subregion, style, state); } }
public class class_name { private SeaGlassContext getContext(JComponent c, Region subregion, int state) { SynthStyle style = null; Class klass = SeaGlassContext.class; if (subregion == Region.TABBED_PANE_TAB) { style = tabStyle; // depends on control dependency: [if], data = [none] } else if (subregion == Region.TABBED_PANE_TAB_AREA) { style = tabAreaStyle; // depends on control dependency: [if], data = [none] } else if (subregion == Region.TABBED_PANE_CONTENT) { style = tabContentStyle; // depends on control dependency: [if], data = [none] } else if (subregion == SeaGlassRegion.TABBED_PANE_TAB_CLOSE_BUTTON) { style = tabCloseStyle; // depends on control dependency: [if], data = [none] } return SeaGlassContext.getContext(klass, c, subregion, style, state); } }
public class class_name { @Override public Session createSession(boolean transacted, int acknowledgeMode) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "createSession", new Object[] { transacted, acknowledgeMode }); JmsSessionImpl jmsSession = null; // throw an exception if the connection is closed. checkClosed(); // mark that the client id cannot be changed. fixClientID(); // enforce consistency on transacted flag and acknowledge mode. if (transacted) { acknowledgeMode = Session.SESSION_TRANSACTED; } if (!transacted && isManaged) { if (acknowledgeMode == Session.CLIENT_ACKNOWLEDGE) { throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class, "INVALID_ACKNOWLEDGE_MODE_CWSIA0514", new Object[] { acknowledgeMode }, tc ); } // if the ackmode is dups_ok then set it to dups_ok, for all the other combination // set it to auto_ack if (acknowledgeMode == Session.DUPS_OK_ACKNOWLEDGE) acknowledgeMode = Session.DUPS_OK_ACKNOWLEDGE; else acknowledgeMode = Session.AUTO_ACKNOWLEDGE; } // create the jca session. boolean internallyTransacted = (transacted || acknowledgeMode == Session.CLIENT_ACKNOWLEDGE || acknowledgeMode == Session.DUPS_OK_ACKNOWLEDGE); JmsJcaSession jcaSession = createJcaSession(internallyTransacted); // Lock here so that another thread using the same connection doesn't reset the // coreConnection to something else as as we are instantiating the Session synchronized (this) { try { // We potentially have a new coreConnection becuase the creation of the JcaSession // detected that the coreConnection is now invalid and so a new managedConnection // and coreConnection was created. So reset the coreConnection for this JmsConnection // to the new one or we just set the old one again. coreConnection = jcaSession.getSICoreConnection(); } catch (IllegalStateException e) { FFDCFilter.processException(e, "com.ibm.ws.sib.api.jms.impl.JmsConnectionImpl", "createSession#2", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "createSession", jmsSession); throw (JMSException) JmsErrorUtils.newThrowable( JMSException.class, "JCA_CREATE_SESS_CWSIA0024", null, e, "JmsConnectionImpl.createSession#2", this, tc); } // instantiate the jms session, and add it to this connection's session list. jmsSession = instantiateSession(transacted, acknowledgeMode, coreConnection, jcaSession); } synchronized (stateLock) { sessions.add(jmsSession); // d353701 - output a warning message if there are 'lots' of sessions active. if (sessions.size() % SESSION_WARNING_THRESHOLD == 0) { // We wish to tell the user which line of their application created the session, // so we must obtain a line of stack trace from their application. String errorLocation = JmsErrorUtils.getFirstApplicationStackString(); SibTr.warning(tc, "MANY_SESSIONS_WARNING_CWSIA0027", new Object[] { "" + sessions.size(), errorLocation }); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "createSession", jmsSession); return jmsSession; } }
public class class_name { @Override public Session createSession(boolean transacted, int acknowledgeMode) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "createSession", new Object[] { transacted, acknowledgeMode }); JmsSessionImpl jmsSession = null; // throw an exception if the connection is closed. checkClosed(); // mark that the client id cannot be changed. fixClientID(); // enforce consistency on transacted flag and acknowledge mode. if (transacted) { acknowledgeMode = Session.SESSION_TRANSACTED; } if (!transacted && isManaged) { if (acknowledgeMode == Session.CLIENT_ACKNOWLEDGE) { throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class, "INVALID_ACKNOWLEDGE_MODE_CWSIA0514", new Object[] { acknowledgeMode }, tc ); } // if the ackmode is dups_ok then set it to dups_ok, for all the other combination // set it to auto_ack if (acknowledgeMode == Session.DUPS_OK_ACKNOWLEDGE) acknowledgeMode = Session.DUPS_OK_ACKNOWLEDGE; else acknowledgeMode = Session.AUTO_ACKNOWLEDGE; } // create the jca session. boolean internallyTransacted = (transacted || acknowledgeMode == Session.CLIENT_ACKNOWLEDGE || acknowledgeMode == Session.DUPS_OK_ACKNOWLEDGE); JmsJcaSession jcaSession = createJcaSession(internallyTransacted); // Lock here so that another thread using the same connection doesn't reset the // coreConnection to something else as as we are instantiating the Session synchronized (this) { try { // We potentially have a new coreConnection becuase the creation of the JcaSession // detected that the coreConnection is now invalid and so a new managedConnection // and coreConnection was created. So reset the coreConnection for this JmsConnection // to the new one or we just set the old one again. coreConnection = jcaSession.getSICoreConnection(); // depends on control dependency: [try], data = [none] } catch (IllegalStateException e) { FFDCFilter.processException(e, "com.ibm.ws.sib.api.jms.impl.JmsConnectionImpl", "createSession#2", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "createSession", jmsSession); throw (JMSException) JmsErrorUtils.newThrowable( JMSException.class, "JCA_CREATE_SESS_CWSIA0024", null, e, "JmsConnectionImpl.createSession#2", this, tc); } // depends on control dependency: [catch], data = [none] // instantiate the jms session, and add it to this connection's session list. jmsSession = instantiateSession(transacted, acknowledgeMode, coreConnection, jcaSession); } synchronized (stateLock) { sessions.add(jmsSession); // d353701 - output a warning message if there are 'lots' of sessions active. if (sessions.size() % SESSION_WARNING_THRESHOLD == 0) { // We wish to tell the user which line of their application created the session, // so we must obtain a line of stack trace from their application. String errorLocation = JmsErrorUtils.getFirstApplicationStackString(); SibTr.warning(tc, "MANY_SESSIONS_WARNING_CWSIA0027", new Object[] { "" + sessions.size(), errorLocation }); // depends on control dependency: [if], data = [none] } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "createSession", jmsSession); return jmsSession; } }
public class class_name { public void marshall(DeleteBotVersionRequest deleteBotVersionRequest, ProtocolMarshaller protocolMarshaller) { if (deleteBotVersionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteBotVersionRequest.getName(), NAME_BINDING); protocolMarshaller.marshall(deleteBotVersionRequest.getVersion(), VERSION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteBotVersionRequest deleteBotVersionRequest, ProtocolMarshaller protocolMarshaller) { if (deleteBotVersionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteBotVersionRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteBotVersionRequest.getVersion(), VERSION_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 InfoOperation getInfoOperation(final Field destination, final Field source) { Class<?> dClass = destination.getType(); Class<?> sClass = source.getType(); Class<?> dItem = null; Class<?> sItem = null; InfoOperation operation = new InfoOperation().setConversionType(UNDEFINED); // Array[] = Collection<> if(dClass.isArray() && collectionIsAssignableFrom(sClass)){ dItem = dClass.getComponentType(); sItem = getCollectionItemClass(source); operation.setInstructionType(ARRAY_LIST); if(areMappedObjects(dItem,sItem,xml)) return operation.setInstructionType(ARRAY_LIST_WITH_MAPPED_ITEMS) .setConfigChosen(configChosen(dItem,sItem,xml)); } // Collection<> = Array[] if(collectionIsAssignableFrom(dClass) && sClass.isArray()){ dItem = getCollectionItemClass(destination); sItem = sClass.getComponentType(); operation.setInstructionType(LIST_ARRAY); if(areMappedObjects(dItem,sItem,xml)) return operation.setInstructionType(LIST_ARRAY_WITH_MAPPED_ITEMS) .setConfigChosen(configChosen(dItem,sItem,xml)); } if(isAssignableFrom(dItem,sItem)) return operation.setConversionType(ABSENT); // if components are primitive or wrapper types, apply implicit conversion if(areBasic(dItem,sItem)) return operation.setConversionType(getConversionType(dItem, sItem)); return operation; } }
public class class_name { public InfoOperation getInfoOperation(final Field destination, final Field source) { Class<?> dClass = destination.getType(); Class<?> sClass = source.getType(); Class<?> dItem = null; Class<?> sItem = null; InfoOperation operation = new InfoOperation().setConversionType(UNDEFINED); // Array[] = Collection<> if(dClass.isArray() && collectionIsAssignableFrom(sClass)){ dItem = dClass.getComponentType(); // depends on control dependency: [if], data = [none] sItem = getCollectionItemClass(source); // depends on control dependency: [if], data = [none] operation.setInstructionType(ARRAY_LIST); // depends on control dependency: [if], data = [none] if(areMappedObjects(dItem,sItem,xml)) return operation.setInstructionType(ARRAY_LIST_WITH_MAPPED_ITEMS) .setConfigChosen(configChosen(dItem,sItem,xml)); } // Collection<> = Array[] if(collectionIsAssignableFrom(dClass) && sClass.isArray()){ dItem = getCollectionItemClass(destination); // depends on control dependency: [if], data = [none] sItem = sClass.getComponentType(); // depends on control dependency: [if], data = [none] operation.setInstructionType(LIST_ARRAY); // depends on control dependency: [if], data = [none] if(areMappedObjects(dItem,sItem,xml)) return operation.setInstructionType(LIST_ARRAY_WITH_MAPPED_ITEMS) .setConfigChosen(configChosen(dItem,sItem,xml)); } if(isAssignableFrom(dItem,sItem)) return operation.setConversionType(ABSENT); // if components are primitive or wrapper types, apply implicit conversion if(areBasic(dItem,sItem)) return operation.setConversionType(getConversionType(dItem, sItem)); return operation; } }
public class class_name { private long getLongCheckSum(int start, int size) { // All the tables here are aligned on four byte boundaries // Add remainder to size if it's not a multiple of 4 int remainder = size % 4; if (remainder != 0) { size += remainder; } long sum = 0; for (int i = 0; i < size; i += 4) { int l = (output[start + i] << 24); l += (output[start + i + 1] << 16); l += (output[start + i + 2] << 16); l += (output[start + i + 3] << 16); sum += l; if (sum > 0xffffffff) { sum = sum - 0xffffffff; } } return sum; } }
public class class_name { private long getLongCheckSum(int start, int size) { // All the tables here are aligned on four byte boundaries // Add remainder to size if it's not a multiple of 4 int remainder = size % 4; if (remainder != 0) { size += remainder; // depends on control dependency: [if], data = [none] } long sum = 0; for (int i = 0; i < size; i += 4) { int l = (output[start + i] << 24); l += (output[start + i + 1] << 16); // depends on control dependency: [for], data = [i] l += (output[start + i + 2] << 16); // depends on control dependency: [for], data = [i] l += (output[start + i + 3] << 16); // depends on control dependency: [for], data = [i] sum += l; // depends on control dependency: [for], data = [none] if (sum > 0xffffffff) { sum = sum - 0xffffffff; // depends on control dependency: [if], data = [none] } } return sum; } }
public class class_name { public void setInstanceStates(java.util.Collection<String> instanceStates) { if (instanceStates == null) { this.instanceStates = null; return; } this.instanceStates = new com.amazonaws.internal.SdkInternalList<String>(instanceStates); } }
public class class_name { public void setInstanceStates(java.util.Collection<String> instanceStates) { if (instanceStates == null) { this.instanceStates = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.instanceStates = new com.amazonaws.internal.SdkInternalList<String>(instanceStates); } }
public class class_name { public boolean addCustomLogger(Logger logger) { if (logger.getClass().getName().startsWith("java")) return false; Logger oldLogger = _localLoggers.get(); if (oldLogger != null) return false; _localLoggers.set(logger); if (_parent != null) { logger.setParent(_parent); } return true; } }
public class class_name { public boolean addCustomLogger(Logger logger) { if (logger.getClass().getName().startsWith("java")) return false; Logger oldLogger = _localLoggers.get(); if (oldLogger != null) return false; _localLoggers.set(logger); if (_parent != null) { logger.setParent(_parent); // depends on control dependency: [if], data = [(_parent] } return true; } }
public class class_name { public void updateColumn(int c, TableColumn col) { int r = 0; while (r < getRowCount()) { TableCellBox cell = cells[c][r]; if (cell != null) { cell.setOwnerColumn(col); //minimal width int min = cell.getMinimalWidth() / cell.getColspan(); if (min > col.getMinimalWidth()) col.setMinimalWidth(min); //maximal width int max = cell.getMaximalWidth() / cell.getColspan(); if (max > col.getMaximalWidth()) col.setMaximalWidth(max); //fixed width and percentages if (cell.wset) { col.wset = true; if (cell.isRelative()) { col.setRelative(true); if (col.percent < cell.percent) col.percent = cell.percent; } else { if (cell.getContentWidth() > col.abswidth) col.abswidth = cell.getContentWidth(); } } //ensure the minimal width if (col.getWidth() < col.getMinimalWidth()) col.setColumnWidth(col.getMinimalWidth()); r += cell.getRowspan(); } else r++; } } }
public class class_name { public void updateColumn(int c, TableColumn col) { int r = 0; while (r < getRowCount()) { TableCellBox cell = cells[c][r]; if (cell != null) { cell.setOwnerColumn(col); // depends on control dependency: [if], data = [none] //minimal width int min = cell.getMinimalWidth() / cell.getColspan(); if (min > col.getMinimalWidth()) col.setMinimalWidth(min); //maximal width int max = cell.getMaximalWidth() / cell.getColspan(); if (max > col.getMaximalWidth()) col.setMaximalWidth(max); //fixed width and percentages if (cell.wset) { col.wset = true; // depends on control dependency: [if], data = [none] if (cell.isRelative()) { col.setRelative(true); // depends on control dependency: [if], data = [none] if (col.percent < cell.percent) col.percent = cell.percent; } else { if (cell.getContentWidth() > col.abswidth) col.abswidth = cell.getContentWidth(); } } //ensure the minimal width if (col.getWidth() < col.getMinimalWidth()) col.setColumnWidth(col.getMinimalWidth()); r += cell.getRowspan(); // depends on control dependency: [if], data = [none] } else r++; } } }
public class class_name { private void setSelectedRadioButton(final E enumValue) { if (enumValue != null) { final JRadioButton radioButton = this.radioButtonMap.get(enumValue); radioButton.setSelected(true); } else { for (final JRadioButton radioButton : this.radioButtonMap.values()) { radioButton.setSelected(false); } } } }
public class class_name { private void setSelectedRadioButton(final E enumValue) { if (enumValue != null) { final JRadioButton radioButton = this.radioButtonMap.get(enumValue); radioButton.setSelected(true); // depends on control dependency: [if], data = [none] } else { for (final JRadioButton radioButton : this.radioButtonMap.values()) { radioButton.setSelected(false); // depends on control dependency: [for], data = [radioButton] } } } }
public class class_name { public static List<String> parseDelimitedString(String value, char delimiter, boolean trim) { if (value == null) { value = ""; } List<String> list = new ArrayList<String>(); StringBuilder sb = new StringBuilder(); int expecting = (CHAR | DELIMITER | START_QUOTE); for (int i = 0; i < value.length(); i++) { char character = value.charAt(i); boolean isEscaped = isEscaped(value, i); boolean isDelimiter = isDelimiter(delimiter, character, isEscaped); boolean isQuote = isQuote(character, isEscaped); if (isDelimiter && ((expecting & DELIMITER) > 0)) { addPart(list, sb, trim); sb.delete(0, sb.length()); expecting = (CHAR | DELIMITER | START_QUOTE); } else if (isQuote && ((expecting & START_QUOTE) > 0)) { sb.append(character); expecting = CHAR | END_QUOTE; } else if (isQuote && ((expecting & END_QUOTE) > 0)) { sb.append(character); expecting = (CHAR | START_QUOTE | DELIMITER); } else if ((expecting & CHAR) > 0) { sb.append(character); } else { String message = String.format("Invalid delimited string [%s] for delimiter: %s", value, delimiter); throw new IllegalArgumentException(message); } } if (sb.length() > 0) { addPart(list, sb, trim); } return list; } }
public class class_name { public static List<String> parseDelimitedString(String value, char delimiter, boolean trim) { if (value == null) { value = ""; // depends on control dependency: [if], data = [none] } List<String> list = new ArrayList<String>(); StringBuilder sb = new StringBuilder(); int expecting = (CHAR | DELIMITER | START_QUOTE); for (int i = 0; i < value.length(); i++) { char character = value.charAt(i); boolean isEscaped = isEscaped(value, i); boolean isDelimiter = isDelimiter(delimiter, character, isEscaped); boolean isQuote = isQuote(character, isEscaped); if (isDelimiter && ((expecting & DELIMITER) > 0)) { addPart(list, sb, trim); // depends on control dependency: [if], data = [none] sb.delete(0, sb.length()); // depends on control dependency: [if], data = [none] expecting = (CHAR | DELIMITER | START_QUOTE); // depends on control dependency: [if], data = [none] } else if (isQuote && ((expecting & START_QUOTE) > 0)) { sb.append(character); // depends on control dependency: [if], data = [none] expecting = CHAR | END_QUOTE; // depends on control dependency: [if], data = [none] } else if (isQuote && ((expecting & END_QUOTE) > 0)) { sb.append(character); // depends on control dependency: [if], data = [none] expecting = (CHAR | START_QUOTE | DELIMITER); // depends on control dependency: [if], data = [none] } else if ((expecting & CHAR) > 0) { sb.append(character); // depends on control dependency: [if], data = [none] } else { String message = String.format("Invalid delimited string [%s] for delimiter: %s", value, delimiter); throw new IllegalArgumentException(message); } } if (sb.length() > 0) { addPart(list, sb, trim); // depends on control dependency: [if], data = [none] } return list; } }
public class class_name { public static double[] timesPlusEquals(final double[] v1, final double s1, final double[] v2) { assert v1.length == v2.length : ERR_VEC_DIMENSIONS; for(int i = 0; i < v1.length; i++) { v1[i] = v1[i] * s1 + v2[i]; } return v1; } }
public class class_name { public static double[] timesPlusEquals(final double[] v1, final double s1, final double[] v2) { assert v1.length == v2.length : ERR_VEC_DIMENSIONS; for(int i = 0; i < v1.length; i++) { v1[i] = v1[i] * s1 + v2[i]; // depends on control dependency: [for], data = [i] } return v1; } }
public class class_name { protected static String adjustMappedUrl(SlingHttpServletRequest request, String url) { // build a pattern with the (false) default port Pattern defaultPortPattern = Pattern.compile( URL_PATTERN_STRING.replaceFirst("\\(:\\\\d\\+\\)\\?", ":" + getDefaultPort(request))); Matcher matcher = defaultPortPattern.matcher(url); // remove the port if the URL matches (contains the port nnumber) if (matcher.matches()) { if (null == matcher.group(1)) url = "//" + matcher.group(2); else url = matcher.group(1) + "://" + matcher.group(2); String uri = matcher.group(3); if (StringUtils.isNotBlank(uri)) { url += uri; } else { url += "/"; } } return url; } }
public class class_name { protected static String adjustMappedUrl(SlingHttpServletRequest request, String url) { // build a pattern with the (false) default port Pattern defaultPortPattern = Pattern.compile( URL_PATTERN_STRING.replaceFirst("\\(:\\\\d\\+\\)\\?", ":" + getDefaultPort(request))); Matcher matcher = defaultPortPattern.matcher(url); // remove the port if the URL matches (contains the port nnumber) if (matcher.matches()) { if (null == matcher.group(1)) url = "//" + matcher.group(2); else url = matcher.group(1) + "://" + matcher.group(2); String uri = matcher.group(3); if (StringUtils.isNotBlank(uri)) { url += uri; // depends on control dependency: [if], data = [none] } else { url += "/"; // depends on control dependency: [if], data = [none] } } return url; } }
public class class_name { private List<AnalyzedToken> getImperativeForm(String word, List<String> sentenceTokens, int pos) { int idx = sentenceTokens.indexOf(word); String previousWord = ""; while (--idx > -1) { previousWord = sentenceTokens.get(idx); if (StringUtils.isWhitespace(previousWord)) { continue; } break; } if (!(pos == 0 && sentenceTokens.size() > 1) && !StringUtils.equalsAnyIgnoreCase(previousWord, "ich", "er", "es", "sie")) { return null; } String w = pos == 0 ? word.toLowerCase() : word; List<TaggedWord> taggedWithE = getWordTagger().tag(w.concat("e")); for (TaggedWord tagged : taggedWithE) { if (tagged.getPosTag().startsWith("VER:IMP:SIN:")) { // do not overwrite manually removed tags if (removalTagger == null || !removalTagger.tag(w).contains(tagged)) { return getAnalyzedTokens(Arrays.asList(tagged), word); } break; } } return null; } }
public class class_name { private List<AnalyzedToken> getImperativeForm(String word, List<String> sentenceTokens, int pos) { int idx = sentenceTokens.indexOf(word); String previousWord = ""; while (--idx > -1) { previousWord = sentenceTokens.get(idx); // depends on control dependency: [while], data = [none] if (StringUtils.isWhitespace(previousWord)) { continue; } break; } if (!(pos == 0 && sentenceTokens.size() > 1) && !StringUtils.equalsAnyIgnoreCase(previousWord, "ich", "er", "es", "sie")) { return null; // depends on control dependency: [if], data = [none] } String w = pos == 0 ? word.toLowerCase() : word; List<TaggedWord> taggedWithE = getWordTagger().tag(w.concat("e")); for (TaggedWord tagged : taggedWithE) { if (tagged.getPosTag().startsWith("VER:IMP:SIN:")) { // do not overwrite manually removed tags if (removalTagger == null || !removalTagger.tag(w).contains(tagged)) { return getAnalyzedTokens(Arrays.asList(tagged), word); // depends on control dependency: [if], data = [none] } break; } } return null; } }
public class class_name { private void addJsString(Node n) { String s = n.getString(); boolean useSlashV = n.getBooleanProp(Node.SLASH_V); if (useSlashV) { add(jsString(n.getString(), useSlashV)); } else { String cached = escapedJsStrings.get(s); if (cached == null) { cached = jsString(n.getString(), useSlashV); escapedJsStrings.put(s, cached); } add(cached); } } }
public class class_name { private void addJsString(Node n) { String s = n.getString(); boolean useSlashV = n.getBooleanProp(Node.SLASH_V); if (useSlashV) { add(jsString(n.getString(), useSlashV)); // depends on control dependency: [if], data = [none] } else { String cached = escapedJsStrings.get(s); if (cached == null) { cached = jsString(n.getString(), useSlashV); // depends on control dependency: [if], data = [none] escapedJsStrings.put(s, cached); // depends on control dependency: [if], data = [none] } add(cached); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(CorsRule corsRule, ProtocolMarshaller protocolMarshaller) { if (corsRule == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(corsRule.getAllowedOrigins(), ALLOWEDORIGINS_BINDING); protocolMarshaller.marshall(corsRule.getAllowedMethods(), ALLOWEDMETHODS_BINDING); protocolMarshaller.marshall(corsRule.getAllowedHeaders(), ALLOWEDHEADERS_BINDING); protocolMarshaller.marshall(corsRule.getMaxAgeSeconds(), MAXAGESECONDS_BINDING); protocolMarshaller.marshall(corsRule.getExposeHeaders(), EXPOSEHEADERS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(CorsRule corsRule, ProtocolMarshaller protocolMarshaller) { if (corsRule == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(corsRule.getAllowedOrigins(), ALLOWEDORIGINS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(corsRule.getAllowedMethods(), ALLOWEDMETHODS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(corsRule.getAllowedHeaders(), ALLOWEDHEADERS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(corsRule.getMaxAgeSeconds(), MAXAGESECONDS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(corsRule.getExposeHeaders(), EXPOSEHEADERS_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 BufferedImage colorizeSign(ImageGray src, BufferedImage dst, double normalize) { dst = checkInputs(src, dst); if (normalize <= 0) { normalize = GImageStatistics.maxAbs(src); } if (normalize == 0) { // sets the output to black ConvertBufferedImage.convertTo(src,dst,true); return dst; } if (src.getClass().isAssignableFrom(GrayF32.class)) { return colorizeSign((GrayF32) src, dst, (float) normalize); } else { return colorizeSign((GrayI) src, dst, (int) normalize); } } }
public class class_name { public static BufferedImage colorizeSign(ImageGray src, BufferedImage dst, double normalize) { dst = checkInputs(src, dst); if (normalize <= 0) { normalize = GImageStatistics.maxAbs(src); // depends on control dependency: [if], data = [none] } if (normalize == 0) { // sets the output to black ConvertBufferedImage.convertTo(src,dst,true); // depends on control dependency: [if], data = [none] return dst; // depends on control dependency: [if], data = [none] } if (src.getClass().isAssignableFrom(GrayF32.class)) { return colorizeSign((GrayF32) src, dst, (float) normalize); // depends on control dependency: [if], data = [none] } else { return colorizeSign((GrayI) src, dst, (int) normalize); // depends on control dependency: [if], data = [none] } } }
public class class_name { private RESTResponse validateAndExecuteRequest(HttpServletRequest request) { Map<String, String> variableMap = new HashMap<String, String>(); String query = extractQueryParam(request, variableMap); Tenant tenant = getTenant(variableMap); // Command matching expects an encoded URI but without the servlet context, if any. String uri = request.getRequestURI(); String context = request.getContextPath(); if (!Utils.isEmpty(context)) { uri = uri.substring(context.length()); } ApplicationDefinition appDef = getApplication(uri, tenant); HttpMethod method = HttpMethod.methodFromString(request.getMethod()); if (method == null) { throw new NotFoundException("Request does not match a known URI: " + request.getRequestURL()); } RegisteredCommand cmd = RESTService.instance().findCommand(appDef, method, uri, query, variableMap); if (cmd == null) { throw new NotFoundException("Request does not match a known URI: " + request.getRequestURL()); } validateTenantAccess(request, tenant, cmd); RESTCallback callback = cmd.getNewCallback(); callback.setRequest(new RESTRequest(tenant, appDef, request, variableMap)); return callback.invoke(); } }
public class class_name { private RESTResponse validateAndExecuteRequest(HttpServletRequest request) { Map<String, String> variableMap = new HashMap<String, String>(); String query = extractQueryParam(request, variableMap); Tenant tenant = getTenant(variableMap); // Command matching expects an encoded URI but without the servlet context, if any. String uri = request.getRequestURI(); String context = request.getContextPath(); if (!Utils.isEmpty(context)) { uri = uri.substring(context.length()); // depends on control dependency: [if], data = [none] } ApplicationDefinition appDef = getApplication(uri, tenant); HttpMethod method = HttpMethod.methodFromString(request.getMethod()); if (method == null) { throw new NotFoundException("Request does not match a known URI: " + request.getRequestURL()); } RegisteredCommand cmd = RESTService.instance().findCommand(appDef, method, uri, query, variableMap); if (cmd == null) { throw new NotFoundException("Request does not match a known URI: " + request.getRequestURL()); } validateTenantAccess(request, tenant, cmd); RESTCallback callback = cmd.getNewCallback(); callback.setRequest(new RESTRequest(tenant, appDef, request, variableMap)); return callback.invoke(); } }
public class class_name { @VisibleForTesting public boolean copyPartitionParams(String completeSourcePartitionName, String completeDestPartitionName, List<String> whitelist, List<String> blacklist) { Optional<Partition> sourcePartitionOptional = getPartitionObject(completeSourcePartitionName); Optional<Partition> destPartitionOptional = getPartitionObject(completeDestPartitionName); if ((!sourcePartitionOptional.isPresent()) || (!destPartitionOptional.isPresent())) { return false; } Map<String, String> sourceParams = sourcePartitionOptional.get().getParameters(); Map<String, String> destParams = destPartitionOptional.get().getParameters(); for (Map.Entry<String, String> param : sourceParams.entrySet()) { if (!matched(whitelist, blacklist, param.getKey())) { continue; } destParams.put(param.getKey(), param.getValue()); } destPartitionOptional.get().setParameters(destParams); if (!dropPartition(completeDestPartitionName)) { return false; } if (!addPartition(destPartitionOptional.get(), completeDestPartitionName)) { return false; } return true; } }
public class class_name { @VisibleForTesting public boolean copyPartitionParams(String completeSourcePartitionName, String completeDestPartitionName, List<String> whitelist, List<String> blacklist) { Optional<Partition> sourcePartitionOptional = getPartitionObject(completeSourcePartitionName); Optional<Partition> destPartitionOptional = getPartitionObject(completeDestPartitionName); if ((!sourcePartitionOptional.isPresent()) || (!destPartitionOptional.isPresent())) { return false; // depends on control dependency: [if], data = [none] } Map<String, String> sourceParams = sourcePartitionOptional.get().getParameters(); Map<String, String> destParams = destPartitionOptional.get().getParameters(); for (Map.Entry<String, String> param : sourceParams.entrySet()) { if (!matched(whitelist, blacklist, param.getKey())) { continue; } destParams.put(param.getKey(), param.getValue()); // depends on control dependency: [for], data = [param] } destPartitionOptional.get().setParameters(destParams); if (!dropPartition(completeDestPartitionName)) { return false; // depends on control dependency: [if], data = [none] } if (!addPartition(destPartitionOptional.get(), completeDestPartitionName)) { return false; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { private boolean isOnlyFolders(String types) { boolean result = true; for (String type : types.split("[, ]+")) { try { if (!OpenCms.getResourceManager().getResourceType(type).isFolder()) { result = false; break; } } catch (CmsLoaderException e) { // ignore } } return result; } }
public class class_name { private boolean isOnlyFolders(String types) { boolean result = true; for (String type : types.split("[, ]+")) { try { if (!OpenCms.getResourceManager().getResourceType(type).isFolder()) { result = false; // depends on control dependency: [if], data = [none] break; } } catch (CmsLoaderException e) { // ignore } // depends on control dependency: [catch], data = [none] } return result; } }
public class class_name { public Object mapToResultType(ControlBeanContext context, Method m, ResultSet resultSet, Calendar cal) { final Class returnType = m.getReturnType(); final boolean isArray = returnType.isArray(); try { if (isArray) { final SQL methodSQL = context.getMethodPropertySet(m, SQL.class); return arrayFromResultSet(resultSet, methodSQL.arrayMaxLength(), returnType, cal); } else { if (!resultSet.next()) { return _tmf.fixNull(m.getReturnType()); } return RowMapperFactory.getRowMapper(resultSet, returnType, cal).mapRowToReturnType(); } } catch (SQLException e) { throw new ControlException(e.getMessage(), e); } } }
public class class_name { public Object mapToResultType(ControlBeanContext context, Method m, ResultSet resultSet, Calendar cal) { final Class returnType = m.getReturnType(); final boolean isArray = returnType.isArray(); try { if (isArray) { final SQL methodSQL = context.getMethodPropertySet(m, SQL.class); return arrayFromResultSet(resultSet, methodSQL.arrayMaxLength(), returnType, cal); // depends on control dependency: [if], data = [none] } else { if (!resultSet.next()) { return _tmf.fixNull(m.getReturnType()); // depends on control dependency: [if], data = [none] } return RowMapperFactory.getRowMapper(resultSet, returnType, cal).mapRowToReturnType(); // depends on control dependency: [if], data = [none] } } catch (SQLException e) { throw new ControlException(e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected String protectSpecialChars(String str, boolean debugPrint) { String result = str.replace("\\", "\\\\").replace("$", "\\$"); if (debugPrint) { System.out.println(" In NonVoltDBBackend.protectSpecialChars:"); System.out.println(" str : " + str); System.out.println(" result: " + result); } return result; } }
public class class_name { protected String protectSpecialChars(String str, boolean debugPrint) { String result = str.replace("\\", "\\\\").replace("$", "\\$"); if (debugPrint) { System.out.println(" In NonVoltDBBackend.protectSpecialChars:"); // depends on control dependency: [if], data = [none] System.out.println(" str : " + str); // depends on control dependency: [if], data = [none] System.out.println(" result: " + result); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { @XmlTransient public void setFieldValue(String fieldNameParam, Object fieldValueParam) { if(fieldNameParam == null || fieldNameParam.trim().length() == 0) { return; } if(this.getFormFields() == null || this.getFormFields().isEmpty()) { this.setFormFields(new ArrayList()); } String fieldNameParamLower = fieldNameParam.toLowerCase(); for (Iterator<Field> fieldIter = this.getFormFields().iterator(); fieldIter.hasNext();) { Field field = fieldIter.next(); if(field.getFieldName() == null || field.getFieldName().trim().length() == 0) { continue; } String fieldNameLower = field.getFieldName().toLowerCase(); if(fieldNameParamLower.equals(fieldNameLower)) { field.setFieldValue(fieldValueParam); return; } } //When the Field is not added previously... this.getFormFields().add(new Field(fieldNameParam,fieldValueParam)); } }
public class class_name { @XmlTransient public void setFieldValue(String fieldNameParam, Object fieldValueParam) { if(fieldNameParam == null || fieldNameParam.trim().length() == 0) { return; // depends on control dependency: [if], data = [none] } if(this.getFormFields() == null || this.getFormFields().isEmpty()) { this.setFormFields(new ArrayList()); // depends on control dependency: [if], data = [none] } String fieldNameParamLower = fieldNameParam.toLowerCase(); for (Iterator<Field> fieldIter = this.getFormFields().iterator(); fieldIter.hasNext();) { Field field = fieldIter.next(); if(field.getFieldName() == null || field.getFieldName().trim().length() == 0) { continue; } String fieldNameLower = field.getFieldName().toLowerCase(); if(fieldNameParamLower.equals(fieldNameLower)) { field.setFieldValue(fieldValueParam); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } //When the Field is not added previously... this.getFormFields().add(new Field(fieldNameParam,fieldValueParam)); } }
public class class_name { protected GeometryEnvelope getEnvelope(GeoPackageGeometryData data) { GeometryEnvelope envelope = null; if (data != null) { envelope = data.getOrBuildEnvelope(); } return envelope; } }
public class class_name { protected GeometryEnvelope getEnvelope(GeoPackageGeometryData data) { GeometryEnvelope envelope = null; if (data != null) { envelope = data.getOrBuildEnvelope(); // depends on control dependency: [if], data = [none] } return envelope; } }
public class class_name { public void writeExternal(ObjectOutput out) throws IOException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "writeExternal"); try { // write magic out.writeShort(EXTERNAL_MAGIC); out.writeShort(MAJOR_VERSION); out.writeShort(MINOR_VERSION); // write the interface type (HOME or REMOTE) if (_isHome) { out.writeByte(IF_HOME); } else { out.writeByte(IF_REMOTE); } //89554 // write the Java EE name writeExternalJ2EEName(out); // write the external primary key writeExternalPKey(out); out.flush(); } finally { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "writeExternal"); } } }
public class class_name { public void writeExternal(ObjectOutput out) throws IOException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "writeExternal"); try { // write magic out.writeShort(EXTERNAL_MAGIC); out.writeShort(MAJOR_VERSION); out.writeShort(MINOR_VERSION); // write the interface type (HOME or REMOTE) if (_isHome) { out.writeByte(IF_HOME); // depends on control dependency: [if], data = [none] } else { out.writeByte(IF_REMOTE); // depends on control dependency: [if], data = [none] } //89554 // write the Java EE name writeExternalJ2EEName(out); // write the external primary key writeExternalPKey(out); out.flush(); } finally { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "writeExternal"); } } }
public class class_name { public static WQConstraint decode(final String field, final String rawValue) { final WQFunctionType function; final String value; if (StringUtils.equalsIgnoreCase(rawValue, WQFunctionType.IS_NULL.getPrefix())) return new WQConstraint(field, WQFunctionType.IS_NULL, null); else if (StringUtils.equalsIgnoreCase(rawValue, WQFunctionType.NOT_NULL.getPrefix())) return new WQConstraint(field, WQFunctionType.NOT_NULL, null); else if (rawValue.startsWith("_f_")) { function = WQFunctionType.getByPrefix(rawValue); if (function.hasParam()) { // Strip the function name from the value value = rawValue.substring(function.getPrefix().length()); if (function.hasBinaryParam()) { final String[] splitValues = StringUtils.split(value, "..", 2); final String left = splitValues[0]; final String right = splitValues[1]; return new WQConstraint(field, function, left, right); } } else { value = null; } } else { function = WQFunctionType.EQ; value = rawValue; } return new WQConstraint(field, function, value); } }
public class class_name { public static WQConstraint decode(final String field, final String rawValue) { final WQFunctionType function; final String value; if (StringUtils.equalsIgnoreCase(rawValue, WQFunctionType.IS_NULL.getPrefix())) return new WQConstraint(field, WQFunctionType.IS_NULL, null); else if (StringUtils.equalsIgnoreCase(rawValue, WQFunctionType.NOT_NULL.getPrefix())) return new WQConstraint(field, WQFunctionType.NOT_NULL, null); else if (rawValue.startsWith("_f_")) { function = WQFunctionType.getByPrefix(rawValue); // depends on control dependency: [if], data = [none] if (function.hasParam()) { // Strip the function name from the value value = rawValue.substring(function.getPrefix().length()); // depends on control dependency: [if], data = [none] if (function.hasBinaryParam()) { final String[] splitValues = StringUtils.split(value, "..", 2); final String left = splitValues[0]; final String right = splitValues[1]; return new WQConstraint(field, function, left, right); // depends on control dependency: [if], data = [none] } } else { value = null; // depends on control dependency: [if], data = [none] } } else { function = WQFunctionType.EQ; // depends on control dependency: [if], data = [none] value = rawValue; // depends on control dependency: [if], data = [none] } return new WQConstraint(field, function, value); } }
public class class_name { public void visit(Function<CmsTreeItem, Boolean> visitor) { visitor.apply(this); for (Widget child : m_children) { ((CmsTreeItem)child).visit(visitor); } } }
public class class_name { public void visit(Function<CmsTreeItem, Boolean> visitor) { visitor.apply(this); for (Widget child : m_children) { ((CmsTreeItem)child).visit(visitor); // depends on control dependency: [for], data = [child] } } }
public class class_name { public void switchWarmup(Long channelId, Long pipelineId) { String path = ManagePathUtils.getMainStem(channelId, pipelineId); try { while (true) { Stat stat = new Stat(); byte[] bytes = zookeeper.readData(path, stat); MainStemEventData mainStemData = JsonUtils.unmarshalFromByte(bytes, MainStemEventData.class); mainStemData.setActive(false); try { zookeeper.writeData(path, JsonUtils.marshalToByte(mainStemData), stat.getVersion()); logger.warn("relase channelId[{}],pipelineId[{}] mainstem successed! ", channelId, pipelineId); break; } catch (ZkBadVersionException e) { // ignore , retrying } } } catch (ZkNoNodeException e) { // ignore } catch (ZkException e) { throw new ArbitrateException("releaseMainStem", pipelineId.toString(), e); } } }
public class class_name { public void switchWarmup(Long channelId, Long pipelineId) { String path = ManagePathUtils.getMainStem(channelId, pipelineId); try { while (true) { Stat stat = new Stat(); byte[] bytes = zookeeper.readData(path, stat); MainStemEventData mainStemData = JsonUtils.unmarshalFromByte(bytes, MainStemEventData.class); mainStemData.setActive(false); // depends on control dependency: [while], data = [none] try { zookeeper.writeData(path, JsonUtils.marshalToByte(mainStemData), stat.getVersion()); // depends on control dependency: [try], data = [none] logger.warn("relase channelId[{}],pipelineId[{}] mainstem successed! ", channelId, pipelineId); // depends on control dependency: [try], data = [none] break; } catch (ZkBadVersionException e) { // ignore , retrying } // depends on control dependency: [catch], data = [none] } } catch (ZkNoNodeException e) { // ignore } catch (ZkException e) { // depends on control dependency: [catch], data = [none] throw new ArbitrateException("releaseMainStem", pipelineId.toString(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public LocalDate plusWeeks(int weeks) { if (weeks == 0) { return this; } long instant = getChronology().weeks().add(getLocalMillis(), weeks); return withLocalMillis(instant); } }
public class class_name { public LocalDate plusWeeks(int weeks) { if (weeks == 0) { return this; // depends on control dependency: [if], data = [none] } long instant = getChronology().weeks().add(getLocalMillis(), weeks); return withLocalMillis(instant); } }
public class class_name { public Observable<ServiceResponse<JsonSchemaInner>> getSchemaJsonWithServiceResponseAsync(String resourceGroupName, String workflowName, String triggerName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (workflowName == null) { throw new IllegalArgumentException("Parameter workflowName is required and cannot be null."); } if (triggerName == null) { throw new IllegalArgumentException("Parameter triggerName is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.getSchemaJson(this.client.subscriptionId(), resourceGroupName, workflowName, triggerName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<JsonSchemaInner>>>() { @Override public Observable<ServiceResponse<JsonSchemaInner>> call(Response<ResponseBody> response) { try { ServiceResponse<JsonSchemaInner> clientResponse = getSchemaJsonDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<JsonSchemaInner>> getSchemaJsonWithServiceResponseAsync(String resourceGroupName, String workflowName, String triggerName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (workflowName == null) { throw new IllegalArgumentException("Parameter workflowName is required and cannot be null."); } if (triggerName == null) { throw new IllegalArgumentException("Parameter triggerName is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.getSchemaJson(this.client.subscriptionId(), resourceGroupName, workflowName, triggerName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<JsonSchemaInner>>>() { @Override public Observable<ServiceResponse<JsonSchemaInner>> call(Response<ResponseBody> response) { try { ServiceResponse<JsonSchemaInner> clientResponse = getSchemaJsonDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { public static void updateMeasureSpec( Spec spec, float aspectRatio, @Nullable ViewGroup.LayoutParams layoutParams, int widthPadding, int heightPadding) { if (aspectRatio <= 0 || layoutParams == null) { return; } if (shouldAdjust(layoutParams.height)) { int widthSpecSize = View.MeasureSpec.getSize(spec.width); int desiredHeight = (int) ((widthSpecSize - widthPadding) / aspectRatio + heightPadding); int resolvedHeight = View.resolveSize(desiredHeight, spec.height); spec.height = View.MeasureSpec.makeMeasureSpec(resolvedHeight, View.MeasureSpec.EXACTLY); } else if (shouldAdjust(layoutParams.width)) { int heightSpecSize = View.MeasureSpec.getSize(spec.height); int desiredWidth = (int) ((heightSpecSize - heightPadding) * aspectRatio + widthPadding); int resolvedWidth = View.resolveSize(desiredWidth, spec.width); spec.width = View.MeasureSpec.makeMeasureSpec(resolvedWidth, View.MeasureSpec.EXACTLY); } } }
public class class_name { public static void updateMeasureSpec( Spec spec, float aspectRatio, @Nullable ViewGroup.LayoutParams layoutParams, int widthPadding, int heightPadding) { if (aspectRatio <= 0 || layoutParams == null) { return; // depends on control dependency: [if], data = [none] } if (shouldAdjust(layoutParams.height)) { int widthSpecSize = View.MeasureSpec.getSize(spec.width); int desiredHeight = (int) ((widthSpecSize - widthPadding) / aspectRatio + heightPadding); int resolvedHeight = View.resolveSize(desiredHeight, spec.height); spec.height = View.MeasureSpec.makeMeasureSpec(resolvedHeight, View.MeasureSpec.EXACTLY); // depends on control dependency: [if], data = [none] } else if (shouldAdjust(layoutParams.width)) { int heightSpecSize = View.MeasureSpec.getSize(spec.height); int desiredWidth = (int) ((heightSpecSize - heightPadding) * aspectRatio + widthPadding); int resolvedWidth = View.resolveSize(desiredWidth, spec.width); spec.width = View.MeasureSpec.makeMeasureSpec(resolvedWidth, View.MeasureSpec.EXACTLY); // depends on control dependency: [if], data = [none] } } }
public class class_name { public FunctionLibrary getLibraryForPrefix(String functionPrefix) { for (int i = 0; i < functionLibraries.size(); i++) { if (((FunctionLibrary)functionLibraries.get(i)).getPrefix().equals(functionPrefix)) { return (FunctionLibrary)functionLibraries.get(i); } } throw new NoSuchFunctionLibraryException("Can not find function library for prefix " + functionPrefix); } }
public class class_name { public FunctionLibrary getLibraryForPrefix(String functionPrefix) { for (int i = 0; i < functionLibraries.size(); i++) { if (((FunctionLibrary)functionLibraries.get(i)).getPrefix().equals(functionPrefix)) { return (FunctionLibrary)functionLibraries.get(i); // depends on control dependency: [if], data = [none] } } throw new NoSuchFunctionLibraryException("Can not find function library for prefix " + functionPrefix); } }
public class class_name { public static String quoteWrap(String name) { String quoteName = null; if (name != null) { if (name.startsWith("\"") && name.endsWith("\"")) { quoteName = name; } else { quoteName = "\"" + name + "\""; } } return quoteName; } }
public class class_name { public static String quoteWrap(String name) { String quoteName = null; if (name != null) { if (name.startsWith("\"") && name.endsWith("\"")) { quoteName = name; // depends on control dependency: [if], data = [none] } else { quoteName = "\"" + name + "\""; // depends on control dependency: [if], data = [none] } } return quoteName; } }
public class class_name { public DescribeInputResult withMediaConnectFlows(MediaConnectFlow... mediaConnectFlows) { if (this.mediaConnectFlows == null) { setMediaConnectFlows(new java.util.ArrayList<MediaConnectFlow>(mediaConnectFlows.length)); } for (MediaConnectFlow ele : mediaConnectFlows) { this.mediaConnectFlows.add(ele); } return this; } }
public class class_name { public DescribeInputResult withMediaConnectFlows(MediaConnectFlow... mediaConnectFlows) { if (this.mediaConnectFlows == null) { setMediaConnectFlows(new java.util.ArrayList<MediaConnectFlow>(mediaConnectFlows.length)); // depends on control dependency: [if], data = [none] } for (MediaConnectFlow ele : mediaConnectFlows) { this.mediaConnectFlows.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { boolean queryLineConnector(int vertex, Line line) { int next = getNextVertex(vertex); if (next == -1) return false; if (!m_b_has_attributes) { Point2D pt = new Point2D(); getXY(vertex, pt); line.setStartXY(pt); getXY(next, pt); line.setEndXY(pt); } else { Point pt = new Point(); queryPoint(vertex, pt); line.setStart(pt); queryPoint(next, pt); line.setEnd(pt); } return true; } }
public class class_name { boolean queryLineConnector(int vertex, Line line) { int next = getNextVertex(vertex); if (next == -1) return false; if (!m_b_has_attributes) { Point2D pt = new Point2D(); getXY(vertex, pt); // depends on control dependency: [if], data = [none] line.setStartXY(pt); // depends on control dependency: [if], data = [none] getXY(next, pt); // depends on control dependency: [if], data = [none] line.setEndXY(pt); // depends on control dependency: [if], data = [none] } else { Point pt = new Point(); queryPoint(vertex, pt); // depends on control dependency: [if], data = [none] line.setStart(pt); // depends on control dependency: [if], data = [none] queryPoint(next, pt); // depends on control dependency: [if], data = [none] line.setEnd(pt); // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public String getArtist(int type) { if (allow(type&ID3V1)) { return id3v1.getArtist(); } if (allow(type&ID3V2)) { return id3v2.getFrameDataString(ID3v2Frames.LEAD_PERFORMERS); } return null; } }
public class class_name { public String getArtist(int type) { if (allow(type&ID3V1)) { return id3v1.getArtist(); // depends on control dependency: [if], data = [none] } if (allow(type&ID3V2)) { return id3v2.getFrameDataString(ID3v2Frames.LEAD_PERFORMERS); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public RunCommandParameters withRunCommandTargets(RunCommandTarget... runCommandTargets) { if (this.runCommandTargets == null) { setRunCommandTargets(new java.util.ArrayList<RunCommandTarget>(runCommandTargets.length)); } for (RunCommandTarget ele : runCommandTargets) { this.runCommandTargets.add(ele); } return this; } }
public class class_name { public RunCommandParameters withRunCommandTargets(RunCommandTarget... runCommandTargets) { if (this.runCommandTargets == null) { setRunCommandTargets(new java.util.ArrayList<RunCommandTarget>(runCommandTargets.length)); // depends on control dependency: [if], data = [none] } for (RunCommandTarget ele : runCommandTargets) { this.runCommandTargets.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public double getAtomOverlapScore(IAtomContainer ac, Vector overlappingAtoms) { overlappingAtoms.removeAllElements(); IAtom atom1 = null; IAtom atom2 = null; Point2d p1 = null; Point2d p2 = null; double distance = 0; double overlapScore = 0; double bondLength = GeometryUtil.getBondLengthAverage(ac); double overlapCutoff = bondLength / 4; logger.debug("Bond length is set to " + bondLength); logger.debug("Now cyling through all pairs of atoms"); for (int f = 0; f < ac.getAtomCount(); f++) { atom1 = ac.getAtom(f); p1 = atom1.getPoint2d(); for (int g = f + 1; g < ac.getAtomCount(); g++) { atom2 = ac.getAtom(g); p2 = atom2.getPoint2d(); distance = p1.distance(p2); if (distance < overlapCutoff) { logger.debug("Detected atom clash with distance: " + distance + ", which is smaller than overlapCutoff " + overlapCutoff); overlapScore += overlapCutoff; overlappingAtoms.addElement(new OverlapPair(atom1, atom2)); } } } return overlapScore; } }
public class class_name { public double getAtomOverlapScore(IAtomContainer ac, Vector overlappingAtoms) { overlappingAtoms.removeAllElements(); IAtom atom1 = null; IAtom atom2 = null; Point2d p1 = null; Point2d p2 = null; double distance = 0; double overlapScore = 0; double bondLength = GeometryUtil.getBondLengthAverage(ac); double overlapCutoff = bondLength / 4; logger.debug("Bond length is set to " + bondLength); logger.debug("Now cyling through all pairs of atoms"); for (int f = 0; f < ac.getAtomCount(); f++) { atom1 = ac.getAtom(f); // depends on control dependency: [for], data = [f] p1 = atom1.getPoint2d(); // depends on control dependency: [for], data = [none] for (int g = f + 1; g < ac.getAtomCount(); g++) { atom2 = ac.getAtom(g); // depends on control dependency: [for], data = [g] p2 = atom2.getPoint2d(); // depends on control dependency: [for], data = [none] distance = p1.distance(p2); // depends on control dependency: [for], data = [none] if (distance < overlapCutoff) { logger.debug("Detected atom clash with distance: " + distance + ", which is smaller than overlapCutoff " + overlapCutoff); // depends on control dependency: [if], data = [none] overlapScore += overlapCutoff; // depends on control dependency: [if], data = [none] overlappingAtoms.addElement(new OverlapPair(atom1, atom2)); // depends on control dependency: [if], data = [none] } } } return overlapScore; } }
public class class_name { public static List<List<QValueResult>> parse(List<String> headers) { final List<QValueResult> found = new ArrayList<>(); QValueResult current = null; for (final String header : headers) { final int l = header.length(); //we do not use a string builder //we just keep track of where the current string starts and call substring() int stringStart = 0; for (int i = 0; i < l; ++i) { char c = header.charAt(i); switch (c) { case ',': { if (current != null && (i - stringStart > 2 && header.charAt(stringStart) == 'q' && header.charAt(stringStart + 1) == '=')) { //if this is a valid qvalue current.qvalue = header.substring(stringStart + 2, i); current = null; } else if (stringStart != i) { current = handleNewEncoding(found, header, stringStart, i); } stringStart = i + 1; break; } case ';': { if (stringStart != i) { current = handleNewEncoding(found, header, stringStart, i); stringStart = i + 1; } break; } case ' ': { if (stringStart != i) { if (current != null && (i - stringStart > 2 && header.charAt(stringStart) == 'q' && header.charAt(stringStart + 1) == '=')) { //if this is a valid qvalue current.qvalue = header.substring(stringStart + 2, i); } else { current = handleNewEncoding(found, header, stringStart, i); } } stringStart = i + 1; } } } if (stringStart != l) { if (current != null && (l - stringStart > 2 && header.charAt(stringStart) == 'q' && header.charAt(stringStart + 1) == '=')) { //if this is a valid qvalue current.qvalue = header.substring(stringStart + 2, l); } else { current = handleNewEncoding(found, header, stringStart, l); } } } Collections.sort(found, Collections.reverseOrder()); String currentQValue = null; List<List<QValueResult>> values = new ArrayList<>(); List<QValueResult> currentSet = null; for(QValueResult val : found) { if(!val.qvalue.equals(currentQValue)) { currentQValue = val.qvalue; currentSet = new ArrayList<>(); values.add(currentSet); } currentSet.add(val); } return values; } }
public class class_name { public static List<List<QValueResult>> parse(List<String> headers) { final List<QValueResult> found = new ArrayList<>(); QValueResult current = null; for (final String header : headers) { final int l = header.length(); //we do not use a string builder //we just keep track of where the current string starts and call substring() int stringStart = 0; for (int i = 0; i < l; ++i) { char c = header.charAt(i); switch (c) { case ',': { if (current != null && (i - stringStart > 2 && header.charAt(stringStart) == 'q' && header.charAt(stringStart + 1) == '=')) { //if this is a valid qvalue current.qvalue = header.substring(stringStart + 2, i); // depends on control dependency: [if], data = [none] current = null; // depends on control dependency: [if], data = [none] } else if (stringStart != i) { current = handleNewEncoding(found, header, stringStart, i); // depends on control dependency: [if], data = [i)] } stringStart = i + 1; break; } case ';': { if (stringStart != i) { current = handleNewEncoding(found, header, stringStart, i); // depends on control dependency: [if], data = [i)] stringStart = i + 1; // depends on control dependency: [if], data = [none] } break; } case ' ': { if (stringStart != i) { if (current != null && (i - stringStart > 2 && header.charAt(stringStart) == 'q' && header.charAt(stringStart + 1) == '=')) { //if this is a valid qvalue current.qvalue = header.substring(stringStart + 2, i); // depends on control dependency: [if], data = [none] } else { current = handleNewEncoding(found, header, stringStart, i); // depends on control dependency: [if], data = [none] } } stringStart = i + 1; } } } if (stringStart != l) { if (current != null && (l - stringStart > 2 && header.charAt(stringStart) == 'q' && header.charAt(stringStart + 1) == '=')) { //if this is a valid qvalue current.qvalue = header.substring(stringStart + 2, l); // depends on control dependency: [if], data = [none] } else { current = handleNewEncoding(found, header, stringStart, l); // depends on control dependency: [if], data = [none] } } } Collections.sort(found, Collections.reverseOrder()); String currentQValue = null; List<List<QValueResult>> values = new ArrayList<>(); List<QValueResult> currentSet = null; for(QValueResult val : found) { if(!val.qvalue.equals(currentQValue)) { currentQValue = val.qvalue; // depends on control dependency: [if], data = [none] currentSet = new ArrayList<>(); // depends on control dependency: [if], data = [none] values.add(currentSet); // depends on control dependency: [if], data = [none] } currentSet.add(val); // depends on control dependency: [for], data = [val] } return values; } }
public class class_name { public ServiceCall<LanguageModels> listLanguageModels(ListLanguageModelsOptions listLanguageModelsOptions) { String[] pathSegments = { "v1/customizations" }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "listLanguageModels"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); if (listLanguageModelsOptions != null) { if (listLanguageModelsOptions.language() != null) { builder.query("language", listLanguageModelsOptions.language()); } } return createServiceCall(builder.build(), ResponseConverterUtils.getObject(LanguageModels.class)); } }
public class class_name { public ServiceCall<LanguageModels> listLanguageModels(ListLanguageModelsOptions listLanguageModelsOptions) { String[] pathSegments = { "v1/customizations" }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "listLanguageModels"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header] } builder.header("Accept", "application/json"); if (listLanguageModelsOptions != null) { if (listLanguageModelsOptions.language() != null) { builder.query("language", listLanguageModelsOptions.language()); // depends on control dependency: [if], data = [none] } } return createServiceCall(builder.build(), ResponseConverterUtils.getObject(LanguageModels.class)); } }
public class class_name { public static void setEnabled(Component component, boolean bEnabled) { if (component instanceof JPanel) { for (int i = 0; i < ((JPanel)component).getComponentCount(); i++) { JComponent componentSub = (JComponent)((JPanel)component).getComponent(i); ScreenUtil.setEnabled(componentSub, bEnabled); } } else if (component instanceof JScrollPane) { JComponent componentSub = (JComponent)((JScrollPane)component).getViewport().getView(); ScreenUtil.setEnabled(componentSub, bEnabled); } else component.setEnabled(bEnabled); } }
public class class_name { public static void setEnabled(Component component, boolean bEnabled) { if (component instanceof JPanel) { for (int i = 0; i < ((JPanel)component).getComponentCount(); i++) { JComponent componentSub = (JComponent)((JPanel)component).getComponent(i); ScreenUtil.setEnabled(componentSub, bEnabled); // depends on control dependency: [for], data = [none] } } else if (component instanceof JScrollPane) { JComponent componentSub = (JComponent)((JScrollPane)component).getViewport().getView(); ScreenUtil.setEnabled(componentSub, bEnabled); // depends on control dependency: [if], data = [none] } else component.setEnabled(bEnabled); } }