code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public void securityCheck(Acl acl, int changeType) { if ((SecurityContextHolder.getContext() == null) || (SecurityContextHolder.getContext().getAuthentication() == null) || !SecurityContextHolder.getContext().getAuthentication() .isAuthenticated()) { throw new AccessDeniedException( "Authenticated principal required to operate with ACLs"); } Authentication authentication = SecurityContextHolder.getContext() .getAuthentication(); // Check if authorized by virtue of ACL ownership Sid currentUser = createCurrentUser(authentication); if (currentUser.equals(acl.getOwner()) && ((changeType == CHANGE_GENERAL) || (changeType == CHANGE_OWNERSHIP))) { return; } // Not authorized by ACL ownership; try via adminstrative permissions GrantedAuthority requiredAuthority; if (changeType == CHANGE_AUDITING) { requiredAuthority = this.gaModifyAuditing; } else if (changeType == CHANGE_GENERAL) { requiredAuthority = this.gaGeneralChanges; } else if (changeType == CHANGE_OWNERSHIP) { requiredAuthority = this.gaTakeOwnership; } else { throw new IllegalArgumentException("Unknown change type"); } // Iterate this principal's authorities to determine right Set<String> authorities = AuthorityUtils.authorityListToSet(authentication.getAuthorities()); if (authorities.contains(requiredAuthority.getAuthority())) { return; } // Try to get permission via ACEs within the ACL List<Sid> sids = sidRetrievalStrategy.getSids(authentication); if (acl.isGranted(Arrays.asList(BasePermission.ADMINISTRATION), sids, false)) { return; } throw new AccessDeniedException( "Principal does not have required ACL permissions to perform requested operation"); } }
public class class_name { public void securityCheck(Acl acl, int changeType) { if ((SecurityContextHolder.getContext() == null) || (SecurityContextHolder.getContext().getAuthentication() == null) || !SecurityContextHolder.getContext().getAuthentication() .isAuthenticated()) { throw new AccessDeniedException( "Authenticated principal required to operate with ACLs"); } Authentication authentication = SecurityContextHolder.getContext() .getAuthentication(); // Check if authorized by virtue of ACL ownership Sid currentUser = createCurrentUser(authentication); if (currentUser.equals(acl.getOwner()) && ((changeType == CHANGE_GENERAL) || (changeType == CHANGE_OWNERSHIP))) { return; // depends on control dependency: [if], data = [none] } // Not authorized by ACL ownership; try via adminstrative permissions GrantedAuthority requiredAuthority; if (changeType == CHANGE_AUDITING) { requiredAuthority = this.gaModifyAuditing; } else if (changeType == CHANGE_GENERAL) { requiredAuthority = this.gaGeneralChanges; } else if (changeType == CHANGE_OWNERSHIP) { requiredAuthority = this.gaTakeOwnership; } else { throw new IllegalArgumentException("Unknown change type"); } // Iterate this principal's authorities to determine right Set<String> authorities = AuthorityUtils.authorityListToSet(authentication.getAuthorities()); if (authorities.contains(requiredAuthority.getAuthority())) { return; } // Try to get permission via ACEs within the ACL List<Sid> sids = sidRetrievalStrategy.getSids(authentication); if (acl.isGranted(Arrays.asList(BasePermission.ADMINISTRATION), sids, false)) { return; } throw new AccessDeniedException( "Principal does not have required ACL permissions to perform requested operation"); } }
public class class_name { final protected AbstractIndexPage getPrevInnerPage(AbstractIndexPage indexPage) { int pos = getPagePosition(indexPage); if (pos > 0) { AbstractIndexPage page = getPageByPos(pos-1); if (page.isLeaf) { return null; } return page; } if (getParent() == null) { return null; } //TODO we really should return the last leaf page of the previous inner page. //But if they get merged, then we have to shift minimal values, which is //complicated. For now we ignore this case, hoping that it doesn't matter much. return null; } }
public class class_name { final protected AbstractIndexPage getPrevInnerPage(AbstractIndexPage indexPage) { int pos = getPagePosition(indexPage); if (pos > 0) { AbstractIndexPage page = getPageByPos(pos-1); if (page.isLeaf) { return null; // depends on control dependency: [if], data = [none] } return page; // depends on control dependency: [if], data = [none] } if (getParent() == null) { return null; // depends on control dependency: [if], data = [none] } //TODO we really should return the last leaf page of the previous inner page. //But if they get merged, then we have to shift minimal values, which is //complicated. For now we ignore this case, hoping that it doesn't matter much. return null; } }
public class class_name { public void setResourceArns(java.util.Collection<String> resourceArns) { if (resourceArns == null) { this.resourceArns = null; return; } this.resourceArns = new com.amazonaws.internal.SdkInternalList<String>(resourceArns); } }
public class class_name { public void setResourceArns(java.util.Collection<String> resourceArns) { if (resourceArns == null) { this.resourceArns = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.resourceArns = new com.amazonaws.internal.SdkInternalList<String>(resourceArns); } }
public class class_name { public List<ActivitySpreadType.Period> getPeriod() { if (period == null) { period = new ArrayList<ActivitySpreadType.Period>(); } return this.period; } }
public class class_name { public List<ActivitySpreadType.Period> getPeriod() { if (period == null) { period = new ArrayList<ActivitySpreadType.Period>(); // depends on control dependency: [if], data = [none] } return this.period; } }
public class class_name { @Deprecated public int numThreadLocalCaches() { PoolArena<?>[] arenas = heapArenas != null ? heapArenas : directArenas; if (arenas == null) { return 0; } int total = 0; for (PoolArena<?> arena : arenas) { total += arena.numThreadCaches.get(); } return total; } }
public class class_name { @Deprecated public int numThreadLocalCaches() { PoolArena<?>[] arenas = heapArenas != null ? heapArenas : directArenas; if (arenas == null) { return 0; // depends on control dependency: [if], data = [none] } int total = 0; for (PoolArena<?> arena : arenas) { total += arena.numThreadCaches.get(); // depends on control dependency: [for], data = [arena] } return total; } }
public class class_name { public void setServerList(java.util.Collection<Server> serverList) { if (serverList == null) { this.serverList = null; return; } this.serverList = new java.util.ArrayList<Server>(serverList); } }
public class class_name { public void setServerList(java.util.Collection<Server> serverList) { if (serverList == null) { this.serverList = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.serverList = new java.util.ArrayList<Server>(serverList); } }
public class class_name { public void marshall(DeregisterTaskDefinitionRequest deregisterTaskDefinitionRequest, ProtocolMarshaller protocolMarshaller) { if (deregisterTaskDefinitionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deregisterTaskDefinitionRequest.getTaskDefinition(), TASKDEFINITION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeregisterTaskDefinitionRequest deregisterTaskDefinitionRequest, ProtocolMarshaller protocolMarshaller) { if (deregisterTaskDefinitionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deregisterTaskDefinitionRequest.getTaskDefinition(), TASKDEFINITION_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private AdvancedModelWrapper performMerge(AdvancedModelWrapper source, AdvancedModelWrapper target) { if (source == null || target == null) { return null; } ModelDescription sourceDesc = source.getModelDescription(); ModelDescription targetDesc = target.getModelDescription(); Object transformResult = transformationEngine.performTransformation(sourceDesc, targetDesc, source.getUnderlyingModel(), target.getUnderlyingModel()); AdvancedModelWrapper wrapper = AdvancedModelWrapper.wrap(transformResult); wrapper.removeOpenEngSBModelEntry(EDBConstants.MODEL_VERSION); return wrapper; } }
public class class_name { private AdvancedModelWrapper performMerge(AdvancedModelWrapper source, AdvancedModelWrapper target) { if (source == null || target == null) { return null; // depends on control dependency: [if], data = [none] } ModelDescription sourceDesc = source.getModelDescription(); ModelDescription targetDesc = target.getModelDescription(); Object transformResult = transformationEngine.performTransformation(sourceDesc, targetDesc, source.getUnderlyingModel(), target.getUnderlyingModel()); AdvancedModelWrapper wrapper = AdvancedModelWrapper.wrap(transformResult); wrapper.removeOpenEngSBModelEntry(EDBConstants.MODEL_VERSION); return wrapper; } }
public class class_name { protected void setAttachmentsInternal(Map<String, ? extends Attachment> attachments) { if (attachments != null) { // this awkward looking way of doing things is to avoid marking the map as being // modified HashMap<String, Attachment> m = new HashMap<String, Attachment>(); for (Map.Entry<String, ? extends Attachment> att : attachments.entrySet()) { m.put(att.getKey(), att.getValue()); } this.attachments = SimpleChangeNotifyingMap.wrap(m); } } }
public class class_name { protected void setAttachmentsInternal(Map<String, ? extends Attachment> attachments) { if (attachments != null) { // this awkward looking way of doing things is to avoid marking the map as being // modified HashMap<String, Attachment> m = new HashMap<String, Attachment>(); for (Map.Entry<String, ? extends Attachment> att : attachments.entrySet()) { m.put(att.getKey(), att.getValue()); // depends on control dependency: [for], data = [att] } this.attachments = SimpleChangeNotifyingMap.wrap(m); // depends on control dependency: [if], data = [none] } } }
public class class_name { static void sleep(long n) { try { Thread.sleep(n); } catch (InterruptedException e) { LOG.warn("Thread interrupted", e); Thread.currentThread().interrupt(); } } }
public class class_name { static void sleep(long n) { try { Thread.sleep(n); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { LOG.warn("Thread interrupted", e); Thread.currentThread().interrupt(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private <T> Class<? extends Annotation> matchImplementationToScope(Class<?> implementation) { for (Annotation next : implementation.getAnnotations()) { Class<? extends Annotation> nextType = next.annotationType(); if (nextType.getAnnotation(BindingScope.class) != null) { return nextType; } } return null; } }
public class class_name { private <T> Class<? extends Annotation> matchImplementationToScope(Class<?> implementation) { for (Annotation next : implementation.getAnnotations()) { Class<? extends Annotation> nextType = next.annotationType(); if (nextType.getAnnotation(BindingScope.class) != null) { return nextType; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public void cancel() { final OnCancelListener listener; synchronized (this) { if (mIsCanceled) { return; } mIsCanceled = true; mCancelInProgress = true; listener = mOnCancelListener; } try { if (listener != null) { listener.onCancel(); } } finally { synchronized (this) { mCancelInProgress = false; notifyAll(); } } } }
public class class_name { public void cancel() { final OnCancelListener listener; synchronized (this) { if (mIsCanceled) { return; // depends on control dependency: [if], data = [none] } mIsCanceled = true; mCancelInProgress = true; listener = mOnCancelListener; } try { if (listener != null) { listener.onCancel(); // depends on control dependency: [if], data = [none] } } finally { synchronized (this) { mCancelInProgress = false; notifyAll(); } } } }
public class class_name { @Override protected void onStart() { m_mappings = new HashMap<Bundle, List<T>>(); // listen to bundles events m_context.addBundleListener( m_bundleListener = new SynchronousBundleListener() { public void bundleChanged( final BundleEvent bundleEvent ) { switch( bundleEvent.getType() ) { case BundleEvent.STARTED: register( bundleEvent.getBundle() ); break; case BundleEvent.STOPPED: unregister( bundleEvent.getBundle() ); break; } } } ); // scan already started bundles Bundle[] bundles = m_context.getBundles(); if( bundles != null ) { for( Bundle bundle : bundles ) { if( bundle.getState() == Bundle.ACTIVE ) { register( bundle ); } } } } }
public class class_name { @Override protected void onStart() { m_mappings = new HashMap<Bundle, List<T>>(); // listen to bundles events m_context.addBundleListener( m_bundleListener = new SynchronousBundleListener() { public void bundleChanged( final BundleEvent bundleEvent ) { switch( bundleEvent.getType() ) { case BundleEvent.STARTED: register( bundleEvent.getBundle() ); break; case BundleEvent.STOPPED: unregister( bundleEvent.getBundle() ); break; } } } ); // scan already started bundles Bundle[] bundles = m_context.getBundles(); if( bundles != null ) { for( Bundle bundle : bundles ) { if( bundle.getState() == Bundle.ACTIVE ) { register( bundle ); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public void setValidNextSteps(java.util.Collection<String> validNextSteps) { if (validNextSteps == null) { this.validNextSteps = null; return; } this.validNextSteps = new com.amazonaws.internal.SdkInternalList<String>(validNextSteps); } }
public class class_name { public void setValidNextSteps(java.util.Collection<String> validNextSteps) { if (validNextSteps == null) { this.validNextSteps = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.validNextSteps = new com.amazonaws.internal.SdkInternalList<String>(validNextSteps); } }
public class class_name { public void moveThisFile(File fileSource, File fileDestDir, String strDestName) { try { fileDestDir.mkdirs(); FileInputStream fileIn = new FileInputStream(fileSource); InputStreamReader inStream = new InputStreamReader(fileIn); StreamSource source = new StreamSource(inStream); System.out.println(fileDestDir + " " + strDestName); File fileDest = new File(fileDestDir, strDestName); fileDest.createNewFile(); FileOutputStream fileOut = new FileOutputStream(fileDest); PrintWriter dataOut = new PrintWriter(fileOut); StreamResult dest = new StreamResult(dataOut); m_transformer.transform(source, dest); dataOut.close(); fileOut.close(); inStream.close(); fileIn.close(); } catch (TransformerException ex) { ex.printStackTrace(); } catch (FileNotFoundException ex) { ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } } }
public class class_name { public void moveThisFile(File fileSource, File fileDestDir, String strDestName) { try { fileDestDir.mkdirs(); // depends on control dependency: [try], data = [none] FileInputStream fileIn = new FileInputStream(fileSource); InputStreamReader inStream = new InputStreamReader(fileIn); StreamSource source = new StreamSource(inStream); System.out.println(fileDestDir + " " + strDestName); // depends on control dependency: [try], data = [none] File fileDest = new File(fileDestDir, strDestName); fileDest.createNewFile(); // depends on control dependency: [try], data = [none] FileOutputStream fileOut = new FileOutputStream(fileDest); PrintWriter dataOut = new PrintWriter(fileOut); StreamResult dest = new StreamResult(dataOut); m_transformer.transform(source, dest); // depends on control dependency: [try], data = [none] dataOut.close(); // depends on control dependency: [try], data = [none] fileOut.close(); // depends on control dependency: [try], data = [none] inStream.close(); // depends on control dependency: [try], data = [none] fileIn.close(); // depends on control dependency: [try], data = [none] } catch (TransformerException ex) { ex.printStackTrace(); } catch (FileNotFoundException ex) { // depends on control dependency: [catch], data = [none] ex.printStackTrace(); } catch (IOException ex) { // depends on control dependency: [catch], data = [none] ex.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void decodeMultipartFormData(ContentType contentType, ByteBuffer fbuf, Map<String, List<String>> parms, Map<String, String> files) throws ResponseException { int pcount = 0; try { int[] boundaryIdxs = getBoundaryPositions(fbuf, contentType.getBoundary().getBytes()); if (boundaryIdxs.length < 2) { throw new ResponseException(Status.BAD_REQUEST, "BAD REQUEST: Content type is multipart/form-data but contains less than two boundary strings."); } byte[] partHeaderBuff = new byte[MAX_HEADER_SIZE]; for (int boundaryIdx = 0; boundaryIdx < boundaryIdxs.length - 1; boundaryIdx++) { fbuf.position(boundaryIdxs[boundaryIdx]); int len = (fbuf.remaining() < MAX_HEADER_SIZE) ? fbuf.remaining() : MAX_HEADER_SIZE; fbuf.get(partHeaderBuff, 0, len); BufferedReader in = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(partHeaderBuff, 0, len), Charset.forName(contentType.getEncoding())), len); int headerLines = 0; // First line is boundary string String mpline = in.readLine(); headerLines++; if (mpline == null || !mpline.contains(contentType.getBoundary())) { throw new ResponseException(Status.BAD_REQUEST, "BAD REQUEST: Content type is multipart/form-data but chunk does not start with boundary."); } String partName = null, fileName = null, partContentType = null; // Parse the reset of the header lines mpline = in.readLine(); headerLines++; while (mpline != null && mpline.trim().length() > 0) { Matcher matcher = NanoHTTPD.CONTENT_DISPOSITION_PATTERN.matcher(mpline); if (matcher.matches()) { String attributeString = matcher.group(2); matcher = NanoHTTPD.CONTENT_DISPOSITION_ATTRIBUTE_PATTERN.matcher(attributeString); while (matcher.find()) { String key = matcher.group(1); if ("name".equalsIgnoreCase(key)) { partName = matcher.group(2); } else if ("filename".equalsIgnoreCase(key)) { fileName = matcher.group(2); // add these two line to support multiple // files uploaded using the same field Id if (!fileName.isEmpty()) { if (pcount > 0) partName = partName + String.valueOf(pcount++); else pcount++; } } } } matcher = NanoHTTPD.CONTENT_TYPE_PATTERN.matcher(mpline); if (matcher.matches()) { partContentType = matcher.group(2).trim(); } mpline = in.readLine(); headerLines++; } int partHeaderLength = 0; while (headerLines-- > 0) { partHeaderLength = scipOverNewLine(partHeaderBuff, partHeaderLength); } // Read the part data if (partHeaderLength >= len - 4) { throw new ResponseException(Status.INTERNAL_ERROR, "Multipart header size exceeds MAX_HEADER_SIZE."); } int partDataStart = boundaryIdxs[boundaryIdx] + partHeaderLength; int partDataEnd = boundaryIdxs[boundaryIdx + 1] - 4; fbuf.position(partDataStart); List<String> values = parms.get(partName); if (values == null) { values = new ArrayList<String>(); parms.put(partName, values); } if (partContentType == null) { // Read the part into a string byte[] data_bytes = new byte[partDataEnd - partDataStart]; fbuf.get(data_bytes); values.add(new String(data_bytes, contentType.getEncoding())); } else { // Read it into a file String path = saveTmpFile(fbuf, partDataStart, partDataEnd - partDataStart, fileName); if (!files.containsKey(partName)) { files.put(partName, path); } else { int count = 2; while (files.containsKey(partName + count)) { count++; } files.put(partName + count, path); } values.add(fileName); } } } catch (ResponseException re) { throw re; } catch (Exception e) { throw new ResponseException(Status.INTERNAL_ERROR, e.toString()); } } }
public class class_name { private void decodeMultipartFormData(ContentType contentType, ByteBuffer fbuf, Map<String, List<String>> parms, Map<String, String> files) throws ResponseException { int pcount = 0; try { int[] boundaryIdxs = getBoundaryPositions(fbuf, contentType.getBoundary().getBytes()); if (boundaryIdxs.length < 2) { throw new ResponseException(Status.BAD_REQUEST, "BAD REQUEST: Content type is multipart/form-data but contains less than two boundary strings."); } byte[] partHeaderBuff = new byte[MAX_HEADER_SIZE]; for (int boundaryIdx = 0; boundaryIdx < boundaryIdxs.length - 1; boundaryIdx++) { fbuf.position(boundaryIdxs[boundaryIdx]); // depends on control dependency: [for], data = [boundaryIdx] int len = (fbuf.remaining() < MAX_HEADER_SIZE) ? fbuf.remaining() : MAX_HEADER_SIZE; fbuf.get(partHeaderBuff, 0, len); // depends on control dependency: [for], data = [none] BufferedReader in = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(partHeaderBuff, 0, len), Charset.forName(contentType.getEncoding())), len); int headerLines = 0; // First line is boundary string String mpline = in.readLine(); headerLines++; // depends on control dependency: [for], data = [none] if (mpline == null || !mpline.contains(contentType.getBoundary())) { throw new ResponseException(Status.BAD_REQUEST, "BAD REQUEST: Content type is multipart/form-data but chunk does not start with boundary."); } String partName = null, fileName = null, partContentType = null; // Parse the reset of the header lines mpline = in.readLine(); // depends on control dependency: [for], data = [none] headerLines++; // depends on control dependency: [for], data = [none] while (mpline != null && mpline.trim().length() > 0) { Matcher matcher = NanoHTTPD.CONTENT_DISPOSITION_PATTERN.matcher(mpline); if (matcher.matches()) { String attributeString = matcher.group(2); matcher = NanoHTTPD.CONTENT_DISPOSITION_ATTRIBUTE_PATTERN.matcher(attributeString); // depends on control dependency: [if], data = [none] while (matcher.find()) { String key = matcher.group(1); if ("name".equalsIgnoreCase(key)) { partName = matcher.group(2); // depends on control dependency: [if], data = [none] } else if ("filename".equalsIgnoreCase(key)) { fileName = matcher.group(2); // depends on control dependency: [if], data = [none] // add these two line to support multiple // files uploaded using the same field Id if (!fileName.isEmpty()) { if (pcount > 0) partName = partName + String.valueOf(pcount++); else pcount++; } } } } matcher = NanoHTTPD.CONTENT_TYPE_PATTERN.matcher(mpline); // depends on control dependency: [while], data = [(mpline] if (matcher.matches()) { partContentType = matcher.group(2).trim(); // depends on control dependency: [if], data = [none] } mpline = in.readLine(); // depends on control dependency: [while], data = [none] headerLines++; // depends on control dependency: [while], data = [none] } int partHeaderLength = 0; while (headerLines-- > 0) { partHeaderLength = scipOverNewLine(partHeaderBuff, partHeaderLength); // depends on control dependency: [while], data = [none] } // Read the part data if (partHeaderLength >= len - 4) { throw new ResponseException(Status.INTERNAL_ERROR, "Multipart header size exceeds MAX_HEADER_SIZE."); } int partDataStart = boundaryIdxs[boundaryIdx] + partHeaderLength; int partDataEnd = boundaryIdxs[boundaryIdx + 1] - 4; fbuf.position(partDataStart); // depends on control dependency: [for], data = [none] List<String> values = parms.get(partName); if (values == null) { values = new ArrayList<String>(); // depends on control dependency: [if], data = [none] parms.put(partName, values); // depends on control dependency: [if], data = [none] } if (partContentType == null) { // Read the part into a string byte[] data_bytes = new byte[partDataEnd - partDataStart]; fbuf.get(data_bytes); // depends on control dependency: [if], data = [none] values.add(new String(data_bytes, contentType.getEncoding())); // depends on control dependency: [if], data = [none] } else { // Read it into a file String path = saveTmpFile(fbuf, partDataStart, partDataEnd - partDataStart, fileName); if (!files.containsKey(partName)) { files.put(partName, path); // depends on control dependency: [if], data = [none] } else { int count = 2; while (files.containsKey(partName + count)) { count++; // depends on control dependency: [while], data = [none] } files.put(partName + count, path); // depends on control dependency: [if], data = [none] } values.add(fileName); // depends on control dependency: [if], data = [none] } } } catch (ResponseException re) { throw re; } catch (Exception e) { throw new ResponseException(Status.INTERNAL_ERROR, e.toString()); } } }
public class class_name { public boolean replaceChild(AbstractPlanNode oldChild, AbstractPlanNode newChild) { assert(oldChild != null); assert(newChild != null); int idx = 0; for (AbstractPlanNode child : m_children) { if (child.equals(oldChild)) { oldChild.m_parents.clear(); setAndLinkChild(idx, newChild); return true; } ++idx; } return false; } }
public class class_name { public boolean replaceChild(AbstractPlanNode oldChild, AbstractPlanNode newChild) { assert(oldChild != null); assert(newChild != null); int idx = 0; for (AbstractPlanNode child : m_children) { if (child.equals(oldChild)) { oldChild.m_parents.clear(); // depends on control dependency: [if], data = [none] setAndLinkChild(idx, newChild); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } ++idx; // depends on control dependency: [for], data = [none] } return false; } }
public class class_name { void select(OptMapInfo alt) { if (alt.value == 0) return; if (value == 0) { copy(alt); return; } int v1 = z / value; int v2 = z /alt.value; if (mmd.compareDistanceValue(alt.mmd, v1, v2) > 0) copy(alt); } }
public class class_name { void select(OptMapInfo alt) { if (alt.value == 0) return; if (value == 0) { copy(alt); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } int v1 = z / value; int v2 = z /alt.value; if (mmd.compareDistanceValue(alt.mmd, v1, v2) > 0) copy(alt); } }
public class class_name { void setParentConnection(final JmsJcaConnectionImpl connection) { if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, "setParentConnection", connection); } _connection = connection; if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, "setParentConnection"); } } }
public class class_name { void setParentConnection(final JmsJcaConnectionImpl connection) { if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, "setParentConnection", connection); // depends on control dependency: [if], data = [none] } _connection = connection; if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, "setParentConnection"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setRepositoriesNotFound(java.util.Collection<String> repositoriesNotFound) { if (repositoriesNotFound == null) { this.repositoriesNotFound = null; return; } this.repositoriesNotFound = new java.util.ArrayList<String>(repositoriesNotFound); } }
public class class_name { public void setRepositoriesNotFound(java.util.Collection<String> repositoriesNotFound) { if (repositoriesNotFound == null) { this.repositoriesNotFound = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.repositoriesNotFound = new java.util.ArrayList<String>(repositoriesNotFound); } }
public class class_name { protected ORecord getRecord() { final ORecord record; if (reusedRecord != null) { // REUSE THE SAME RECORD AFTER HAVING RESETTED IT record = reusedRecord; record.reset(); } else record = null; return record; } }
public class class_name { protected ORecord getRecord() { final ORecord record; if (reusedRecord != null) { // REUSE THE SAME RECORD AFTER HAVING RESETTED IT record = reusedRecord; // depends on control dependency: [if], data = [none] record.reset(); // depends on control dependency: [if], data = [none] } else record = null; return record; } }
public class class_name { public int getCompletedTasks() { int completedTasks = 0; for (TaskState taskState : this.taskStates.values()) { if (taskState.isCompleted()) { completedTasks++; } } return completedTasks; } }
public class class_name { public int getCompletedTasks() { int completedTasks = 0; for (TaskState taskState : this.taskStates.values()) { if (taskState.isCompleted()) { completedTasks++; // depends on control dependency: [if], data = [none] } } return completedTasks; } }
public class class_name { public static void main(String[] argv) { if (argv.length == 0) { printUsage(""); System.exit(-1); } String inputPathsString = null; Path outputPath = null; String shardsString = null; String indexPath = null; int numShards = -1; int numMapTasks = -1; Configuration conf = new Configuration(); String confPath = null; // parse the command line for (int i = 0; i < argv.length; i++) { // parse command line if (argv[i].equals("-inputPaths")) { inputPathsString = argv[++i]; } else if (argv[i].equals("-outputPath")) { outputPath = new Path(argv[++i]); } else if (argv[i].equals("-shards")) { shardsString = argv[++i]; } else if (argv[i].equals("-indexPath")) { indexPath = argv[++i]; } else if (argv[i].equals("-numShards")) { numShards = Integer.parseInt(argv[++i]); } else if (argv[i].equals("-numMapTasks")) { numMapTasks = Integer.parseInt(argv[++i]); } else if (argv[i].equals("-conf")) { // add as a local FS resource confPath = argv[++i]; conf.addResource(new Path(confPath)); } else { System.out.println("Unknown option " + argv[i] + " w/ value " + argv[++i]); } } LOG.info("inputPaths = " + inputPathsString); LOG.info("outputPath = " + outputPath); LOG.info("shards = " + shardsString); LOG.info("indexPath = " + indexPath); LOG.info("numShards = " + numShards); LOG.info("numMapTasks= " + numMapTasks); LOG.info("confPath = " + confPath); Path[] inputPaths = null; Shard[] shards = null; JobConf jobConf = new JobConf(conf); IndexUpdateConfiguration iconf = new IndexUpdateConfiguration(jobConf); if (inputPathsString != null) { jobConf.set("mapred.input.dir", inputPathsString); } inputPaths = FileInputFormat.getInputPaths(jobConf); if (inputPaths.length == 0) { inputPaths = null; } if (outputPath == null) { outputPath = FileOutputFormat.getOutputPath(jobConf); } if (inputPaths == null || outputPath == null) { System.err.println("InputPaths and outputPath must be specified."); printUsage(""); System.exit(-1); } if (shardsString != null) { iconf.setIndexShards(shardsString); } shards = Shard.getIndexShards(iconf); if (shards != null && shards.length == 0) { shards = null; } if (indexPath == null) { indexPath = getIndexPath(conf); } if (numShards <= 0) { numShards = getNumShards(conf); } if (shards == null && indexPath == null) { System.err.println("Either shards or indexPath must be specified."); printUsage(""); System.exit(-1); } if (numMapTasks <= 0) { numMapTasks = jobConf.getNumMapTasks(); } try { // create shards and set their directories if necessary if (shards == null) { shards = createShards(indexPath, numShards, conf); } long startTime = now(); try { IIndexUpdater updater = (IIndexUpdater) ReflectionUtils.newInstance( iconf.getIndexUpdaterClass(), conf); LOG.info("sea.index.updater = " + iconf.getIndexUpdaterClass().getName()); updater.run(conf, inputPaths, outputPath, numMapTasks, shards); LOG.info("Index update job is done"); } finally { long elapsedTime = now() - startTime; LOG.info("Elapsed time is " + (elapsedTime / 1000) + "s"); System.out.println("Elapsed time is " + (elapsedTime / 1000) + "s"); } } catch (Exception e) { e.printStackTrace(System.err); } } }
public class class_name { public static void main(String[] argv) { if (argv.length == 0) { printUsage(""); // depends on control dependency: [if], data = [none] System.exit(-1); // depends on control dependency: [if], data = [none] } String inputPathsString = null; Path outputPath = null; String shardsString = null; String indexPath = null; int numShards = -1; int numMapTasks = -1; Configuration conf = new Configuration(); String confPath = null; // parse the command line for (int i = 0; i < argv.length; i++) { // parse command line if (argv[i].equals("-inputPaths")) { inputPathsString = argv[++i]; // depends on control dependency: [if], data = [none] } else if (argv[i].equals("-outputPath")) { outputPath = new Path(argv[++i]); // depends on control dependency: [if], data = [none] } else if (argv[i].equals("-shards")) { shardsString = argv[++i]; // depends on control dependency: [if], data = [none] } else if (argv[i].equals("-indexPath")) { indexPath = argv[++i]; // depends on control dependency: [if], data = [none] } else if (argv[i].equals("-numShards")) { numShards = Integer.parseInt(argv[++i]); // depends on control dependency: [if], data = [none] } else if (argv[i].equals("-numMapTasks")) { numMapTasks = Integer.parseInt(argv[++i]); // depends on control dependency: [if], data = [none] } else if (argv[i].equals("-conf")) { // add as a local FS resource confPath = argv[++i]; // depends on control dependency: [if], data = [none] conf.addResource(new Path(confPath)); // depends on control dependency: [if], data = [none] } else { System.out.println("Unknown option " + argv[i] + " w/ value " + argv[++i]); // depends on control dependency: [if], data = [none] } } LOG.info("inputPaths = " + inputPathsString); LOG.info("outputPath = " + outputPath); LOG.info("shards = " + shardsString); LOG.info("indexPath = " + indexPath); LOG.info("numShards = " + numShards); LOG.info("numMapTasks= " + numMapTasks); LOG.info("confPath = " + confPath); Path[] inputPaths = null; Shard[] shards = null; JobConf jobConf = new JobConf(conf); IndexUpdateConfiguration iconf = new IndexUpdateConfiguration(jobConf); if (inputPathsString != null) { jobConf.set("mapred.input.dir", inputPathsString); // depends on control dependency: [if], data = [none] } inputPaths = FileInputFormat.getInputPaths(jobConf); if (inputPaths.length == 0) { inputPaths = null; // depends on control dependency: [if], data = [none] } if (outputPath == null) { outputPath = FileOutputFormat.getOutputPath(jobConf); // depends on control dependency: [if], data = [none] } if (inputPaths == null || outputPath == null) { System.err.println("InputPaths and outputPath must be specified."); // depends on control dependency: [if], data = [none] printUsage(""); // depends on control dependency: [if], data = [none] System.exit(-1); // depends on control dependency: [if], data = [none] } if (shardsString != null) { iconf.setIndexShards(shardsString); // depends on control dependency: [if], data = [(shardsString] } shards = Shard.getIndexShards(iconf); if (shards != null && shards.length == 0) { shards = null; // depends on control dependency: [if], data = [none] } if (indexPath == null) { indexPath = getIndexPath(conf); // depends on control dependency: [if], data = [none] } if (numShards <= 0) { numShards = getNumShards(conf); // depends on control dependency: [if], data = [none] } if (shards == null && indexPath == null) { System.err.println("Either shards or indexPath must be specified."); // depends on control dependency: [if], data = [none] printUsage(""); // depends on control dependency: [if], data = [none] System.exit(-1); // depends on control dependency: [if], data = [none] } if (numMapTasks <= 0) { numMapTasks = jobConf.getNumMapTasks(); // depends on control dependency: [if], data = [none] } try { // create shards and set their directories if necessary if (shards == null) { shards = createShards(indexPath, numShards, conf); // depends on control dependency: [if], data = [none] } long startTime = now(); try { IIndexUpdater updater = (IIndexUpdater) ReflectionUtils.newInstance( iconf.getIndexUpdaterClass(), conf); LOG.info("sea.index.updater = " + iconf.getIndexUpdaterClass().getName()); // depends on control dependency: [try], data = [none] updater.run(conf, inputPaths, outputPath, numMapTasks, shards); // depends on control dependency: [try], data = [none] LOG.info("Index update job is done"); // depends on control dependency: [try], data = [none] } finally { long elapsedTime = now() - startTime; LOG.info("Elapsed time is " + (elapsedTime / 1000) + "s"); System.out.println("Elapsed time is " + (elapsedTime / 1000) + "s"); } } catch (Exception e) { e.printStackTrace(System.err); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private String concatDate(){ if(params.length != 2){ throw new IllegalArgumentException("Wrong number of Parameters for concat date expression"); } final DateTimeFormat yearFormat = DateTimeFormat.getFormat(DataType.DATE_FORMAT_YEAR_ONLY); final String rawDateFrom = record.getValueByFieldName(params[0]); Date dateFrom = DataType.ParseUtil.tryParseDate(rawDateFrom, DataType.DEFAULT_DATE); final String rawDateTo = record.getValueByFieldName(params[1]); Date dateTo = DataType.ParseUtil.tryParseDate(rawDateTo, DataType.DEFAULT_DATE); String res; if(dateFrom.equals(dateTo)){ res = yearFormat.format(dateFrom); }else{ res = yearFormat.format(dateFrom) + " - " + yearFormat.format(dateTo); } return res; } }
public class class_name { private String concatDate(){ if(params.length != 2){ throw new IllegalArgumentException("Wrong number of Parameters for concat date expression"); } final DateTimeFormat yearFormat = DateTimeFormat.getFormat(DataType.DATE_FORMAT_YEAR_ONLY); final String rawDateFrom = record.getValueByFieldName(params[0]); Date dateFrom = DataType.ParseUtil.tryParseDate(rawDateFrom, DataType.DEFAULT_DATE); final String rawDateTo = record.getValueByFieldName(params[1]); Date dateTo = DataType.ParseUtil.tryParseDate(rawDateTo, DataType.DEFAULT_DATE); String res; if(dateFrom.equals(dateTo)){ res = yearFormat.format(dateFrom); // depends on control dependency: [if], data = [none] }else{ res = yearFormat.format(dateFrom) + " - " + yearFormat.format(dateTo); // depends on control dependency: [if], data = [none] } return res; } }
public class class_name { public Collection<Tenant> getTenants() { checkServiceState(); Map<String, TenantDefinition> tenantMap = getAllTenantDefs(); List<Tenant> result = new ArrayList<>(); for (String tenantName : tenantMap.keySet()) { result.add(new Tenant(tenantMap.get(tenantName))); } return result; } }
public class class_name { public Collection<Tenant> getTenants() { checkServiceState(); Map<String, TenantDefinition> tenantMap = getAllTenantDefs(); List<Tenant> result = new ArrayList<>(); for (String tenantName : tenantMap.keySet()) { result.add(new Tenant(tenantMap.get(tenantName))); // depends on control dependency: [for], data = [tenantName] } return result; } }
public class class_name { public void setHistory(java.util.Collection<ConfigurationId> history) { if (history == null) { this.history = null; return; } this.history = new java.util.ArrayList<ConfigurationId>(history); } }
public class class_name { public void setHistory(java.util.Collection<ConfigurationId> history) { if (history == null) { this.history = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.history = new java.util.ArrayList<ConfigurationId>(history); } }
public class class_name { public Iterable<ServerInstanceLogRecordList> getLogLists(RepositoryPointer after, Date endTime, final LogRecordHeaderFilter filter) { if (after instanceof RepositoryPointerImpl) { final RepositoryPointerImpl location = (RepositoryPointerImpl) after; final long max = endTime == null ? -1 : endTime.getTime(); LogRepositoryBrowser logs = logInstanceBrowser.find(location, false); LogRepositoryBrowser traces = null; if (traceInstanceBrowser != null) { traces = traceInstanceBrowser.find(location, false); } if (logs == null && traces == null) { return EMPTY_ITERABLE; } // Check that location come from the log. if (logs != null) { final RepositoryLogRecord current = new LogRecordBrowser(logs).getRecord(location); if (current != null) { final LogRepositoryBrowser finalLogs = logs; final LogRepositoryBrowser finalTraces = traceInstanceBrowser == null ? null : traceInstanceBrowser.find(location, true); return new Iterable<ServerInstanceLogRecordList>() { @Override public Iterator<ServerInstanceLogRecordList> iterator() { return new ServerInstanceListsIterator(max, finalLogs, finalTraces) { @Override protected OnePidRecordListImpl queryResult( LogRepositoryBrowser browser) { return new LogRecordBrowser(browser).recordsInProcess(-1, max, filter); } @Override protected ServerInstanceLogRecordList queryFirstInstance( LogRepositoryBrowser firstLog, LogRepositoryBrowser firstTrace) { return new ServerInstanceLogRecordListHeaderPointerImpl(firstLog, firstTrace, false, location, current, filter, max); } }; } }; } } // Check that location come from the trace. if (traces != null) { final RepositoryLogRecord current = new LogRecordBrowser(traces).getRecord(location); if (current != null) { final LogRepositoryBrowser finalLogs = logInstanceBrowser.find(location, true); final LogRepositoryBrowser finalTraces = traces; return new Iterable<ServerInstanceLogRecordList>() { @Override public Iterator<ServerInstanceLogRecordList> iterator() { return new ServerInstanceListsIterator(max, finalLogs, finalTraces) { @Override protected OnePidRecordListImpl queryResult( LogRepositoryBrowser browser) { return new LogRecordBrowser(browser).recordsInProcess(-1, max, filter); } @Override protected ServerInstanceLogRecordList queryFirstInstance( LogRepositoryBrowser firstLog, LogRepositoryBrowser firstTrace) { return new ServerInstanceLogRecordListHeaderPointerImpl(firstTrace, firstLog, true, location, current, filter, max); } }; } }; } } // Neither trace nor log contain the location which means that file containing // it was purged already and that we can just return all the records we can find. final LogRepositoryBrowser finalLogs = logInstanceBrowser.find(location, true); final LogRepositoryBrowser finalTraces = traceInstanceBrowser == null ? null : traceInstanceBrowser.find(location, true); return new Iterable<ServerInstanceLogRecordList>() { @Override public Iterator<ServerInstanceLogRecordList> iterator() { return new ServerInstanceListsIterator(max, finalLogs, finalTraces) { @Override protected OnePidRecordListImpl queryResult( LogRepositoryBrowser browser) { return new LogRecordBrowser(browser).recordsInProcess(-1, max, filter); } }; } }; } else if (after != null) { throw new IllegalArgumentException("This method accept only RepositoryPointer instances retrieved from previously read records"); } return getLogLists((Date) null, endTime, filter); } }
public class class_name { public Iterable<ServerInstanceLogRecordList> getLogLists(RepositoryPointer after, Date endTime, final LogRecordHeaderFilter filter) { if (after instanceof RepositoryPointerImpl) { final RepositoryPointerImpl location = (RepositoryPointerImpl) after; final long max = endTime == null ? -1 : endTime.getTime(); LogRepositoryBrowser logs = logInstanceBrowser.find(location, false); LogRepositoryBrowser traces = null; if (traceInstanceBrowser != null) { traces = traceInstanceBrowser.find(location, false); // depends on control dependency: [if], data = [none] } if (logs == null && traces == null) { return EMPTY_ITERABLE; // depends on control dependency: [if], data = [none] } // Check that location come from the log. if (logs != null) { final RepositoryLogRecord current = new LogRecordBrowser(logs).getRecord(location); if (current != null) { final LogRepositoryBrowser finalLogs = logs; final LogRepositoryBrowser finalTraces = traceInstanceBrowser == null ? null : traceInstanceBrowser.find(location, true); return new Iterable<ServerInstanceLogRecordList>() { @Override public Iterator<ServerInstanceLogRecordList> iterator() { return new ServerInstanceListsIterator(max, finalLogs, finalTraces) { @Override protected OnePidRecordListImpl queryResult( LogRepositoryBrowser browser) { return new LogRecordBrowser(browser).recordsInProcess(-1, max, filter); } @Override protected ServerInstanceLogRecordList queryFirstInstance( LogRepositoryBrowser firstLog, LogRepositoryBrowser firstTrace) { return new ServerInstanceLogRecordListHeaderPointerImpl(firstLog, firstTrace, false, location, current, filter, max); } }; } }; // depends on control dependency: [if], data = [none] } } // Check that location come from the trace. if (traces != null) { final RepositoryLogRecord current = new LogRecordBrowser(traces).getRecord(location); if (current != null) { final LogRepositoryBrowser finalLogs = logInstanceBrowser.find(location, true); final LogRepositoryBrowser finalTraces = traces; return new Iterable<ServerInstanceLogRecordList>() { @Override public Iterator<ServerInstanceLogRecordList> iterator() { return new ServerInstanceListsIterator(max, finalLogs, finalTraces) { @Override protected OnePidRecordListImpl queryResult( LogRepositoryBrowser browser) { return new LogRecordBrowser(browser).recordsInProcess(-1, max, filter); } @Override protected ServerInstanceLogRecordList queryFirstInstance( LogRepositoryBrowser firstLog, LogRepositoryBrowser firstTrace) { return new ServerInstanceLogRecordListHeaderPointerImpl(firstTrace, firstLog, true, location, current, filter, max); } }; } }; // depends on control dependency: [if], data = [none] } } // Neither trace nor log contain the location which means that file containing // it was purged already and that we can just return all the records we can find. final LogRepositoryBrowser finalLogs = logInstanceBrowser.find(location, true); final LogRepositoryBrowser finalTraces = traceInstanceBrowser == null ? null : traceInstanceBrowser.find(location, true); return new Iterable<ServerInstanceLogRecordList>() { @Override public Iterator<ServerInstanceLogRecordList> iterator() { return new ServerInstanceListsIterator(max, finalLogs, finalTraces) { @Override protected OnePidRecordListImpl queryResult( LogRepositoryBrowser browser) { return new LogRecordBrowser(browser).recordsInProcess(-1, max, filter); } }; } }; // depends on control dependency: [if], data = [none] } else if (after != null) { throw new IllegalArgumentException("This method accept only RepositoryPointer instances retrieved from previously read records"); } return getLogLists((Date) null, endTime, filter); } }
public class class_name { private int doWork(String[] args) { if (args.length == 1) { CommandHandler handler = Command.getHandler(args[0]); if (handler != null) { return handler.doWork(this); } } printUsage(); return -1; } }
public class class_name { private int doWork(String[] args) { if (args.length == 1) { CommandHandler handler = Command.getHandler(args[0]); if (handler != null) { return handler.doWork(this); // depends on control dependency: [if], data = [none] } } printUsage(); return -1; } }
public class class_name { protected void doPick() { GVRSceneObject owner = getOwnerObject(); GVRTransform trans = (owner != null) ? owner.getTransform() : null; GVRPickedObject[] picked; if (mPickClosest) { GVRPickedObject closest = pickClosest(mScene, trans, mRayOrigin.x, mRayOrigin.y, mRayOrigin.z, mRayDirection.x, mRayDirection.y, mRayDirection.z); if (closest != null) { picked = new GVRPickedObject[] { closest }; } else { picked = new GVRPickedObject[0]; } } else { picked = pickObjects(mScene, trans, mRayOrigin.x, mRayOrigin.y, mRayOrigin.z, mRayDirection.x, mRayDirection.y, mRayDirection.z); } generatePickEvents(picked); mMotionEvent = null; } }
public class class_name { protected void doPick() { GVRSceneObject owner = getOwnerObject(); GVRTransform trans = (owner != null) ? owner.getTransform() : null; GVRPickedObject[] picked; if (mPickClosest) { GVRPickedObject closest = pickClosest(mScene, trans, mRayOrigin.x, mRayOrigin.y, mRayOrigin.z, mRayDirection.x, mRayDirection.y, mRayDirection.z); if (closest != null) { picked = new GVRPickedObject[] { closest }; // depends on control dependency: [if], data = [none] } else { picked = new GVRPickedObject[0]; // depends on control dependency: [if], data = [none] } } else { picked = pickObjects(mScene, trans, mRayOrigin.x, mRayOrigin.y, mRayOrigin.z, mRayDirection.x, mRayDirection.y, mRayDirection.z); // depends on control dependency: [if], data = [none] } generatePickEvents(picked); mMotionEvent = null; } }
public class class_name { public static Date parseDate(final String date) { /* IE9 sends a superflous lenght parameter after date in the If-Modified-Since header, which needs to be stripped before parsing. */ final int semicolonIndex = date.indexOf(';'); final String trimmedDate = semicolonIndex >= 0 ? date.substring(0, semicolonIndex) : date; ParsePosition pp = new ParsePosition(0); SimpleDateFormat dateFormat = RFC1123_PATTERN_FORMAT.get(); dateFormat.setTimeZone(GMT_ZONE); Date val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; } pp = new ParsePosition(0); dateFormat = new SimpleDateFormat(RFC1036_PATTERN, LOCALE_US); dateFormat.setTimeZone(GMT_ZONE); val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; } pp = new ParsePosition(0); dateFormat = new SimpleDateFormat(ASCITIME_PATTERN, LOCALE_US); dateFormat.setTimeZone(GMT_ZONE); val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; } pp = new ParsePosition(0); dateFormat = new SimpleDateFormat(OLD_COOKIE_PATTERN, LOCALE_US); dateFormat.setTimeZone(GMT_ZONE); val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; } return null; } }
public class class_name { public static Date parseDate(final String date) { /* IE9 sends a superflous lenght parameter after date in the If-Modified-Since header, which needs to be stripped before parsing. */ final int semicolonIndex = date.indexOf(';'); final String trimmedDate = semicolonIndex >= 0 ? date.substring(0, semicolonIndex) : date; ParsePosition pp = new ParsePosition(0); SimpleDateFormat dateFormat = RFC1123_PATTERN_FORMAT.get(); dateFormat.setTimeZone(GMT_ZONE); Date val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; // depends on control dependency: [if], data = [none] } pp = new ParsePosition(0); dateFormat = new SimpleDateFormat(RFC1036_PATTERN, LOCALE_US); dateFormat.setTimeZone(GMT_ZONE); val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; // depends on control dependency: [if], data = [none] } pp = new ParsePosition(0); dateFormat = new SimpleDateFormat(ASCITIME_PATTERN, LOCALE_US); dateFormat.setTimeZone(GMT_ZONE); val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; // depends on control dependency: [if], data = [none] } pp = new ParsePosition(0); dateFormat = new SimpleDateFormat(OLD_COOKIE_PATTERN, LOCALE_US); dateFormat.setTimeZone(GMT_ZONE); val = dateFormat.parse(trimmedDate, pp); if (val != null && pp.getIndex() == trimmedDate.length()) { return val; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public static void rank1UpdateMultR_TopRow(final int blockLength , final DSubmatrixD1 A , final int col , final double gamma ) { final double dataA[] = A.original.data; final int widthCol = Math.min( blockLength , A.col1 - col ); // step through columns in top block, skipping over the first block for( int colStartJ = A.col0 + blockLength; colStartJ < A.col1; colStartJ += blockLength ) { final int widthJ = Math.min( blockLength , A.col1 - colStartJ); for( int j = 0; j < widthJ; j++ ) { // total = U^T * A(:,j) * gamma double total = innerProdCol(blockLength, A, col, widthCol, (colStartJ-A.col0)+j, widthJ)*gamma; // A(:,j) - gamma*U*total // just update the top most block int i = A.row0; int height = Math.min( blockLength , A.row1 - i ); int indexU = i*A.original.numCols + height*A.col0 + col; int indexA = i*A.original.numCols + height*colStartJ + j; // take in account zeros and one indexU += widthCol*(col+1); indexA += widthJ*col; dataA[ indexA ] -= total; indexA += widthJ; for( int k = col+1; k < height; k++ , indexU += widthCol, indexA += widthJ ) { dataA[ indexA ] -= total*dataA[ indexU ]; } } } } }
public class class_name { public static void rank1UpdateMultR_TopRow(final int blockLength , final DSubmatrixD1 A , final int col , final double gamma ) { final double dataA[] = A.original.data; final int widthCol = Math.min( blockLength , A.col1 - col ); // step through columns in top block, skipping over the first block for( int colStartJ = A.col0 + blockLength; colStartJ < A.col1; colStartJ += blockLength ) { final int widthJ = Math.min( blockLength , A.col1 - colStartJ); for( int j = 0; j < widthJ; j++ ) { // total = U^T * A(:,j) * gamma double total = innerProdCol(blockLength, A, col, widthCol, (colStartJ-A.col0)+j, widthJ)*gamma; // A(:,j) - gamma*U*total // just update the top most block int i = A.row0; int height = Math.min( blockLength , A.row1 - i ); int indexU = i*A.original.numCols + height*A.col0 + col; int indexA = i*A.original.numCols + height*colStartJ + j; // take in account zeros and one indexU += widthCol*(col+1); // depends on control dependency: [for], data = [none] indexA += widthJ*col; // depends on control dependency: [for], data = [none] dataA[ indexA ] -= total; // depends on control dependency: [for], data = [none] indexA += widthJ; // depends on control dependency: [for], data = [none] for( int k = col+1; k < height; k++ , indexU += widthCol, indexA += widthJ ) { dataA[ indexA ] -= total*dataA[ indexU ]; // depends on control dependency: [for], data = [none] } } } } }
public class class_name { private boolean hasEagerSingletonBinding() { for (Key<?> key : bindings.keySet()) { GinScope scope = determineScope(key); if (GinScope.EAGER_SINGLETON.equals(scope)) { return true; } } return false; } }
public class class_name { private boolean hasEagerSingletonBinding() { for (Key<?> key : bindings.keySet()) { GinScope scope = determineScope(key); if (GinScope.EAGER_SINGLETON.equals(scope)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { @PostConstruct public synchronized void initialize() { final FwCoreDirection direction = assistCoreDirection(); final ConcurrentAsyncExecutorProvider provider = direction.assistConcurrentAsyncExecutorProvider(); defaultConcurrentAsyncOption = provider != null ? provider.provideDefaultOption() : null; if (defaultConcurrentAsyncOption == null) { defaultConcurrentAsyncOption = new ConcurrentAsyncOption(); } primaryExecutorService = createDefaultPrimaryExecutorService(provider); secondaryExecutorService = createDefaultSecondaryExecutorService(provider); tertiaryExecutorService = createDefaultSecondaryExecutorService(provider); showBootLogging(); } }
public class class_name { @PostConstruct public synchronized void initialize() { final FwCoreDirection direction = assistCoreDirection(); final ConcurrentAsyncExecutorProvider provider = direction.assistConcurrentAsyncExecutorProvider(); defaultConcurrentAsyncOption = provider != null ? provider.provideDefaultOption() : null; if (defaultConcurrentAsyncOption == null) { defaultConcurrentAsyncOption = new ConcurrentAsyncOption(); // depends on control dependency: [if], data = [none] } primaryExecutorService = createDefaultPrimaryExecutorService(provider); secondaryExecutorService = createDefaultSecondaryExecutorService(provider); tertiaryExecutorService = createDefaultSecondaryExecutorService(provider); showBootLogging(); } }
public class class_name { public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { val name = SpringRestClientEnabledScan.class.getName(); val annotationAttributes = importingClassMetadata.getAnnotationAttributes(name); val scanner = new ClassPathSpringRestClientScanner(registry); if (resourceLoader != null) { // this check is needed in Spring 3.1 scanner.setResourceLoader(resourceLoader); } val annoAttrs = AnnotationAttributes.fromMap(annotationAttributes); Class<? extends BeanNameGenerator> generatorClass; generatorClass = annoAttrs.getClass("nameGenerator"); if (!BeanNameGenerator.class.equals(generatorClass)) { scanner.setBeanNameGenerator(BeanUtils.instantiateClass(generatorClass)); } val basePackages = new ArrayList<String>(); for (val pkg : annoAttrs.getStringArray("value")) { if (StringUtils.hasText(pkg)) basePackages.add(pkg); } for (val pkg : annoAttrs.getStringArray("basePackages")) { if (StringUtils.hasText(pkg)) basePackages.add(pkg); } for (val clazz : annoAttrs.getClassArray("basePackageClasses")) { basePackages.add(ClassUtils.getPackageName(clazz)); } if (basePackages.isEmpty()) { String className = importingClassMetadata.getClassName(); basePackages.add(ClassUtils.getPackageName(className)); } scanner.registerFilters(); scanner.doScan(StringUtils.toStringArray(basePackages)); } }
public class class_name { public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { val name = SpringRestClientEnabledScan.class.getName(); val annotationAttributes = importingClassMetadata.getAnnotationAttributes(name); val scanner = new ClassPathSpringRestClientScanner(registry); if (resourceLoader != null) { // this check is needed in Spring 3.1 scanner.setResourceLoader(resourceLoader); // depends on control dependency: [if], data = [(resourceLoader] } val annoAttrs = AnnotationAttributes.fromMap(annotationAttributes); Class<? extends BeanNameGenerator> generatorClass; generatorClass = annoAttrs.getClass("nameGenerator"); if (!BeanNameGenerator.class.equals(generatorClass)) { scanner.setBeanNameGenerator(BeanUtils.instantiateClass(generatorClass)); // depends on control dependency: [if], data = [none] } val basePackages = new ArrayList<String>(); for (val pkg : annoAttrs.getStringArray("value")) { if (StringUtils.hasText(pkg)) basePackages.add(pkg); } for (val pkg : annoAttrs.getStringArray("basePackages")) { if (StringUtils.hasText(pkg)) basePackages.add(pkg); } for (val clazz : annoAttrs.getClassArray("basePackageClasses")) { basePackages.add(ClassUtils.getPackageName(clazz)); // depends on control dependency: [for], data = [clazz] } if (basePackages.isEmpty()) { String className = importingClassMetadata.getClassName(); basePackages.add(ClassUtils.getPackageName(className)); // depends on control dependency: [if], data = [none] } scanner.registerFilters(); scanner.doScan(StringUtils.toStringArray(basePackages)); } }
public class class_name { public Future<Void> forceClose() { this.close(); if (forceClosing.compareAndSet(false, true) && channel.isOpen()) { writeCoalescer .writeAndFlush(channel, FORCEFUL_CLOSE_MESSAGE) .addListener(UncaughtExceptions::log); } return channel.closeFuture(); } }
public class class_name { public Future<Void> forceClose() { this.close(); if (forceClosing.compareAndSet(false, true) && channel.isOpen()) { writeCoalescer .writeAndFlush(channel, FORCEFUL_CLOSE_MESSAGE) .addListener(UncaughtExceptions::log); // depends on control dependency: [if], data = [none] } return channel.closeFuture(); } }
public class class_name { public <E extends Enum<E>> List<E> getTypeList(Class<E> clz, E[] typeList) { if (typeList.length > 0) { return new ArrayList<>(Arrays.asList(typeList)); } else { return new ArrayList<>(EnumSet.allOf(clz)); } } }
public class class_name { public <E extends Enum<E>> List<E> getTypeList(Class<E> clz, E[] typeList) { if (typeList.length > 0) { return new ArrayList<>(Arrays.asList(typeList)); // depends on control dependency: [if], data = [none] } else { return new ArrayList<>(EnumSet.allOf(clz)); // depends on control dependency: [if], data = [none] } } }
public class class_name { @SuppressWarnings("unchecked") public static synchronized <F> F getInstance(Class<?> objectType, Class<F> factory) { try { return org.cojen.util.QuickConstructorGenerator.getInstance(objectType, factory); } catch (NoClassDefFoundError e) { // Use older code instead. } SoftValuedCache<Class<?>, Object> innerCache = cCache.get(factory); if (innerCache == null) { innerCache = SoftValuedCache.newCache(7); cCache.put(factory, innerCache); } F instance = (F) innerCache.get(objectType); if (instance != null) { return instance; } if (objectType == null) { throw new IllegalArgumentException("No object type"); } if (factory == null) { throw new IllegalArgumentException("No factory type"); } if (!factory.isInterface()) { throw new IllegalArgumentException("Factory must be an interface"); } String prefix = objectType.getName(); if (prefix.startsWith("java.")) { // Defining classes in java packages is restricted. int index = prefix.lastIndexOf('.'); if (index > 0) { prefix = prefix.substring(index + 1); } } ClassInjector ci = ClassInjector.create(prefix, objectType.getClassLoader()); ClassFile cf = null; for (Method method : factory.getMethods()) { if (!Modifier.isAbstract(method.getModifiers())) { continue; } Constructor ctor; try { ctor = objectType.getConstructor((Class[]) method.getParameterTypes()); } catch (NoSuchMethodException e) { throw new IllegalArgumentException(e); } if (!method.getReturnType().isAssignableFrom(objectType)) { throw new IllegalArgumentException ("Method return type must be \"" + objectType.getName() + "\" or supertype: " + method); } Class<?>[] methodExTypes = method.getExceptionTypes(); for (Class<?> ctorExType : ctor.getExceptionTypes()) { if (RuntimeException.class.isAssignableFrom(ctorExType) || Error.class.isAssignableFrom(ctorExType)) { continue; } exCheck: { // Make sure method declares throwing it or a supertype. for (Class<?> methodExType : methodExTypes) { if (methodExType.isAssignableFrom(ctorExType)) { break exCheck; } } throw new IllegalArgumentException("Method must declare throwing \"" + ctorExType.getName() +"\": " + method); } } if (cf == null) { cf = new ClassFile(ci.getClassName()); cf.setSourceFile(QuickConstructorGenerator.class.getName()); cf.setTarget("1.5"); cf.addInterface(factory); cf.markSynthetic(); cf.addDefaultConstructor(); } // Now define the method that constructs the object. CodeBuilder b = new CodeBuilder(cf.addMethod(method)); b.newObject(TypeDesc.forClass(objectType)); b.dup(); int count = b.getParameterCount(); for (int i=0; i<count; i++) { b.loadLocal(b.getParameter(i)); } b.invoke(ctor); b.returnValue(TypeDesc.OBJECT); } if (cf == null) { // No methods found to implement. throw new IllegalArgumentException("No methods in factory to implement"); } try { instance = (F) ci.defineClass(cf).newInstance(); } catch (IllegalAccessException e) { throw new UndeclaredThrowableException(e); } catch (InstantiationException e) { throw new UndeclaredThrowableException(e); } innerCache.put(objectType, instance); return instance; } }
public class class_name { @SuppressWarnings("unchecked") public static synchronized <F> F getInstance(Class<?> objectType, Class<F> factory) { try { return org.cojen.util.QuickConstructorGenerator.getInstance(objectType, factory); // depends on control dependency: [try], data = [none] } catch (NoClassDefFoundError e) { // Use older code instead. } // depends on control dependency: [catch], data = [none] SoftValuedCache<Class<?>, Object> innerCache = cCache.get(factory); if (innerCache == null) { innerCache = SoftValuedCache.newCache(7); // depends on control dependency: [if], data = [none] cCache.put(factory, innerCache); // depends on control dependency: [if], data = [none] } F instance = (F) innerCache.get(objectType); if (instance != null) { return instance; // depends on control dependency: [if], data = [none] } if (objectType == null) { throw new IllegalArgumentException("No object type"); } if (factory == null) { throw new IllegalArgumentException("No factory type"); } if (!factory.isInterface()) { throw new IllegalArgumentException("Factory must be an interface"); } String prefix = objectType.getName(); if (prefix.startsWith("java.")) { // Defining classes in java packages is restricted. int index = prefix.lastIndexOf('.'); if (index > 0) { prefix = prefix.substring(index + 1); // depends on control dependency: [if], data = [(index] } } ClassInjector ci = ClassInjector.create(prefix, objectType.getClassLoader()); ClassFile cf = null; for (Method method : factory.getMethods()) { if (!Modifier.isAbstract(method.getModifiers())) { continue; } Constructor ctor; try { ctor = objectType.getConstructor((Class[]) method.getParameterTypes()); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException e) { throw new IllegalArgumentException(e); } // depends on control dependency: [catch], data = [none] if (!method.getReturnType().isAssignableFrom(objectType)) { throw new IllegalArgumentException ("Method return type must be \"" + objectType.getName() + "\" or supertype: " + method); } Class<?>[] methodExTypes = method.getExceptionTypes(); for (Class<?> ctorExType : ctor.getExceptionTypes()) { if (RuntimeException.class.isAssignableFrom(ctorExType) || Error.class.isAssignableFrom(ctorExType)) { continue; } exCheck: { // Make sure method declares throwing it or a supertype. for (Class<?> methodExType : methodExTypes) { if (methodExType.isAssignableFrom(ctorExType)) { break exCheck; } } throw new IllegalArgumentException("Method must declare throwing \"" + ctorExType.getName() +"\": " + method); } } if (cf == null) { cf = new ClassFile(ci.getClassName()); // depends on control dependency: [if], data = [none] cf.setSourceFile(QuickConstructorGenerator.class.getName()); // depends on control dependency: [if], data = [none] cf.setTarget("1.5"); // depends on control dependency: [if], data = [none] cf.addInterface(factory); // depends on control dependency: [if], data = [none] cf.markSynthetic(); // depends on control dependency: [if], data = [none] cf.addDefaultConstructor(); // depends on control dependency: [if], data = [none] } // Now define the method that constructs the object. CodeBuilder b = new CodeBuilder(cf.addMethod(method)); b.newObject(TypeDesc.forClass(objectType)); // depends on control dependency: [for], data = [none] b.dup(); // depends on control dependency: [for], data = [none] int count = b.getParameterCount(); for (int i=0; i<count; i++) { b.loadLocal(b.getParameter(i)); // depends on control dependency: [for], data = [i] } b.invoke(ctor); // depends on control dependency: [for], data = [none] b.returnValue(TypeDesc.OBJECT); // depends on control dependency: [for], data = [none] } if (cf == null) { // No methods found to implement. throw new IllegalArgumentException("No methods in factory to implement"); } try { instance = (F) ci.defineClass(cf).newInstance(); // depends on control dependency: [try], data = [none] } catch (IllegalAccessException e) { throw new UndeclaredThrowableException(e); } catch (InstantiationException e) { // depends on control dependency: [catch], data = [none] throw new UndeclaredThrowableException(e); } // depends on control dependency: [catch], data = [none] innerCache.put(objectType, instance); return instance; } }
public class class_name { private final void connectToProvider(String itemName) { log.debug("Attempting connection to {}", itemName); IMessageInput in = msgInReference.get(); if (in == null) { in = providerService.getLiveProviderInput(subscriberStream.getScope(), itemName, true); msgInReference.set(in); } if (in != null) { log.debug("Provider: {}", msgInReference.get()); if (in.subscribe(this, null)) { log.debug("Subscribed to {} provider", itemName); // execute the processes to get Live playback setup try { playLive(); } catch (IOException e) { log.warn("Could not play live stream: {}", itemName, e); } } else { log.warn("Subscribe to {} provider failed", itemName); } } else { log.warn("Provider was not found for {}", itemName); StreamService.sendNetStreamStatus(subscriberStream.getConnection(), StatusCodes.NS_PLAY_STREAMNOTFOUND, "Stream was not found", itemName, Status.ERROR, streamId); } } }
public class class_name { private final void connectToProvider(String itemName) { log.debug("Attempting connection to {}", itemName); IMessageInput in = msgInReference.get(); if (in == null) { in = providerService.getLiveProviderInput(subscriberStream.getScope(), itemName, true); // depends on control dependency: [if], data = [none] msgInReference.set(in); // depends on control dependency: [if], data = [(in] } if (in != null) { log.debug("Provider: {}", msgInReference.get()); // depends on control dependency: [if], data = [none] if (in.subscribe(this, null)) { log.debug("Subscribed to {} provider", itemName); // depends on control dependency: [if], data = [none] // execute the processes to get Live playback setup try { playLive(); // depends on control dependency: [try], data = [none] } catch (IOException e) { log.warn("Could not play live stream: {}", itemName, e); } // depends on control dependency: [catch], data = [none] } else { log.warn("Subscribe to {} provider failed", itemName); // depends on control dependency: [if], data = [none] } } else { log.warn("Provider was not found for {}", itemName); // depends on control dependency: [if], data = [none] StreamService.sendNetStreamStatus(subscriberStream.getConnection(), StatusCodes.NS_PLAY_STREAMNOTFOUND, "Stream was not found", itemName, Status.ERROR, streamId); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected String defaultConfiguration() { final StringBuilder bldr = new StringBuilder(); for (final Entry<String, String> entry : defaults().entrySet()) { final String name = entry.getKey(); final String value = entry.getValue(); bldr.append(name); bldr.append(" "); bldr.append(NAME_VALUE_DELIMITER); bldr.append(" "); bldr.append(value); bldr.append("\n"); } return bldr.toString(); } }
public class class_name { protected String defaultConfiguration() { final StringBuilder bldr = new StringBuilder(); for (final Entry<String, String> entry : defaults().entrySet()) { final String name = entry.getKey(); final String value = entry.getValue(); bldr.append(name); // depends on control dependency: [for], data = [none] bldr.append(" "); // depends on control dependency: [for], data = [none] bldr.append(NAME_VALUE_DELIMITER); // depends on control dependency: [for], data = [none] bldr.append(" "); // depends on control dependency: [for], data = [none] bldr.append(value); // depends on control dependency: [for], data = [none] bldr.append("\n"); // depends on control dependency: [for], data = [none] } return bldr.toString(); } }
public class class_name { private void openUploadWithFiles(JavaScriptObject files) { JsArray<CmsFileInfo> cmsFiles = files.cast(); List<CmsFileInfo> fileObjects = new ArrayList<CmsFileInfo>(); for (int i = 0; i < cmsFiles.length(); ++i) { fileObjects.add(cmsFiles.get(i)); } CmsDialogUploadButtonHandler buttonHandler = new CmsDialogUploadButtonHandler( new Supplier<I_CmsUploadContext>() { /** * @see com.google.common.base.Supplier#get() */ public I_CmsUploadContext get() { return new I_CmsUploadContext() { public void onUploadFinished(List<String> uploadedFiles) { uploadFinished(uploadedFiles); } }; } }); buttonHandler.setIsTargetRootPath(true); buttonHandler.setTargetFolder(getState().getTargetFolderRootPath()); buttonHandler.openDialogWithFiles(fileObjects); } }
public class class_name { private void openUploadWithFiles(JavaScriptObject files) { JsArray<CmsFileInfo> cmsFiles = files.cast(); List<CmsFileInfo> fileObjects = new ArrayList<CmsFileInfo>(); for (int i = 0; i < cmsFiles.length(); ++i) { fileObjects.add(cmsFiles.get(i)); // depends on control dependency: [for], data = [i] } CmsDialogUploadButtonHandler buttonHandler = new CmsDialogUploadButtonHandler( new Supplier<I_CmsUploadContext>() { /** * @see com.google.common.base.Supplier#get() */ public I_CmsUploadContext get() { return new I_CmsUploadContext() { public void onUploadFinished(List<String> uploadedFiles) { uploadFinished(uploadedFiles); } }; } }); buttonHandler.setIsTargetRootPath(true); buttonHandler.setTargetFolder(getState().getTargetFolderRootPath()); buttonHandler.openDialogWithFiles(fileObjects); } }
public class class_name { private static void closeDB(PersistenceManager pm) { if (pm.currentTransaction().isActive()) { pm.currentTransaction().rollback(); } pm.close(); pm.getPersistenceManagerFactory().close(); } }
public class class_name { private static void closeDB(PersistenceManager pm) { if (pm.currentTransaction().isActive()) { pm.currentTransaction().rollback(); // depends on control dependency: [if], data = [none] } pm.close(); pm.getPersistenceManagerFactory().close(); } }
public class class_name { public QueryResult executeQuery(String query) throws FMSException { IntuitMessage intuitMessage = prepareQuery(query); // execute interceptors executeInterceptors(intuitMessage); QueryResult queryResult = null; // Iterate the IntuitObjects list in QueryResponse and convert to <T> entity IntuitResponse intuitResponse = (IntuitResponse) intuitMessage.getResponseElements().getResponse(); if (intuitResponse != null) { QueryResponse queryResponse = intuitResponse.getQueryResponse(); if (queryResponse != null) { queryResult = getQueryResult(queryResponse); } } return queryResult; } }
public class class_name { public QueryResult executeQuery(String query) throws FMSException { IntuitMessage intuitMessage = prepareQuery(query); // execute interceptors executeInterceptors(intuitMessage); QueryResult queryResult = null; // Iterate the IntuitObjects list in QueryResponse and convert to <T> entity IntuitResponse intuitResponse = (IntuitResponse) intuitMessage.getResponseElements().getResponse(); if (intuitResponse != null) { QueryResponse queryResponse = intuitResponse.getQueryResponse(); if (queryResponse != null) { queryResult = getQueryResult(queryResponse); // depends on control dependency: [if], data = [(queryResponse] } } return queryResult; } }
public class class_name { public static String getEndDateOfMonth(String dat) {// yyyy-MM-dd String str = dat.substring(0, 8); String month = dat.substring(5, 7); int mon = Integer.parseInt(month); if (mon == 1 || mon == 3 || mon == 5 || mon == 7 || mon == 8 || mon == 10 || mon == 12) { str += "31"; } else if (mon == 4 || mon == 6 || mon == 9 || mon == 11) { str += "30"; } else { if (isLeapYear(dat)) { str += "29"; } else { str += "28"; } } return str; } }
public class class_name { public static String getEndDateOfMonth(String dat) {// yyyy-MM-dd String str = dat.substring(0, 8); String month = dat.substring(5, 7); int mon = Integer.parseInt(month); if (mon == 1 || mon == 3 || mon == 5 || mon == 7 || mon == 8 || mon == 10 || mon == 12) { str += "31"; // depends on control dependency: [if], data = [none] } else if (mon == 4 || mon == 6 || mon == 9 || mon == 11) { str += "30"; // depends on control dependency: [if], data = [none] } else { if (isLeapYear(dat)) { str += "29"; // depends on control dependency: [if], data = [none] } else { str += "28"; // depends on control dependency: [if], data = [none] } } return str; } }
public class class_name { @Nullable static View getView(Context context, int resourceId, View view) { LayoutInflater inflater = LayoutInflater.from(context); if (view != null) { return view; } if (resourceId != INVALID) { view = inflater.inflate(resourceId, null); } return view; } }
public class class_name { @Nullable static View getView(Context context, int resourceId, View view) { LayoutInflater inflater = LayoutInflater.from(context); if (view != null) { return view; // depends on control dependency: [if], data = [none] } if (resourceId != INVALID) { view = inflater.inflate(resourceId, null); // depends on control dependency: [if], data = [(resourceId] } return view; } }
public class class_name { @Override public ResultSet foreignKeyCheck() { ResultSet resultSet = query("PRAGMA foreign_key_check", null); try { if (!resultSet.next()) { resultSet.close(); resultSet = null; } } catch (SQLException e) { throw new GeoPackageException( "Foreign key check failed on database: " + getName(), e); } return resultSet; } }
public class class_name { @Override public ResultSet foreignKeyCheck() { ResultSet resultSet = query("PRAGMA foreign_key_check", null); try { if (!resultSet.next()) { resultSet.close(); // depends on control dependency: [if], data = [none] resultSet = null; // depends on control dependency: [if], data = [none] } } catch (SQLException e) { throw new GeoPackageException( "Foreign key check failed on database: " + getName(), e); } // depends on control dependency: [catch], data = [none] return resultSet; } }
public class class_name { public String getTableName(String table, Number shardKey) { if (orMapping.getShardCount() <= 1 || shardKey == null || shardKey.longValue() <= 0) { return table; } return table + calShardNum(shardKey.longValue()); } }
public class class_name { public String getTableName(String table, Number shardKey) { if (orMapping.getShardCount() <= 1 || shardKey == null || shardKey.longValue() <= 0) { return table; // depends on control dependency: [if], data = [none] } return table + calShardNum(shardKey.longValue()); } }
public class class_name { public <TTDPO> TransformedDataProviderContext transform(Transformer<TDPO, TTDPO> ruleInputTransformer) { if (ruleInputTransformer != null) { addedRuleInputTransformers.add(ruleInputTransformer); } // Change context because output type has changed return new TransformedDataProviderContext<DPO, TTDPO>(addedTriggers, addedDataProviders, dataProviderToRuleMapping, addedRuleInputTransformers); } }
public class class_name { public <TTDPO> TransformedDataProviderContext transform(Transformer<TDPO, TTDPO> ruleInputTransformer) { if (ruleInputTransformer != null) { addedRuleInputTransformers.add(ruleInputTransformer); // depends on control dependency: [if], data = [(ruleInputTransformer] } // Change context because output type has changed return new TransformedDataProviderContext<DPO, TTDPO>(addedTriggers, addedDataProviders, dataProviderToRuleMapping, addedRuleInputTransformers); } }
public class class_name { static void register(Object value) { if (value != null) { Map<Object, Object> m = getRegistry(); if (m == null) { REGISTRY.set(new WeakHashMap<Object, Object>()); } getRegistry().put(value, null); } } }
public class class_name { static void register(Object value) { if (value != null) { Map<Object, Object> m = getRegistry(); if (m == null) { REGISTRY.set(new WeakHashMap<Object, Object>()); // depends on control dependency: [if], data = [none] } getRegistry().put(value, null); // depends on control dependency: [if], data = [(value] } } }
public class class_name { private void addPostParams(final Request request) { if (friendlyName != null) { request.addPostParam("FriendlyName", friendlyName); } if (status != null) { request.addPostParam("Status", status.toString()); } } }
public class class_name { private void addPostParams(final Request request) { if (friendlyName != null) { request.addPostParam("FriendlyName", friendlyName); // depends on control dependency: [if], data = [none] } if (status != null) { request.addPostParam("Status", status.toString()); // depends on control dependency: [if], data = [none] } } }
public class class_name { @UiThread public void removeObjectSync(T object) { //To make sure all the appropriate callbacks happen, we just want to piggyback on the //existing code that handles deleting spans when the text changes ArrayList<Editable>texts = new ArrayList<>(); //If there is hidden content, it's important that we update it first if (hiddenContent != null) { texts.add(hiddenContent); } if (getText() != null) { texts.add(getText()); } // If the object is currently visible, remove it for (Editable text: texts) { TokenImageSpan[] spans = text.getSpans(0, text.length(), TokenImageSpan.class); for (TokenImageSpan span : spans) { if (span.getToken().equals(object)) { removeSpan(text, span); } } } updateCountSpan(); } }
public class class_name { @UiThread public void removeObjectSync(T object) { //To make sure all the appropriate callbacks happen, we just want to piggyback on the //existing code that handles deleting spans when the text changes ArrayList<Editable>texts = new ArrayList<>(); //If there is hidden content, it's important that we update it first if (hiddenContent != null) { texts.add(hiddenContent); // depends on control dependency: [if], data = [(hiddenContent] } if (getText() != null) { texts.add(getText()); // depends on control dependency: [if], data = [(getText()] } // If the object is currently visible, remove it for (Editable text: texts) { TokenImageSpan[] spans = text.getSpans(0, text.length(), TokenImageSpan.class); for (TokenImageSpan span : spans) { if (span.getToken().equals(object)) { removeSpan(text, span); // depends on control dependency: [if], data = [none] } } } updateCountSpan(); } }
public class class_name { protected String printConcept(int id) { Object oid = factory.lookupConceptId(id); if(factory.isVirtualConcept(id)) { if(oid instanceof AbstractConcept) { return printAbstractConcept((AbstractConcept) oid); } else { return oid.toString(); } } else { return (String) oid; } } }
public class class_name { protected String printConcept(int id) { Object oid = factory.lookupConceptId(id); if(factory.isVirtualConcept(id)) { if(oid instanceof AbstractConcept) { return printAbstractConcept((AbstractConcept) oid); // depends on control dependency: [if], data = [none] } else { return oid.toString(); // depends on control dependency: [if], data = [none] } } else { return (String) oid; // depends on control dependency: [if], data = [none] } } }
public class class_name { private boolean isDeadlockError(Throwable e) { // Looking for PersistenceException, wrapping a LockAcquisitionException if (e != null && e instanceof PersistenceException) { e = e.getCause(); if (e != null && e instanceof LockAcquisitionException) { return true; } } // Does not match return false; } }
public class class_name { private boolean isDeadlockError(Throwable e) { // Looking for PersistenceException, wrapping a LockAcquisitionException if (e != null && e instanceof PersistenceException) { e = e.getCause(); // depends on control dependency: [if], data = [none] if (e != null && e instanceof LockAcquisitionException) { return true; // depends on control dependency: [if], data = [none] } } // Does not match return false; } }
public class class_name { private boolean isPosTokenMatched(AnalyzedToken token) { if (posToken == null || posToken.posTag == null) { // if no POS set defaulting to true return true; } if (token.getPOSTag() == null) { return posToken.posUnknown && token.hasNoTag(); } boolean match; if (posToken.regExp) { Matcher mPos = posToken.posPattern.matcher(token.getPOSTag()); match = mPos.matches(); } else { match = posToken.posTag.equals(token.getPOSTag()); } if (!match && posToken.posUnknown) { // ignore helper tags match = token.hasNoTag(); } return match; } }
public class class_name { private boolean isPosTokenMatched(AnalyzedToken token) { if (posToken == null || posToken.posTag == null) { // if no POS set defaulting to true return true; // depends on control dependency: [if], data = [none] } if (token.getPOSTag() == null) { return posToken.posUnknown && token.hasNoTag(); // depends on control dependency: [if], data = [none] } boolean match; if (posToken.regExp) { Matcher mPos = posToken.posPattern.matcher(token.getPOSTag()); match = mPos.matches(); // depends on control dependency: [if], data = [none] } else { match = posToken.posTag.equals(token.getPOSTag()); // depends on control dependency: [if], data = [none] } if (!match && posToken.posUnknown) { // ignore helper tags match = token.hasNoTag(); // depends on control dependency: [if], data = [none] } return match; } }
public class class_name { private static Iterable<ParameterSpec> parameters(Iterable<Parameter> parameters) { ImmutableList.Builder<ParameterSpec> builder = ImmutableList.builder(); for (Parameter parameter : parameters) { ParameterSpec.Builder parameterBuilder = ParameterSpec.builder(TypeName.get(parameter.type()), parameter.name()); for (AnnotationMirror annotation : Iterables.concat(parameter.nullable().asSet(), parameter.key().qualifier().asSet())) { parameterBuilder.addAnnotation(AnnotationSpec.get(annotation)); } builder.add(parameterBuilder.build()); } return builder.build(); } }
public class class_name { private static Iterable<ParameterSpec> parameters(Iterable<Parameter> parameters) { ImmutableList.Builder<ParameterSpec> builder = ImmutableList.builder(); for (Parameter parameter : parameters) { ParameterSpec.Builder parameterBuilder = ParameterSpec.builder(TypeName.get(parameter.type()), parameter.name()); for (AnnotationMirror annotation : Iterables.concat(parameter.nullable().asSet(), parameter.key().qualifier().asSet())) { parameterBuilder.addAnnotation(AnnotationSpec.get(annotation)); // depends on control dependency: [for], data = [annotation] } builder.add(parameterBuilder.build()); // depends on control dependency: [for], data = [parameter] } return builder.build(); } }
public class class_name { public void setGroupIdentifiers(java.util.Collection<GroupIdentifier> groupIdentifiers) { if (groupIdentifiers == null) { this.groupIdentifiers = null; return; } this.groupIdentifiers = new java.util.ArrayList<GroupIdentifier>(groupIdentifiers); } }
public class class_name { public void setGroupIdentifiers(java.util.Collection<GroupIdentifier> groupIdentifiers) { if (groupIdentifiers == null) { this.groupIdentifiers = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.groupIdentifiers = new java.util.ArrayList<GroupIdentifier>(groupIdentifiers); } }
public class class_name { @SuppressWarnings("unchecked") public static <K, V> Map<K, V> createMap(Class<?> mapType) { if (mapType.isAssignableFrom(AbstractMap.class)) { return new HashMap<>(); } else { return (Map<K, V>) ReflectUtil.newInstance(mapType); } } }
public class class_name { @SuppressWarnings("unchecked") public static <K, V> Map<K, V> createMap(Class<?> mapType) { if (mapType.isAssignableFrom(AbstractMap.class)) { return new HashMap<>(); // depends on control dependency: [if], data = [none] } else { return (Map<K, V>) ReflectUtil.newInstance(mapType); // depends on control dependency: [if], data = [none] } } }
public class class_name { public TableDescription withAttributeDefinitions(AttributeDefinition... attributeDefinitions) { if (this.attributeDefinitions == null) { setAttributeDefinitions(new java.util.ArrayList<AttributeDefinition>(attributeDefinitions.length)); } for (AttributeDefinition ele : attributeDefinitions) { this.attributeDefinitions.add(ele); } return this; } }
public class class_name { public TableDescription withAttributeDefinitions(AttributeDefinition... attributeDefinitions) { if (this.attributeDefinitions == null) { setAttributeDefinitions(new java.util.ArrayList<AttributeDefinition>(attributeDefinitions.length)); // depends on control dependency: [if], data = [none] } for (AttributeDefinition ele : attributeDefinitions) { this.attributeDefinitions.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public final void variableDeclarators() throws RecognitionException { int variableDeclarators_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 38) ) { return; } // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:451:5: ( variableDeclarator ( ',' variableDeclarator )* ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:451:7: variableDeclarator ( ',' variableDeclarator )* { pushFollow(FOLLOW_variableDeclarator_in_variableDeclarators1303); variableDeclarator(); state._fsp--; if (state.failed) return; // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:451:26: ( ',' variableDeclarator )* loop53: while (true) { int alt53=2; int LA53_0 = input.LA(1); if ( (LA53_0==43) ) { alt53=1; } switch (alt53) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:451:27: ',' variableDeclarator { match(input,43,FOLLOW_43_in_variableDeclarators1306); if (state.failed) return; pushFollow(FOLLOW_variableDeclarator_in_variableDeclarators1308); variableDeclarator(); state._fsp--; if (state.failed) return; } break; default : break loop53; } } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 38, variableDeclarators_StartIndex); } } } }
public class class_name { public final void variableDeclarators() throws RecognitionException { int variableDeclarators_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 38) ) { return; } // depends on control dependency: [if], data = [none] // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:451:5: ( variableDeclarator ( ',' variableDeclarator )* ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:451:7: variableDeclarator ( ',' variableDeclarator )* { pushFollow(FOLLOW_variableDeclarator_in_variableDeclarators1303); variableDeclarator(); state._fsp--; if (state.failed) return; // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:451:26: ( ',' variableDeclarator )* loop53: while (true) { int alt53=2; int LA53_0 = input.LA(1); if ( (LA53_0==43) ) { alt53=1; // depends on control dependency: [if], data = [none] } switch (alt53) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:451:27: ',' variableDeclarator { match(input,43,FOLLOW_43_in_variableDeclarators1306); if (state.failed) return; pushFollow(FOLLOW_variableDeclarator_in_variableDeclarators1308); variableDeclarator(); state._fsp--; if (state.failed) return; } break; default : break loop53; } } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 38, variableDeclarators_StartIndex); } // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setLematized(String lematized) { if(lematized != null) { lematized = lematized.trim(); } this.lematized = lematized; } }
public class class_name { public void setLematized(String lematized) { if(lematized != null) { lematized = lematized.trim(); // depends on control dependency: [if], data = [none] } this.lematized = lematized; } }
public class class_name { public static <T extends ArbitrateLifeCycle> void destory(Long pipelineId, Class<T> instanceClass) { Map<Class, Object> resources = cache.get(pipelineId); if (resources != null) { Object obj = resources.remove(instanceClass); if (obj instanceof ArbitrateLifeCycle) { ArbitrateLifeCycle lifeCycle = (ArbitrateLifeCycle) obj; lifeCycle.destory();// 调用销毁方法 } } } }
public class class_name { public static <T extends ArbitrateLifeCycle> void destory(Long pipelineId, Class<T> instanceClass) { Map<Class, Object> resources = cache.get(pipelineId); if (resources != null) { Object obj = resources.remove(instanceClass); if (obj instanceof ArbitrateLifeCycle) { ArbitrateLifeCycle lifeCycle = (ArbitrateLifeCycle) obj; lifeCycle.destory();// 调用销毁方法 // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static LocalFilter fromOptionalParams(List<Param> optionalParams) { LocalFilter filter = new LocalFilter(); Param p = filter.getQueryParam(optionalParams); if (p == null) { return null; } filter.value = p.getValue(); return filter; } }
public class class_name { public static LocalFilter fromOptionalParams(List<Param> optionalParams) { LocalFilter filter = new LocalFilter(); Param p = filter.getQueryParam(optionalParams); if (p == null) { return null; // depends on control dependency: [if], data = [none] } filter.value = p.getValue(); return filter; } }
public class class_name { public void marshall(DescribeUserProfileRequest describeUserProfileRequest, ProtocolMarshaller protocolMarshaller) { if (describeUserProfileRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeUserProfileRequest.getUserArn(), USERARN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DescribeUserProfileRequest describeUserProfileRequest, ProtocolMarshaller protocolMarshaller) { if (describeUserProfileRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeUserProfileRequest.getUserArn(), USERARN_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected void initTemplates(Element root, CmsXmlContentDefinition contentDefinition) { String strEnabledByDefault = root.attributeValue(ATTR_ENABLED_BY_DEFAULT); m_allowedTemplates.setDefaultMembership(safeParseBoolean(strEnabledByDefault, true)); List<Node> elements = root.selectNodes(APPINFO_TEMPLATE); for (Node elem : elements) { boolean enabled = safeParseBoolean(((Element)elem).attributeValue(ATTR_ENABLED), true); String templateName = elem.getText().trim(); m_allowedTemplates.setContains(templateName, enabled); } m_allowedTemplates.freeze(); } }
public class class_name { protected void initTemplates(Element root, CmsXmlContentDefinition contentDefinition) { String strEnabledByDefault = root.attributeValue(ATTR_ENABLED_BY_DEFAULT); m_allowedTemplates.setDefaultMembership(safeParseBoolean(strEnabledByDefault, true)); List<Node> elements = root.selectNodes(APPINFO_TEMPLATE); for (Node elem : elements) { boolean enabled = safeParseBoolean(((Element)elem).attributeValue(ATTR_ENABLED), true); String templateName = elem.getText().trim(); m_allowedTemplates.setContains(templateName, enabled); // depends on control dependency: [for], data = [none] } m_allowedTemplates.freeze(); } }
public class class_name { public void setProperty(String property, Object newValue) { if (newValue instanceof Closure) { if (property.equals(CONSTRUCTOR)) { property = GROOVY_CONSTRUCTOR; } Closure callable = (Closure) newValue; final List<MetaMethod> list = ClosureMetaMethod.createMethodList(property, theClass, callable); for (MetaMethod method : list) { // here we don't care if the method exists or not we assume the // developer is responsible and wants to override methods where necessary registerInstanceMethod(method); } } else { registerBeanProperty(property, newValue); } } }
public class class_name { public void setProperty(String property, Object newValue) { if (newValue instanceof Closure) { if (property.equals(CONSTRUCTOR)) { property = GROOVY_CONSTRUCTOR; // depends on control dependency: [if], data = [none] } Closure callable = (Closure) newValue; final List<MetaMethod> list = ClosureMetaMethod.createMethodList(property, theClass, callable); for (MetaMethod method : list) { // here we don't care if the method exists or not we assume the // developer is responsible and wants to override methods where necessary registerInstanceMethod(method); // depends on control dependency: [for], data = [method] } } else { registerBeanProperty(property, newValue); // depends on control dependency: [if], data = [none] } } }
public class class_name { static HSV toHSV( double color ) { long argb = Double.doubleToRawLongBits( color ); double a = alpha( color ); double r = clamp( ((argb >> 32) & 0xFFFF) / (double)0xFF00 ); double g = clamp( ((argb >> 16) & 0xFFFF) / (double)0xFF00 ); double b = clamp( ((argb >> 0) & 0xFFFF) / (double)0xFF00 ); double max = Math.max(Math.max(r, g), b); double min = Math.min(Math.min(r, g), b); double h, s, v = max; double d = max - min; if (max == 0) { s = 0; } else { s = d / max; } if (max == min) { h = 0; } else if( max == r ){ h = (g - b) / d + (g < b ? 6 : 0); } else if( max == g ){ h = (b - r) / d + 2; } else { //if( max == b ){ h = (r - g) / d + 4; } h /= 6; return new HSV( h * 360, s, v, a ); } }
public class class_name { static HSV toHSV( double color ) { long argb = Double.doubleToRawLongBits( color ); double a = alpha( color ); double r = clamp( ((argb >> 32) & 0xFFFF) / (double)0xFF00 ); double g = clamp( ((argb >> 16) & 0xFFFF) / (double)0xFF00 ); double b = clamp( ((argb >> 0) & 0xFFFF) / (double)0xFF00 ); double max = Math.max(Math.max(r, g), b); double min = Math.min(Math.min(r, g), b); double h, s, v = max; double d = max - min; if (max == 0) { s = 0; // depends on control dependency: [if], data = [none] } else { s = d / max; // depends on control dependency: [if], data = [none] } if (max == min) { h = 0; // depends on control dependency: [if], data = [none] } else if( max == r ){ h = (g - b) / d + (g < b ? 6 : 0); // depends on control dependency: [if], data = [none] } else if( max == g ){ h = (b - r) / d + 2; // depends on control dependency: [if], data = [none] } else { //if( max == b ){ h = (r - g) / d + 4; // depends on control dependency: [if], data = [none] } h /= 6; return new HSV( h * 360, s, v, a ); } }
public class class_name { private void setUpConditionStyles(JRDesignStyle jrstyle, AbstractColumn column) { if (getReport().getOptions().isPrintBackgroundOnOddRows() && Utils.isEmpty(column.getConditionalStyles())) { JRDesignExpression expression = new JRDesignExpression(); expression.setValueClass(Boolean.class); expression.setText(EXPRESSION_TRUE_WHEN_ODD); Style oddRowBackgroundStyle = getReport().getOptions().getOddRowBackgroundStyle(); JRDesignConditionalStyle condStyle = new JRDesignConditionalStyle(); condStyle.setBackcolor(oddRowBackgroundStyle.getBackgroundColor()); condStyle.setMode(ModeEnum.OPAQUE); condStyle.setConditionExpression(expression); jrstyle.addConditionalStyle(condStyle); return; } if (Utils.isEmpty(column.getConditionalStyles())) return; for (ConditionalStyle condition : column.getConditionalStyles()) { if (getReport().getOptions().isPrintBackgroundOnOddRows() && Transparency.TRANSPARENT == condition.getStyle().getTransparency()) { //condition style + odd row (only if conditional style's background is transparent) JRDesignExpression expressionForConditionalStyle = ExpressionUtils.getExpressionForConditionalStyle(condition, column.getTextForExpression()); String expStr = JRExpressionUtil.getExpressionText(expressionForConditionalStyle); //ODD JRDesignExpression expressionOdd = new JRDesignExpression(); expressionOdd.setValueClass(Boolean.class); expressionOdd.setText("new java.lang.Boolean(" + EXPRESSION_TRUE_WHEN_ODD + ".booleanValue() && ((java.lang.Boolean)" + expStr + ").booleanValue() )"); Style oddRowBackgroundStyle = getReport().getOptions().getOddRowBackgroundStyle(); JRDesignConditionalStyle condStyleOdd = makeConditionalStyle(condition.getStyle()); // Utils.copyProperties(condStyleOdd, condition.getStyle().transform()); condStyleOdd.setBackcolor(oddRowBackgroundStyle.getBackgroundColor()); condStyleOdd.setMode(ModeEnum.OPAQUE); condStyleOdd.setConditionExpression(expressionOdd); jrstyle.addConditionalStyle(condStyleOdd); //EVEN JRDesignExpression expressionEven = new JRDesignExpression(); expressionEven.setValueClass(Boolean.class); expressionEven.setText("new java.lang.Boolean(" + EXPRESSION_TRUE_WHEN_EVEN + ".booleanValue() && ((java.lang.Boolean)" + expStr + ").booleanValue() )"); JRDesignConditionalStyle condStyleEven = makeConditionalStyle(condition.getStyle()); condStyleEven.setConditionExpression(expressionEven); jrstyle.addConditionalStyle(condStyleEven); } else { //No odd row, just the conditional style JRDesignExpression expression = ExpressionUtils.getExpressionForConditionalStyle(condition, column.getTextForExpression()); JRDesignConditionalStyle condStyle = makeConditionalStyle(condition.getStyle()); condStyle.setConditionExpression(expression); jrstyle.addConditionalStyle(condStyle); } } //The last condition is the basic one //ODD if (getReport().getOptions().isPrintBackgroundOnOddRows()) { JRDesignExpression expressionOdd = new JRDesignExpression(); expressionOdd.setValueClass(Boolean.class); expressionOdd.setText(EXPRESSION_TRUE_WHEN_ODD); Style oddRowBackgroundStyle = getReport().getOptions().getOddRowBackgroundStyle(); JRDesignConditionalStyle condStyleOdd = new JRDesignConditionalStyle(); condStyleOdd.setBackcolor(oddRowBackgroundStyle.getBackgroundColor()); condStyleOdd.setMode(ModeEnum.OPAQUE); condStyleOdd.setConditionExpression(expressionOdd); jrstyle.addConditionalStyle(condStyleOdd); //EVEN JRDesignExpression expressionEven = new JRDesignExpression(); expressionEven.setValueClass(Boolean.class); expressionEven.setText(EXPRESSION_TRUE_WHEN_EVEN); JRDesignConditionalStyle condStyleEven = new JRDesignConditionalStyle(); condStyleEven.setBackcolor(jrstyle.getBackcolor()); condStyleEven.setMode(jrstyle.getModeValue()); condStyleEven.setConditionExpression(expressionEven); jrstyle.addConditionalStyle(condStyleEven); } } }
public class class_name { private void setUpConditionStyles(JRDesignStyle jrstyle, AbstractColumn column) { if (getReport().getOptions().isPrintBackgroundOnOddRows() && Utils.isEmpty(column.getConditionalStyles())) { JRDesignExpression expression = new JRDesignExpression(); expression.setValueClass(Boolean.class); // depends on control dependency: [if], data = [none] expression.setText(EXPRESSION_TRUE_WHEN_ODD); // depends on control dependency: [if], data = [none] Style oddRowBackgroundStyle = getReport().getOptions().getOddRowBackgroundStyle(); JRDesignConditionalStyle condStyle = new JRDesignConditionalStyle(); condStyle.setBackcolor(oddRowBackgroundStyle.getBackgroundColor()); // depends on control dependency: [if], data = [none] condStyle.setMode(ModeEnum.OPAQUE); // depends on control dependency: [if], data = [none] condStyle.setConditionExpression(expression); // depends on control dependency: [if], data = [none] jrstyle.addConditionalStyle(condStyle); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (Utils.isEmpty(column.getConditionalStyles())) return; for (ConditionalStyle condition : column.getConditionalStyles()) { if (getReport().getOptions().isPrintBackgroundOnOddRows() && Transparency.TRANSPARENT == condition.getStyle().getTransparency()) { //condition style + odd row (only if conditional style's background is transparent) JRDesignExpression expressionForConditionalStyle = ExpressionUtils.getExpressionForConditionalStyle(condition, column.getTextForExpression()); String expStr = JRExpressionUtil.getExpressionText(expressionForConditionalStyle); //ODD JRDesignExpression expressionOdd = new JRDesignExpression(); expressionOdd.setValueClass(Boolean.class); // depends on control dependency: [if], data = [none] expressionOdd.setText("new java.lang.Boolean(" + EXPRESSION_TRUE_WHEN_ODD + ".booleanValue() && ((java.lang.Boolean)" + expStr + ").booleanValue() )"); // depends on control dependency: [if], data = [none] Style oddRowBackgroundStyle = getReport().getOptions().getOddRowBackgroundStyle(); JRDesignConditionalStyle condStyleOdd = makeConditionalStyle(condition.getStyle()); // Utils.copyProperties(condStyleOdd, condition.getStyle().transform()); condStyleOdd.setBackcolor(oddRowBackgroundStyle.getBackgroundColor()); // depends on control dependency: [if], data = [none] condStyleOdd.setMode(ModeEnum.OPAQUE); // depends on control dependency: [if], data = [none] condStyleOdd.setConditionExpression(expressionOdd); // depends on control dependency: [if], data = [none] jrstyle.addConditionalStyle(condStyleOdd); // depends on control dependency: [if], data = [none] //EVEN JRDesignExpression expressionEven = new JRDesignExpression(); expressionEven.setValueClass(Boolean.class); // depends on control dependency: [if], data = [none] expressionEven.setText("new java.lang.Boolean(" + EXPRESSION_TRUE_WHEN_EVEN + ".booleanValue() && ((java.lang.Boolean)" + expStr + ").booleanValue() )"); // depends on control dependency: [if], data = [none] JRDesignConditionalStyle condStyleEven = makeConditionalStyle(condition.getStyle()); condStyleEven.setConditionExpression(expressionEven); // depends on control dependency: [if], data = [none] jrstyle.addConditionalStyle(condStyleEven); // depends on control dependency: [if], data = [none] } else { //No odd row, just the conditional style JRDesignExpression expression = ExpressionUtils.getExpressionForConditionalStyle(condition, column.getTextForExpression()); JRDesignConditionalStyle condStyle = makeConditionalStyle(condition.getStyle()); condStyle.setConditionExpression(expression); // depends on control dependency: [if], data = [none] jrstyle.addConditionalStyle(condStyle); // depends on control dependency: [if], data = [none] } } //The last condition is the basic one //ODD if (getReport().getOptions().isPrintBackgroundOnOddRows()) { JRDesignExpression expressionOdd = new JRDesignExpression(); expressionOdd.setValueClass(Boolean.class); // depends on control dependency: [if], data = [none] expressionOdd.setText(EXPRESSION_TRUE_WHEN_ODD); // depends on control dependency: [if], data = [none] Style oddRowBackgroundStyle = getReport().getOptions().getOddRowBackgroundStyle(); JRDesignConditionalStyle condStyleOdd = new JRDesignConditionalStyle(); condStyleOdd.setBackcolor(oddRowBackgroundStyle.getBackgroundColor()); // depends on control dependency: [if], data = [none] condStyleOdd.setMode(ModeEnum.OPAQUE); // depends on control dependency: [if], data = [none] condStyleOdd.setConditionExpression(expressionOdd); // depends on control dependency: [if], data = [none] jrstyle.addConditionalStyle(condStyleOdd); // depends on control dependency: [if], data = [none] //EVEN JRDesignExpression expressionEven = new JRDesignExpression(); expressionEven.setValueClass(Boolean.class); // depends on control dependency: [if], data = [none] expressionEven.setText(EXPRESSION_TRUE_WHEN_EVEN); // depends on control dependency: [if], data = [none] JRDesignConditionalStyle condStyleEven = new JRDesignConditionalStyle(); condStyleEven.setBackcolor(jrstyle.getBackcolor()); // depends on control dependency: [if], data = [none] condStyleEven.setMode(jrstyle.getModeValue()); // depends on control dependency: [if], data = [none] condStyleEven.setConditionExpression(expressionEven); // depends on control dependency: [if], data = [none] jrstyle.addConditionalStyle(condStyleEven); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static INDArray div(INDArray x, INDArray y, INDArray z, int... dimensions) { if(dimensions == null) { Preconditions.checkArgument(Arrays.equals(x.shape(),y.shape()),getFormattedShapeErrorMessageXy(x,y)); Preconditions.checkArgument(Arrays.equals(x.shape(),z.shape()),getFormattedShapeErrorMessageXResult(x,z)); return Nd4j.getExecutioner().execAndReturn(new OldDivOp(x,y,z)); } return Nd4j.getExecutioner().execAndReturn(new BroadcastDivOp(x,y,z,dimensions)); } }
public class class_name { public static INDArray div(INDArray x, INDArray y, INDArray z, int... dimensions) { if(dimensions == null) { Preconditions.checkArgument(Arrays.equals(x.shape(),y.shape()),getFormattedShapeErrorMessageXy(x,y)); // depends on control dependency: [if], data = [none] Preconditions.checkArgument(Arrays.equals(x.shape(),z.shape()),getFormattedShapeErrorMessageXResult(x,z)); // depends on control dependency: [if], data = [none] return Nd4j.getExecutioner().execAndReturn(new OldDivOp(x,y,z)); // depends on control dependency: [if], data = [none] } return Nd4j.getExecutioner().execAndReturn(new BroadcastDivOp(x,y,z,dimensions)); } }
public class class_name { private int comparePrecedence(char sourceRelation, char targetRelation) { int result = -1; int sourcePrecedence = getPrecedenceNumber(sourceRelation); int targetPrecedence = getPrecedenceNumber(targetRelation); if (sourcePrecedence < targetPrecedence) { result = 1; } else if (sourcePrecedence == targetPrecedence) { result = 0; } else { result = -1; } return result; } }
public class class_name { private int comparePrecedence(char sourceRelation, char targetRelation) { int result = -1; int sourcePrecedence = getPrecedenceNumber(sourceRelation); int targetPrecedence = getPrecedenceNumber(targetRelation); if (sourcePrecedence < targetPrecedence) { result = 1; // depends on control dependency: [if], data = [none] } else if (sourcePrecedence == targetPrecedence) { result = 0; // depends on control dependency: [if], data = [none] } else { result = -1; // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public List<DataMediaPair> listByIds(Long... identities) { List<DataMediaPair> dataMediaPairs = new ArrayList<DataMediaPair>(); try { List<DataMediaPairDO> dataMediaPairDos = null; if (identities.length < 1) { dataMediaPairDos = dataMediaPairDao.listAll(); if (dataMediaPairDos.isEmpty()) { logger.debug("DEBUG ## couldn't query any dataMediaPair, maybe hasn't create any dataMediaPair."); return dataMediaPairs; } } else { dataMediaPairDos = dataMediaPairDao.listByMultiId(identities); if (dataMediaPairDos.isEmpty()) { String exceptionCause = "couldn't query any dataMediaPair by dataMediaPairIds:" + Arrays.toString(identities); logger.error("ERROR ## " + exceptionCause); throw new ManagerException(exceptionCause); } } dataMediaPairs = doToModel(dataMediaPairDos); } catch (Exception e) { logger.error("ERROR ## query dataMediaPairs has an exception!", e); throw new ManagerException(e); } return dataMediaPairs; } }
public class class_name { public List<DataMediaPair> listByIds(Long... identities) { List<DataMediaPair> dataMediaPairs = new ArrayList<DataMediaPair>(); try { List<DataMediaPairDO> dataMediaPairDos = null; if (identities.length < 1) { dataMediaPairDos = dataMediaPairDao.listAll(); // depends on control dependency: [if], data = [none] if (dataMediaPairDos.isEmpty()) { logger.debug("DEBUG ## couldn't query any dataMediaPair, maybe hasn't create any dataMediaPair."); // depends on control dependency: [if], data = [none] return dataMediaPairs; // depends on control dependency: [if], data = [none] } } else { dataMediaPairDos = dataMediaPairDao.listByMultiId(identities); // depends on control dependency: [if], data = [none] if (dataMediaPairDos.isEmpty()) { String exceptionCause = "couldn't query any dataMediaPair by dataMediaPairIds:" + Arrays.toString(identities); logger.error("ERROR ## " + exceptionCause); // depends on control dependency: [if], data = [none] throw new ManagerException(exceptionCause); } } dataMediaPairs = doToModel(dataMediaPairDos); // depends on control dependency: [try], data = [none] } catch (Exception e) { logger.error("ERROR ## query dataMediaPairs has an exception!", e); throw new ManagerException(e); } // depends on control dependency: [catch], data = [none] return dataMediaPairs; } }
public class class_name { public static PropertiesBuilder builder(KnowledgeComponentImplementationModel implementationModel) { PropertiesModel propertiesModel = null; if (implementationModel != null) { propertiesModel = implementationModel.getProperties(); } return new PropertiesBuilder(propertiesModel); } }
public class class_name { public static PropertiesBuilder builder(KnowledgeComponentImplementationModel implementationModel) { PropertiesModel propertiesModel = null; if (implementationModel != null) { propertiesModel = implementationModel.getProperties(); // depends on control dependency: [if], data = [none] } return new PropertiesBuilder(propertiesModel); } }
public class class_name { protected Object doConvert(String value) { try { return format.parse(value); } catch (ParseException ex) { throw new IllegalArgumentException("Unsupported date format", ex); } } }
public class class_name { protected Object doConvert(String value) { try { return format.parse(value); // depends on control dependency: [try], data = [none] } catch (ParseException ex) { throw new IllegalArgumentException("Unsupported date format", ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private List<String> parse( URL url ) { InputStream is = null; BufferedReader reader = null; List<String> names = new ArrayList<String>(); try { is = url.openStream(); reader = new BufferedReader( new InputStreamReader( is, "UTF-8" ) ); String line = null; while( ( line = reader.readLine() ) != null ) { parseLine( names, line ); } } catch ( IOException exc ) { throw new NoServiceProviderException( exc ); } finally { closeSilently( reader ); } return names; } }
public class class_name { private List<String> parse( URL url ) { InputStream is = null; BufferedReader reader = null; List<String> names = new ArrayList<String>(); try { is = url.openStream(); // depends on control dependency: [try], data = [none] reader = new BufferedReader( new InputStreamReader( is, "UTF-8" ) ); // depends on control dependency: [try], data = [none] String line = null; while( ( line = reader.readLine() ) != null ) { parseLine( names, line ); // depends on control dependency: [while], data = [none] } } catch ( IOException exc ) { throw new NoServiceProviderException( exc ); } // depends on control dependency: [catch], data = [none] finally { closeSilently( reader ); } return names; } }
public class class_name { public static Throwable getOriginalCause(Throwable e) { if (e instanceof InvocationTargetException) { return getOriginalCause(((InvocationTargetException) e).getTargetException()); } if (e.getCause() instanceof Throwable) { return getOriginalCause(e.getCause()); } return e; } }
public class class_name { public static Throwable getOriginalCause(Throwable e) { if (e instanceof InvocationTargetException) { return getOriginalCause(((InvocationTargetException) e).getTargetException()); // depends on control dependency: [if], data = [none] } if (e.getCause() instanceof Throwable) { return getOriginalCause(e.getCause()); // depends on control dependency: [if], data = [none] } return e; } }
public class class_name { protected boolean isCandidateComponent(MetadataReader metadataReader) throws IOException { for (TypeFilter tf : this.excludeFilters) { if (tf.match(metadataReader, this.metadataReaderFactory)) { return false; } } for (TypeFilter tf : this.includeFilters) { if (tf.match(metadataReader, this.metadataReaderFactory)) { return true; } } return false; } }
public class class_name { protected boolean isCandidateComponent(MetadataReader metadataReader) throws IOException { for (TypeFilter tf : this.excludeFilters) { if (tf.match(metadataReader, this.metadataReaderFactory)) { return false; // depends on control dependency: [if], data = [none] } } for (TypeFilter tf : this.includeFilters) { if (tf.match(metadataReader, this.metadataReaderFactory)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public int get(int i, int j) { if (i < 0 || i >= size()) { throw new IllegalArgumentException("Invalid index: i = " + i); } int[] x = get(i).x; if (x.length == 0) { return 0; } int low = 0; int high = x.length - 1; int mid = (low + high) / 2; while (j != x[mid] && low <= high) { mid = (low + high) / 2; if (j < x[mid]) high = mid - 1; else low = mid + 1; } if (j == x[mid]) { return 1; } else { return 0; } } }
public class class_name { public int get(int i, int j) { if (i < 0 || i >= size()) { throw new IllegalArgumentException("Invalid index: i = " + i); } int[] x = get(i).x; if (x.length == 0) { return 0; // depends on control dependency: [if], data = [none] } int low = 0; int high = x.length - 1; int mid = (low + high) / 2; while (j != x[mid] && low <= high) { mid = (low + high) / 2; // depends on control dependency: [while], data = [none] if (j < x[mid]) high = mid - 1; else low = mid + 1; } if (j == x[mid]) { return 1; // depends on control dependency: [if], data = [none] } else { return 0; // depends on control dependency: [if], data = [none] } } }
public class class_name { public SofaResteasyClientBuilder registerProvider() { ResteasyProviderFactory providerFactory = getProviderFactory(); // 注册内置 Set<Class> internalProviderClasses = JAXRSProviderManager.getInternalProviderClasses(); if (CommonUtils.isNotEmpty(internalProviderClasses)) { for (Class providerClass : internalProviderClasses) { providerFactory.register(providerClass); } } // 注册自定义 Set<Object> customProviderInstances = JAXRSProviderManager.getCustomProviderInstances(); if (CommonUtils.isNotEmpty(customProviderInstances)) { for (Object provider : customProviderInstances) { PropertyInjector propertyInjector = providerFactory.getInjectorFactory() .createPropertyInjector( JAXRSProviderManager.getTargetClass(provider), providerFactory); propertyInjector.inject(provider); providerFactory.registerProviderInstance(provider); } } return this; } }
public class class_name { public SofaResteasyClientBuilder registerProvider() { ResteasyProviderFactory providerFactory = getProviderFactory(); // 注册内置 Set<Class> internalProviderClasses = JAXRSProviderManager.getInternalProviderClasses(); if (CommonUtils.isNotEmpty(internalProviderClasses)) { for (Class providerClass : internalProviderClasses) { providerFactory.register(providerClass); // depends on control dependency: [for], data = [providerClass] } } // 注册自定义 Set<Object> customProviderInstances = JAXRSProviderManager.getCustomProviderInstances(); if (CommonUtils.isNotEmpty(customProviderInstances)) { for (Object provider : customProviderInstances) { PropertyInjector propertyInjector = providerFactory.getInjectorFactory() .createPropertyInjector( JAXRSProviderManager.getTargetClass(provider), providerFactory); propertyInjector.inject(provider); // depends on control dependency: [for], data = [provider] providerFactory.registerProviderInstance(provider); // depends on control dependency: [for], data = [provider] } } return this; } }
public class class_name { private static String getFormattedList(long[] idList) { if (idList == null) { idList = new long[]{}; } return new StringBuilder().append("{") .append(StringUtils.join(ArrayUtils.toObject(idList), ',')) .append("}").toString(); } }
public class class_name { private static String getFormattedList(long[] idList) { if (idList == null) { idList = new long[]{}; // depends on control dependency: [if], data = [none] } return new StringBuilder().append("{") .append(StringUtils.join(ArrayUtils.toObject(idList), ',')) .append("}").toString(); } }
public class class_name { public static Axiom deserialise(String s) { if(unmarshaller == null) init(); try { Object res = unmarshaller.unmarshal(new ByteArrayInputStream(s.getBytes())); return (Axiom) res; } catch(JAXBException e) { log.error("There was a problem deserialising an axiom. JAXB threw an exception.", e); throw new RuntimeException(e); } } }
public class class_name { public static Axiom deserialise(String s) { if(unmarshaller == null) init(); try { Object res = unmarshaller.unmarshal(new ByteArrayInputStream(s.getBytes())); return (Axiom) res; // depends on control dependency: [try], data = [none] } catch(JAXBException e) { log.error("There was a problem deserialising an axiom. JAXB threw an exception.", e); throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public VoltXMLElement findChild(String elementName, String attributeName) { String attName = attributeName; if (attName == null) { attName = "default"; } return findChild(elementName + attName); } }
public class class_name { public VoltXMLElement findChild(String elementName, String attributeName) { String attName = attributeName; if (attName == null) { attName = "default"; // depends on control dependency: [if], data = [none] } return findChild(elementName + attName); } }
public class class_name { static String normalizeServicePath(String servicePath) { Preconditions.checkNotNull(servicePath, "service path cannot be null"); if (servicePath.length() == 1) { Preconditions.checkArgument( "/".equals(servicePath), "service path must equal \"/\" if it is of length 1."); servicePath = ""; } else if (servicePath.length() > 0) { if (!servicePath.endsWith("/")) { servicePath += "/"; } if (servicePath.startsWith("/")) { servicePath = servicePath.substring(1); } } return servicePath; } }
public class class_name { static String normalizeServicePath(String servicePath) { Preconditions.checkNotNull(servicePath, "service path cannot be null"); if (servicePath.length() == 1) { Preconditions.checkArgument( "/".equals(servicePath), "service path must equal \"/\" if it is of length 1."); // depends on control dependency: [if], data = [none] servicePath = ""; // depends on control dependency: [if], data = [none] } else if (servicePath.length() > 0) { if (!servicePath.endsWith("/")) { servicePath += "/"; // depends on control dependency: [if], data = [none] } if (servicePath.startsWith("/")) { servicePath = servicePath.substring(1); // depends on control dependency: [if], data = [none] } } return servicePath; } }
public class class_name { private long mixInHash(long hash, StorableProperty<?> property, int multiplier) { hash = mixInHash(hash, property.getName(), multiplier); hash = mixInHash(hash, property.getType().getName(), multiplier); hash = hash * multiplier + (property.isNullable() ? 1 : 2); hash = hash * multiplier + (property.isPrimaryKeyMember() ? 1 : 2); // Keep this in for compatibility with prior versions of hash code. hash = hash * multiplier + 1; if (property.getAdapter() != null) { // Keep this in for compatibility with prior versions of hash code. hash += 1; StorablePropertyAdapter adapter = property.getAdapter(); StorablePropertyAnnotation annotation = adapter.getAnnotation(); hash = mixInHash(hash, annotation.getAnnotationType().getName(), multiplier); // Annotation may contain parameters which affect how property // value is stored. So mix that in too. Annotation ann = annotation.getAnnotation(); if (ann != null) { hash = hash * multiplier + annHashCode(ann); } } return hash; } }
public class class_name { private long mixInHash(long hash, StorableProperty<?> property, int multiplier) { hash = mixInHash(hash, property.getName(), multiplier); hash = mixInHash(hash, property.getType().getName(), multiplier); hash = hash * multiplier + (property.isNullable() ? 1 : 2); hash = hash * multiplier + (property.isPrimaryKeyMember() ? 1 : 2); // Keep this in for compatibility with prior versions of hash code. hash = hash * multiplier + 1; if (property.getAdapter() != null) { // Keep this in for compatibility with prior versions of hash code. hash += 1; // depends on control dependency: [if], data = [none] StorablePropertyAdapter adapter = property.getAdapter(); StorablePropertyAnnotation annotation = adapter.getAnnotation(); hash = mixInHash(hash, annotation.getAnnotationType().getName(), multiplier); // depends on control dependency: [if], data = [none] // Annotation may contain parameters which affect how property // value is stored. So mix that in too. Annotation ann = annotation.getAnnotation(); if (ann != null) { hash = hash * multiplier + annHashCode(ann); // depends on control dependency: [if], data = [(ann] } } return hash; } }
public class class_name { public static ComplexImg transform(final boolean inverse, ComplexImg toTransform, ComplexImg target){ if(target == null){ target = new ComplexImg(toTransform.getDimension()); } else if(!target.getDimension().equals(toTransform.getDimension())){ throw new IllegalArgumentException(String.format( "specified target is of wrong dimensions. Expected %s but has %s.", toTransform.getDimension(), target.getDimension())); } final int w = toTransform.getWidth(); final int h = toTransform.getHeight(); try( NativeRealArray inr = new NativeRealArray(toTransform.numValues()); NativeRealArray ini = new NativeRealArray(inr.length); NativeRealArray outr = new NativeRealArray(inr.length); NativeRealArray outi = new NativeRealArray(inr.length); ){ if(toTransform.getCurrentXshift() != 0 || toTransform.getCurrentYshift() != 0){ ComplexValuedSampler sampler = getSamplerForShiftedComplexImg(toTransform); PrecisionDependentUtils.fillNativeArrayFromSampler(inr, sampler.getPartSampler(false), w,h); PrecisionDependentUtils.fillNativeArrayFromSampler(ini, sampler.getPartSampler(true), w,h); } else { inr.set(toTransform.getDataReal()); ini.set(toTransform.getDataImag()); } if(inverse){ // swap real and imaginary args FFTW_Guru.execute_split_c2c(ini, inr, outi, outr, w,h); } else { FFTW_Guru.execute_split_c2c(inr, ini, outr, outi, w,h); } if(target.getCurrentXshift() != 0 || target.getCurrentYshift() != 0){ ComplexValuedWriter writer = getWriterForShiftedComplexImg(target); PrecisionDependentUtils.readNativeArrayToWriter(outr, writer.getPartWriter(false), w,h); PrecisionDependentUtils.readNativeArrayToWriter(outi, writer.getPartWriter(true), w,h); } else { outr.get(0, target.getDataReal()); outi.get(0, target.getDataImag()); } if(inverse){ // need to rescale double scaling = 1.0/toTransform.numValues(); ArrayUtils.scaleArray(target.getDataReal(), scaling); ArrayUtils.scaleArray(target.getDataImag(), scaling); } } return target; } }
public class class_name { public static ComplexImg transform(final boolean inverse, ComplexImg toTransform, ComplexImg target){ if(target == null){ target = new ComplexImg(toTransform.getDimension()); // depends on control dependency: [if], data = [none] } else if(!target.getDimension().equals(toTransform.getDimension())){ throw new IllegalArgumentException(String.format( "specified target is of wrong dimensions. Expected %s but has %s.", toTransform.getDimension(), target.getDimension())); } final int w = toTransform.getWidth(); final int h = toTransform.getHeight(); try( NativeRealArray inr = new NativeRealArray(toTransform.numValues()); NativeRealArray ini = new NativeRealArray(inr.length); NativeRealArray outr = new NativeRealArray(inr.length); NativeRealArray outi = new NativeRealArray(inr.length); ){ if(toTransform.getCurrentXshift() != 0 || toTransform.getCurrentYshift() != 0){ ComplexValuedSampler sampler = getSamplerForShiftedComplexImg(toTransform); PrecisionDependentUtils.fillNativeArrayFromSampler(inr, sampler.getPartSampler(false), w,h); // depends on control dependency: [if], data = [none] PrecisionDependentUtils.fillNativeArrayFromSampler(ini, sampler.getPartSampler(true), w,h); // depends on control dependency: [if], data = [none] } else { inr.set(toTransform.getDataReal()); // depends on control dependency: [if], data = [none] ini.set(toTransform.getDataImag()); // depends on control dependency: [if], data = [none] } if(inverse){ // swap real and imaginary args FFTW_Guru.execute_split_c2c(ini, inr, outi, outr, w,h); // depends on control dependency: [if], data = [none] } else { FFTW_Guru.execute_split_c2c(inr, ini, outr, outi, w,h); // depends on control dependency: [if], data = [none] } if(target.getCurrentXshift() != 0 || target.getCurrentYshift() != 0){ ComplexValuedWriter writer = getWriterForShiftedComplexImg(target); PrecisionDependentUtils.readNativeArrayToWriter(outr, writer.getPartWriter(false), w,h); // depends on control dependency: [if], data = [none] PrecisionDependentUtils.readNativeArrayToWriter(outi, writer.getPartWriter(true), w,h); // depends on control dependency: [if], data = [none] } else { outr.get(0, target.getDataReal()); // depends on control dependency: [if], data = [none] outi.get(0, target.getDataImag()); // depends on control dependency: [if], data = [none] } if(inverse){ // need to rescale double scaling = 1.0/toTransform.numValues(); ArrayUtils.scaleArray(target.getDataReal(), scaling); // depends on control dependency: [if], data = [none] ArrayUtils.scaleArray(target.getDataImag(), scaling); // depends on control dependency: [if], data = [none] } } return target; } }
public class class_name { private static boolean isDelimiter(final char ch, final char[] delimiters) { if (delimiters == null) { return CharUtils.isWhitespace(ch); } for (final char delimiter : delimiters) { if (ch == delimiter) { return true; } } return false; } }
public class class_name { private static boolean isDelimiter(final char ch, final char[] delimiters) { if (delimiters == null) { return CharUtils.isWhitespace(ch); // depends on control dependency: [if], data = [none] } for (final char delimiter : delimiters) { if (ch == delimiter) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public JobFlowInstancesDetail withInstanceGroups(InstanceGroupDetail... instanceGroups) { if (this.instanceGroups == null) { setInstanceGroups(new com.amazonaws.internal.SdkInternalList<InstanceGroupDetail>(instanceGroups.length)); } for (InstanceGroupDetail ele : instanceGroups) { this.instanceGroups.add(ele); } return this; } }
public class class_name { public JobFlowInstancesDetail withInstanceGroups(InstanceGroupDetail... instanceGroups) { if (this.instanceGroups == null) { setInstanceGroups(new com.amazonaws.internal.SdkInternalList<InstanceGroupDetail>(instanceGroups.length)); // depends on control dependency: [if], data = [none] } for (InstanceGroupDetail ele : instanceGroups) { this.instanceGroups.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { @Override public void applicationStarting(ApplicationInfo appInfo) throws StateChangeException { /* * On twas at this point the TCCL is completely unrelated to the app that's starting. On Liberty it's a ContextFinder object. * This context finder is able to correctly load classes if it is invoked in any WAR inside an EAR with many wars as * ContextFinder will delegate loading classes to the correct ClassLoader. * * However if the TCCL is used as the key to the map, for example by DeltaSpike's configuration code. Then it will not * work. The same ContextFinder object will be used as a key regardless of which module DeltaSpike is looking at. * * While the ContextFinder has the advantage of being able to load classes, setting the TCCL like I do below has the advantage * of keeping Liberty and twas in sync. * * Given that both options have an advantage and a drawback I chose to keep the two servers in sync. And am documenting why I * did so with this comment. */ ClassLoader newCL = null; ClassLoader oldCl = null; boolean setContext = false; try { Application application = this.runtimeFactory.newApplication(appInfo); /* if there is no app classes info then the app manager is not in control of this app */ if (!application.hasModules()) { this.runtimeFactory.removeApplication(appInfo); return; } newCL = getRealAppClassLoader(application); if (newCL != null) { oldCl = CDIUtils.getAndSetLoader(newCL); } //Because weld fires observes in all modules when endInitialization() is called //We can only set the jndi context once. This is sufficent for the java:app namespace //but not for the java module namespace. //Origonally I tried to setup JNDI so only application metadata was on the thread but //that didn't work so I use give classic utils one of the module archives. if (application.getModuleArchives().size() > 0 && application.getApplicationMetaData() != null) { CDIArchive archive = application.getModuleArchives().iterator().next(); beginContext(archive); setContext = true; } for (CDIArchive archive : application.getModuleArchives()) { registerDeferedMetaData(archive); } WebSphereCDIDeployment webSphereCDIDeployment = getCDIContainer().startInitialization(application); if (webSphereCDIDeployment != null) { getCDIContainer().endInitialization(webSphereCDIDeployment);//This split is just to keep the CDIContainerImpl code conistant across liberty & websphere. } } catch (CDIException e) { throw new StateChangeException(e); } finally { if (oldCl != null) { CDIUtils.getAndSetLoader(oldCl); } if (setContext) { endContext(); } } } }
public class class_name { @Override public void applicationStarting(ApplicationInfo appInfo) throws StateChangeException { /* * On twas at this point the TCCL is completely unrelated to the app that's starting. On Liberty it's a ContextFinder object. * This context finder is able to correctly load classes if it is invoked in any WAR inside an EAR with many wars as * ContextFinder will delegate loading classes to the correct ClassLoader. * * However if the TCCL is used as the key to the map, for example by DeltaSpike's configuration code. Then it will not * work. The same ContextFinder object will be used as a key regardless of which module DeltaSpike is looking at. * * While the ContextFinder has the advantage of being able to load classes, setting the TCCL like I do below has the advantage * of keeping Liberty and twas in sync. * * Given that both options have an advantage and a drawback I chose to keep the two servers in sync. And am documenting why I * did so with this comment. */ ClassLoader newCL = null; ClassLoader oldCl = null; boolean setContext = false; try { Application application = this.runtimeFactory.newApplication(appInfo); /* if there is no app classes info then the app manager is not in control of this app */ if (!application.hasModules()) { this.runtimeFactory.removeApplication(appInfo); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } newCL = getRealAppClassLoader(application); if (newCL != null) { oldCl = CDIUtils.getAndSetLoader(newCL); // depends on control dependency: [if], data = [(newCL] } //Because weld fires observes in all modules when endInitialization() is called //We can only set the jndi context once. This is sufficent for the java:app namespace //but not for the java module namespace. //Origonally I tried to setup JNDI so only application metadata was on the thread but //that didn't work so I use give classic utils one of the module archives. if (application.getModuleArchives().size() > 0 && application.getApplicationMetaData() != null) { CDIArchive archive = application.getModuleArchives().iterator().next(); beginContext(archive); // depends on control dependency: [if], data = [none] setContext = true; // depends on control dependency: [if], data = [none] } for (CDIArchive archive : application.getModuleArchives()) { registerDeferedMetaData(archive); // depends on control dependency: [for], data = [archive] } WebSphereCDIDeployment webSphereCDIDeployment = getCDIContainer().startInitialization(application); if (webSphereCDIDeployment != null) { getCDIContainer().endInitialization(webSphereCDIDeployment);//This split is just to keep the CDIContainerImpl code conistant across liberty & websphere. // depends on control dependency: [if], data = [(webSphereCDIDeployment] } } catch (CDIException e) { throw new StateChangeException(e); } finally { if (oldCl != null) { CDIUtils.getAndSetLoader(oldCl); // depends on control dependency: [if], data = [(oldCl] } if (setContext) { endContext(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void checkConfiguration(JobExecutorXml jobExecutorXml) { Map<String, String> properties = jobExecutorXml.getProperties(); for (Entry<String, String> entry : properties.entrySet()) { LOGGER.warning("Property " + entry.getKey() + " with value " + entry.getValue() + " from bpm-platform.xml will be ignored for JobExecutor."); } } }
public class class_name { private void checkConfiguration(JobExecutorXml jobExecutorXml) { Map<String, String> properties = jobExecutorXml.getProperties(); for (Entry<String, String> entry : properties.entrySet()) { LOGGER.warning("Property " + entry.getKey() + " with value " + entry.getValue() + " from bpm-platform.xml will be ignored for JobExecutor."); // depends on control dependency: [for], data = [entry] } } }
public class class_name { private static Element handleNode(Element parent, String xpathName) { // if node is no attribute, create a new node String childrenPart = null; String nodeName; int pos = xpathName.indexOf("["); if (pos > 0) { childrenPart = xpathName.substring(pos + 1, xpathName.length() - 1); nodeName = xpathName.substring(0, pos); } else { nodeName = xpathName; } // create node Element elem = parent.addElement(nodeName); if (childrenPart != null) { pos = childrenPart.indexOf("["); if ((pos > 0) && (childrenPart.indexOf("]") > pos)) { handleNode(elem, childrenPart); return elem; } if (childrenPart.contains("=")) { Map<String, String> children = CmsStringUtil.splitAsMap(childrenPart, "][", "="); // handle child nodes for (Map.Entry<String, String> child : children.entrySet()) { String childName = child.getKey(); String childValue = child.getValue(); if (childValue.startsWith("'")) { childValue = childValue.substring(1); } if (childValue.endsWith("'")) { childValue = childValue.substring(0, childValue.length() - 1); } if (childName.startsWith("@")) { elem.addAttribute(childName.substring(1), childValue); } else if (childName.equals("text()")) { elem.setText(childValue); } else if (!childName.contains("(")) { Element childElem = elem.addElement(childName); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(childValue)) { childElem.addText(childValue); } } } } } return elem; } }
public class class_name { private static Element handleNode(Element parent, String xpathName) { // if node is no attribute, create a new node String childrenPart = null; String nodeName; int pos = xpathName.indexOf("["); if (pos > 0) { childrenPart = xpathName.substring(pos + 1, xpathName.length() - 1); // depends on control dependency: [if], data = [(pos] nodeName = xpathName.substring(0, pos); // depends on control dependency: [if], data = [none] } else { nodeName = xpathName; // depends on control dependency: [if], data = [none] } // create node Element elem = parent.addElement(nodeName); if (childrenPart != null) { pos = childrenPart.indexOf("["); // depends on control dependency: [if], data = [none] if ((pos > 0) && (childrenPart.indexOf("]") > pos)) { handleNode(elem, childrenPart); // depends on control dependency: [if], data = [none] return elem; // depends on control dependency: [if], data = [none] } if (childrenPart.contains("=")) { Map<String, String> children = CmsStringUtil.splitAsMap(childrenPart, "][", "="); // handle child nodes for (Map.Entry<String, String> child : children.entrySet()) { String childName = child.getKey(); String childValue = child.getValue(); if (childValue.startsWith("'")) { childValue = childValue.substring(1); // depends on control dependency: [if], data = [none] } if (childValue.endsWith("'")) { childValue = childValue.substring(0, childValue.length() - 1); // depends on control dependency: [if], data = [none] } if (childName.startsWith("@")) { elem.addAttribute(childName.substring(1), childValue); // depends on control dependency: [if], data = [none] } else if (childName.equals("text()")) { elem.setText(childValue); // depends on control dependency: [if], data = [none] } else if (!childName.contains("(")) { Element childElem = elem.addElement(childName); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(childValue)) { childElem.addText(childValue); // depends on control dependency: [if], data = [none] } } } } } return elem; } }
public class class_name { public void setDatabaseDuplicateIds() { // Set the spec topic duplicate ids based on topic title for (final Entry<Integer, List<ITopicNode>> topicTitleEntry : topics.entrySet()) { final List<ITopicNode> topics = topicTitleEntry.getValue(); if (topics.size() > 1) { for (int i = 1; i < topics.size(); i++) { topics.get(i).setDuplicateId(Integer.toString(i)); } } } } }
public class class_name { public void setDatabaseDuplicateIds() { // Set the spec topic duplicate ids based on topic title for (final Entry<Integer, List<ITopicNode>> topicTitleEntry : topics.entrySet()) { final List<ITopicNode> topics = topicTitleEntry.getValue(); if (topics.size() > 1) { for (int i = 1; i < topics.size(); i++) { topics.get(i).setDuplicateId(Integer.toString(i)); // depends on control dependency: [for], data = [i] } } } } }
public class class_name { public void setRequestedEc2AvailabilityZones(java.util.Collection<String> requestedEc2AvailabilityZones) { if (requestedEc2AvailabilityZones == null) { this.requestedEc2AvailabilityZones = null; return; } this.requestedEc2AvailabilityZones = new com.amazonaws.internal.SdkInternalList<String>(requestedEc2AvailabilityZones); } }
public class class_name { public void setRequestedEc2AvailabilityZones(java.util.Collection<String> requestedEc2AvailabilityZones) { if (requestedEc2AvailabilityZones == null) { this.requestedEc2AvailabilityZones = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.requestedEc2AvailabilityZones = new com.amazonaws.internal.SdkInternalList<String>(requestedEc2AvailabilityZones); } }
public class class_name { public List<String> getProviderNames() { @SuppressWarnings("unchecked") List<String> result = get(KEY_QUERY_PROVIDERS, List.class); if (result == null) { return Collections.emptyList(); } return result; } }
public class class_name { public List<String> getProviderNames() { @SuppressWarnings("unchecked") List<String> result = get(KEY_QUERY_PROVIDERS, List.class); if (result == null) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public void marshall(SecurityServicePolicyData securityServicePolicyData, ProtocolMarshaller protocolMarshaller) { if (securityServicePolicyData == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(securityServicePolicyData.getType(), TYPE_BINDING); protocolMarshaller.marshall(securityServicePolicyData.getManagedServiceData(), MANAGEDSERVICEDATA_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(SecurityServicePolicyData securityServicePolicyData, ProtocolMarshaller protocolMarshaller) { if (securityServicePolicyData == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(securityServicePolicyData.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(securityServicePolicyData.getManagedServiceData(), MANAGEDSERVICEDATA_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 List<JoinableResourceBundle> getResourceBundles(Properties properties) { PropertiesConfigHelper props = new PropertiesConfigHelper(properties, resourceType); String fileExtension = "." + resourceType; // Initialize custom bundles List<JoinableResourceBundle> customBundles = new ArrayList<>(); // Check if we should use the bundle names property or // find the bundle name using the bundle id declaration : // jawr.<type>.bundle.<name>.id if (null != props.getProperty(PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_NAMES)) { StringTokenizer tk = new StringTokenizer( props.getProperty(PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_NAMES), ","); while (tk.hasMoreTokens()) { customBundles .add(buildJoinableResourceBundle(props, tk.nextToken().trim(), fileExtension, rsReaderHandler)); } } else { Iterator<String> bundleNames = props.getPropertyBundleNameSet().iterator(); while (bundleNames.hasNext()) { customBundles .add(buildJoinableResourceBundle(props, bundleNames.next(), fileExtension, rsReaderHandler)); } } // Initialize the bundles dependencies Iterator<String> bundleNames = props.getPropertyBundleNameSet().iterator(); while (bundleNames.hasNext()) { String bundleName = (String) bundleNames.next(); List<String> bundleNameDependencies = props.getCustomBundlePropertyAsList(bundleName, PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_DEPENDENCIES); if (!bundleNameDependencies.isEmpty()) { JoinableResourceBundle bundle = getBundleFromName(bundleName, customBundles); List<JoinableResourceBundle> bundleDependencies = getBundlesFromName(bundleNameDependencies, customBundles); bundle.setDependencies(bundleDependencies); } } return customBundles; } }
public class class_name { public List<JoinableResourceBundle> getResourceBundles(Properties properties) { PropertiesConfigHelper props = new PropertiesConfigHelper(properties, resourceType); String fileExtension = "." + resourceType; // Initialize custom bundles List<JoinableResourceBundle> customBundles = new ArrayList<>(); // Check if we should use the bundle names property or // find the bundle name using the bundle id declaration : // jawr.<type>.bundle.<name>.id if (null != props.getProperty(PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_NAMES)) { StringTokenizer tk = new StringTokenizer( props.getProperty(PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_NAMES), ","); while (tk.hasMoreTokens()) { customBundles .add(buildJoinableResourceBundle(props, tk.nextToken().trim(), fileExtension, rsReaderHandler)); // depends on control dependency: [while], data = [none] } } else { Iterator<String> bundleNames = props.getPropertyBundleNameSet().iterator(); while (bundleNames.hasNext()) { customBundles .add(buildJoinableResourceBundle(props, bundleNames.next(), fileExtension, rsReaderHandler)); // depends on control dependency: [while], data = [none] } } // Initialize the bundles dependencies Iterator<String> bundleNames = props.getPropertyBundleNameSet().iterator(); while (bundleNames.hasNext()) { String bundleName = (String) bundleNames.next(); List<String> bundleNameDependencies = props.getCustomBundlePropertyAsList(bundleName, PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_DEPENDENCIES); if (!bundleNameDependencies.isEmpty()) { JoinableResourceBundle bundle = getBundleFromName(bundleName, customBundles); List<JoinableResourceBundle> bundleDependencies = getBundlesFromName(bundleNameDependencies, customBundles); bundle.setDependencies(bundleDependencies); // depends on control dependency: [if], data = [none] } } return customBundles; } }
public class class_name { public void add(StatementRank rank, Resource subject) { if (this.bestRank == rank) { subjects.add(subject); } else if(bestRank == StatementRank.NORMAL && rank == StatementRank.PREFERRED) { //We found a preferred statement subjects.clear(); bestRank = StatementRank.PREFERRED; subjects.add(subject); } } }
public class class_name { public void add(StatementRank rank, Resource subject) { if (this.bestRank == rank) { subjects.add(subject); // depends on control dependency: [if], data = [none] } else if(bestRank == StatementRank.NORMAL && rank == StatementRank.PREFERRED) { //We found a preferred statement subjects.clear(); // depends on control dependency: [if], data = [none] bestRank = StatementRank.PREFERRED; // depends on control dependency: [if], data = [none] subjects.add(subject); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) { if (context.isResourceServiceRestartAllowed()) { final PathAddress address = context.getCurrentAddress(); final String name = address.getLastElement().getValue(); ServiceName nonCapabilityServiceName = serviceName(name, address); if (nonCapabilityServiceName != null) { context.removeService(serviceName(name, address)); } Set<RuntimeCapability> capabilitySet = unavailableCapabilities.isEmpty() ? context.getResourceRegistration().getCapabilities() : unavailableCapabilities; for (RuntimeCapability<?> capability : capabilitySet) { if (capability.getCapabilityServiceValueType() != null) { context.removeService(capability.getCapabilityServiceName(address)); } } } else { context.reloadRequired(); } } }
public class class_name { @Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) { if (context.isResourceServiceRestartAllowed()) { final PathAddress address = context.getCurrentAddress(); final String name = address.getLastElement().getValue(); ServiceName nonCapabilityServiceName = serviceName(name, address); if (nonCapabilityServiceName != null) { context.removeService(serviceName(name, address)); // depends on control dependency: [if], data = [none] } Set<RuntimeCapability> capabilitySet = unavailableCapabilities.isEmpty() ? context.getResourceRegistration().getCapabilities() : unavailableCapabilities; for (RuntimeCapability<?> capability : capabilitySet) { if (capability.getCapabilityServiceValueType() != null) { context.removeService(capability.getCapabilityServiceName(address)); // depends on control dependency: [if], data = [none] } } } else { context.reloadRequired(); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected boolean isCallbackMethodImplementation(Method method) { if (!ActionHook.class.isAssignableFrom(method.getDeclaringClass())) { return false; // not required if statement but for performance } for (Method callbackMethod : callbackMethodSet) { if (isImplementsMethod(method, callbackMethod)) { return true; } } return false; } }
public class class_name { protected boolean isCallbackMethodImplementation(Method method) { if (!ActionHook.class.isAssignableFrom(method.getDeclaringClass())) { return false; // not required if statement but for performance // depends on control dependency: [if], data = [none] } for (Method callbackMethod : callbackMethodSet) { if (isImplementsMethod(method, callbackMethod)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { private String removeHeaderComments(String fileContent, SortedSet<Comment> comments) { String headerlessFileContent = fileContent; for (Comment comment : comments) { String commentValue = comment.getValue(); if (headerlessFileContent.startsWith(commentValue)) { headerlessFileContent = headerlessFileContent.replace(commentValue, EMPTY_STRING); // remove all leading white spaces and new line characters while (StringUtils.isNotBlank(headerlessFileContent) && Character.isWhitespace(headerlessFileContent.charAt(0))) { headerlessFileContent = headerlessFileContent.substring(1); } } else { // finished removing all header comments break; } } return headerlessFileContent; } }
public class class_name { private String removeHeaderComments(String fileContent, SortedSet<Comment> comments) { String headerlessFileContent = fileContent; for (Comment comment : comments) { String commentValue = comment.getValue(); if (headerlessFileContent.startsWith(commentValue)) { headerlessFileContent = headerlessFileContent.replace(commentValue, EMPTY_STRING); // depends on control dependency: [if], data = [none] // remove all leading white spaces and new line characters while (StringUtils.isNotBlank(headerlessFileContent) && Character.isWhitespace(headerlessFileContent.charAt(0))) { headerlessFileContent = headerlessFileContent.substring(1); // depends on control dependency: [while], data = [none] } } else { // finished removing all header comments break; } } return headerlessFileContent; } }
public class class_name { protected void checkNext () { _executingNow = !_queue.isEmpty(); if (_executingNow) { // start up a thread to execute the task in question ExecutorTask task = _queue.remove(0); final ExecutorThread thread = new ExecutorThread(task); thread.start(); // start up a timer that will abort this thread after the specified timeout new Interval(Interval.RUN_DIRECT) { @Override public void expired () { // this will NOOP if the task has already completed thread.abort(); } }.schedule(task.getTimeout()); } } }
public class class_name { protected void checkNext () { _executingNow = !_queue.isEmpty(); if (_executingNow) { // start up a thread to execute the task in question ExecutorTask task = _queue.remove(0); final ExecutorThread thread = new ExecutorThread(task); thread.start(); // depends on control dependency: [if], data = [none] // start up a timer that will abort this thread after the specified timeout new Interval(Interval.RUN_DIRECT) { @Override public void expired () { // this will NOOP if the task has already completed thread.abort(); } }.schedule(task.getTimeout()); // depends on control dependency: [if], data = [none] } } }
public class class_name { private Object getPreviousElement() { Object element = null; while (currentIndex >= startIndex && element == null) { currentIndex--; element = getElement(); } return element; } }
public class class_name { private Object getPreviousElement() { Object element = null; while (currentIndex >= startIndex && element == null) { currentIndex--; // depends on control dependency: [while], data = [none] element = getElement(); // depends on control dependency: [while], data = [none] } return element; } }
public class class_name { private void parseMethod() throws IOException { int accessFlags = readShort(); int nameIndex = readShort(); int descriptorIndex = readShort(); JavaMethod method = new JavaMethod(_loader); method.setJavaClass(_class); method.setName(_cp.getUtf8(nameIndex).getValue()); method.setDescriptor(_cp.getUtf8(descriptorIndex).getValue()); method.setAccessFlags(accessFlags); int attributesCount = readShort(); for (int i = 0; i < attributesCount; i++) { Attribute attr = parseAttribute(); method.addAttribute(attr); if (attr instanceof ExceptionsAttribute) { ExceptionsAttribute exn = (ExceptionsAttribute) attr; ArrayList<String> exnNames = exn.getExceptionList(); if (exnNames.size() > 0) { JClass []exnClasses = new JClass[exnNames.size()]; for (int j = 0; j < exnNames.size(); j++) { String exnName = exnNames.get(j).replace('/', '.'); exnClasses[j] = _loader.forName(exnName); } method.setExceptionTypes(exnClasses); } } } _class.addMethod(method); } }
public class class_name { private void parseMethod() throws IOException { int accessFlags = readShort(); int nameIndex = readShort(); int descriptorIndex = readShort(); JavaMethod method = new JavaMethod(_loader); method.setJavaClass(_class); method.setName(_cp.getUtf8(nameIndex).getValue()); method.setDescriptor(_cp.getUtf8(descriptorIndex).getValue()); method.setAccessFlags(accessFlags); int attributesCount = readShort(); for (int i = 0; i < attributesCount; i++) { Attribute attr = parseAttribute(); method.addAttribute(attr); if (attr instanceof ExceptionsAttribute) { ExceptionsAttribute exn = (ExceptionsAttribute) attr; ArrayList<String> exnNames = exn.getExceptionList(); if (exnNames.size() > 0) { JClass []exnClasses = new JClass[exnNames.size()]; for (int j = 0; j < exnNames.size(); j++) { String exnName = exnNames.get(j).replace('/', '.'); exnClasses[j] = _loader.forName(exnName); // depends on control dependency: [for], data = [j] } method.setExceptionTypes(exnClasses); // depends on control dependency: [if], data = [none] } } } _class.addMethod(method); } }
public class class_name { @Override public void close() { if (isClosed()) return; // Set the session state to ENDED. setSessionState(JingleSessionStateEnded.getInstance()); for (ContentNegotiator contentNegotiator : contentNegotiators) { contentNegotiator.stopJingleMediaSession(); for (TransportCandidate candidate : contentNegotiator.getTransportNegotiator().getOfferedCandidates()) candidate.removeCandidateEcho(); contentNegotiator.close(); } removeAsyncPacketListener(); removeConnectionListener(); getConnection().removeConnectionListener(connectionListener); LOGGER.fine("Negotiation Closed: " + getConnection().getUser() + " " + sid); super.close(); } }
public class class_name { @Override public void close() { if (isClosed()) return; // Set the session state to ENDED. setSessionState(JingleSessionStateEnded.getInstance()); for (ContentNegotiator contentNegotiator : contentNegotiators) { contentNegotiator.stopJingleMediaSession(); // depends on control dependency: [for], data = [contentNegotiator] for (TransportCandidate candidate : contentNegotiator.getTransportNegotiator().getOfferedCandidates()) candidate.removeCandidateEcho(); contentNegotiator.close(); // depends on control dependency: [for], data = [contentNegotiator] } removeAsyncPacketListener(); removeConnectionListener(); getConnection().removeConnectionListener(connectionListener); LOGGER.fine("Negotiation Closed: " + getConnection().getUser() + " " + sid); super.close(); } }