code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { static public String getPathToRoot(JBakeConfiguration config, File rootPath, File sourceFile) { Path r = Paths.get(rootPath.toURI()); Path s = Paths.get(sourceFile.getParentFile().toURI()); Path relativePath = s.relativize(r); StringBuilder sb = new StringBuilder(); sb.append(asPath(relativePath.toString())); if (config.getUriWithoutExtension()) { sb.append("/.."); } if (sb.length() > 0) { // added as calling logic assumes / at end. sb.append("/"); } return sb.toString(); } }
public class class_name { static public String getPathToRoot(JBakeConfiguration config, File rootPath, File sourceFile) { Path r = Paths.get(rootPath.toURI()); Path s = Paths.get(sourceFile.getParentFile().toURI()); Path relativePath = s.relativize(r); StringBuilder sb = new StringBuilder(); sb.append(asPath(relativePath.toString())); if (config.getUriWithoutExtension()) { sb.append("/.."); // depends on control dependency: [if], data = [none] } if (sb.length() > 0) { // added as calling logic assumes / at end. sb.append("/"); // depends on control dependency: [if], data = [none] } return sb.toString(); } }
public class class_name { protected void remoteSubscribeEvent( List topicSpaces, List topics, String busId, Transaction transaction, boolean sendProxy) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "remoteSubscribeEvent", new Object[] { topicSpaces, topics, busId, transaction}); // Get the list of buses that this subscription needs to be forwarded // onto final BusGroup[] buses = _neighbours.getAllBuses(); // Loop through each of the buses deciding if this // subscription event needs to be forwarded for (int i = 0; i < buses.length; ++i) { if (!buses[i].getName().equals(busId)) { // Declaration of a message handler that can be used for // building up the proxy subscription message to be forwarded. SubscriptionMessageHandler messageHandler = null; // Get the iterators for this message final Iterator topicIterator = topics.listIterator(); final Iterator tsIterator = topicSpaces.listIterator(); // Iterate through each of the topics to decide if this needs // to be forwarded. while (topicIterator.hasNext()) { final SIBUuid12 topicSpace = (SIBUuid12) tsIterator.next(); final String topic = (String) topicIterator.next(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug( tc, "Forwarding topic " + topicSpace + topic + " to bus " + buses[i]); // Add this subscription to this buse. // This method call passes through the fact that this method can // only be called by a proxy subscription that was registered on this // ME messageHandler = buses[i].addRemoteSubscription(topicSpace, topic, messageHandler, sendProxy); } // If the subscription message isn't null, then add it back into // the list of subscription messages. if (messageHandler != null) { // Send to all the Neighbours in this buse buses[i].sendToNeighbours( messageHandler.getSubscriptionMessage(), transaction, false); addMessageHandler(messageHandler); messageHandler = null; } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "remoteSubscribeEvent"); } }
public class class_name { protected void remoteSubscribeEvent( List topicSpaces, List topics, String busId, Transaction transaction, boolean sendProxy) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "remoteSubscribeEvent", new Object[] { topicSpaces, topics, busId, transaction}); // Get the list of buses that this subscription needs to be forwarded // onto final BusGroup[] buses = _neighbours.getAllBuses(); // Loop through each of the buses deciding if this // subscription event needs to be forwarded for (int i = 0; i < buses.length; ++i) { if (!buses[i].getName().equals(busId)) { // Declaration of a message handler that can be used for // building up the proxy subscription message to be forwarded. SubscriptionMessageHandler messageHandler = null; // Get the iterators for this message final Iterator topicIterator = topics.listIterator(); final Iterator tsIterator = topicSpaces.listIterator(); // Iterate through each of the topics to decide if this needs // to be forwarded. while (topicIterator.hasNext()) { final SIBUuid12 topicSpace = (SIBUuid12) tsIterator.next(); final String topic = (String) topicIterator.next(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug( tc, "Forwarding topic " + topicSpace + topic + " to bus " + buses[i]); // Add this subscription to this buse. // This method call passes through the fact that this method can // only be called by a proxy subscription that was registered on this // ME messageHandler = buses[i].addRemoteSubscription(topicSpace, topic, messageHandler, sendProxy); // depends on control dependency: [while], data = [none] } // If the subscription message isn't null, then add it back into // the list of subscription messages. if (messageHandler != null) { // Send to all the Neighbours in this buse buses[i].sendToNeighbours( messageHandler.getSubscriptionMessage(), transaction, false); // depends on control dependency: [if], data = [none] addMessageHandler(messageHandler); // depends on control dependency: [if], data = [(messageHandler] messageHandler = null; // depends on control dependency: [if], data = [none] } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "remoteSubscribeEvent"); } }
public class class_name { private static void checkDuplicates(ImmutableList<SQLPPTriplesMap> mappings) throws DuplicateMappingException { Set<SQLPPTriplesMap> mappingSet = new HashSet<>(mappings); int duplicateCount = mappings.size() - mappingSet.size(); /** * If there are some triplesMaps, finds them */ if (duplicateCount > 0) { Set<String> duplicateIds = new HashSet<>(); int remaining = duplicateCount; for (SQLPPTriplesMap mapping : mappings) { if (mappingSet.contains(mapping)) { mappingSet.remove(mapping); } /** * Duplicate */ else { duplicateIds.add(mapping.getId()); if (--remaining == 0) break; } } //TODO: indicate the source throw new DuplicateMappingException(String.format("Found %d duplicates in the following ids: %s", duplicateCount, duplicateIds.toString())); } } }
public class class_name { private static void checkDuplicates(ImmutableList<SQLPPTriplesMap> mappings) throws DuplicateMappingException { Set<SQLPPTriplesMap> mappingSet = new HashSet<>(mappings); int duplicateCount = mappings.size() - mappingSet.size(); /** * If there are some triplesMaps, finds them */ if (duplicateCount > 0) { Set<String> duplicateIds = new HashSet<>(); int remaining = duplicateCount; for (SQLPPTriplesMap mapping : mappings) { if (mappingSet.contains(mapping)) { mappingSet.remove(mapping); // depends on control dependency: [if], data = [none] } /** * Duplicate */ else { duplicateIds.add(mapping.getId()); // depends on control dependency: [if], data = [none] if (--remaining == 0) break; } } //TODO: indicate the source throw new DuplicateMappingException(String.format("Found %d duplicates in the following ids: %s", duplicateCount, duplicateIds.toString())); } } }
public class class_name { void setParent(JMFMessageData parent) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.entry(this, tc, "setParent", new Object[] { parent }); synchronized (getMessageLockArtefact()) { // If the parent is a JSMessageData then this is straight forward if (parent instanceof JSMessageData) { parentMessage = (JSMessageData) parent; master = ((JSMessageData) parent).master; containingMessage = ((JSMessageData) parent).compatibilityWrapperOrSelf; } // ... if not, it must be a JSCompatibleMessageImpl, and its encoding must // be a JSMessageData, because if it was a JMFEncapsulation it couldn't be our parent else { JSMessageData msg = (JSMessageData) ((JSCompatibleMessageImpl) parent).getEncodingMessage(); parentMessage = msg; master = msg.master; containingMessage = parent; } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.exit(this, tc, "setParent"); } }
public class class_name { void setParent(JMFMessageData parent) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.entry(this, tc, "setParent", new Object[] { parent }); synchronized (getMessageLockArtefact()) { // If the parent is a JSMessageData then this is straight forward if (parent instanceof JSMessageData) { parentMessage = (JSMessageData) parent; // depends on control dependency: [if], data = [none] master = ((JSMessageData) parent).master; // depends on control dependency: [if], data = [none] containingMessage = ((JSMessageData) parent).compatibilityWrapperOrSelf; // depends on control dependency: [if], data = [none] } // ... if not, it must be a JSCompatibleMessageImpl, and its encoding must // be a JSMessageData, because if it was a JMFEncapsulation it couldn't be our parent else { JSMessageData msg = (JSMessageData) ((JSCompatibleMessageImpl) parent).getEncodingMessage(); parentMessage = msg; // depends on control dependency: [if], data = [none] master = msg.master; // depends on control dependency: [if], data = [none] containingMessage = parent; // depends on control dependency: [if], data = [none] } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.exit(this, tc, "setParent"); } }
public class class_name { public void setFormValue(Object value) { if (value == null) { value = ""; } if (value instanceof String) { String strValue = (String)value; m_selectionInput.m_textbox.setText(strValue); setTitle(strValue); } } }
public class class_name { public void setFormValue(Object value) { if (value == null) { value = ""; // depends on control dependency: [if], data = [none] } if (value instanceof String) { String strValue = (String)value; m_selectionInput.m_textbox.setText(strValue); // depends on control dependency: [if], data = [none] setTitle(strValue); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static <K extends Comparable< ? super K>,V extends Comparable< ? super V>> List<Entry<K,V>> sortKeyValuePairByValue(Map<K,V> map) { List<Map.Entry<K,V>> entries = new ArrayList<Map.Entry<K,V>>(map.entrySet()); Collections.sort(entries, new Comparator<Map.Entry<K,V>>() { @Override public int compare(Entry<K,V> o1, Entry<K,V> o2) { if (!o1.getValue().equals(o2.getValue())) { return (o1.getValue()).compareTo(o2.getValue()); } return o1.getKey().compareTo(o2.getKey()); } } ); return entries; } }
public class class_name { public static <K extends Comparable< ? super K>,V extends Comparable< ? super V>> List<Entry<K,V>> sortKeyValuePairByValue(Map<K,V> map) { List<Map.Entry<K,V>> entries = new ArrayList<Map.Entry<K,V>>(map.entrySet()); Collections.sort(entries, new Comparator<Map.Entry<K,V>>() { @Override public int compare(Entry<K,V> o1, Entry<K,V> o2) { if (!o1.getValue().equals(o2.getValue())) { return (o1.getValue()).compareTo(o2.getValue()); // depends on control dependency: [if], data = [none] } return o1.getKey().compareTo(o2.getKey()); } } ); return entries; } }
public class class_name { @Override public IdDt withServerBase(String theServerBase, String theResourceType) { if (isLocal() || isUrn()) { return new IdDt(getValueAsString()); } return new IdDt(theServerBase, theResourceType, getIdPart(), getVersionIdPart()); } }
public class class_name { @Override public IdDt withServerBase(String theServerBase, String theResourceType) { if (isLocal() || isUrn()) { return new IdDt(getValueAsString()); // depends on control dependency: [if], data = [none] } return new IdDt(theServerBase, theResourceType, getIdPart(), getVersionIdPart()); } }
public class class_name { public static Method getSetterMethod(Class<?> cType, String fieldName, Class<?> paramType) { Class<?> subType = getSubType(paramType); String methodName = getMethodName(fieldName, SET_METHOD_PREFIX); try { return cType.getMethod(methodName, paramType); } catch (NoSuchMethodException e) { try { return cType.getMethod(methodName, subType); } catch (NoSuchMethodException e1) { //log.info("setter method not found : " + fieldName); return null; } } } }
public class class_name { public static Method getSetterMethod(Class<?> cType, String fieldName, Class<?> paramType) { Class<?> subType = getSubType(paramType); String methodName = getMethodName(fieldName, SET_METHOD_PREFIX); try { return cType.getMethod(methodName, paramType); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException e) { try { return cType.getMethod(methodName, subType); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException e1) { //log.info("setter method not found : " + fieldName); return null; } // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static <SI, SO> GlobalMetadataBuilder<SO> builderWithInput(GlobalMetadata<SI> inputMetadata, Optional<SO> outputSchema) { GlobalMetadataBuilder<SO> builder = (GlobalMetadataBuilder<SO>) builder(); if (outputSchema.isPresent()) { builder.schema(outputSchema.get()); } return builder; } }
public class class_name { public static <SI, SO> GlobalMetadataBuilder<SO> builderWithInput(GlobalMetadata<SI> inputMetadata, Optional<SO> outputSchema) { GlobalMetadataBuilder<SO> builder = (GlobalMetadataBuilder<SO>) builder(); if (outputSchema.isPresent()) { builder.schema(outputSchema.get()); // depends on control dependency: [if], data = [none] } return builder; } }
public class class_name { public void set( List<Point2D_F64> list ) { vertexes.resize(list.size()); for (int i = 0; i < list.size(); i++) { vertexes.data[i].set( list.get(i)); } } }
public class class_name { public void set( List<Point2D_F64> list ) { vertexes.resize(list.size()); for (int i = 0; i < list.size(); i++) { vertexes.data[i].set( list.get(i)); // depends on control dependency: [for], data = [i] } } }
public class class_name { @OverrideOnDemand @OverridingMethodsMustInvokeSuper protected void fillMicroElement (@Nonnull final IMicroElement aElement, @Nonnull final IHCConversionSettingsToNode aConversionSettings) { final boolean bHTML5 = aConversionSettings.getHTMLVersion ().isAtLeastHTML5 (); if (StringHelper.hasText (m_sID)) aElement.setAttribute (CHTMLAttributes.ID, m_sID); if (StringHelper.hasText (m_sTitle)) aElement.setAttribute (CHTMLAttributes.TITLE, m_sTitle); if (StringHelper.hasText (m_sLanguage)) { // Both "xml:lang" and "lang" aElement.setAttribute (new MicroQName (XMLConstants.XML_NS_URI, CHTMLAttributes.LANG.getName ()), m_sLanguage); aElement.setAttribute (CHTMLAttributes.LANG, m_sLanguage); } if (m_eDirection != null) aElement.setAttribute (CHTMLAttributes.DIR, m_eDirection); aElement.setAttribute (CHTMLAttributes.CLASS, getAllClassesAsString ()); aElement.setAttribute (CHTMLAttributes.STYLE, getAllStylesAsString (aConversionSettings.getCSSWriterSettings ())); // Emit all JS events if (m_aJSHandler != null) { final IJSWriterSettings aJSWriterSettings = aConversionSettings.getJSWriterSettings (); // Loop over all events in the defined order for consistent results for (final EJSEvent eEvent : EJSEvent.values ()) { final CollectingJSCodeProvider aProvider = m_aJSHandler.getHandler (eEvent); if (aProvider != null) { final String sJSCode = aProvider.getJSCode (aJSWriterSettings); aElement.setAttribute (eEvent.getHTMLEventName (), CJS.JS_PREFIX + sJSCode); } } } // unfocusable is handled by the customizer as it is non-standard // Global attributes if (m_nTabIndex != DEFAULT_TABINDEX) aElement.setAttribute (CHTMLAttributes.TABINDEX, m_nTabIndex); if (StringHelper.hasText (m_sAccessKey)) aElement.setAttribute (CHTMLAttributes.ACCESSKEY, m_sAccessKey); // Global HTML5 attributes if (bHTML5) { if (m_eTranslate.isDefined ()) aElement.setAttribute (CHTMLAttributes.TRANSLATE, m_eTranslate.isTrue () ? CHTMLAttributeValues.YES : CHTMLAttributeValues.NO); if (m_eContentEditable != null) aElement.setAttribute (CHTMLAttributes.CONTENTEDITABLE, m_eContentEditable); if (StringHelper.hasText (m_sContextMenuID)) aElement.setAttribute (CHTMLAttributes.CONTEXTMENU, m_sContextMenuID); if (m_eDraggable != null) aElement.setAttribute (CHTMLAttributes.DRAGGABLE, m_eDraggable); if (m_eDropZone != null) aElement.setAttribute (CHTMLAttributes.DROPZONE, m_eDropZone); if (m_bHidden) aElement.setAttribute (CHTMLAttributes.HIDDEN, CHTMLAttributeValues.HIDDEN); if (m_bSpellCheck) aElement.setAttribute (CHTMLAttributes.SPELLCHECK, CHTMLAttributeValues.SPELLCHECK); } if (m_eRole != null) aElement.setAttribute (CHTMLAttributes.ROLE, m_eRole.getID ()); if (m_aCustomAttrs != null) for (final Map.Entry <IMicroQName, String> aEntry : m_aCustomAttrs.entrySet ()) aElement.setAttribute (aEntry.getKey (), aEntry.getValue ()); } }
public class class_name { @OverrideOnDemand @OverridingMethodsMustInvokeSuper protected void fillMicroElement (@Nonnull final IMicroElement aElement, @Nonnull final IHCConversionSettingsToNode aConversionSettings) { final boolean bHTML5 = aConversionSettings.getHTMLVersion ().isAtLeastHTML5 (); if (StringHelper.hasText (m_sID)) aElement.setAttribute (CHTMLAttributes.ID, m_sID); if (StringHelper.hasText (m_sTitle)) aElement.setAttribute (CHTMLAttributes.TITLE, m_sTitle); if (StringHelper.hasText (m_sLanguage)) { // Both "xml:lang" and "lang" aElement.setAttribute (new MicroQName (XMLConstants.XML_NS_URI, CHTMLAttributes.LANG.getName ()), m_sLanguage); // depends on control dependency: [if], data = [none] aElement.setAttribute (CHTMLAttributes.LANG, m_sLanguage); // depends on control dependency: [if], data = [none] } if (m_eDirection != null) aElement.setAttribute (CHTMLAttributes.DIR, m_eDirection); aElement.setAttribute (CHTMLAttributes.CLASS, getAllClassesAsString ()); aElement.setAttribute (CHTMLAttributes.STYLE, getAllStylesAsString (aConversionSettings.getCSSWriterSettings ())); // Emit all JS events if (m_aJSHandler != null) { final IJSWriterSettings aJSWriterSettings = aConversionSettings.getJSWriterSettings (); // Loop over all events in the defined order for consistent results for (final EJSEvent eEvent : EJSEvent.values ()) { final CollectingJSCodeProvider aProvider = m_aJSHandler.getHandler (eEvent); if (aProvider != null) { final String sJSCode = aProvider.getJSCode (aJSWriterSettings); aElement.setAttribute (eEvent.getHTMLEventName (), CJS.JS_PREFIX + sJSCode); // depends on control dependency: [if], data = [none] } } } // unfocusable is handled by the customizer as it is non-standard // Global attributes if (m_nTabIndex != DEFAULT_TABINDEX) aElement.setAttribute (CHTMLAttributes.TABINDEX, m_nTabIndex); if (StringHelper.hasText (m_sAccessKey)) aElement.setAttribute (CHTMLAttributes.ACCESSKEY, m_sAccessKey); // Global HTML5 attributes if (bHTML5) { if (m_eTranslate.isDefined ()) aElement.setAttribute (CHTMLAttributes.TRANSLATE, m_eTranslate.isTrue () ? CHTMLAttributeValues.YES : CHTMLAttributeValues.NO); if (m_eContentEditable != null) aElement.setAttribute (CHTMLAttributes.CONTENTEDITABLE, m_eContentEditable); if (StringHelper.hasText (m_sContextMenuID)) aElement.setAttribute (CHTMLAttributes.CONTEXTMENU, m_sContextMenuID); if (m_eDraggable != null) aElement.setAttribute (CHTMLAttributes.DRAGGABLE, m_eDraggable); if (m_eDropZone != null) aElement.setAttribute (CHTMLAttributes.DROPZONE, m_eDropZone); if (m_bHidden) aElement.setAttribute (CHTMLAttributes.HIDDEN, CHTMLAttributeValues.HIDDEN); if (m_bSpellCheck) aElement.setAttribute (CHTMLAttributes.SPELLCHECK, CHTMLAttributeValues.SPELLCHECK); } if (m_eRole != null) aElement.setAttribute (CHTMLAttributes.ROLE, m_eRole.getID ()); if (m_aCustomAttrs != null) for (final Map.Entry <IMicroQName, String> aEntry : m_aCustomAttrs.entrySet ()) aElement.setAttribute (aEntry.getKey (), aEntry.getValue ()); } }
public class class_name { int getIndexOfBit(int n) { // return __builtin_popcountll(value & ~(0xffffffffffffffffULL >> n)); int numMarkedBits = 0; for (int i = 0; i < n; i++) { if (hasBit(i)) { numMarkedBits++; } } return numMarkedBits; } }
public class class_name { int getIndexOfBit(int n) { // return __builtin_popcountll(value & ~(0xffffffffffffffffULL >> n)); int numMarkedBits = 0; for (int i = 0; i < n; i++) { if (hasBit(i)) { numMarkedBits++; // depends on control dependency: [if], data = [none] } } return numMarkedBits; } }
public class class_name { private DateTime[] asDateTime( List<Object> values ) { ValueFactory<DateTime> factory = valueFactories.getDateFactory(); DateTime[] res = new DateTime[values.size()]; for (int i = 0; i < res.length; i++) { res[i] = factory.create(((GregorianCalendar)values.get(i)).getTime()); } return res; } }
public class class_name { private DateTime[] asDateTime( List<Object> values ) { ValueFactory<DateTime> factory = valueFactories.getDateFactory(); DateTime[] res = new DateTime[values.size()]; for (int i = 0; i < res.length; i++) { res[i] = factory.create(((GregorianCalendar)values.get(i)).getTime()); // depends on control dependency: [for], data = [i] } return res; } }
public class class_name { public static void addDependencyFactory(Object... dependencyFactories) { for (Object dependencyFactory : dependencyFactories) { if (!dependencyFactory.getClass().isAnnotationPresent(DependencyFactory.class)) { throw new AvicennaRuntimeException( dependencyFactory.getClass() + " should be annotated with DependencyFactory."); } if (Avicenna.dependencyFactories.contains(dependencyFactory.getClass())) { throw new AvicennaRuntimeException( dependencyFactory.getClass() + " has already been added to container."); } addDependencyFactoryToContainer(dependencyFactory); Avicenna.dependencyFactories.add(dependencyFactory.getClass()); } } }
public class class_name { public static void addDependencyFactory(Object... dependencyFactories) { for (Object dependencyFactory : dependencyFactories) { if (!dependencyFactory.getClass().isAnnotationPresent(DependencyFactory.class)) { throw new AvicennaRuntimeException( dependencyFactory.getClass() + " should be annotated with DependencyFactory."); } if (Avicenna.dependencyFactories.contains(dependencyFactory.getClass())) { throw new AvicennaRuntimeException( dependencyFactory.getClass() + " has already been added to container."); } addDependencyFactoryToContainer(dependencyFactory); // depends on control dependency: [for], data = [dependencyFactory] Avicenna.dependencyFactories.add(dependencyFactory.getClass()); // depends on control dependency: [for], data = [dependencyFactory] } } }
public class class_name { private ArrayList<String> generateDefaultEjbBindings(String interfaceName) throws NameAlreadyBoundException // d457053.1 { ArrayList<String> defaultJNDINames = new ArrayList<String>(2); StringBuilder sb = new StringBuilder(256); if (ivDefaultJNDIPrefix == null) { // Add the context specific (local/remote) default binding prefix first. if (ivContextPrefix != null) sb.append(ivContextPrefix); // Then add the component-id or j2eename if (ivHomeRecord.bmd.ivComponent_Id != null) { // d445912 sb.append(ivHomeRecord.bmd.ivComponent_Id).append("#"); // d445912 } else { sb.append(ivHomeRecord.j2eeName.getApplication()).append("/"); sb.append(ivHomeRecord.j2eeName.getModule()).append("/"); sb.append(ivHomeRecord.j2eeName.getComponent()).append("#"); // d443702 } // cache away the string we just built up so we can resuse it again the next time ivDefaultJNDIPrefix = sb.toString(); } else { // Use the previously cached prefix sb.append(ivDefaultJNDIPrefix); } sb.append(interfaceName); // d443702 String longBindingName = sb.toString(); // Add to the list of jndiNames to be returned defaultJNDINames.add(longBindingName); addToServerContextBindingMap(interfaceName, longBindingName); ivEjbContextBindingMap.put(interfaceName, longBindingName); // Add the short default (convienence) bindings if not explicitly disabled. if (ivHomeRecord.shortDefaultBindingsEnabled()) { // Determine if this interface (short binding) has already been bound // by another EJB. BindingData bdata = ivServerContextBindingMap.get(interfaceName); // For both cases, add to the ShortDefaultName map so that it can // be unbound during application stop, and to the server wide // context map (so other ambiguous references may be found). addToServerContextBindingMap(interfaceName); ivEjbContextShortDefaultJndiNames.add(interfaceName); if (bdata == null) { // Has not been bound yet, so just bind this EJB. defaultJNDINames.add(interfaceName); } else if (bdata.ivExplicitBean == null) // d457053.1 { // Has already been bound, so add an AmbiguousEJBReference to // the ambiguous map, which will be bound later. addAmbiguousShortDefaultBindingName(interfaceName); } else { // There is an explicit binding, so just ignore this // short-form default (convenience) binding. d457053.1 if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "generateDefaultEjbBindings: " + interfaceName + " short-form default overridden : " + bdata.ivExplicitBean); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "generateDefaultEjbBindings: " + defaultJNDINames); return defaultJNDINames; } }
public class class_name { private ArrayList<String> generateDefaultEjbBindings(String interfaceName) throws NameAlreadyBoundException // d457053.1 { ArrayList<String> defaultJNDINames = new ArrayList<String>(2); StringBuilder sb = new StringBuilder(256); if (ivDefaultJNDIPrefix == null) { // Add the context specific (local/remote) default binding prefix first. if (ivContextPrefix != null) sb.append(ivContextPrefix); // Then add the component-id or j2eename if (ivHomeRecord.bmd.ivComponent_Id != null) { // d445912 sb.append(ivHomeRecord.bmd.ivComponent_Id).append("#"); // d445912 // depends on control dependency: [if], data = [(ivHomeRecord.bmd.ivComponent_Id] } else { sb.append(ivHomeRecord.j2eeName.getApplication()).append("/"); // depends on control dependency: [if], data = [none] sb.append(ivHomeRecord.j2eeName.getModule()).append("/"); // depends on control dependency: [if], data = [none] sb.append(ivHomeRecord.j2eeName.getComponent()).append("#"); // d443702 // depends on control dependency: [if], data = [none] } // cache away the string we just built up so we can resuse it again the next time ivDefaultJNDIPrefix = sb.toString(); } else { // Use the previously cached prefix sb.append(ivDefaultJNDIPrefix); } sb.append(interfaceName); // d443702 String longBindingName = sb.toString(); // Add to the list of jndiNames to be returned defaultJNDINames.add(longBindingName); addToServerContextBindingMap(interfaceName, longBindingName); ivEjbContextBindingMap.put(interfaceName, longBindingName); // Add the short default (convienence) bindings if not explicitly disabled. if (ivHomeRecord.shortDefaultBindingsEnabled()) { // Determine if this interface (short binding) has already been bound // by another EJB. BindingData bdata = ivServerContextBindingMap.get(interfaceName); // For both cases, add to the ShortDefaultName map so that it can // be unbound during application stop, and to the server wide // context map (so other ambiguous references may be found). addToServerContextBindingMap(interfaceName); ivEjbContextShortDefaultJndiNames.add(interfaceName); if (bdata == null) { // Has not been bound yet, so just bind this EJB. defaultJNDINames.add(interfaceName); } else if (bdata.ivExplicitBean == null) // d457053.1 { // Has already been bound, so add an AmbiguousEJBReference to // the ambiguous map, which will be bound later. addAmbiguousShortDefaultBindingName(interfaceName); } else { // There is an explicit binding, so just ignore this // short-form default (convenience) binding. d457053.1 if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "generateDefaultEjbBindings: " + interfaceName + " short-form default overridden : " + bdata.ivExplicitBean); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "generateDefaultEjbBindings: " + defaultJNDINames); return defaultJNDINames; } }
public class class_name { protected <T> List<? extends Decoration> getDecorations(ProjectEntity entity, Decorator<T> decorator) { try { return decorator.getDecorations(entity); } catch (Exception ex) { return Collections.singletonList( Decoration.error(decorator, getErrorMessage(ex)) ); } } }
public class class_name { protected <T> List<? extends Decoration> getDecorations(ProjectEntity entity, Decorator<T> decorator) { try { return decorator.getDecorations(entity); // depends on control dependency: [try], data = [none] } catch (Exception ex) { return Collections.singletonList( Decoration.error(decorator, getErrorMessage(ex)) ); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static void doFilter(PortletFilter filter, PortletRequest request, PortletResponse response, FilterChain chain) throws IOException, PortletException { final Object phase = request.getAttribute(PortletRequest.LIFECYCLE_PHASE); if (PortletRequest.ACTION_PHASE.equals(phase)) { if (filter instanceof ActionFilter) { ((ActionFilter) filter).doFilter((ActionRequest) request, (ActionResponse) response, chain); } else { throw new IllegalArgumentException("Provided filter does not implement ActionFilter as required by : " + phase + " - " + filter); } } else if (PortletRequest.EVENT_PHASE.equals(phase)) { if (filter instanceof EventFilter) { ((EventFilter) filter).doFilter((EventRequest) request, (EventResponse) response, chain); } else { throw new IllegalArgumentException("Provided filter does not implement EventFilter as required by : " + phase + " - " + filter); } } else if (PortletRequest.RENDER_PHASE.equals(phase)) { if (filter instanceof RenderFilter) { ((RenderFilter) filter).doFilter((RenderRequest) request, (RenderResponse) response, chain); } else { throw new IllegalArgumentException("Provided filter does not implement RenderFilter as required by : " + phase + " - " + filter); } } else if (PortletRequest.RESOURCE_PHASE.equals(phase)) { if (filter instanceof ResourceFilter) { ((ResourceFilter) filter).doFilter((ResourceRequest) request, (ResourceResponse) response, chain); } else { throw new IllegalArgumentException("Provided filter does not implement ResourceFilter as required by : " + phase + " - " + filter); } } else { throw new IllegalArgumentException("Unknown Portlet Lifecycle Phase: " + phase); } } }
public class class_name { public static void doFilter(PortletFilter filter, PortletRequest request, PortletResponse response, FilterChain chain) throws IOException, PortletException { final Object phase = request.getAttribute(PortletRequest.LIFECYCLE_PHASE); if (PortletRequest.ACTION_PHASE.equals(phase)) { if (filter instanceof ActionFilter) { ((ActionFilter) filter).doFilter((ActionRequest) request, (ActionResponse) response, chain); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Provided filter does not implement ActionFilter as required by : " + phase + " - " + filter); } } else if (PortletRequest.EVENT_PHASE.equals(phase)) { if (filter instanceof EventFilter) { ((EventFilter) filter).doFilter((EventRequest) request, (EventResponse) response, chain); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Provided filter does not implement EventFilter as required by : " + phase + " - " + filter); } } else if (PortletRequest.RENDER_PHASE.equals(phase)) { if (filter instanceof RenderFilter) { ((RenderFilter) filter).doFilter((RenderRequest) request, (RenderResponse) response, chain); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Provided filter does not implement RenderFilter as required by : " + phase + " - " + filter); } } else if (PortletRequest.RESOURCE_PHASE.equals(phase)) { if (filter instanceof ResourceFilter) { ((ResourceFilter) filter).doFilter((ResourceRequest) request, (ResourceResponse) response, chain); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Provided filter does not implement ResourceFilter as required by : " + phase + " - " + filter); } } else { throw new IllegalArgumentException("Unknown Portlet Lifecycle Phase: " + phase); } } }
public class class_name { @Override public void visitField(Field obj) { if (obj.isStatic() && obj.isPublic() && obj.isFinal()) { JavaClass cls = getClassContext().getJavaClass(); if (!obj.isEnum()) { String fieldClass = obj.getSignature(); if (fieldClass.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) { fieldClass = SignatureUtils.trimSignature(fieldClass); String clsClass = cls.getClassName(); if (fieldClass.equals(clsClass)) { enumConstNames.add(obj.getName()); super.visitField(obj); } } } } } }
public class class_name { @Override public void visitField(Field obj) { if (obj.isStatic() && obj.isPublic() && obj.isFinal()) { JavaClass cls = getClassContext().getJavaClass(); if (!obj.isEnum()) { String fieldClass = obj.getSignature(); if (fieldClass.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) { fieldClass = SignatureUtils.trimSignature(fieldClass); // depends on control dependency: [if], data = [none] String clsClass = cls.getClassName(); if (fieldClass.equals(clsClass)) { enumConstNames.add(obj.getName()); // depends on control dependency: [if], data = [none] super.visitField(obj); // depends on control dependency: [if], data = [none] } } } } } }
public class class_name { public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (!hasMatchingMediaType(mediaType)) { return false; } return isValidType(type, annotations); } }
public class class_name { public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (!hasMatchingMediaType(mediaType)) { return false; // depends on control dependency: [if], data = [none] } return isValidType(type, annotations); } }
public class class_name { @Override public Object executeWithArray(Object... parameters) { compileQuery(); checkParamCount(parameters.length); for (int i = 0; i < parameters.length; i++) { this.parameters.get(i).setValue(parameters[i]); } return runQuery(); } }
public class class_name { @Override public Object executeWithArray(Object... parameters) { compileQuery(); checkParamCount(parameters.length); for (int i = 0; i < parameters.length; i++) { this.parameters.get(i).setValue(parameters[i]); // depends on control dependency: [for], data = [i] } return runQuery(); } }
public class class_name { protected void unmapPlaceManager (PlaceManager pmgr) { int ploid = pmgr.getPlaceObject().getOid(); // remove it from the table if (_pmgrs.remove(ploid) == null) { log.warning("Requested to unmap unmapped place manager", "pmgr", pmgr); // } else { // Log.info("Unmapped place manager [class=" + pmgr.getClass().getName() + // ", ploid=" + ploid + "]."); } } }
public class class_name { protected void unmapPlaceManager (PlaceManager pmgr) { int ploid = pmgr.getPlaceObject().getOid(); // remove it from the table if (_pmgrs.remove(ploid) == null) { log.warning("Requested to unmap unmapped place manager", "pmgr", pmgr); // depends on control dependency: [if], data = [none] // } else { // Log.info("Unmapped place manager [class=" + pmgr.getClass().getName() + // ", ploid=" + ploid + "]."); } } }
public class class_name { public static String getRdfaAttributes(I_CmsXmlContentValue value) { String path = ""; String elementPath = value.getPath(); if (elementPath.contains("/")) { path += "/" + removePathIndexes(elementPath.substring(0, elementPath.lastIndexOf("/")) + ":"); } path += CmsContentService.getAttributeName(value); return String.format(RDFA_ATTRIBUTES, CmsContentService.getEntityId(value), path); } }
public class class_name { public static String getRdfaAttributes(I_CmsXmlContentValue value) { String path = ""; String elementPath = value.getPath(); if (elementPath.contains("/")) { path += "/" + removePathIndexes(elementPath.substring(0, elementPath.lastIndexOf("/")) + ":"); // depends on control dependency: [if], data = [none] } path += CmsContentService.getAttributeName(value); return String.format(RDFA_ATTRIBUTES, CmsContentService.getEntityId(value), path); } }
public class class_name { public void marshall(Fragment fragment, ProtocolMarshaller protocolMarshaller) { if (fragment == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(fragment.getFragmentNumber(), FRAGMENTNUMBER_BINDING); protocolMarshaller.marshall(fragment.getFragmentSizeInBytes(), FRAGMENTSIZEINBYTES_BINDING); protocolMarshaller.marshall(fragment.getProducerTimestamp(), PRODUCERTIMESTAMP_BINDING); protocolMarshaller.marshall(fragment.getServerTimestamp(), SERVERTIMESTAMP_BINDING); protocolMarshaller.marshall(fragment.getFragmentLengthInMilliseconds(), FRAGMENTLENGTHINMILLISECONDS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(Fragment fragment, ProtocolMarshaller protocolMarshaller) { if (fragment == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(fragment.getFragmentNumber(), FRAGMENTNUMBER_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(fragment.getFragmentSizeInBytes(), FRAGMENTSIZEINBYTES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(fragment.getProducerTimestamp(), PRODUCERTIMESTAMP_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(fragment.getServerTimestamp(), SERVERTIMESTAMP_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(fragment.getFragmentLengthInMilliseconds(), FRAGMENTLENGTHINMILLISECONDS_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 { void mapInVal(Object val, Object to, String to_in) { if (val == null) { throw new ComponentException("Null value for " + name(to, to_in)); } if (to == ca.getComponent()) { throw new ComponentException("field and component ar ethe same for mapping :" + to_in); } ComponentAccess ca_to = lookup(to); Access to_access = ca_to.input(to_in); checkFA(to_access, to, to_in); ca_to.setInput(to_in, new FieldValueAccess(to_access, val)); if (log.isLoggable(Level.CONFIG)) { log.config(String.format("Value(%s) -> @In(%s)", val.toString(), to_access.toString())); } } }
public class class_name { void mapInVal(Object val, Object to, String to_in) { if (val == null) { throw new ComponentException("Null value for " + name(to, to_in)); } if (to == ca.getComponent()) { throw new ComponentException("field and component ar ethe same for mapping :" + to_in); } ComponentAccess ca_to = lookup(to); Access to_access = ca_to.input(to_in); checkFA(to_access, to, to_in); ca_to.setInput(to_in, new FieldValueAccess(to_access, val)); if (log.isLoggable(Level.CONFIG)) { log.config(String.format("Value(%s) -> @In(%s)", val.toString(), to_access.toString())); // depends on control dependency: [if], data = [none] } } }
public class class_name { public EJSLocalWrapper createWrapper_Local(BeanId id) throws CreateException, RemoteException, CSIException { homeEnabled(); EJSLocalWrapper result = null; //------------------------------------------------------------------------ // This is the method used by Stateless and Message home create methods // to check and see if their singleton wrapper is already registered. //------------------------------------------------------------------------ // If the wrapper has been created, and is still in the wrapper cache, // then just return the local wrapper from the singleton WrapperCommon. // Note that 'inCache' will 'touch' the wrapper in the Wrapper Cache, // updating the LRU data. d196581.1 if (ivStatelessWrappers != null && ivStatelessWrappers.inCache()) { result = (EJSLocalWrapper) ivStatelessWrappers.getLocalObject(); } else { // The singleton wrapper has either not been created yet, or is not // currently in the wrapper cache. So, getting it from the Wrapper // Manager will cause it to be created (if needed) and faulted into // the Wrapper Cache. d196581.1 // Use a cached instance beanId... for stateless and message beans all // instances have the same id. d140003.26 if (statelessSessionHome || messageDrivenHome) { // Since this is is one of the home types with a singleton wrapper, // then set the local cached value now that it has been created // and inserted into the Wrapper Cache. It cannot be cached // locally until inserted into the Wrapper Cache, as the insert // updates the wrapper with a reference to the bucket. d233983 ivStatelessWrappers = wrapperManager.getWrapper(ivStatelessId); result = (EJSLocalWrapper) ivStatelessWrappers.getLocalObject(); } } return result; } }
public class class_name { public EJSLocalWrapper createWrapper_Local(BeanId id) throws CreateException, RemoteException, CSIException { homeEnabled(); EJSLocalWrapper result = null; //------------------------------------------------------------------------ // This is the method used by Stateless and Message home create methods // to check and see if their singleton wrapper is already registered. //------------------------------------------------------------------------ // If the wrapper has been created, and is still in the wrapper cache, // then just return the local wrapper from the singleton WrapperCommon. // Note that 'inCache' will 'touch' the wrapper in the Wrapper Cache, // updating the LRU data. d196581.1 if (ivStatelessWrappers != null && ivStatelessWrappers.inCache()) { result = (EJSLocalWrapper) ivStatelessWrappers.getLocalObject(); } else { // The singleton wrapper has either not been created yet, or is not // currently in the wrapper cache. So, getting it from the Wrapper // Manager will cause it to be created (if needed) and faulted into // the Wrapper Cache. d196581.1 // Use a cached instance beanId... for stateless and message beans all // instances have the same id. d140003.26 if (statelessSessionHome || messageDrivenHome) { // Since this is is one of the home types with a singleton wrapper, // then set the local cached value now that it has been created // and inserted into the Wrapper Cache. It cannot be cached // locally until inserted into the Wrapper Cache, as the insert // updates the wrapper with a reference to the bucket. d233983 ivStatelessWrappers = wrapperManager.getWrapper(ivStatelessId); // depends on control dependency: [if], data = [none] result = (EJSLocalWrapper) ivStatelessWrappers.getLocalObject(); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { public String solutionToString(int fractionDigits) { if(!isSolvable()) { throw new IllegalStateException("System is not solvable!"); } DecimalFormat nf = new DecimalFormat(); nf.setMinimumFractionDigits(fractionDigits); nf.setMaximumFractionDigits(fractionDigits); nf.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US)); nf.setNegativePrefix(""); nf.setPositivePrefix(""); int row = coeff[0].length >> 1; int params = u.length; int paramsDigits = integerDigits(params); int x0Digits = maxIntegerDigits(x_0); int[] uDigits = maxIntegerDigits(u); StringBuilder buffer = new StringBuilder(); for(int i = 0; i < x_0.length; i++) { double value = x_0[i]; format(nf, buffer, value, x0Digits); for(int j = 0; j < u[0].length; j++) { if(i == row) { buffer.append(" + a_").append(j).append(" * "); } else { buffer.append(" "); for(int d = 0; d < paramsDigits; d++) { buffer.append(' '); } } format(nf, buffer, u[i][j], uDigits[j]); } buffer.append('\n'); } return buffer.toString(); } }
public class class_name { public String solutionToString(int fractionDigits) { if(!isSolvable()) { throw new IllegalStateException("System is not solvable!"); } DecimalFormat nf = new DecimalFormat(); nf.setMinimumFractionDigits(fractionDigits); nf.setMaximumFractionDigits(fractionDigits); nf.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US)); nf.setNegativePrefix(""); nf.setPositivePrefix(""); int row = coeff[0].length >> 1; int params = u.length; int paramsDigits = integerDigits(params); int x0Digits = maxIntegerDigits(x_0); int[] uDigits = maxIntegerDigits(u); StringBuilder buffer = new StringBuilder(); for(int i = 0; i < x_0.length; i++) { double value = x_0[i]; format(nf, buffer, value, x0Digits); // depends on control dependency: [for], data = [none] for(int j = 0; j < u[0].length; j++) { if(i == row) { buffer.append(" + a_").append(j).append(" * "); // depends on control dependency: [if], data = [none] } else { buffer.append(" "); // depends on control dependency: [if], data = [none] for(int d = 0; d < paramsDigits; d++) { buffer.append(' '); // depends on control dependency: [for], data = [none] } } format(nf, buffer, u[i][j], uDigits[j]); // depends on control dependency: [for], data = [j] } buffer.append('\n'); // depends on control dependency: [for], data = [none] } return buffer.toString(); } }
public class class_name { private String toPropertiesString(Group[] groups, String headerName, String projectName) { StringBuilder result = new StringBuilder(); result.append(format(header, headerName, projectName)); for (Group group : groups) { result.append(group.toString()); } result.append(generateFileFooter()); return result.toString(); } }
public class class_name { private String toPropertiesString(Group[] groups, String headerName, String projectName) { StringBuilder result = new StringBuilder(); result.append(format(header, headerName, projectName)); for (Group group : groups) { result.append(group.toString()); // depends on control dependency: [for], data = [group] } result.append(generateFileFooter()); return result.toString(); } }
public class class_name { private static String blankToNull(String value) { if (value != null) { value = value.trim(); if (value.equals("")) { value = null; } } return value; } }
public class class_name { private static String blankToNull(String value) { if (value != null) { value = value.trim(); // depends on control dependency: [if], data = [none] if (value.equals("")) { value = null; // depends on control dependency: [if], data = [none] } } return value; } }
public class class_name { protected void startThread() { try { m_cms.getRequestContext().setCurrentProject(m_cms.readProject((CmsUUID)m_project.getValue())); } catch (CmsException e) { LOG.error("Unable to set project", e); } updateExportParams(); CmsVfsImportExportHandler handler = new CmsVfsImportExportHandler(); handler.setExportParams(m_exportParams); A_CmsReportThread exportThread = new CmsExportThread(m_cms, handler, false); Window window = CmsBasicDialog.prepareWindow(DialogWidth.max); window.setContent(new CmsExportThreadDialog(exportThread, window)); A_CmsUI.get().addWindow(window); exportThread.start(); } }
public class class_name { protected void startThread() { try { m_cms.getRequestContext().setCurrentProject(m_cms.readProject((CmsUUID)m_project.getValue())); // depends on control dependency: [try], data = [none] } catch (CmsException e) { LOG.error("Unable to set project", e); } // depends on control dependency: [catch], data = [none] updateExportParams(); CmsVfsImportExportHandler handler = new CmsVfsImportExportHandler(); handler.setExportParams(m_exportParams); A_CmsReportThread exportThread = new CmsExportThread(m_cms, handler, false); Window window = CmsBasicDialog.prepareWindow(DialogWidth.max); window.setContent(new CmsExportThreadDialog(exportThread, window)); A_CmsUI.get().addWindow(window); exportThread.start(); } }
public class class_name { private void addTypeSubstitutions(Map<Wrapper<ExprNode>, SoyType> substitutionsToAdd) { for (Map.Entry<Wrapper<ExprNode>, SoyType> entry : substitutionsToAdd.entrySet()) { ExprNode expr = entry.getKey().get(); // Get the existing type SoyType previousType = expr.getType(); for (TypeSubstitution subst = substitutions; subst != null; subst = subst.parent) { if (ExprEquivalence.get().equivalent(subst.expression, expr)) { previousType = subst.type; break; } } // If the new type is different than the current type, then add a new type substitution. if (!entry.getValue().equals(previousType)) { substitutions = new TypeSubstitution(substitutions, expr, entry.getValue()); } } } }
public class class_name { private void addTypeSubstitutions(Map<Wrapper<ExprNode>, SoyType> substitutionsToAdd) { for (Map.Entry<Wrapper<ExprNode>, SoyType> entry : substitutionsToAdd.entrySet()) { ExprNode expr = entry.getKey().get(); // Get the existing type SoyType previousType = expr.getType(); for (TypeSubstitution subst = substitutions; subst != null; subst = subst.parent) { if (ExprEquivalence.get().equivalent(subst.expression, expr)) { previousType = subst.type; // depends on control dependency: [if], data = [none] break; } } // If the new type is different than the current type, then add a new type substitution. if (!entry.getValue().equals(previousType)) { substitutions = new TypeSubstitution(substitutions, expr, entry.getValue()); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public List<String> scan() { try { JarFile jar = new JarFile(jarURL.getFile()); try { List<String> result = new ArrayList<>(); Enumeration<JarEntry> en = jar.entries(); while (en.hasMoreElements()) { JarEntry entry = en.nextElement(); String path = entry.getName(); boolean match = includes.size() == 0; if (!match) { for (String pattern : includes) { if ( patternMatches(pattern, path)) { match = true; break; } } } if (match) { for (String pattern : excludes) { if ( patternMatches(pattern, path)) { match = false; break; } } } if (match) { result.add(path); } } return result; } finally { jar.close(); } } catch (IOException e) { throw new IllegalStateException(e); } } }
public class class_name { public List<String> scan() { try { JarFile jar = new JarFile(jarURL.getFile()); try { List<String> result = new ArrayList<>(); Enumeration<JarEntry> en = jar.entries(); while (en.hasMoreElements()) { JarEntry entry = en.nextElement(); String path = entry.getName(); boolean match = includes.size() == 0; if (!match) { for (String pattern : includes) { if ( patternMatches(pattern, path)) { match = true; // depends on control dependency: [if], data = [none] break; } } } if (match) { for (String pattern : excludes) { if ( patternMatches(pattern, path)) { match = false; // depends on control dependency: [if], data = [none] break; } } } if (match) { result.add(path); // depends on control dependency: [if], data = [none] } } return result; // depends on control dependency: [try], data = [none] } finally { jar.close(); } } catch (IOException e) { throw new IllegalStateException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static ImageArchiveManifestEntry findEntryByRepoTag(String repoTag, ImageArchiveManifest manifest) { if(repoTag == null || manifest == null) { return null; } for(ImageArchiveManifestEntry entry : manifest.getEntries()) { for(String entryRepoTag : entry.getRepoTags()) { if(repoTag.equals(entryRepoTag)) { return entry; } } } return null; } }
public class class_name { public static ImageArchiveManifestEntry findEntryByRepoTag(String repoTag, ImageArchiveManifest manifest) { if(repoTag == null || manifest == null) { return null; // depends on control dependency: [if], data = [none] } for(ImageArchiveManifestEntry entry : manifest.getEntries()) { for(String entryRepoTag : entry.getRepoTags()) { if(repoTag.equals(entryRepoTag)) { return entry; // depends on control dependency: [if], data = [none] } } } return null; } }
public class class_name { @Override public Object get(final ByteBuffer buf, final int position) { final Lock lock = stripedLock.getAt(lockIndex(position)).readLock(); lock.lock(); try { return sketchCache.get(buf).get(position).copy(); } finally { lock.unlock(); } } }
public class class_name { @Override public Object get(final ByteBuffer buf, final int position) { final Lock lock = stripedLock.getAt(lockIndex(position)).readLock(); lock.lock(); try { return sketchCache.get(buf).get(position).copy(); // depends on control dependency: [try], data = [none] } finally { lock.unlock(); } } }
public class class_name { public Object next() { if (tc.isEntryEnabled()) SibTr.entry(tc, "next"); AOBrowserSession aoBrowserSession; RemoteBrowserReceiver remoteBrowserReceiver; if (browserIterator.hasNext()) { aoBrowserSession = (AOBrowserSession) browserIterator.next(); remoteBrowserReceiver = new RemoteBrowserReceiver(aoBrowserSession); } else { remoteBrowserReceiver = null; } if (tc.isEntryEnabled()) SibTr.exit(tc, "next", remoteBrowserReceiver); return remoteBrowserReceiver; } }
public class class_name { public Object next() { if (tc.isEntryEnabled()) SibTr.entry(tc, "next"); AOBrowserSession aoBrowserSession; RemoteBrowserReceiver remoteBrowserReceiver; if (browserIterator.hasNext()) { aoBrowserSession = (AOBrowserSession) browserIterator.next(); // depends on control dependency: [if], data = [none] remoteBrowserReceiver = new RemoteBrowserReceiver(aoBrowserSession); // depends on control dependency: [if], data = [none] } else { remoteBrowserReceiver = null; // depends on control dependency: [if], data = [none] } if (tc.isEntryEnabled()) SibTr.exit(tc, "next", remoteBrowserReceiver); return remoteBrowserReceiver; } }
public class class_name { public Node mutate(Random rng, Probability mutationProbability, TreeFactory treeFactory) { if (mutationProbability.nextEvent(rng)) { return treeFactory.generateRandomCandidate(rng); } else { // Node is unchanged. return this; } } }
public class class_name { public Node mutate(Random rng, Probability mutationProbability, TreeFactory treeFactory) { if (mutationProbability.nextEvent(rng)) { return treeFactory.generateRandomCandidate(rng); // depends on control dependency: [if], data = [none] } else { // Node is unchanged. return this; // depends on control dependency: [if], data = [none] } } }
public class class_name { public String generateSqlSelect(String tableName) { try { return cacheSQLs.get("SELECT:" + tableName, () -> { return MessageFormat.format("SELECT {2} FROM {0} WHERE {1}", tableName, strWherePkClause, strAllColumns); }); } catch (ExecutionException e) { throw new DaoException(e); } } }
public class class_name { public String generateSqlSelect(String tableName) { try { return cacheSQLs.get("SELECT:" + tableName, () -> { return MessageFormat.format("SELECT {2} FROM {0} WHERE {1}", tableName, strWherePkClause, strAllColumns); }); // depends on control dependency: [try], data = [none] } catch (ExecutionException e) { throw new DaoException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Config setTopicConfigs(Map<String, TopicConfig> topicConfigs) { this.topicConfigs.clear(); this.topicConfigs.putAll(topicConfigs); for (final Entry<String, TopicConfig> entry : this.topicConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; } }
public class class_name { public Config setTopicConfigs(Map<String, TopicConfig> topicConfigs) { this.topicConfigs.clear(); this.topicConfigs.putAll(topicConfigs); for (final Entry<String, TopicConfig> entry : this.topicConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); // depends on control dependency: [for], data = [entry] } return this; } }
public class class_name { public static void copyBundles(AbstractWisdomMojo mojo, DependencyGraphBuilder graph, boolean transitive, boolean deployTestDependencies, boolean disableDefaultExclusions, Libraries libraries) throws IOException { File applicationDirectory = new File(mojo.getWisdomRootDirectory(), "application"); File runtimeDirectory = new File(mojo.getWisdomRootDirectory(), "runtime"); File coreDirectory = new File(mojo.getWisdomRootDirectory(), "core"); Set<Artifact> artifacts = getArtifactsToConsider(mojo, graph, transitive, null); for (Artifact artifact : artifacts) { // Is it an excluded dependency if (!disableDefaultExclusions && BundleExclusions.isExcluded(artifact)) { mojo.getLog().info("Dependency " + artifact + " not copied - the artifact is on the exclusion list"); continue; } // We still have to do this test, as when using the direct dependencies we may include test and provided // dependencies. if (SCOPE_COMPILE.equalsIgnoreCase(artifact.getScope()) || deployTestDependencies && SCOPE_TEST .equalsIgnoreCase(artifact.getScope())) { File file = artifact.getFile(); // Check it's a 'jar file' if (file == null || !file.getName().endsWith(".jar")) { mojo.getLog().info("Dependency " + artifact + " not copied - it does not look like a jar " + "file"); continue; } // Do we already have this file in core or runtime ? File test = new File(coreDirectory, file.getName()); if (test.exists()) { mojo.getLog().info("Dependency " + file.getName() + " not copied - already existing in `core`"); continue; } test = new File(runtimeDirectory, file.getName()); if (test.exists()) { mojo.getLog().info("Dependency " + file.getName() + " not copied - already existing in `runtime`"); continue; } if (libraries != null && libraries.hasLibraries() && libraries.isExcludeFromApplication()) { if (!libraries.getReverseFilter().include(artifact)) { mojo.getLog().info("Dependency " + file.getName() + " not copied - excluded from the " + "libraries settings"); continue; } } // Check that it's a bundle. if (isBundle(file)) { File destination = new File(applicationDirectory, DefaultMaven2OsgiConverter.getBundleFileName(artifact)); mojo.getLog().info("Dependency " + file.getName() + " is a bundle, " + "artifact copied to " + destination.getAbsolutePath()); FileUtils.copyFile(file, destination, true); } else { mojo.getLog().debug("Dependency " + file.getName() + " is not a bundle"); } } } } }
public class class_name { public static void copyBundles(AbstractWisdomMojo mojo, DependencyGraphBuilder graph, boolean transitive, boolean deployTestDependencies, boolean disableDefaultExclusions, Libraries libraries) throws IOException { File applicationDirectory = new File(mojo.getWisdomRootDirectory(), "application"); File runtimeDirectory = new File(mojo.getWisdomRootDirectory(), "runtime"); File coreDirectory = new File(mojo.getWisdomRootDirectory(), "core"); Set<Artifact> artifacts = getArtifactsToConsider(mojo, graph, transitive, null); for (Artifact artifact : artifacts) { // Is it an excluded dependency if (!disableDefaultExclusions && BundleExclusions.isExcluded(artifact)) { mojo.getLog().info("Dependency " + artifact + " not copied - the artifact is on the exclusion list"); // depends on control dependency: [if], data = [none] continue; } // We still have to do this test, as when using the direct dependencies we may include test and provided // dependencies. if (SCOPE_COMPILE.equalsIgnoreCase(artifact.getScope()) || deployTestDependencies && SCOPE_TEST .equalsIgnoreCase(artifact.getScope())) { File file = artifact.getFile(); // Check it's a 'jar file' if (file == null || !file.getName().endsWith(".jar")) { mojo.getLog().info("Dependency " + artifact + " not copied - it does not look like a jar " + "file"); // depends on control dependency: [if], data = [none] continue; } // Do we already have this file in core or runtime ? File test = new File(coreDirectory, file.getName()); if (test.exists()) { mojo.getLog().info("Dependency " + file.getName() + " not copied - already existing in `core`"); // depends on control dependency: [if], data = [none] continue; } test = new File(runtimeDirectory, file.getName()); // depends on control dependency: [if], data = [none] if (test.exists()) { mojo.getLog().info("Dependency " + file.getName() + " not copied - already existing in `runtime`"); // depends on control dependency: [if], data = [none] continue; } if (libraries != null && libraries.hasLibraries() && libraries.isExcludeFromApplication()) { if (!libraries.getReverseFilter().include(artifact)) { mojo.getLog().info("Dependency " + file.getName() + " not copied - excluded from the " + "libraries settings"); // depends on control dependency: [if], data = [none] continue; } } // Check that it's a bundle. if (isBundle(file)) { File destination = new File(applicationDirectory, DefaultMaven2OsgiConverter.getBundleFileName(artifact)); mojo.getLog().info("Dependency " + file.getName() + " is a bundle, " + "artifact copied to " + destination.getAbsolutePath()); // depends on control dependency: [if], data = [none] FileUtils.copyFile(file, destination, true); // depends on control dependency: [if], data = [none] } else { mojo.getLog().debug("Dependency " + file.getName() + " is not a bundle"); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public static byte[] allocateReuseBytes(int length) { byte[] bytes = BYTES_LOCAL.get(); if (bytes == null) { if (length <= MAX_BYTES_LENGTH) { bytes = new byte[MAX_BYTES_LENGTH]; BYTES_LOCAL.set(bytes); } else { bytes = new byte[length]; } } else if (bytes.length < length) { bytes = new byte[length]; } return bytes; } }
public class class_name { public static byte[] allocateReuseBytes(int length) { byte[] bytes = BYTES_LOCAL.get(); if (bytes == null) { if (length <= MAX_BYTES_LENGTH) { bytes = new byte[MAX_BYTES_LENGTH]; // depends on control dependency: [if], data = [none] BYTES_LOCAL.set(bytes); // depends on control dependency: [if], data = [none] } else { bytes = new byte[length]; // depends on control dependency: [if], data = [none] } } else if (bytes.length < length) { bytes = new byte[length]; // depends on control dependency: [if], data = [none] } return bytes; } }
public class class_name { public void addSourcePath(File sourcePath) { if (this.sourcePath == null) { this.sourcePath = new ArrayList<>(); } this.sourcePath.add(sourcePath); } }
public class class_name { public void addSourcePath(File sourcePath) { if (this.sourcePath == null) { this.sourcePath = new ArrayList<>(); // depends on control dependency: [if], data = [none] } this.sourcePath.add(sourcePath); } }
public class class_name { public static String resourceName(URI uri) { if (!CLASSPATH_SCHEME.equals(uri.getScheme())) { throw new IllegalArgumentException("uri must have classpath scheme " + uri); } String resourceName = uri.getSchemeSpecificPart(); if (resourceName.startsWith("/")) { return resourceName.substring(1); } return resourceName; } }
public class class_name { public static String resourceName(URI uri) { if (!CLASSPATH_SCHEME.equals(uri.getScheme())) { throw new IllegalArgumentException("uri must have classpath scheme " + uri); } String resourceName = uri.getSchemeSpecificPart(); if (resourceName.startsWith("/")) { return resourceName.substring(1); // depends on control dependency: [if], data = [none] } return resourceName; } }
public class class_name { public void marshall(EnableUserRequest enableUserRequest, ProtocolMarshaller protocolMarshaller) { if (enableUserRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(enableUserRequest.getUserName(), USERNAME_BINDING); protocolMarshaller.marshall(enableUserRequest.getAuthenticationType(), AUTHENTICATIONTYPE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(EnableUserRequest enableUserRequest, ProtocolMarshaller protocolMarshaller) { if (enableUserRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(enableUserRequest.getUserName(), USERNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(enableUserRequest.getAuthenticationType(), AUTHENTICATIONTYPE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void patch_splitMax(LinkedList<Patch> patches) { short patch_size = Match_MaxBits; String precontext, postcontext; Patch patch; int start1, start2; boolean empty; Operation diff_type; String diff_text; ListIterator<Patch> pointer = patches.listIterator(); Patch bigpatch = pointer.hasNext() ? pointer.next() : null; while (bigpatch != null) { if (bigpatch.length1 <= Match_MaxBits) { bigpatch = pointer.hasNext() ? pointer.next() : null; continue; } // Remove the big old patch. pointer.remove(); start1 = bigpatch.start1; start2 = bigpatch.start2; precontext = ""; while (!bigpatch.diffs.isEmpty()) { // Create one of several smaller patches. patch = new Patch(); empty = true; patch.start1 = start1 - precontext.length(); patch.start2 = start2 - precontext.length(); if (precontext.length() != 0) { patch.length1 = patch.length2 = precontext.length(); patch.diffs.add(new Diff(Operation.EQUAL, precontext)); } while (!bigpatch.diffs.isEmpty() && patch.length1 < patch_size - Patch_Margin) { diff_type = bigpatch.diffs.getFirst().operation; diff_text = bigpatch.diffs.getFirst().text; if (diff_type == Operation.INSERT) { // Insertions are harmless. patch.length2 += diff_text.length(); start2 += diff_text.length(); patch.diffs.addLast(bigpatch.diffs.removeFirst()); empty = false; } else if (diff_type == Operation.DELETE && patch.diffs.size() == 1 && patch.diffs.getFirst().operation == Operation.EQUAL && diff_text.length() > 2 * patch_size) { // This is a large deletion. Let it pass in one chunk. patch.length1 += diff_text.length(); start1 += diff_text.length(); empty = false; patch.diffs.add(new Diff(diff_type, diff_text)); bigpatch.diffs.removeFirst(); } else { // Deletion or equality. Only take as much as we can // stomach. diff_text = diff_text.substring( 0, Math.min(diff_text.length(), patch_size - patch.length1 - Patch_Margin)); patch.length1 += diff_text.length(); start1 += diff_text.length(); if (diff_type == Operation.EQUAL) { patch.length2 += diff_text.length(); start2 += diff_text.length(); } else { empty = false; } patch.diffs.add(new Diff(diff_type, diff_text)); if (diff_text.equals(bigpatch.diffs.getFirst().text)) { bigpatch.diffs.removeFirst(); } else { bigpatch.diffs.getFirst().text = bigpatch.diffs .getFirst().text.substring(diff_text .length()); } } } // Compute the head context for the next patch. precontext = diff_text2(patch.diffs); precontext = precontext.substring(Math.max(0, precontext.length() - Patch_Margin)); // Append the end context for this patch. if (diff_text1(bigpatch.diffs).length() > Patch_Margin) { postcontext = diff_text1(bigpatch.diffs).substring(0, Patch_Margin); } else { postcontext = diff_text1(bigpatch.diffs); } if (postcontext.length() != 0) { patch.length1 += postcontext.length(); patch.length2 += postcontext.length(); if (!patch.diffs.isEmpty() && patch.diffs.getLast().operation == Operation.EQUAL) { patch.diffs.getLast().text += postcontext; } else { patch.diffs.add(new Diff(Operation.EQUAL, postcontext)); } } if (!empty) { pointer.add(patch); } } bigpatch = pointer.hasNext() ? pointer.next() : null; } } }
public class class_name { public void patch_splitMax(LinkedList<Patch> patches) { short patch_size = Match_MaxBits; String precontext, postcontext; Patch patch; int start1, start2; boolean empty; Operation diff_type; String diff_text; ListIterator<Patch> pointer = patches.listIterator(); Patch bigpatch = pointer.hasNext() ? pointer.next() : null; while (bigpatch != null) { if (bigpatch.length1 <= Match_MaxBits) { bigpatch = pointer.hasNext() ? pointer.next() : null; // depends on control dependency: [if], data = [none] continue; } // Remove the big old patch. pointer.remove(); // depends on control dependency: [while], data = [none] start1 = bigpatch.start1; // depends on control dependency: [while], data = [none] start2 = bigpatch.start2; // depends on control dependency: [while], data = [none] precontext = ""; // depends on control dependency: [while], data = [none] while (!bigpatch.diffs.isEmpty()) { // Create one of several smaller patches. patch = new Patch(); // depends on control dependency: [while], data = [none] empty = true; // depends on control dependency: [while], data = [none] patch.start1 = start1 - precontext.length(); // depends on control dependency: [while], data = [none] patch.start2 = start2 - precontext.length(); // depends on control dependency: [while], data = [none] if (precontext.length() != 0) { patch.length1 = patch.length2 = precontext.length(); // depends on control dependency: [if], data = [none] patch.diffs.add(new Diff(Operation.EQUAL, precontext)); // depends on control dependency: [if], data = [none] } while (!bigpatch.diffs.isEmpty() && patch.length1 < patch_size - Patch_Margin) { diff_type = bigpatch.diffs.getFirst().operation; // depends on control dependency: [while], data = [none] diff_text = bigpatch.diffs.getFirst().text; // depends on control dependency: [while], data = [none] if (diff_type == Operation.INSERT) { // Insertions are harmless. patch.length2 += diff_text.length(); // depends on control dependency: [if], data = [none] start2 += diff_text.length(); // depends on control dependency: [if], data = [none] patch.diffs.addLast(bigpatch.diffs.removeFirst()); // depends on control dependency: [if], data = [none] empty = false; // depends on control dependency: [if], data = [none] } else if (diff_type == Operation.DELETE && patch.diffs.size() == 1 && patch.diffs.getFirst().operation == Operation.EQUAL && diff_text.length() > 2 * patch_size) { // This is a large deletion. Let it pass in one chunk. patch.length1 += diff_text.length(); // depends on control dependency: [if], data = [none] start1 += diff_text.length(); // depends on control dependency: [if], data = [none] empty = false; // depends on control dependency: [if], data = [none] patch.diffs.add(new Diff(diff_type, diff_text)); // depends on control dependency: [if], data = [(diff_type] bigpatch.diffs.removeFirst(); // depends on control dependency: [if], data = [none] } else { // Deletion or equality. Only take as much as we can // stomach. diff_text = diff_text.substring( 0, Math.min(diff_text.length(), patch_size - patch.length1 - Patch_Margin)); // depends on control dependency: [if], data = [none] patch.length1 += diff_text.length(); // depends on control dependency: [if], data = [none] start1 += diff_text.length(); // depends on control dependency: [if], data = [none] if (diff_type == Operation.EQUAL) { patch.length2 += diff_text.length(); // depends on control dependency: [if], data = [none] start2 += diff_text.length(); // depends on control dependency: [if], data = [none] } else { empty = false; // depends on control dependency: [if], data = [none] } patch.diffs.add(new Diff(diff_type, diff_text)); // depends on control dependency: [if], data = [(diff_type] if (diff_text.equals(bigpatch.diffs.getFirst().text)) { bigpatch.diffs.removeFirst(); // depends on control dependency: [if], data = [none] } else { bigpatch.diffs.getFirst().text = bigpatch.diffs .getFirst().text.substring(diff_text .length()); // depends on control dependency: [if], data = [none] } } } // Compute the head context for the next patch. precontext = diff_text2(patch.diffs); // depends on control dependency: [while], data = [none] precontext = precontext.substring(Math.max(0, precontext.length() - Patch_Margin)); // depends on control dependency: [while], data = [none] // Append the end context for this patch. if (diff_text1(bigpatch.diffs).length() > Patch_Margin) { postcontext = diff_text1(bigpatch.diffs).substring(0, Patch_Margin); // depends on control dependency: [if], data = [none] } else { postcontext = diff_text1(bigpatch.diffs); // depends on control dependency: [if], data = [none] } if (postcontext.length() != 0) { patch.length1 += postcontext.length(); // depends on control dependency: [if], data = [none] patch.length2 += postcontext.length(); // depends on control dependency: [if], data = [none] if (!patch.diffs.isEmpty() && patch.diffs.getLast().operation == Operation.EQUAL) { patch.diffs.getLast().text += postcontext; // depends on control dependency: [if], data = [none] } else { patch.diffs.add(new Diff(Operation.EQUAL, postcontext)); // depends on control dependency: [if], data = [none] } } if (!empty) { pointer.add(patch); // depends on control dependency: [if], data = [none] } } bigpatch = pointer.hasNext() ? pointer.next() : null; // depends on control dependency: [while], data = [none] } } }
public class class_name { public void invalidate() { // Close all associated tunnels, if possible for (GuacamoleTunnel tunnel : tunnels.values()) { try { tunnel.close(); } catch (GuacamoleException e) { logger.debug("Unable to close tunnel.", e); } } // Invalidate all user contextx for (UserContext userContext : userContexts) userContext.invalidate(); // Invalidate the authenticated user object authenticatedUser.invalidate(); } }
public class class_name { public void invalidate() { // Close all associated tunnels, if possible for (GuacamoleTunnel tunnel : tunnels.values()) { try { tunnel.close(); // depends on control dependency: [try], data = [none] } catch (GuacamoleException e) { logger.debug("Unable to close tunnel.", e); } // depends on control dependency: [catch], data = [none] } // Invalidate all user contextx for (UserContext userContext : userContexts) userContext.invalidate(); // Invalidate the authenticated user object authenticatedUser.invalidate(); } }
public class class_name { public EtcdSelfStatsResponse getSelfStats() { try { return new EtcdSelfStatsRequest(this.client, retryHandler).send().get(); } catch (IOException | EtcdException | EtcdAuthenticationException | TimeoutException e) { return null; } } }
public class class_name { public EtcdSelfStatsResponse getSelfStats() { try { return new EtcdSelfStatsRequest(this.client, retryHandler).send().get(); // depends on control dependency: [try], data = [none] } catch (IOException | EtcdException | EtcdAuthenticationException | TimeoutException e) { return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static JSONObject toJsonObject(Map<String, ?> map) { JSONObject jsonObject = new JSONObject(); for (Map.Entry<String, ?> entry : map.entrySet()) { Object value = wrap(entry.getValue()); try { jsonObject.put(entry.getKey(), value); } catch (JSONException ignored) { // Ignore values that JSONObject doesn't accept. } } return jsonObject; } }
public class class_name { public static JSONObject toJsonObject(Map<String, ?> map) { JSONObject jsonObject = new JSONObject(); for (Map.Entry<String, ?> entry : map.entrySet()) { Object value = wrap(entry.getValue()); try { jsonObject.put(entry.getKey(), value); // depends on control dependency: [try], data = [none] } catch (JSONException ignored) { // Ignore values that JSONObject doesn't accept. } // depends on control dependency: [catch], data = [none] } return jsonObject; } }
public class class_name { long getBackoffOffset(boolean endTime) { if (isPeriodic()) { return 0L; } long offset; switch (getBackoffPolicy()) { case LINEAR: offset = mFailureCount * getBackoffMs(); break; case EXPONENTIAL: if (mFailureCount == 0) { offset = 0L; } else { offset = (long) (getBackoffMs() * Math.pow(2, mFailureCount - 1)); } break; default: throw new IllegalStateException("not implemented"); } if (endTime && !isExact()) { offset *= 1.2f; } return Math.min(offset, TimeUnit.HOURS.toMillis(5)); // use max of 5 hours like JobScheduler } }
public class class_name { long getBackoffOffset(boolean endTime) { if (isPeriodic()) { return 0L; // depends on control dependency: [if], data = [none] } long offset; switch (getBackoffPolicy()) { case LINEAR: offset = mFailureCount * getBackoffMs(); break; case EXPONENTIAL: if (mFailureCount == 0) { offset = 0L; // depends on control dependency: [if], data = [none] } else { offset = (long) (getBackoffMs() * Math.pow(2, mFailureCount - 1)); // depends on control dependency: [if], data = [none] } break; default: throw new IllegalStateException("not implemented"); } if (endTime && !isExact()) { offset *= 1.2f; } return Math.min(offset, TimeUnit.HOURS.toMillis(5)); // use max of 5 hours like JobScheduler } }
public class class_name { public void add(E edge) { if (! edge.added) { edges.add(edge); edge.added = true; add(edge.getChild()); add(edge.getParent()); } } }
public class class_name { public void add(E edge) { if (! edge.added) { edges.add(edge); // depends on control dependency: [if], data = [none] edge.added = true; // depends on control dependency: [if], data = [none] add(edge.getChild()); // depends on control dependency: [if], data = [none] add(edge.getParent()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setRemoveSubnetIds(java.util.Collection<String> removeSubnetIds) { if (removeSubnetIds == null) { this.removeSubnetIds = null; return; } this.removeSubnetIds = new com.amazonaws.internal.SdkInternalList<String>(removeSubnetIds); } }
public class class_name { public void setRemoveSubnetIds(java.util.Collection<String> removeSubnetIds) { if (removeSubnetIds == null) { this.removeSubnetIds = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.removeSubnetIds = new com.amazonaws.internal.SdkInternalList<String>(removeSubnetIds); } }
public class class_name { public final static String convertRoute(String route) { if (Objects.isNull(route)) { return ""; } if ("/".equals(route)) { return route; } String[] splits = route.split("/"); String newRoute = ""; for (int i = 1; i < splits.length; i++) { String s = splits[i]; if (!Objects.isNull(s)) { if ("*".equals(s)) { newRoute += "/*"; } else if (s.startsWith(":")) { newRoute += "/*"; } else { newRoute += "/" + s; } } } return newRoute; } }
public class class_name { public final static String convertRoute(String route) { if (Objects.isNull(route)) { return ""; // depends on control dependency: [if], data = [none] } if ("/".equals(route)) { return route; // depends on control dependency: [if], data = [none] } String[] splits = route.split("/"); String newRoute = ""; for (int i = 1; i < splits.length; i++) { String s = splits[i]; if (!Objects.isNull(s)) { if ("*".equals(s)) { newRoute += "/*"; // depends on control dependency: [if], data = [none] } else if (s.startsWith(":")) { newRoute += "/*"; // depends on control dependency: [if], data = [none] } else { newRoute += "/" + s; // depends on control dependency: [if], data = [none] } } } return newRoute; } }
public class class_name { private Resource<T> translateResourceExternal(Resource<T> resource) { if (fullPath) { return resource; } return new translatedResource<T>(resource, translatePathExternal(resource.getPath())); } }
public class class_name { private Resource<T> translateResourceExternal(Resource<T> resource) { if (fullPath) { return resource; // depends on control dependency: [if], data = [none] } return new translatedResource<T>(resource, translatePathExternal(resource.getPath())); } }
public class class_name { private synchronized void fillSegment(char[] charArray , int begin , int length , int enabled){ //获取字典表中的汉字对象 Character beginChar = Character.valueOf(charArray[begin]); Character keyChar = charMap.get(beginChar); //字典中没有该字,则将其添加入字典 if(keyChar == null){ charMap.put(beginChar, beginChar); keyChar = beginChar; } //搜索当前节点的存储,查询对应keyChar的keyChar,如果没有则创建 DictSegment ds = lookforSegment(keyChar , enabled); if(ds != null){ //处理keyChar对应的segment if(length > 1){ //词元还没有完全加入词典树 ds.fillSegment(charArray, begin + 1, length - 1 , enabled); }else if (length == 1){ //已经是词元的最后一个char,设置当前节点状态为enabled, //enabled=1表明一个完整的词,enabled=0表示从词典中屏蔽当前词 ds.nodeState = enabled; } } } }
public class class_name { private synchronized void fillSegment(char[] charArray , int begin , int length , int enabled){ //获取字典表中的汉字对象 Character beginChar = Character.valueOf(charArray[begin]); Character keyChar = charMap.get(beginChar); //字典中没有该字,则将其添加入字典 if(keyChar == null){ charMap.put(beginChar, beginChar); // depends on control dependency: [if], data = [none] keyChar = beginChar; // depends on control dependency: [if], data = [none] } //搜索当前节点的存储,查询对应keyChar的keyChar,如果没有则创建 DictSegment ds = lookforSegment(keyChar , enabled); if(ds != null){ //处理keyChar对应的segment if(length > 1){ //词元还没有完全加入词典树 ds.fillSegment(charArray, begin + 1, length - 1 , enabled); // depends on control dependency: [if], data = [none] }else if (length == 1){ //已经是词元的最后一个char,设置当前节点状态为enabled, //enabled=1表明一个完整的词,enabled=0表示从词典中屏蔽当前词 ds.nodeState = enabled; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public boolean readLine(Appendable buf) throws IOException { boolean success = false; while(true) { // Process buffer: while(pos < end) { success = true; final char c = buffer[pos++]; if(c == '\n') { return success; } if(c == '\r') { continue; } buf.append(c); } // Refill buffer: assert (pos >= end) : "Buffer wasn't empty when refilling!"; end = in.read(buffer, 0, buffer.length); pos = 0; if(end < 0) { // End of stream. return success; } } } }
public class class_name { public boolean readLine(Appendable buf) throws IOException { boolean success = false; while(true) { // Process buffer: while(pos < end) { success = true; // depends on control dependency: [while], data = [none] final char c = buffer[pos++]; if(c == '\n') { return success; // depends on control dependency: [if], data = [none] } if(c == '\r') { continue; } buf.append(c); // depends on control dependency: [while], data = [none] } // Refill buffer: assert (pos >= end) : "Buffer wasn't empty when refilling!"; end = in.read(buffer, 0, buffer.length); pos = 0; if(end < 0) { // End of stream. return success; // depends on control dependency: [if], data = [none] } } } }
public class class_name { private static String formatClassSig(String classSig) { int start = 0; int end = classSig.length(); if (end <= 0) { return classSig; } while (classSig.startsWith("[L", start) && classSig.charAt(end - 1) == ';') { start += 2; end--; } if (start > 0) { start -= 2; end++; return classSig.substring(start, end); } return classSig; } }
public class class_name { private static String formatClassSig(String classSig) { int start = 0; int end = classSig.length(); if (end <= 0) { return classSig; // depends on control dependency: [if], data = [none] } while (classSig.startsWith("[L", start) && classSig.charAt(end - 1) == ';') { start += 2; // depends on control dependency: [while], data = [none] end--; // depends on control dependency: [while], data = [none] } if (start > 0) { start -= 2; // depends on control dependency: [if], data = [none] end++; // depends on control dependency: [if], data = [none] return classSig.substring(start, end); // depends on control dependency: [if], data = [(start] } return classSig; } }
public class class_name { protected static PatchElement createRollbackElement(final PatchEntry entry) { final PatchElement patchElement = entry.element; final String patchId; final Patch.PatchType patchType = patchElement.getProvider().getPatchType(); if (patchType == Patch.PatchType.CUMULATIVE) { patchId = entry.getCumulativePatchID(); } else { patchId = patchElement.getId(); } return createPatchElement(entry, patchId, entry.rollbackActions); } }
public class class_name { protected static PatchElement createRollbackElement(final PatchEntry entry) { final PatchElement patchElement = entry.element; final String patchId; final Patch.PatchType patchType = patchElement.getProvider().getPatchType(); if (patchType == Patch.PatchType.CUMULATIVE) { patchId = entry.getCumulativePatchID(); // depends on control dependency: [if], data = [none] } else { patchId = patchElement.getId(); // depends on control dependency: [if], data = [none] } return createPatchElement(entry, patchId, entry.rollbackActions); } }
public class class_name { public static String simpleClassName(Class<?> clazz) { if (!clazz.isAnonymousClass()) { return clazz.getSimpleName(); } // Simple name of anonymous class is empty String name = clazz.getName(); int lastDot = name.lastIndexOf('.'); if (lastDot <= 0) { return name; } return name.substring(lastDot + 1); } }
public class class_name { public static String simpleClassName(Class<?> clazz) { if (!clazz.isAnonymousClass()) { return clazz.getSimpleName(); // depends on control dependency: [if], data = [none] } // Simple name of anonymous class is empty String name = clazz.getName(); int lastDot = name.lastIndexOf('.'); if (lastDot <= 0) { return name; // depends on control dependency: [if], data = [none] } return name.substring(lastDot + 1); } }
public class class_name { public void cancel() { if (isOpen()) { LOG.debug("Cancelling stream ({})", mDescription); mCanceled = true; mRequestObserver.cancel("Request is cancelled by user.", null); } } }
public class class_name { public void cancel() { if (isOpen()) { LOG.debug("Cancelling stream ({})", mDescription); // depends on control dependency: [if], data = [none] mCanceled = true; // depends on control dependency: [if], data = [none] mRequestObserver.cancel("Request is cancelled by user.", null); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected String resolveHelpText(Locale locale) { String helpText = getHelpText().key(locale); if ((getColumnForTexts() != null) && (getItem().get(getColumnForTexts()) != null)) { helpText = new MessageFormat(helpText, locale).format(new Object[] {getItem().get(getColumnForTexts())}); } return helpText; } }
public class class_name { protected String resolveHelpText(Locale locale) { String helpText = getHelpText().key(locale); if ((getColumnForTexts() != null) && (getItem().get(getColumnForTexts()) != null)) { helpText = new MessageFormat(helpText, locale).format(new Object[] {getItem().get(getColumnForTexts())}); // depends on control dependency: [if], data = [none] } return helpText; } }
public class class_name { public void remove(Object key) { for (Scope cur=this; cur!=null; cur=cur.parent) { if (cur.data != null && cur.data.containsKey(key)) { cur.data.remove(key); return ; } } } }
public class class_name { public void remove(Object key) { for (Scope cur=this; cur!=null; cur=cur.parent) { if (cur.data != null && cur.data.containsKey(key)) { cur.data.remove(key); // depends on control dependency: [if], data = [none] return ; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void marshall(ListPartsRequest listPartsRequest, ProtocolMarshaller protocolMarshaller) { if (listPartsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listPartsRequest.getAccountId(), ACCOUNTID_BINDING); protocolMarshaller.marshall(listPartsRequest.getVaultName(), VAULTNAME_BINDING); protocolMarshaller.marshall(listPartsRequest.getUploadId(), UPLOADID_BINDING); protocolMarshaller.marshall(listPartsRequest.getMarker(), MARKER_BINDING); protocolMarshaller.marshall(listPartsRequest.getLimit(), LIMIT_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ListPartsRequest listPartsRequest, ProtocolMarshaller protocolMarshaller) { if (listPartsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listPartsRequest.getAccountId(), ACCOUNTID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listPartsRequest.getVaultName(), VAULTNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listPartsRequest.getUploadId(), UPLOADID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listPartsRequest.getMarker(), MARKER_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listPartsRequest.getLimit(), LIMIT_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 { @Nullable public OfflineDownloadOptions getActiveDownloadForOfflineRegion(OfflineRegion offlineRegion) { OfflineDownloadOptions offlineDownload = null; if (!offlineDownloads.isEmpty()) { for (OfflineDownloadOptions download : offlineDownloads) { if (download.uuid() == offlineRegion.getID()) { offlineDownload = download; } } } return offlineDownload; } }
public class class_name { @Nullable public OfflineDownloadOptions getActiveDownloadForOfflineRegion(OfflineRegion offlineRegion) { OfflineDownloadOptions offlineDownload = null; if (!offlineDownloads.isEmpty()) { for (OfflineDownloadOptions download : offlineDownloads) { if (download.uuid() == offlineRegion.getID()) { offlineDownload = download; // depends on control dependency: [if], data = [none] } } } return offlineDownload; } }
public class class_name { public Field field(int tag) { for (Field field : declaredFields) { if (field.tag() == tag) { return field; } } for (Field field : extensionFields) { if (field.tag() == tag) { return field; } } return null; } }
public class class_name { public Field field(int tag) { for (Field field : declaredFields) { if (field.tag() == tag) { return field; // depends on control dependency: [if], data = [none] } } for (Field field : extensionFields) { if (field.tag() == tag) { return field; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public static Map mapKeys(Mapper mapper, Map map, boolean allowNull) { HashMap h = new HashMap(); for (Object e : map.entrySet()) { Map.Entry entry = (Map.Entry) e; Object o = mapper.map(entry.getKey()); if (allowNull || o != null) { h.put(o, entry.getValue()); } } return h; } }
public class class_name { public static Map mapKeys(Mapper mapper, Map map, boolean allowNull) { HashMap h = new HashMap(); for (Object e : map.entrySet()) { Map.Entry entry = (Map.Entry) e; Object o = mapper.map(entry.getKey()); if (allowNull || o != null) { h.put(o, entry.getValue()); // depends on control dependency: [if], data = [none] } } return h; } }
public class class_name { public static String[] getTopNodes(String[] nodes) { int nodeSize = nodes.length; if (nodeSize == 1) { return nodes; } ArrayList<String> nodeList = new ArrayList<String>(nodeSize); for (int i = 0; i < nodes.length; i++) { String DN = nodes[i]; // If one of the nodes is empty node, one this empty node is top node if (DN.length() == 0) { return new String[] { DN }; } // Remove duplicate nodes boolean duplicated = false; for (int j = 0; j < nodeList.size(); j++) { if (DN.equalsIgnoreCase((String) nodeList.get(j))) { duplicated = true; } } if (!duplicated) { nodeList.add(DN); nodes[i] = DN.toLowerCase(); } } Arrays.sort(nodes, new StringLengthComparator()); ArrayList<String> sortNodeList = new ArrayList<String>(nodeSize); for (int i = 0; i < nodes.length; i++) { sortNodeList.add(nodes[i]); } int count = 1; int i = sortNodeList.size() - count; // Find out super nodes: while (i > 0 && i < sortNodeList.size()) { String node = (String) sortNodeList.get(i); ArrayList<String> removeList = new ArrayList<String>(); for (int j = 0; j < i; j++) { String subNode = (String) sortNodeList.get(j); int index = subNode.indexOf(node); if (index > -1 && (subNode.length() - index) == node.length()) { removeList.add(subNode); } } for (int j = 0; j < removeList.size(); j++) { sortNodeList.remove(removeList.get(j)); } count++; i = sortNodeList.size() - count; } ArrayList<String> resultList = new ArrayList<String>(); for (int k = 0; k < nodeList.size(); k++) { String node = (String) nodeList.get(k); if (sortNodeList.contains(node.toLowerCase())) { resultList.add(node); } } return (String[]) resultList.toArray(new String[0]); } }
public class class_name { public static String[] getTopNodes(String[] nodes) { int nodeSize = nodes.length; if (nodeSize == 1) { return nodes; // depends on control dependency: [if], data = [none] } ArrayList<String> nodeList = new ArrayList<String>(nodeSize); for (int i = 0; i < nodes.length; i++) { String DN = nodes[i]; // If one of the nodes is empty node, one this empty node is top node if (DN.length() == 0) { return new String[] { DN }; // depends on control dependency: [if], data = [none] } // Remove duplicate nodes boolean duplicated = false; for (int j = 0; j < nodeList.size(); j++) { if (DN.equalsIgnoreCase((String) nodeList.get(j))) { duplicated = true; // depends on control dependency: [if], data = [none] } } if (!duplicated) { nodeList.add(DN); // depends on control dependency: [if], data = [none] nodes[i] = DN.toLowerCase(); // depends on control dependency: [if], data = [none] } } Arrays.sort(nodes, new StringLengthComparator()); ArrayList<String> sortNodeList = new ArrayList<String>(nodeSize); for (int i = 0; i < nodes.length; i++) { sortNodeList.add(nodes[i]); // depends on control dependency: [for], data = [i] } int count = 1; int i = sortNodeList.size() - count; // Find out super nodes: while (i > 0 && i < sortNodeList.size()) { String node = (String) sortNodeList.get(i); ArrayList<String> removeList = new ArrayList<String>(); for (int j = 0; j < i; j++) { String subNode = (String) sortNodeList.get(j); int index = subNode.indexOf(node); if (index > -1 && (subNode.length() - index) == node.length()) { removeList.add(subNode); // depends on control dependency: [if], data = [none] } } for (int j = 0; j < removeList.size(); j++) { sortNodeList.remove(removeList.get(j)); // depends on control dependency: [for], data = [j] } count++; // depends on control dependency: [while], data = [none] i = sortNodeList.size() - count; // depends on control dependency: [while], data = [none] } ArrayList<String> resultList = new ArrayList<String>(); for (int k = 0; k < nodeList.size(); k++) { String node = (String) nodeList.get(k); if (sortNodeList.contains(node.toLowerCase())) { resultList.add(node); // depends on control dependency: [if], data = [none] } } return (String[]) resultList.toArray(new String[0]); } }
public class class_name { private void extendTail(int count) { if (terminated || count < 1) { return; } while (--count >= 0) { // create a copy of the last slot and make it the last one final Slot inserted = slots.insertSlotAt(slots.size(), slots.getLastSlot()); inserted.setValue(null); inserted.withTags(TAG_EXTENSION); } } }
public class class_name { private void extendTail(int count) { if (terminated || count < 1) { return; // depends on control dependency: [if], data = [none] } while (--count >= 0) { // create a copy of the last slot and make it the last one final Slot inserted = slots.insertSlotAt(slots.size(), slots.getLastSlot()); inserted.setValue(null); // depends on control dependency: [while], data = [none] inserted.withTags(TAG_EXTENSION); // depends on control dependency: [while], data = [none] } } }
public class class_name { public static File unzip(File zip, File toDir, Predicate<ZipEntry> filter) throws IOException { if (!toDir.exists()) { FileUtils.forceMkdir(toDir); } Path targetDirNormalizedPath = toDir.toPath().normalize(); try (ZipFile zipFile = new ZipFile(zip)) { Enumeration<? extends ZipEntry> entries = zipFile.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); if (filter.test(entry)) { File target = new File(toDir, entry.getName()); verifyInsideTargetDirectory(entry, target.toPath(), targetDirNormalizedPath); if (entry.isDirectory()) { throwExceptionIfDirectoryIsNotCreatable(target); } else { File parent = target.getParentFile(); throwExceptionIfDirectoryIsNotCreatable(parent); copy(zipFile, entry, target); } } } return toDir; } } }
public class class_name { public static File unzip(File zip, File toDir, Predicate<ZipEntry> filter) throws IOException { if (!toDir.exists()) { FileUtils.forceMkdir(toDir); } Path targetDirNormalizedPath = toDir.toPath().normalize(); try (ZipFile zipFile = new ZipFile(zip)) { Enumeration<? extends ZipEntry> entries = zipFile.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); if (filter.test(entry)) { File target = new File(toDir, entry.getName()); verifyInsideTargetDirectory(entry, target.toPath(), targetDirNormalizedPath); // depends on control dependency: [if], data = [none] if (entry.isDirectory()) { throwExceptionIfDirectoryIsNotCreatable(target); // depends on control dependency: [if], data = [none] } else { File parent = target.getParentFile(); throwExceptionIfDirectoryIsNotCreatable(parent); // depends on control dependency: [if], data = [none] copy(zipFile, entry, target); // depends on control dependency: [if], data = [none] } } } return toDir; } } }
public class class_name { public <T> List<T> resultOf(DomainObjectMatch<T> match, boolean forceResolve) { List<T> ret; Object so = InternalAccess.getQueryExecutor(this.domainQuery).getMappingInfo() .getInternalDomainAccess().getSyncObject(); if (so != null) { synchronized (so) { ret = intResultOf(match, forceResolve); } } else ret = intResultOf(match, forceResolve); return ret; } }
public class class_name { public <T> List<T> resultOf(DomainObjectMatch<T> match, boolean forceResolve) { List<T> ret; Object so = InternalAccess.getQueryExecutor(this.domainQuery).getMappingInfo() .getInternalDomainAccess().getSyncObject(); if (so != null) { synchronized (so) { // depends on control dependency: [if], data = [(so] ret = intResultOf(match, forceResolve); } } else ret = intResultOf(match, forceResolve); return ret; } }
public class class_name { boolean findNext( int firstIdx , EdgeSet splitterSet , EdgeSet candidateSet , double parallel, SearchResults results ) { Edge e0 = candidateSet.get(firstIdx); results.index = -1; results.error = Double.MAX_VALUE; boolean checkParallel = !Double.isNaN(parallel); for (int i = 0; i < candidateSet.size(); i++) { if( i == firstIdx ) continue; // stop considering edges when they are more than 180 degrees away Edge eI = candidateSet.get(i); double distanceCCW = UtilAngle.distanceCCW(e0.direction,eI.direction); if( distanceCCW >= Math.PI*0.9 ) // Multiplying by 0.9 helped remove a lot of bad matches continue; // It was pairing up opposite corners under heavy perspective distortion // It should be parallel to a previously found line if( checkParallel ) { double a = UtilAngle.boundHalf(eI.direction); double b = UtilAngle.boundHalf(parallel); double distanceParallel = UtilAngle.distHalf(a,b); if( distanceParallel > parallelTol ) { continue; } } // find the perpendicular corner which splits these two edges and also find the index of // the perpendicular sets which points towards the splitter. if( !findSplitter(e0.direction,eI.direction,splitterSet,e0.dst.perpendicular,eI.dst.perpendicular,tuple3) ) continue; double acute0 = UtilAngle.dist( candidateSet.get(firstIdx).direction, e0.dst.perpendicular.get(tuple3.b).direction); double error0 = UtilAngle.dist(acute0,Math.PI/2.0); if( error0 > Math.PI*0.3 ) continue; double acute1 = UtilAngle.dist( candidateSet.get(i).direction, eI.dst.perpendicular.get(tuple3.c).direction); double error1 = UtilAngle.dist(acute1,Math.PI/2.0); if( error1 > Math.PI*0.3 ) continue; // Find the edge from corner 0 to corner i. The direction of this vector and the corner's // orientation has a known relationship described by 'phaseOri' int e0_to_eI = e0.dst.parallel.find(eI.dst); if( e0_to_eI < 0 ) continue; // The quadrilateral with the smallest area is most often the best solution. Area is more expensive // so the perimeter is computed instead. one side is left off since all of them have that side double error = e0.dst.perpendicular.get(tuple3.b).distance; error += eI.dst.perpendicular.get(tuple3.c).distance; error += eI.distance; if( error < results.error ) { results.error = error; results.index = i; } } return results.index != -1; } }
public class class_name { boolean findNext( int firstIdx , EdgeSet splitterSet , EdgeSet candidateSet , double parallel, SearchResults results ) { Edge e0 = candidateSet.get(firstIdx); results.index = -1; results.error = Double.MAX_VALUE; boolean checkParallel = !Double.isNaN(parallel); for (int i = 0; i < candidateSet.size(); i++) { if( i == firstIdx ) continue; // stop considering edges when they are more than 180 degrees away Edge eI = candidateSet.get(i); double distanceCCW = UtilAngle.distanceCCW(e0.direction,eI.direction); if( distanceCCW >= Math.PI*0.9 ) // Multiplying by 0.9 helped remove a lot of bad matches continue; // It was pairing up opposite corners under heavy perspective distortion // It should be parallel to a previously found line if( checkParallel ) { double a = UtilAngle.boundHalf(eI.direction); double b = UtilAngle.boundHalf(parallel); double distanceParallel = UtilAngle.distHalf(a,b); if( distanceParallel > parallelTol ) { continue; } } // find the perpendicular corner which splits these two edges and also find the index of // the perpendicular sets which points towards the splitter. if( !findSplitter(e0.direction,eI.direction,splitterSet,e0.dst.perpendicular,eI.dst.perpendicular,tuple3) ) continue; double acute0 = UtilAngle.dist( candidateSet.get(firstIdx).direction, e0.dst.perpendicular.get(tuple3.b).direction); double error0 = UtilAngle.dist(acute0,Math.PI/2.0); if( error0 > Math.PI*0.3 ) continue; double acute1 = UtilAngle.dist( candidateSet.get(i).direction, eI.dst.perpendicular.get(tuple3.c).direction); double error1 = UtilAngle.dist(acute1,Math.PI/2.0); if( error1 > Math.PI*0.3 ) continue; // Find the edge from corner 0 to corner i. The direction of this vector and the corner's // orientation has a known relationship described by 'phaseOri' int e0_to_eI = e0.dst.parallel.find(eI.dst); if( e0_to_eI < 0 ) continue; // The quadrilateral with the smallest area is most often the best solution. Area is more expensive // so the perimeter is computed instead. one side is left off since all of them have that side double error = e0.dst.perpendicular.get(tuple3.b).distance; error += eI.dst.perpendicular.get(tuple3.c).distance; // depends on control dependency: [for], data = [none] error += eI.distance; // depends on control dependency: [for], data = [none] if( error < results.error ) { results.error = error; // depends on control dependency: [if], data = [none] results.index = i; // depends on control dependency: [if], data = [none] } } return results.index != -1; } }
public class class_name { public InternalTile paint(InternalTile tile) throws RenderException { if (tile.getContentType().equals(VectorTileContentType.URL_CONTENT)) { if (urlBuilder != null) { if (paintGeometries) { urlBuilder.paintGeometries(paintGeometries); urlBuilder.paintLabels(false); tile.setFeatureContent(urlBuilder.getImageUrl()); } if (paintLabels) { urlBuilder.paintGeometries(false); urlBuilder.paintLabels(paintLabels); tile.setLabelContent(urlBuilder.getImageUrl()); } return tile; } } return tile; } }
public class class_name { public InternalTile paint(InternalTile tile) throws RenderException { if (tile.getContentType().equals(VectorTileContentType.URL_CONTENT)) { if (urlBuilder != null) { if (paintGeometries) { urlBuilder.paintGeometries(paintGeometries); // depends on control dependency: [if], data = [(paintGeometries)] urlBuilder.paintLabels(false); // depends on control dependency: [if], data = [none] tile.setFeatureContent(urlBuilder.getImageUrl()); // depends on control dependency: [if], data = [none] } if (paintLabels) { urlBuilder.paintGeometries(false); // depends on control dependency: [if], data = [none] urlBuilder.paintLabels(paintLabels); // depends on control dependency: [if], data = [(paintLabels)] tile.setLabelContent(urlBuilder.getImageUrl()); // depends on control dependency: [if], data = [none] } return tile; // depends on control dependency: [if], data = [none] } } return tile; } }
public class class_name { public static void readAndWriteStreams(InputStream inputStream,OutputStream outputStream) throws IOException { byte[] buffer=new byte[5000]; int read=-1; try { do { //read next buffer read=inputStream.read(buffer); if(read!=-1) { //write to in memory stream outputStream.write(buffer,0,read); } }while(read!=-1); } finally { //close streams IOHelper.closeResource(inputStream); IOHelper.closeResource(outputStream); } } }
public class class_name { public static void readAndWriteStreams(InputStream inputStream,OutputStream outputStream) throws IOException { byte[] buffer=new byte[5000]; int read=-1; try { do { //read next buffer read=inputStream.read(buffer); if(read!=-1) { //write to in memory stream outputStream.write(buffer,0,read); // depends on control dependency: [if], data = [none] } }while(read!=-1); } finally { //close streams IOHelper.closeResource(inputStream); IOHelper.closeResource(outputStream); } } }
public class class_name { public String objectToString() { try { checkForDao(); } catch (SQLException e) { throw new IllegalArgumentException(e); } @SuppressWarnings("unchecked") T t = (T) this; return dao.objectToString(t); } }
public class class_name { public String objectToString() { try { checkForDao(); // depends on control dependency: [try], data = [none] } catch (SQLException e) { throw new IllegalArgumentException(e); } // depends on control dependency: [catch], data = [none] @SuppressWarnings("unchecked") T t = (T) this; return dao.objectToString(t); } }
public class class_name { public LeapSecondEvent getNextEvent(long utc) { ExtendedLSE[] events = this.getEventsInDescendingOrder(); LeapSecondEvent result = null; for (int i = 0; i < events.length; i++) { ExtendedLSE lse = events[i]; if (utc >= lse.utc()) { break; } else { result = lse; } } return result; } }
public class class_name { public LeapSecondEvent getNextEvent(long utc) { ExtendedLSE[] events = this.getEventsInDescendingOrder(); LeapSecondEvent result = null; for (int i = 0; i < events.length; i++) { ExtendedLSE lse = events[i]; if (utc >= lse.utc()) { break; } else { result = lse; // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { private void removePropertyForEmbedded(Node embeddedNode, String[] embeddedColumnSplit, int i) { if ( i == embeddedColumnSplit.length - 1 ) { // Property String property = embeddedColumnSplit[embeddedColumnSplit.length - 1]; if ( embeddedNode.hasProperty( property ) ) { embeddedNode.removeProperty( property ); } } else { Iterator<Relationship> iterator = embeddedNode.getRelationships( Direction.OUTGOING, withName( embeddedColumnSplit[i] ) ).iterator(); if ( iterator.hasNext() ) { removePropertyForEmbedded( iterator.next().getEndNode(), embeddedColumnSplit, i + 1 ); } } if ( !embeddedNode.getPropertyKeys().iterator().hasNext() ) { // Node without properties Iterator<Relationship> iterator = embeddedNode.getRelationships().iterator(); if ( iterator.hasNext() ) { Relationship relationship = iterator.next(); if ( !iterator.hasNext() ) { // Node with only one relationship and no properties, // we can remove it: // It means we have removed all the properties from the embedded node // and it is NOT an intermediate node like // (entity) --> (embedded1) --> (embedded2) relationship.delete(); embeddedNode.delete(); } } } } }
public class class_name { private void removePropertyForEmbedded(Node embeddedNode, String[] embeddedColumnSplit, int i) { if ( i == embeddedColumnSplit.length - 1 ) { // Property String property = embeddedColumnSplit[embeddedColumnSplit.length - 1]; if ( embeddedNode.hasProperty( property ) ) { embeddedNode.removeProperty( property ); // depends on control dependency: [if], data = [none] } } else { Iterator<Relationship> iterator = embeddedNode.getRelationships( Direction.OUTGOING, withName( embeddedColumnSplit[i] ) ).iterator(); if ( iterator.hasNext() ) { removePropertyForEmbedded( iterator.next().getEndNode(), embeddedColumnSplit, i + 1 ); // depends on control dependency: [if], data = [none] } } if ( !embeddedNode.getPropertyKeys().iterator().hasNext() ) { // Node without properties Iterator<Relationship> iterator = embeddedNode.getRelationships().iterator(); if ( iterator.hasNext() ) { Relationship relationship = iterator.next(); if ( !iterator.hasNext() ) { // Node with only one relationship and no properties, // we can remove it: // It means we have removed all the properties from the embedded node // and it is NOT an intermediate node like // (entity) --> (embedded1) --> (embedded2) relationship.delete(); // depends on control dependency: [if], data = [none] embeddedNode.delete(); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { synchronized CleanupStatus removeFinishedWrites() { Exceptions.checkNotClosed(this.closed, this); long currentTime = this.timeSupplier.get(); long totalElapsed = 0; int removedCount = 0; boolean failedWrite = false; while (!this.writes.isEmpty() && this.writes.peekFirst().isDone()) { Write w = this.writes.removeFirst(); this.totalLength = Math.max(0, this.totalLength - w.data.getLength()); removedCount++; totalElapsed += currentTime - w.getQueueAddedTimestamp(); failedWrite |= w.getFailureCause() != null; } if (removedCount > 0) { this.lastDurationMillis = (int) (totalElapsed / removedCount / AbstractTimer.NANOS_TO_MILLIS); } return failedWrite ? CleanupStatus.WriteFailed : this.writes.isEmpty() ? CleanupStatus.QueueEmpty : CleanupStatus.QueueNotEmpty; } }
public class class_name { synchronized CleanupStatus removeFinishedWrites() { Exceptions.checkNotClosed(this.closed, this); long currentTime = this.timeSupplier.get(); long totalElapsed = 0; int removedCount = 0; boolean failedWrite = false; while (!this.writes.isEmpty() && this.writes.peekFirst().isDone()) { Write w = this.writes.removeFirst(); this.totalLength = Math.max(0, this.totalLength - w.data.getLength()); // depends on control dependency: [while], data = [none] removedCount++; // depends on control dependency: [while], data = [none] totalElapsed += currentTime - w.getQueueAddedTimestamp(); // depends on control dependency: [while], data = [none] failedWrite |= w.getFailureCause() != null; // depends on control dependency: [while], data = [none] } if (removedCount > 0) { this.lastDurationMillis = (int) (totalElapsed / removedCount / AbstractTimer.NANOS_TO_MILLIS); // depends on control dependency: [if], data = [none] } return failedWrite ? CleanupStatus.WriteFailed : this.writes.isEmpty() ? CleanupStatus.QueueEmpty : CleanupStatus.QueueNotEmpty; } }
public class class_name { public void init(Record record, ScreenLocation itsLocation, BasePanel parentScreen, Converter fieldConverter, int iDisplayFieldDesc, Map<String,Object> properties) { if (properties != null) { Task task = parentScreen.getTask(); BaseApplication app = (BaseApplication)task.getApplication(); properties.remove(DBParams.SCREEN); properties.remove(ScreenModel.LOCATION); // Lame properties.remove(ScreenModel.DISPLAY); // Lame boolean isSameProperties = true; for (String key : properties.keySet()) { if ((properties.get(key) == null) || (DBConstants.BLANK.equals(properties.get(key)))) if (app.getProperty(key) != null) properties.put(key, app.getProperty(key)); // Blank property means use old property if (properties.get(key).equals(app.getProperty(key))) continue; isSameProperties = false; } if (!isSameProperties) { app.removeTask(task); task.setApplication(null); Environment env = app.getEnvironment(); Map<String,Object> appProps = env.getDefaultApplication().getProperties(); if ((appProps != null) && (properties != null)) { // Merge starting properties String[] propNames = {DBParams.CONNECTION_TYPE, DBParams.CODEBASE, DBParams.REMOTE_HOST, DBParams.USER_NAME, DBParams.USER_ID, DBParams.LOCAL, DBParams.REMOTE, DBParams.TABLE}; Iterator<String> i = appProps.keySet().iterator(); while (i.hasNext()) { String key = i.next(); for (String s : propNames) { if (s.equalsIgnoreCase(key)) properties.put(key, appProps.get(key)); } } } env.removeApplication(app); env.free(); env = new Environment(properties); app = new MainApplication(env, properties, null); app.addTask(task, null); task.setApplication(app); } } super.init(record, itsLocation, parentScreen, fieldConverter, iDisplayFieldDesc, properties); } }
public class class_name { public void init(Record record, ScreenLocation itsLocation, BasePanel parentScreen, Converter fieldConverter, int iDisplayFieldDesc, Map<String,Object> properties) { if (properties != null) { Task task = parentScreen.getTask(); BaseApplication app = (BaseApplication)task.getApplication(); properties.remove(DBParams.SCREEN); // depends on control dependency: [if], data = [none] properties.remove(ScreenModel.LOCATION); // Lame // depends on control dependency: [if], data = [none] properties.remove(ScreenModel.DISPLAY); // Lame // depends on control dependency: [if], data = [none] boolean isSameProperties = true; for (String key : properties.keySet()) { if ((properties.get(key) == null) || (DBConstants.BLANK.equals(properties.get(key)))) if (app.getProperty(key) != null) properties.put(key, app.getProperty(key)); // Blank property means use old property if (properties.get(key).equals(app.getProperty(key))) continue; isSameProperties = false; // depends on control dependency: [for], data = [none] } if (!isSameProperties) { app.removeTask(task); // depends on control dependency: [if], data = [none] task.setApplication(null); // depends on control dependency: [if], data = [none] Environment env = app.getEnvironment(); Map<String,Object> appProps = env.getDefaultApplication().getProperties(); if ((appProps != null) && (properties != null)) { // Merge starting properties String[] propNames = {DBParams.CONNECTION_TYPE, DBParams.CODEBASE, DBParams.REMOTE_HOST, DBParams.USER_NAME, DBParams.USER_ID, DBParams.LOCAL, DBParams.REMOTE, DBParams.TABLE}; Iterator<String> i = appProps.keySet().iterator(); while (i.hasNext()) { String key = i.next(); for (String s : propNames) { if (s.equalsIgnoreCase(key)) properties.put(key, appProps.get(key)); } } } env.removeApplication(app); // depends on control dependency: [if], data = [none] env.free(); // depends on control dependency: [if], data = [none] env = new Environment(properties); // depends on control dependency: [if], data = [none] app = new MainApplication(env, properties, null); // depends on control dependency: [if], data = [none] app.addTask(task, null); // depends on control dependency: [if], data = [none] task.setApplication(app); // depends on control dependency: [if], data = [none] } } super.init(record, itsLocation, parentScreen, fieldConverter, iDisplayFieldDesc, properties); } }
public class class_name { public TextEditor replaceAll(Pattern pattern, Replacement replacement) { Matcher m = pattern.matcher(text); int lastIndex = 0; StringBuilder sb = new StringBuilder(); while (m.find()) { sb.append(text.subSequence(lastIndex, m.start())); sb.append(replacement.replacement(m)); lastIndex = m.end(); } sb.append(text.subSequence(lastIndex, text.length())); text = sb; return this; } }
public class class_name { public TextEditor replaceAll(Pattern pattern, Replacement replacement) { Matcher m = pattern.matcher(text); int lastIndex = 0; StringBuilder sb = new StringBuilder(); while (m.find()) { sb.append(text.subSequence(lastIndex, m.start())); // depends on control dependency: [while], data = [none] sb.append(replacement.replacement(m)); // depends on control dependency: [while], data = [none] lastIndex = m.end(); // depends on control dependency: [while], data = [none] } sb.append(text.subSequence(lastIndex, text.length())); text = sb; return this; } }
public class class_name { public T getObjectFromNameClassPair(NameClassPair nameClassPair) { if (!(nameClassPair instanceof SearchResult)) { throw new IllegalArgumentException("Parameter must be an instance of SearchResult"); } SearchResult searchResult = (SearchResult) nameClassPair; Attributes attributes = searchResult.getAttributes(); try { return mapper.mapFromAttributes(attributes); } catch (javax.naming.NamingException e) { throw LdapUtils.convertLdapException(e); } } }
public class class_name { public T getObjectFromNameClassPair(NameClassPair nameClassPair) { if (!(nameClassPair instanceof SearchResult)) { throw new IllegalArgumentException("Parameter must be an instance of SearchResult"); } SearchResult searchResult = (SearchResult) nameClassPair; Attributes attributes = searchResult.getAttributes(); try { return mapper.mapFromAttributes(attributes); // depends on control dependency: [try], data = [none] } catch (javax.naming.NamingException e) { throw LdapUtils.convertLdapException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Observable<ServiceResponse<ManagementLockObjectInner>> createOrUpdateAtResourceGroupLevelWithServiceResponseAsync(String resourceGroupName, String lockName, ManagementLockObjectInner parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (lockName == null) { throw new IllegalArgumentException("Parameter lockName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Validator.validate(parameters); return service.createOrUpdateAtResourceGroupLevel(resourceGroupName, lockName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ManagementLockObjectInner>>>() { @Override public Observable<ServiceResponse<ManagementLockObjectInner>> call(Response<ResponseBody> response) { try { ServiceResponse<ManagementLockObjectInner> clientResponse = createOrUpdateAtResourceGroupLevelDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<ManagementLockObjectInner>> createOrUpdateAtResourceGroupLevelWithServiceResponseAsync(String resourceGroupName, String lockName, ManagementLockObjectInner parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (lockName == null) { throw new IllegalArgumentException("Parameter lockName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Validator.validate(parameters); return service.createOrUpdateAtResourceGroupLevel(resourceGroupName, lockName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ManagementLockObjectInner>>>() { @Override public Observable<ServiceResponse<ManagementLockObjectInner>> call(Response<ResponseBody> response) { try { ServiceResponse<ManagementLockObjectInner> clientResponse = createOrUpdateAtResourceGroupLevelDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { public boolean delete(final String name) { return SecurityHelper.doPrivilegedAction(new PrivilegedAction<Boolean>() { public Boolean run() { File directory = new File(baseDir, name); // trivial if it does not exist anymore if (!directory.exists()) { return true; } // delete files first File[] files = directory.listFiles(); if (files != null) { for (int i = 0; i < files.length; i++) { if (!files[i].delete()) { return false; } } } else { return false; } // now delete directory itself return directory.delete(); } }); } }
public class class_name { public boolean delete(final String name) { return SecurityHelper.doPrivilegedAction(new PrivilegedAction<Boolean>() { public Boolean run() { File directory = new File(baseDir, name); // trivial if it does not exist anymore if (!directory.exists()) { return true; // depends on control dependency: [if], data = [none] } // delete files first File[] files = directory.listFiles(); if (files != null) { for (int i = 0; i < files.length; i++) { if (!files[i].delete()) { return false; // depends on control dependency: [if], data = [none] } } } else { return false; // depends on control dependency: [if], data = [none] } // now delete directory itself return directory.delete(); } }); } }
public class class_name { public PermalinkList getPermalinks() { // TODO: shall we cache this? PermalinkList permalinks = new PermalinkList(Permalink.BUILTIN); for (PermalinkProjectAction ppa : getActions(PermalinkProjectAction.class)) { permalinks.addAll(ppa.getPermalinks()); } return permalinks; } }
public class class_name { public PermalinkList getPermalinks() { // TODO: shall we cache this? PermalinkList permalinks = new PermalinkList(Permalink.BUILTIN); for (PermalinkProjectAction ppa : getActions(PermalinkProjectAction.class)) { permalinks.addAll(ppa.getPermalinks()); // depends on control dependency: [for], data = [ppa] } return permalinks; } }
public class class_name { private static void appendSystemClasspath(JobConf conf, String pathSeparator, StringBuffer classPath) { // The alternate runtime can be used to debug tasks by putting a // custom version of the mapred libraries. This will get loaded before // the TT's jars. String debugRuntime = conf.get("mapred.task.debug.runtime.classpath"); if (debugRuntime != null) { classPath.append(pathSeparator); classPath.append(debugRuntime); } // Determine system classpath for tasks. Default to tasktracker's // classpath. String systemClasspath = System.getenv( MAPREDUCE_TASK_SYSTEM_CLASSPATH_PROPERTY); if (systemClasspath == null) { systemClasspath = System.getProperty("java.class.path"); } if (LOG.isDebugEnabled()) { LOG.debug("System classpath " + systemClasspath); } classPath.append(pathSeparator); classPath.append(systemClasspath); } }
public class class_name { private static void appendSystemClasspath(JobConf conf, String pathSeparator, StringBuffer classPath) { // The alternate runtime can be used to debug tasks by putting a // custom version of the mapred libraries. This will get loaded before // the TT's jars. String debugRuntime = conf.get("mapred.task.debug.runtime.classpath"); if (debugRuntime != null) { classPath.append(pathSeparator); // depends on control dependency: [if], data = [none] classPath.append(debugRuntime); // depends on control dependency: [if], data = [(debugRuntime] } // Determine system classpath for tasks. Default to tasktracker's // classpath. String systemClasspath = System.getenv( MAPREDUCE_TASK_SYSTEM_CLASSPATH_PROPERTY); if (systemClasspath == null) { systemClasspath = System.getProperty("java.class.path"); // depends on control dependency: [if], data = [none] } if (LOG.isDebugEnabled()) { LOG.debug("System classpath " + systemClasspath); // depends on control dependency: [if], data = [none] } classPath.append(pathSeparator); classPath.append(systemClasspath); } }
public class class_name { public static BigDecimal roundToClosest(double value, double steps) { final BigDecimal down = DMatrixUtils.roundDownTo(value, steps); final BigDecimal up = DMatrixUtils.roundUpTo(value, steps); final BigDecimal orig = new BigDecimal(String.valueOf(value)); if (orig.subtract(down).abs().compareTo(orig.subtract(up).abs()) < 0) { return down; } return up; } }
public class class_name { public static BigDecimal roundToClosest(double value, double steps) { final BigDecimal down = DMatrixUtils.roundDownTo(value, steps); final BigDecimal up = DMatrixUtils.roundUpTo(value, steps); final BigDecimal orig = new BigDecimal(String.valueOf(value)); if (orig.subtract(down).abs().compareTo(orig.subtract(up).abs()) < 0) { return down; // depends on control dependency: [if], data = [none] } return up; } }
public class class_name { public void setConer(int index, Vector3D v) { if (index <= 0) { this.x1 = v.getX(); this.y1 = v.getY(); } else if (index == 1) { this.x2 = v.getX(); this.y2 = v.getY(); } else if (index == 2) { this.x3 = v.getX(); this.y3 = v.getY(); } else if (3 <= index) { this.x4 = v.getX(); this.y4 = v.getY(); } calcG(); } }
public class class_name { public void setConer(int index, Vector3D v) { if (index <= 0) { this.x1 = v.getX(); // depends on control dependency: [if], data = [none] this.y1 = v.getY(); // depends on control dependency: [if], data = [none] } else if (index == 1) { this.x2 = v.getX(); // depends on control dependency: [if], data = [none] this.y2 = v.getY(); // depends on control dependency: [if], data = [none] } else if (index == 2) { this.x3 = v.getX(); // depends on control dependency: [if], data = [none] this.y3 = v.getY(); // depends on control dependency: [if], data = [none] } else if (3 <= index) { this.x4 = v.getX(); // depends on control dependency: [if], data = [none] this.y4 = v.getY(); // depends on control dependency: [if], data = [none] } calcG(); } }
public class class_name { protected String getCssClass(final String name) { var computedCssClass = "fa fa-lock"; if (StringUtils.isNotBlank(name)) { computedCssClass = computedCssClass.concat(' ' + PAC4J_CLIENT_CSS_CLASS_SUBSTITUTION_PATTERN.matcher(name).replaceAll("-")); } LOGGER.debug("CSS class for [{}] is [{}]", name, computedCssClass); return computedCssClass; } }
public class class_name { protected String getCssClass(final String name) { var computedCssClass = "fa fa-lock"; if (StringUtils.isNotBlank(name)) { computedCssClass = computedCssClass.concat(' ' + PAC4J_CLIENT_CSS_CLASS_SUBSTITUTION_PATTERN.matcher(name).replaceAll("-")); // depends on control dependency: [if], data = [none] } LOGGER.debug("CSS class for [{}] is [{}]", name, computedCssClass); return computedCssClass; } }
public class class_name { public void marshall(CertificateSummary certificateSummary, ProtocolMarshaller protocolMarshaller) { if (certificateSummary == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(certificateSummary.getCertificateArn(), CERTIFICATEARN_BINDING); protocolMarshaller.marshall(certificateSummary.getDomainName(), DOMAINNAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(CertificateSummary certificateSummary, ProtocolMarshaller protocolMarshaller) { if (certificateSummary == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(certificateSummary.getCertificateArn(), CERTIFICATEARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(certificateSummary.getDomainName(), DOMAINNAME_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static Map<String, String> parsePipeSeparatedConfigString(String configString) { Map<String, String> result = new HashMap<>(); if (null != configString) { List<String> options = Arrays.asList(configString.split("\\|")); for (String option : options) { String optKey; String optValue; int firstEquals = option.indexOf("="); if (firstEquals >= 0) { optKey = option.substring(0, firstEquals); optValue = option.substring(firstEquals + 1); } else { optKey = option.toLowerCase(); optValue = null; } if (optKey.length() > 0) { result.put(optKey, optValue); } } } return result; } }
public class class_name { public static Map<String, String> parsePipeSeparatedConfigString(String configString) { Map<String, String> result = new HashMap<>(); if (null != configString) { List<String> options = Arrays.asList(configString.split("\\|")); for (String option : options) { String optKey; String optValue; int firstEquals = option.indexOf("="); if (firstEquals >= 0) { optKey = option.substring(0, firstEquals); // depends on control dependency: [if], data = [none] optValue = option.substring(firstEquals + 1); // depends on control dependency: [if], data = [(firstEquals] } else { optKey = option.toLowerCase(); // depends on control dependency: [if], data = [none] optValue = null; // depends on control dependency: [if], data = [none] } if (optKey.length() > 0) { result.put(optKey, optValue); // depends on control dependency: [if], data = [none] } } } return result; } }
public class class_name { public void setIncludePath(Path src) { if (includePath == null) { includePath = src; } else { includePath.append(src); } } }
public class class_name { public void setIncludePath(Path src) { if (includePath == null) { includePath = src; // depends on control dependency: [if], data = [none] } else { includePath.append(src); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void castToNonPrimitiveIfNecessary(final ClassNode sourceType, final ClassNode targetType) { OperandStack os = controller.getOperandStack(); ClassNode boxedType = os.box(); if (WideningCategories.implementsInterfaceOrSubclassOf(boxedType, targetType)) return; MethodVisitor mv = controller.getMethodVisitor(); if (ClassHelper.CLASS_Type.equals(targetType)) { castToClassMethod.call(mv); } else if (ClassHelper.STRING_TYPE.equals(targetType)) { castToStringMethod.call(mv); } else if (targetType.isDerivedFrom(ClassHelper.Enum_Type)) { (new ClassExpression(targetType)).visit(controller.getAcg()); os.remove(1); castToEnumMethod.call(mv); BytecodeHelper.doCast(mv, targetType); } else { (new ClassExpression(targetType)).visit(controller.getAcg()); os.remove(1); castToTypeMethod.call(mv); } } }
public class class_name { public void castToNonPrimitiveIfNecessary(final ClassNode sourceType, final ClassNode targetType) { OperandStack os = controller.getOperandStack(); ClassNode boxedType = os.box(); if (WideningCategories.implementsInterfaceOrSubclassOf(boxedType, targetType)) return; MethodVisitor mv = controller.getMethodVisitor(); if (ClassHelper.CLASS_Type.equals(targetType)) { castToClassMethod.call(mv); // depends on control dependency: [if], data = [none] } else if (ClassHelper.STRING_TYPE.equals(targetType)) { castToStringMethod.call(mv); // depends on control dependency: [if], data = [none] } else if (targetType.isDerivedFrom(ClassHelper.Enum_Type)) { (new ClassExpression(targetType)).visit(controller.getAcg()); // depends on control dependency: [if], data = [none] os.remove(1); // depends on control dependency: [if], data = [none] castToEnumMethod.call(mv); // depends on control dependency: [if], data = [none] BytecodeHelper.doCast(mv, targetType); // depends on control dependency: [if], data = [none] } else { (new ClassExpression(targetType)).visit(controller.getAcg()); // depends on control dependency: [if], data = [none] os.remove(1); // depends on control dependency: [if], data = [none] castToTypeMethod.call(mv); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Deprecated public static <T> T releaseLater(T msg, int decrement) { if (msg instanceof ReferenceCounted) { ThreadDeathWatcher.watch(Thread.currentThread(), new ReleasingTask((ReferenceCounted) msg, decrement)); } return msg; } }
public class class_name { @Deprecated public static <T> T releaseLater(T msg, int decrement) { if (msg instanceof ReferenceCounted) { ThreadDeathWatcher.watch(Thread.currentThread(), new ReleasingTask((ReferenceCounted) msg, decrement)); // depends on control dependency: [if], data = [none] } return msg; } }
public class class_name { public static float getArtifactUploadPopupWidth(final float newBrowserWidth, final int minPopupWidth) { final float extraWidth = findRequiredSwModuleExtraWidth(newBrowserWidth); if (extraWidth + minPopupWidth > SPUIDefinitions.MAX_UPLOAD_CONFIRMATION_POPUP_WIDTH) { return SPUIDefinitions.MAX_UPLOAD_CONFIRMATION_POPUP_WIDTH; } return extraWidth + minPopupWidth; } }
public class class_name { public static float getArtifactUploadPopupWidth(final float newBrowserWidth, final int minPopupWidth) { final float extraWidth = findRequiredSwModuleExtraWidth(newBrowserWidth); if (extraWidth + minPopupWidth > SPUIDefinitions.MAX_UPLOAD_CONFIRMATION_POPUP_WIDTH) { return SPUIDefinitions.MAX_UPLOAD_CONFIRMATION_POPUP_WIDTH; // depends on control dependency: [if], data = [none] } return extraWidth + minPopupWidth; } }
public class class_name { public void plusMinutes(long delta) { if (delta != 0) { long result = getMinute() + delta; setMinute((int) Math.floorMod(result, 60)); plusHours(Math.floorDiv(result, 60)); } } }
public class class_name { public void plusMinutes(long delta) { if (delta != 0) { long result = getMinute() + delta; setMinute((int) Math.floorMod(result, 60)); // depends on control dependency: [if], data = [0)] plusHours(Math.floorDiv(result, 60)); // depends on control dependency: [if], data = [0)] } } }
public class class_name { public Q clearParameters() { init(); if (preparedStatement == null) { return _this(); } try { preparedStatement.clearParameters(); } catch (SQLException sex) { throw new DbSqlException(sex); } return _this(); } }
public class class_name { public Q clearParameters() { init(); if (preparedStatement == null) { return _this(); // depends on control dependency: [if], data = [none] } try { preparedStatement.clearParameters(); // depends on control dependency: [try], data = [none] } catch (SQLException sex) { throw new DbSqlException(sex); } // depends on control dependency: [catch], data = [none] return _this(); } }
public class class_name { public static void rcvXA_setTxTimeout(CommsByteBuffer request, Conversation conversation, int requestNumber, boolean allocatedFromBufferPool, boolean partOfExchange) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "rcvXA_setTxTimeout", new Object[] { request, conversation, ""+requestNumber, ""+allocatedFromBufferPool, ""+partOfExchange }); try { int clientTransactionId = request.getInt(); int timeout = request.getInt(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "XAResource Object ID", clientTransactionId); SibTr.debug(tc, "Timeout", timeout); } // Get the transaction out of the table ServerLinkLevelState linkState = (ServerLinkLevelState) conversation.getLinkLevelAttachment(); SITransaction tran = linkState.getTransactionTable().get(clientTransactionId, true); boolean success = false; if ((tran != null) && (tran != IdToTransactionTable.INVALID_TRANSACTION)) { // tran may be null if the client is calling this method on // an unenlisted XA resource. // Get the actual transaction ... SIXAResource xaResource = (SIXAResource) tran; // Now call the method on the XA resource success = xaResource.setTransactionTimeout(timeout); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Result: " + success); CommsByteBuffer reply = poolManager.allocate(); if (success) { reply.put((byte) 1); } else { reply.put((byte) 0); } try { conversation.send(reply, JFapChannelConstants.SEG_XA_SETTXTIMEOUT_R, requestNumber, JFapChannelConstants.PRIORITY_MEDIUM, true, ThrottlingPolicy.BLOCK_THREAD, null); } catch (SIException e) { FFDCFilter.processException(e, CLASS_NAME + ".rcvXA_setTxTimeout", CommsConstants.STATICCATXATRANSACTION_SETTXTIMEOUT_01); SibTr.error(tc, "COMMUNICATION_ERROR_SICO2027", e); } } catch (XAException e) { FFDCFilter.processException(e, CLASS_NAME + ".rcvXA_setTxTimeout", CommsConstants.STATICCATXATRANSACTION_SETTXTIMEOUT_02); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "XAException - RC: " + e.errorCode, e); StaticCATHelper.sendExceptionToClient(e, CommsConstants.STATICCATXATRANSACTION_SETTXTIMEOUT_02, conversation, requestNumber); } request.release(allocatedFromBufferPool); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "rcvXA_setTxTimeout"); } }
public class class_name { public static void rcvXA_setTxTimeout(CommsByteBuffer request, Conversation conversation, int requestNumber, boolean allocatedFromBufferPool, boolean partOfExchange) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "rcvXA_setTxTimeout", new Object[] { request, conversation, ""+requestNumber, ""+allocatedFromBufferPool, ""+partOfExchange }); try { int clientTransactionId = request.getInt(); int timeout = request.getInt(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "XAResource Object ID", clientTransactionId); // depends on control dependency: [if], data = [none] SibTr.debug(tc, "Timeout", timeout); // depends on control dependency: [if], data = [none] } // Get the transaction out of the table ServerLinkLevelState linkState = (ServerLinkLevelState) conversation.getLinkLevelAttachment(); SITransaction tran = linkState.getTransactionTable().get(clientTransactionId, true); boolean success = false; if ((tran != null) && (tran != IdToTransactionTable.INVALID_TRANSACTION)) { // tran may be null if the client is calling this method on // an unenlisted XA resource. // Get the actual transaction ... SIXAResource xaResource = (SIXAResource) tran; // Now call the method on the XA resource success = xaResource.setTransactionTimeout(timeout); // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Result: " + success); CommsByteBuffer reply = poolManager.allocate(); if (success) { reply.put((byte) 1); // depends on control dependency: [if], data = [none] } else { reply.put((byte) 0); // depends on control dependency: [if], data = [none] } try { conversation.send(reply, JFapChannelConstants.SEG_XA_SETTXTIMEOUT_R, requestNumber, JFapChannelConstants.PRIORITY_MEDIUM, true, ThrottlingPolicy.BLOCK_THREAD, null); // depends on control dependency: [try], data = [none] } catch (SIException e) { FFDCFilter.processException(e, CLASS_NAME + ".rcvXA_setTxTimeout", CommsConstants.STATICCATXATRANSACTION_SETTXTIMEOUT_01); SibTr.error(tc, "COMMUNICATION_ERROR_SICO2027", e); } // depends on control dependency: [catch], data = [none] } catch (XAException e) { FFDCFilter.processException(e, CLASS_NAME + ".rcvXA_setTxTimeout", CommsConstants.STATICCATXATRANSACTION_SETTXTIMEOUT_02); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "XAException - RC: " + e.errorCode, e); StaticCATHelper.sendExceptionToClient(e, CommsConstants.STATICCATXATRANSACTION_SETTXTIMEOUT_02, conversation, requestNumber); } // depends on control dependency: [catch], data = [none] request.release(allocatedFromBufferPool); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "rcvXA_setTxTimeout"); } }
public class class_name { @SuppressWarnings("unchecked") public static boolean isRunnable(Class cl, String methodName, List<FilterDefinition> filters) { try { Method method = cl.getMethod(methodName); return isRunnable(cl, method, filters); } catch (NoSuchMethodException | SecurityException e) { return true; } } }
public class class_name { @SuppressWarnings("unchecked") public static boolean isRunnable(Class cl, String methodName, List<FilterDefinition> filters) { try { Method method = cl.getMethod(methodName); return isRunnable(cl, method, filters); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException | SecurityException e) { return true; } // depends on control dependency: [catch], data = [none] } }
public class class_name { boolean deliver(final OtpMsg m) { OtpMbox mbox = null; try { final int t = m.type(); if (t == OtpMsg.regSendTag) { final String name = m.getRecipientName(); /* special case for netKernel requests */ if (name.equals("net_kernel")) { return netKernel(m); } mbox = mboxes.get(name); } else { mbox = mboxes.get(m.getRecipientPid()); } if (mbox == null) { return false; } mbox.deliver(m); } catch (final Exception e) { return false; } return true; } }
public class class_name { boolean deliver(final OtpMsg m) { OtpMbox mbox = null; try { final int t = m.type(); if (t == OtpMsg.regSendTag) { final String name = m.getRecipientName(); /* special case for netKernel requests */ if (name.equals("net_kernel")) { return netKernel(m); // depends on control dependency: [if], data = [none] } mbox = mboxes.get(name); // depends on control dependency: [if], data = [none] } else { mbox = mboxes.get(m.getRecipientPid()); // depends on control dependency: [if], data = [none] } if (mbox == null) { return false; // depends on control dependency: [if], data = [none] } mbox.deliver(m); // depends on control dependency: [try], data = [none] } catch (final Exception e) { return false; } // depends on control dependency: [catch], data = [none] return true; } }
public class class_name { public static String escape(String text) { StringBuffer sb = new StringBuffer(); for (char c : text.toCharArray()) { escape(c, sb); } return sb.toString(); } }
public class class_name { public static String escape(String text) { StringBuffer sb = new StringBuffer(); for (char c : text.toCharArray()) { escape(c, sb); // depends on control dependency: [for], data = [c] } return sb.toString(); } }
public class class_name { void processAck(Message msg) { PubAck pa; Exception ex = null; try { pa = PubAck.parseFrom(msg.getData()); } catch (InvalidProtocolBufferException e) { // If we are speaking to a server we don't understand, let the // user know. System.err.println("Protocol error: " + e.getStackTrace()); return; } // Remove AckClosure ackClosure = removeAck(pa.getGuid()); if (ackClosure != null) { // Capture error if it exists. String ackError = pa.getError(); if (ackClosure.ah != null) { if (!ackError.isEmpty()) { ex = new IOException(ackError); } // Perform the ackHandler callback ackClosure.ah.onAck(pa.getGuid(), ex); } else if (ackClosure.ch != null) { try { ackClosure.ch.put(ackError); } catch (InterruptedException e) { // ignore } } } } }
public class class_name { void processAck(Message msg) { PubAck pa; Exception ex = null; try { pa = PubAck.parseFrom(msg.getData()); // depends on control dependency: [try], data = [none] } catch (InvalidProtocolBufferException e) { // If we are speaking to a server we don't understand, let the // user know. System.err.println("Protocol error: " + e.getStackTrace()); return; } // depends on control dependency: [catch], data = [none] // Remove AckClosure ackClosure = removeAck(pa.getGuid()); if (ackClosure != null) { // Capture error if it exists. String ackError = pa.getError(); if (ackClosure.ah != null) { if (!ackError.isEmpty()) { ex = new IOException(ackError); // depends on control dependency: [if], data = [none] } // Perform the ackHandler callback ackClosure.ah.onAck(pa.getGuid(), ex); // depends on control dependency: [if], data = [none] } else if (ackClosure.ch != null) { try { ackClosure.ch.put(ackError); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { // ignore } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { @Override public void execute(final RemoveFromList command) { referenceKeeper.cleanReferenceCache(); if (couldBeExecuted(command)) { executor.execute(command); } } }
public class class_name { @Override public void execute(final RemoveFromList command) { referenceKeeper.cleanReferenceCache(); if (couldBeExecuted(command)) { executor.execute(command); // depends on control dependency: [if], data = [none] } } }
public class class_name { @SuppressWarnings("unchecked") public final FluentModelImplT withTag(String key, String value) { if (this.inner().getTags() == null) { this.inner().withTags(new HashMap<String, String>()); } this.inner().getTags().put(key, value); return (FluentModelImplT) this; } }
public class class_name { @SuppressWarnings("unchecked") public final FluentModelImplT withTag(String key, String value) { if (this.inner().getTags() == null) { this.inner().withTags(new HashMap<String, String>()); // depends on control dependency: [if], data = [none] } this.inner().getTags().put(key, value); return (FluentModelImplT) this; } }
public class class_name { @Override public List<DocumentRevision> delete(final String id) throws DocumentNotFoundException, DocumentStoreException { Misc.checkNotNull(id, "ID"); try { if (id.startsWith(CouchConstants._local_prefix)) { String localId = id.substring(CouchConstants._local_prefix.length()); deleteLocalDocument(localId); // for local documents there is no "new document" to return as the document is // removed rather than updated with a tombstone return Collections.singletonList(null); } else { return get(queue.submitTransaction(new DeleteAllRevisionsCallable(id))); } } catch (ExecutionException e) { // documentnotfoundexception if it was a non-existent local document throwCauseAs(e, DocumentNotFoundException.class); String message = "Failed to delete document"; logger.log(Level.SEVERE, message, e); throw new DocumentStoreException(message, e.getCause()); } } }
public class class_name { @Override public List<DocumentRevision> delete(final String id) throws DocumentNotFoundException, DocumentStoreException { Misc.checkNotNull(id, "ID"); try { if (id.startsWith(CouchConstants._local_prefix)) { String localId = id.substring(CouchConstants._local_prefix.length()); deleteLocalDocument(localId); // depends on control dependency: [if], data = [none] // for local documents there is no "new document" to return as the document is // removed rather than updated with a tombstone return Collections.singletonList(null); // depends on control dependency: [if], data = [none] } else { return get(queue.submitTransaction(new DeleteAllRevisionsCallable(id))); // depends on control dependency: [if], data = [none] } } catch (ExecutionException e) { // documentnotfoundexception if it was a non-existent local document throwCauseAs(e, DocumentNotFoundException.class); String message = "Failed to delete document"; logger.log(Level.SEVERE, message, e); throw new DocumentStoreException(message, e.getCause()); } } }