code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { @Override public <K,V> Map<K,V> getBigMap(String name, Class<K> keyClass, Class<V> valueClass, StorageEngine.MapType type, StorageEngine.StorageHint storageHint, boolean isConcurrent, boolean isTemporary) { assertConnectionOpen(); if(storageHint == StorageEngine.StorageHint.IN_MEMORY && storageConfiguration.isHybridized()) { //store in memory if(StorageEngine.MapType.HASHMAP.equals(type)) { return isConcurrent?new ConcurrentHashMap<>():new HashMap<>(); } else if(StorageEngine.MapType.TREEMAP.equals(type)) { return isConcurrent?new ConcurrentSkipListMap<>():new TreeMap<>(); } else { throw new IllegalArgumentException("Unsupported MapType."); } } else { //store in disk with optional LRU cache //first find if the particular collection exists and retrieve its storageType StorageType storageType = getStorageTypeFromName(name); if(storageType == null) { //the map does not exist. Find where it should be created. if(isTemporary == false) { if(storageHint == StorageEngine.StorageHint.IN_MEMORY || storageHint == StorageEngine.StorageHint.IN_CACHE) { //we will use the LRU cache option storageType = StorageType.PRIMARY_STORAGE; } else if(storageHint == StorageEngine.StorageHint.IN_DISK) { //no cache at all storageType = StorageType.SECONDARY_STORAGE; } else { throw new IllegalArgumentException("Unsupported StorageHint."); } } else { if(storageHint == StorageEngine.StorageHint.IN_MEMORY || storageHint == StorageEngine.StorageHint.IN_CACHE) { //we will use the LRU cache option storageType = StorageType.TEMP_PRIMARY_STORAGE; } else if(storageHint == StorageEngine.StorageHint.IN_DISK) { //no cache at all storageType = StorageType.TEMP_SECONDARY_STORAGE; } else { throw new IllegalArgumentException("Unsupported StorageHint."); } } } //ensure the storage is open DB storage = openStorage(storageType); //return the appropriate type Map<K,V> map; if(StorageEngine.MapType.HASHMAP.equals(type)) { map = storage.createHashMap(name) .counterEnable() .keySerializer(getSerializerFromClass(keyClass)) .valueSerializer(getSerializerFromClass(valueClass)) .makeOrGet(); } else if(StorageEngine.MapType.TREEMAP.equals(type)) { map = storage.createTreeMap(name) .valuesOutsideNodesEnable() .counterEnable() .keySerializer(getBTreeKeySerializerFromClass(keyClass)) .valueSerializer(getSerializerFromClass(valueClass)) .makeOrGet(); //HOTFIX: There is a race condition in BTreeMap (MapDB v1.0.9 - https://github.com/jankotek/mapdb/issues/664). Remove it once it's patched. if(isConcurrent) { map = Collections.synchronizedMap(map); } } else { throw new IllegalArgumentException("Unsupported MapType."); } return map; } } }
public class class_name { @Override public <K,V> Map<K,V> getBigMap(String name, Class<K> keyClass, Class<V> valueClass, StorageEngine.MapType type, StorageEngine.StorageHint storageHint, boolean isConcurrent, boolean isTemporary) { assertConnectionOpen(); if(storageHint == StorageEngine.StorageHint.IN_MEMORY && storageConfiguration.isHybridized()) { //store in memory if(StorageEngine.MapType.HASHMAP.equals(type)) { return isConcurrent?new ConcurrentHashMap<>():new HashMap<>(); // depends on control dependency: [if], data = [none] } else if(StorageEngine.MapType.TREEMAP.equals(type)) { return isConcurrent?new ConcurrentSkipListMap<>():new TreeMap<>(); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Unsupported MapType."); } } else { //store in disk with optional LRU cache //first find if the particular collection exists and retrieve its storageType StorageType storageType = getStorageTypeFromName(name); if(storageType == null) { //the map does not exist. Find where it should be created. if(isTemporary == false) { if(storageHint == StorageEngine.StorageHint.IN_MEMORY || storageHint == StorageEngine.StorageHint.IN_CACHE) { //we will use the LRU cache option storageType = StorageType.PRIMARY_STORAGE; // depends on control dependency: [if], data = [none] } else if(storageHint == StorageEngine.StorageHint.IN_DISK) { //no cache at all storageType = StorageType.SECONDARY_STORAGE; // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Unsupported StorageHint."); } } else { if(storageHint == StorageEngine.StorageHint.IN_MEMORY || storageHint == StorageEngine.StorageHint.IN_CACHE) { //we will use the LRU cache option storageType = StorageType.TEMP_PRIMARY_STORAGE; // depends on control dependency: [if], data = [none] } else if(storageHint == StorageEngine.StorageHint.IN_DISK) { //no cache at all storageType = StorageType.TEMP_SECONDARY_STORAGE; // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Unsupported StorageHint."); } } } //ensure the storage is open DB storage = openStorage(storageType); //return the appropriate type Map<K,V> map; if(StorageEngine.MapType.HASHMAP.equals(type)) { map = storage.createHashMap(name) .counterEnable() .keySerializer(getSerializerFromClass(keyClass)) .valueSerializer(getSerializerFromClass(valueClass)) .makeOrGet(); // depends on control dependency: [if], data = [none] } else if(StorageEngine.MapType.TREEMAP.equals(type)) { map = storage.createTreeMap(name) .valuesOutsideNodesEnable() .counterEnable() .keySerializer(getBTreeKeySerializerFromClass(keyClass)) .valueSerializer(getSerializerFromClass(valueClass)) .makeOrGet(); // depends on control dependency: [if], data = [none] //HOTFIX: There is a race condition in BTreeMap (MapDB v1.0.9 - https://github.com/jankotek/mapdb/issues/664). Remove it once it's patched. if(isConcurrent) { map = Collections.synchronizedMap(map); // depends on control dependency: [if], data = [none] } } else { throw new IllegalArgumentException("Unsupported MapType."); } return map; // depends on control dependency: [if], data = [none] } } }
public class class_name { public Object invokeBestMethodOnTarget( String[] methodNames, final Object target, final Object... arguments ) throws NoSuchMethodException, SecurityException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { Class<?>[] argumentClasses = buildArgumentClasses(arguments); int remaining = methodNames.length; Object result = null; for (String methodName : methodNames) { --remaining; try { final Method method = findBestMethodWithSignature(methodName, argumentClasses); result = AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { @Override public Object run() throws Exception { return method.invoke(target, arguments); } }); break; } catch (PrivilegedActionException pae) { // pae will be wrapping one of IllegalAccessException, IllegalArgumentException, InvocationTargetException if (pae.getException() instanceof IllegalAccessException) { throw (IllegalAccessException)pae.getException(); } if (pae.getException() instanceof IllegalArgumentException) { throw (IllegalArgumentException)pae.getException(); } if (pae.getException() instanceof InvocationTargetException) { throw (InvocationTargetException)pae.getException(); } } catch (NoSuchMethodException e) { if (remaining == 0) throw e; } } return result; } }
public class class_name { public Object invokeBestMethodOnTarget( String[] methodNames, final Object target, final Object... arguments ) throws NoSuchMethodException, SecurityException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { Class<?>[] argumentClasses = buildArgumentClasses(arguments); int remaining = methodNames.length; Object result = null; for (String methodName : methodNames) { --remaining; // depends on control dependency: [for], data = [none] try { final Method method = findBestMethodWithSignature(methodName, argumentClasses); result = AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { @Override public Object run() throws Exception { return method.invoke(target, arguments); } }); // depends on control dependency: [try], data = [none] break; } catch (PrivilegedActionException pae) { // pae will be wrapping one of IllegalAccessException, IllegalArgumentException, InvocationTargetException if (pae.getException() instanceof IllegalAccessException) { throw (IllegalAccessException)pae.getException(); } if (pae.getException() instanceof IllegalArgumentException) { throw (IllegalArgumentException)pae.getException(); } if (pae.getException() instanceof InvocationTargetException) { throw (InvocationTargetException)pae.getException(); } } catch (NoSuchMethodException e) { // depends on control dependency: [catch], data = [none] if (remaining == 0) throw e; } // depends on control dependency: [catch], data = [none] } return result; } }
public class class_name { public boolean disapproveTranslation(String appid, String langCode, String key) { if (StringUtils.isBlank(langCode) || key == null || getDefaultLanguageCode().equals(langCode)) { return false; } Sysprop s = dao.read(appid, keyPrefix.concat(langCode)); if (s != null) { String value = getDefaultLanguage(appid).get(key); s.addProperty(key, value); dao.update(appid, s); if (LANG_CACHE.containsKey(langCode)) { LANG_CACHE.get(langCode).put(key, value); } updateTranslationProgressMap(appid, langCode, MINUS); return true; } return false; } }
public class class_name { public boolean disapproveTranslation(String appid, String langCode, String key) { if (StringUtils.isBlank(langCode) || key == null || getDefaultLanguageCode().equals(langCode)) { return false; // depends on control dependency: [if], data = [none] } Sysprop s = dao.read(appid, keyPrefix.concat(langCode)); if (s != null) { String value = getDefaultLanguage(appid).get(key); s.addProperty(key, value); // depends on control dependency: [if], data = [none] dao.update(appid, s); // depends on control dependency: [if], data = [none] if (LANG_CACHE.containsKey(langCode)) { LANG_CACHE.get(langCode).put(key, value); // depends on control dependency: [if], data = [none] } updateTranslationProgressMap(appid, langCode, MINUS); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { private void initNotificationBuilder(Context context) { // inti builder. mNotificationBuilder = new NotificationCompat.Builder(context); mNotificationView = new RemoteViews(context.getPackageName(), R.layout.simple_sound_cloud_notification); mNotificationExpandedView = new RemoteViews(context.getPackageName(), R.layout.simple_sound_cloud_notification_expanded); // add right icon on Lollipop. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { addSmallIcon(mNotificationView); addSmallIcon(mNotificationExpandedView); } // set pending intents mNotificationView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_previous, mPreviousPendingIntent); mNotificationExpandedView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_previous, mPreviousPendingIntent); mNotificationView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_next, mNextPendingIntent); mNotificationExpandedView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_next, mNextPendingIntent); mNotificationView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_play, mTogglePlaybackPendingIntent); mNotificationExpandedView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_play, mTogglePlaybackPendingIntent); mNotificationView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_clear, mClearPendingIntent); mNotificationExpandedView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_clear, mClearPendingIntent); // add icon for action bar. mNotificationBuilder.setSmallIcon(mNotificationConfig.getNotificationIcon()); // set the remote view. mNotificationBuilder.setContent(mNotificationView); // set the notification priority. mNotificationBuilder.setPriority(NotificationCompat.PRIORITY_HIGH); mNotificationBuilder.setStyle(new NotificationCompat.DecoratedCustomViewStyle()); // set the content intent. Class<?> playerActivity = mNotificationConfig.getNotificationActivity(); if (playerActivity != null) { Intent i = new Intent(context, playerActivity); PendingIntent contentIntent = PendingIntent.getActivity(context, REQUEST_DISPLAYING_CONTROLLER, i, PendingIntent.FLAG_UPDATE_CURRENT); mNotificationBuilder.setContentIntent(contentIntent); } } }
public class class_name { private void initNotificationBuilder(Context context) { // inti builder. mNotificationBuilder = new NotificationCompat.Builder(context); mNotificationView = new RemoteViews(context.getPackageName(), R.layout.simple_sound_cloud_notification); mNotificationExpandedView = new RemoteViews(context.getPackageName(), R.layout.simple_sound_cloud_notification_expanded); // add right icon on Lollipop. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { addSmallIcon(mNotificationView); // depends on control dependency: [if], data = [none] addSmallIcon(mNotificationExpandedView); // depends on control dependency: [if], data = [none] } // set pending intents mNotificationView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_previous, mPreviousPendingIntent); mNotificationExpandedView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_previous, mPreviousPendingIntent); mNotificationView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_next, mNextPendingIntent); mNotificationExpandedView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_next, mNextPendingIntent); mNotificationView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_play, mTogglePlaybackPendingIntent); mNotificationExpandedView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_play, mTogglePlaybackPendingIntent); mNotificationView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_clear, mClearPendingIntent); mNotificationExpandedView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_clear, mClearPendingIntent); // add icon for action bar. mNotificationBuilder.setSmallIcon(mNotificationConfig.getNotificationIcon()); // set the remote view. mNotificationBuilder.setContent(mNotificationView); // set the notification priority. mNotificationBuilder.setPriority(NotificationCompat.PRIORITY_HIGH); mNotificationBuilder.setStyle(new NotificationCompat.DecoratedCustomViewStyle()); // set the content intent. Class<?> playerActivity = mNotificationConfig.getNotificationActivity(); if (playerActivity != null) { Intent i = new Intent(context, playerActivity); PendingIntent contentIntent = PendingIntent.getActivity(context, REQUEST_DISPLAYING_CONTROLLER, i, PendingIntent.FLAG_UPDATE_CURRENT); mNotificationBuilder.setContentIntent(contentIntent); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(DeviceFilter deviceFilter, ProtocolMarshaller protocolMarshaller) { if (deviceFilter == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deviceFilter.getAttribute(), ATTRIBUTE_BINDING); protocolMarshaller.marshall(deviceFilter.getOperator(), OPERATOR_BINDING); protocolMarshaller.marshall(deviceFilter.getValues(), VALUES_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeviceFilter deviceFilter, ProtocolMarshaller protocolMarshaller) { if (deviceFilter == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deviceFilter.getAttribute(), ATTRIBUTE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deviceFilter.getOperator(), OPERATOR_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deviceFilter.getValues(), VALUES_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 String getPrefix(int nodeHandle) { nodes.readSlot(nodeHandle, gotslot); short type = (short) (gotslot[0] & 0xFFFF); String name = ""; if((type==ELEMENT_NODE) || (type==ATTRIBUTE_NODE)) { int i=gotslot[3]; name=m_prefixNames.indexToString(i >>16); if(name==null) name=""; } return name; } }
public class class_name { public String getPrefix(int nodeHandle) { nodes.readSlot(nodeHandle, gotslot); short type = (short) (gotslot[0] & 0xFFFF); String name = ""; if((type==ELEMENT_NODE) || (type==ATTRIBUTE_NODE)) { int i=gotslot[3]; name=m_prefixNames.indexToString(i >>16); // depends on control dependency: [if], data = [none] if(name==null) name=""; } return name; } }
public class class_name { private Expr parseBitwiseOrExpression(EnclosingScope scope, boolean terminated) { int start = index; Expr lhs = parseBitwiseXorExpression(scope, terminated); if (tryAndMatch(terminated, VerticalBar) != null) { Expr rhs = parseExpression(scope, terminated); return annotateSourceLocation(new Expr.BitwiseOr(Type.Byte, new Tuple<>(lhs, rhs)), start); } return lhs; } }
public class class_name { private Expr parseBitwiseOrExpression(EnclosingScope scope, boolean terminated) { int start = index; Expr lhs = parseBitwiseXorExpression(scope, terminated); if (tryAndMatch(terminated, VerticalBar) != null) { Expr rhs = parseExpression(scope, terminated); return annotateSourceLocation(new Expr.BitwiseOr(Type.Byte, new Tuple<>(lhs, rhs)), start); // depends on control dependency: [if], data = [none] } return lhs; } }
public class class_name { private String parseValue(String fieldType, Object value) { if (TypeConver.isBasicType(fieldType)) { if (value != null) { return value.toString(); } else { return null; } } return null; } }
public class class_name { private String parseValue(String fieldType, Object value) { if (TypeConver.isBasicType(fieldType)) { if (value != null) { return value.toString(); // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { void unregisterEntry(ListIterator<PathElement> iterator, String value, ConcreteNotificationHandlerRegistration.NotificationHandlerEntry entry) { NotificationHandlerNodeRegistry registry = childRegistries.get(value); if (registry == null) { return; } registry.unregisterEntry(iterator, entry); } }
public class class_name { void unregisterEntry(ListIterator<PathElement> iterator, String value, ConcreteNotificationHandlerRegistration.NotificationHandlerEntry entry) { NotificationHandlerNodeRegistry registry = childRegistries.get(value); if (registry == null) { return; // depends on control dependency: [if], data = [none] } registry.unregisterEntry(iterator, entry); } }
public class class_name { public String getDataImage(boolean forceUpdate, final Map<String, File> pluginFiles, String imageName) throws IOException, SettingsBuildingException, InterruptedException { String existedDataImage = null; final List<Image> images = getDockerCli().listImagesCmd() .withShowAll(true) .exec(); OUTER: for (Image image : images) { final String[] repoTags = image.getRepoTags(); if (nonNull(repoTags)) { for (String repoTag : repoTags) { if (repoTag.equals(imageName)) { existedDataImage = image.getId(); break OUTER; } } } } if (nonNull(existedDataImage) && (forceUpdate || !isActualDataImage(pluginFiles, existedDataImage))) { LOG.info("Removing data-image."); //TODO https://github.com/docker-java/docker-java/issues/398 getDockerCli().removeImageCmd(existedDataImage).withForce(true).exec(); existedDataImage = null; } if (isNull(existedDataImage)) { LOG.debug("Preparing plugin files for"); // final Set<Artifact> artifactResults = resolvePluginsFor(THIS_PLUGIN); // LOG.debug("Resolved plugins: {}", artifactResults); //// System.out.println(artifactResults); // artifactResults.stream().forEach(artifact -> // pluginFiles.put( // // {@link hudson.PluginManager.copyBundledPlugin()} //// artifact.getArtifactId() + "." + artifact.getExtension(), // artifact.getArtifactId() + ".jpi", // artifact.getFile() // ) // ); existedDataImage = buildImage(pluginFiles); } return existedDataImage; } }
public class class_name { public String getDataImage(boolean forceUpdate, final Map<String, File> pluginFiles, String imageName) throws IOException, SettingsBuildingException, InterruptedException { String existedDataImage = null; final List<Image> images = getDockerCli().listImagesCmd() .withShowAll(true) .exec(); OUTER: for (Image image : images) { final String[] repoTags = image.getRepoTags(); if (nonNull(repoTags)) { for (String repoTag : repoTags) { if (repoTag.equals(imageName)) { existedDataImage = image.getId(); // depends on control dependency: [if], data = [none] break OUTER; } } } } if (nonNull(existedDataImage) && (forceUpdate || !isActualDataImage(pluginFiles, existedDataImage))) { LOG.info("Removing data-image."); //TODO https://github.com/docker-java/docker-java/issues/398 getDockerCli().removeImageCmd(existedDataImage).withForce(true).exec(); existedDataImage = null; } if (isNull(existedDataImage)) { LOG.debug("Preparing plugin files for"); // final Set<Artifact> artifactResults = resolvePluginsFor(THIS_PLUGIN); // LOG.debug("Resolved plugins: {}", artifactResults); //// System.out.println(artifactResults); // artifactResults.stream().forEach(artifact -> // pluginFiles.put( // // {@link hudson.PluginManager.copyBundledPlugin()} //// artifact.getArtifactId() + "." + artifact.getExtension(), // artifact.getArtifactId() + ".jpi", // artifact.getFile() // ) // ); existedDataImage = buildImage(pluginFiles); } return existedDataImage; } }
public class class_name { public Q setMap(final Map parameters) { if (parameters == null) { return _this(); } init(); query.forEachNamedParameter(p -> { final String paramName = p.name; setObject(paramName, parameters.get(paramName)); }); return _this(); } }
public class class_name { public Q setMap(final Map parameters) { if (parameters == null) { return _this(); // depends on control dependency: [if], data = [none] } init(); query.forEachNamedParameter(p -> { final String paramName = p.name; setObject(paramName, parameters.get(paramName)); }); return _this(); } }
public class class_name { @VisibleForTesting int getValueFromList(final List<Integer> values, int index, final AtomicInteger shift) { Preconditions.checkNotNullNorEmpty(values, "List must not be empty"); if (index < 0) { index = index + values.size(); shift.incrementAndGet(); return getValueFromList(values, index, shift); } if (index >= values.size()) { index = index - values.size(); shift.incrementAndGet(); return getValueFromList(values, index, shift); } return values.get(index); } }
public class class_name { @VisibleForTesting int getValueFromList(final List<Integer> values, int index, final AtomicInteger shift) { Preconditions.checkNotNullNorEmpty(values, "List must not be empty"); if (index < 0) { index = index + values.size(); // depends on control dependency: [if], data = [none] shift.incrementAndGet(); // depends on control dependency: [if], data = [none] return getValueFromList(values, index, shift); // depends on control dependency: [if], data = [none] } if (index >= values.size()) { index = index - values.size(); // depends on control dependency: [if], data = [none] shift.incrementAndGet(); // depends on control dependency: [if], data = [none] return getValueFromList(values, index, shift); // depends on control dependency: [if], data = [none] } return values.get(index); } }
public class class_name { public void marshall(BatchDeleteImageRequest batchDeleteImageRequest, ProtocolMarshaller protocolMarshaller) { if (batchDeleteImageRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(batchDeleteImageRequest.getRegistryId(), REGISTRYID_BINDING); protocolMarshaller.marshall(batchDeleteImageRequest.getRepositoryName(), REPOSITORYNAME_BINDING); protocolMarshaller.marshall(batchDeleteImageRequest.getImageIds(), IMAGEIDS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(BatchDeleteImageRequest batchDeleteImageRequest, ProtocolMarshaller protocolMarshaller) { if (batchDeleteImageRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(batchDeleteImageRequest.getRegistryId(), REGISTRYID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(batchDeleteImageRequest.getRepositoryName(), REPOSITORYNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(batchDeleteImageRequest.getImageIds(), IMAGEIDS_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 { @SuppressWarnings("checkstyle:npathcomplexity") public static IClasspathEntry[][] decodeClasspath(String projectName, IPath projectRootAbsoluteFullPath, String xmlClasspath, Map<IPath, UnknownXmlElements> unknownElements) throws IOException, ClasspathEntry.AssertionFailedException { final List<IClasspathEntry> paths = new ArrayList<>(); IClasspathEntry defaultOutput = null; final Element cpElement; try (StringReader reader = new StringReader(xmlClasspath);) { final DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); cpElement = parser.parse(new InputSource(reader)).getDocumentElement(); } catch (SAXException e) { throw new IOException(Messages.file_badFormat); } catch (ParserConfigurationException e) { throw new IOException(Messages.file_badFormat); } if (!cpElement.getNodeName().equalsIgnoreCase("classpath")) { //$NON-NLS-1$ throw new IOException(Messages.file_badFormat); } NodeList list = cpElement.getElementsByTagName(ClasspathEntry.TAG_CLASSPATHENTRY); int length = list.getLength(); for (int i = 0; i < length; ++i) { final Node node = list.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { final IClasspathEntry entry = elementDecode((Element) node, projectName, projectRootAbsoluteFullPath, unknownElements); if (entry != null) { if (entry.getContentKind() == ClasspathEntry.K_OUTPUT) { // separate output defaultOutput = entry; } else { paths.add(entry); } } } } final int pathSize = paths.size(); final IClasspathEntry[][] entries = new IClasspathEntry[2][]; entries[0] = new IClasspathEntry[pathSize + (defaultOutput == null ? 0 : 1)]; paths.toArray(entries[0]); if (defaultOutput != null) { // ensure output is last item entries[0][pathSize] = defaultOutput; } paths.clear(); list = cpElement.getElementsByTagName(ClasspathEntry.TAG_REFERENCED_ENTRY); length = list.getLength(); for (int i = 0; i < length; ++i) { final Node node = list.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { final IClasspathEntry entry = elementDecode((Element) node, projectName, projectRootAbsoluteFullPath, unknownElements); if (entry != null) { paths.add(entry); } } } entries[1] = new IClasspathEntry[paths.size()]; paths.toArray(entries[1]); return entries; } }
public class class_name { @SuppressWarnings("checkstyle:npathcomplexity") public static IClasspathEntry[][] decodeClasspath(String projectName, IPath projectRootAbsoluteFullPath, String xmlClasspath, Map<IPath, UnknownXmlElements> unknownElements) throws IOException, ClasspathEntry.AssertionFailedException { final List<IClasspathEntry> paths = new ArrayList<>(); IClasspathEntry defaultOutput = null; final Element cpElement; try (StringReader reader = new StringReader(xmlClasspath);) { final DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); cpElement = parser.parse(new InputSource(reader)).getDocumentElement(); } catch (SAXException e) { throw new IOException(Messages.file_badFormat); } catch (ParserConfigurationException e) { throw new IOException(Messages.file_badFormat); } if (!cpElement.getNodeName().equalsIgnoreCase("classpath")) { //$NON-NLS-1$ throw new IOException(Messages.file_badFormat); } NodeList list = cpElement.getElementsByTagName(ClasspathEntry.TAG_CLASSPATHENTRY); int length = list.getLength(); for (int i = 0; i < length; ++i) { final Node node = list.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { final IClasspathEntry entry = elementDecode((Element) node, projectName, projectRootAbsoluteFullPath, unknownElements); if (entry != null) { if (entry.getContentKind() == ClasspathEntry.K_OUTPUT) { // separate output defaultOutput = entry; // depends on control dependency: [if], data = [none] } else { paths.add(entry); // depends on control dependency: [if], data = [none] } } } } final int pathSize = paths.size(); final IClasspathEntry[][] entries = new IClasspathEntry[2][]; entries[0] = new IClasspathEntry[pathSize + (defaultOutput == null ? 0 : 1)]; paths.toArray(entries[0]); if (defaultOutput != null) { // ensure output is last item entries[0][pathSize] = defaultOutput; } paths.clear(); list = cpElement.getElementsByTagName(ClasspathEntry.TAG_REFERENCED_ENTRY); length = list.getLength(); for (int i = 0; i < length; ++i) { final Node node = list.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { final IClasspathEntry entry = elementDecode((Element) node, projectName, projectRootAbsoluteFullPath, unknownElements); if (entry != null) { paths.add(entry); } } } entries[1] = new IClasspathEntry[paths.size()]; paths.toArray(entries[1]); return entries; } }
public class class_name { void _fireEvent(ActivityHandle realHandle, ActivityHandle refHandle, FireableEventType eventType, Object event, Address address, ReceivableService receivableService, int eventFlags, final SleeTransaction barrierTx) throws ActivityIsEndingException, SLEEException { final ActivityContextHandle ach = new ResourceAdaptorActivityContextHandleImpl( raEntity, refHandle); // get ac final ActivityContext ac = acFactory.getActivityContext(ach); if (ac == null) { throw new UnrecognizedActivityHandleException("Unable to fire " + eventType.getEventType() + " on activity handle " + realHandle + " , the handle is not mapped to an activity context"); } else { // suspend activity if needed if (barrierTx != null) { final ActivityEventQueueManager aeqm = ac.getLocalActivityContext().getEventQueueManager(); aeqm.createBarrier(barrierTx); TransactionalAction action = new TransactionalAction() { public void execute() { aeqm.removeBarrier(barrierTx); } }; final TransactionContext tc = barrierTx.getTransactionContext(); tc.getAfterCommitActions().add(action); tc.getAfterRollbackActions().add(action); } final EventProcessingCallbacks callbacks = new EventProcessingCallbacks( realHandle, eventType, event, address, receivableService, eventFlags, raEntity); final EventProcessingSucceedCallback succeedCallback = EventFlags .hasRequestProcessingSuccessfulCallback(eventFlags) ? callbacks : null; final EventProcessingFailedCallback failedCallback = EventFlags .hasRequestProcessingFailedCallback(eventFlags) ? callbacks : null; final EventUnreferencedCallback unreferencedCallback = EventFlags .hasRequestEventReferenceReleasedCallback(eventFlags) ? callbacks : null; ac.fireEvent(eventType.getEventType(), event, address, receivableService == null ? null : receivableService .getService(), succeedCallback, failedCallback, unreferencedCallback); } } }
public class class_name { void _fireEvent(ActivityHandle realHandle, ActivityHandle refHandle, FireableEventType eventType, Object event, Address address, ReceivableService receivableService, int eventFlags, final SleeTransaction barrierTx) throws ActivityIsEndingException, SLEEException { final ActivityContextHandle ach = new ResourceAdaptorActivityContextHandleImpl( raEntity, refHandle); // get ac final ActivityContext ac = acFactory.getActivityContext(ach); if (ac == null) { throw new UnrecognizedActivityHandleException("Unable to fire " + eventType.getEventType() + " on activity handle " + realHandle + " , the handle is not mapped to an activity context"); } else { // suspend activity if needed if (barrierTx != null) { final ActivityEventQueueManager aeqm = ac.getLocalActivityContext().getEventQueueManager(); aeqm.createBarrier(barrierTx); // depends on control dependency: [if], data = [(barrierTx] TransactionalAction action = new TransactionalAction() { public void execute() { aeqm.removeBarrier(barrierTx); } }; final TransactionContext tc = barrierTx.getTransactionContext(); tc.getAfterCommitActions().add(action); // depends on control dependency: [if], data = [none] tc.getAfterRollbackActions().add(action); // depends on control dependency: [if], data = [none] } final EventProcessingCallbacks callbacks = new EventProcessingCallbacks( realHandle, eventType, event, address, receivableService, eventFlags, raEntity); final EventProcessingSucceedCallback succeedCallback = EventFlags .hasRequestProcessingSuccessfulCallback(eventFlags) ? callbacks : null; final EventProcessingFailedCallback failedCallback = EventFlags .hasRequestProcessingFailedCallback(eventFlags) ? callbacks : null; final EventUnreferencedCallback unreferencedCallback = EventFlags .hasRequestEventReferenceReleasedCallback(eventFlags) ? callbacks : null; ac.fireEvent(eventType.getEventType(), event, address, receivableService == null ? null : receivableService .getService(), succeedCallback, failedCallback, unreferencedCallback); } } }
public class class_name { protected boolean addDependencies(DependencyContainer container) { /* XXX: if (_classPath instanceof JarPath) { container.add(_depend); return false; } else */ if (_hasJNIReload) { container.add(this); return true; } else if (_sourcePath == null) { container.add(_depend); return false; } else { container.add(this); return true; } } }
public class class_name { protected boolean addDependencies(DependencyContainer container) { /* XXX: if (_classPath instanceof JarPath) { container.add(_depend); return false; } else */ if (_hasJNIReload) { container.add(this); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } else if (_sourcePath == null) { container.add(_depend); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } else { container.add(this); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static ByteBuf copiedBuffer(ByteBuffer... buffers) { switch (buffers.length) { case 0: return EMPTY_BUFFER; case 1: return copiedBuffer(buffers[0]); } // Merge the specified buffers into one buffer. ByteOrder order = null; int length = 0; for (ByteBuffer b: buffers) { int bLen = b.remaining(); if (bLen <= 0) { continue; } if (Integer.MAX_VALUE - length < bLen) { throw new IllegalArgumentException( "The total length of the specified buffers is too big."); } length += bLen; if (order != null) { if (!order.equals(b.order())) { throw new IllegalArgumentException("inconsistent byte order"); } } else { order = b.order(); } } if (length == 0) { return EMPTY_BUFFER; } byte[] mergedArray = PlatformDependent.allocateUninitializedArray(length); for (int i = 0, j = 0; i < buffers.length; i ++) { // Duplicate the buffer so we not adjust the position during our get operation. // See https://github.com/netty/netty/issues/3896 ByteBuffer b = buffers[i].duplicate(); int bLen = b.remaining(); b.get(mergedArray, j, bLen); j += bLen; } return wrappedBuffer(mergedArray).order(order); } }
public class class_name { public static ByteBuf copiedBuffer(ByteBuffer... buffers) { switch (buffers.length) { case 0: return EMPTY_BUFFER; case 1: return copiedBuffer(buffers[0]); } // Merge the specified buffers into one buffer. ByteOrder order = null; int length = 0; for (ByteBuffer b: buffers) { int bLen = b.remaining(); if (bLen <= 0) { continue; } if (Integer.MAX_VALUE - length < bLen) { throw new IllegalArgumentException( "The total length of the specified buffers is too big."); } length += bLen; // depends on control dependency: [for], data = [b] if (order != null) { if (!order.equals(b.order())) { throw new IllegalArgumentException("inconsistent byte order"); } } else { order = b.order(); // depends on control dependency: [if], data = [none] } } if (length == 0) { return EMPTY_BUFFER; // depends on control dependency: [if], data = [none] } byte[] mergedArray = PlatformDependent.allocateUninitializedArray(length); for (int i = 0, j = 0; i < buffers.length; i ++) { // Duplicate the buffer so we not adjust the position during our get operation. // See https://github.com/netty/netty/issues/3896 ByteBuffer b = buffers[i].duplicate(); int bLen = b.remaining(); b.get(mergedArray, j, bLen); // depends on control dependency: [for], data = [none] j += bLen; // depends on control dependency: [for], data = [none] } return wrappedBuffer(mergedArray).order(order); } }
public class class_name { public void revertLabels(@NonNull INDArray[] labels, INDArray[] labelsMask) { for (int i = 0; i < labels.length; i++) { INDArray mask = (labelsMask == null ? null : labelsMask[i]); revertLabels(labels[i], mask, i); } } }
public class class_name { public void revertLabels(@NonNull INDArray[] labels, INDArray[] labelsMask) { for (int i = 0; i < labels.length; i++) { INDArray mask = (labelsMask == null ? null : labelsMask[i]); revertLabels(labels[i], mask, i); // depends on control dependency: [for], data = [i] } } }
public class class_name { public void into(@NonNull ImageView target, @Nullable Callback callback) { long started = System.nanoTime(); checkMain(); if (target == null) { throw new IllegalArgumentException("Target must not be null."); } if (!data.hasImage()) { picasso.cancelRequest(target); if (setPlaceholder) { setPlaceholder(target, getPlaceholderDrawable()); } return; } if (deferred) { if (data.hasSize()) { throw new IllegalStateException("Fit cannot be used with resize."); } int width = target.getWidth(); int height = target.getHeight(); if (width == 0 || height == 0) { if (setPlaceholder) { setPlaceholder(target, getPlaceholderDrawable()); } picasso.defer(target, new DeferredRequestCreator(this, target, callback)); return; } data.resize(width, height); } Request request = createRequest(started); if (shouldReadFromMemoryCache(request.memoryPolicy)) { Bitmap bitmap = picasso.quickMemoryCacheCheck(request.key); if (bitmap != null) { picasso.cancelRequest(target); RequestHandler.Result result = new RequestHandler.Result(bitmap, MEMORY); setResult(target, picasso.context, result, noFade, picasso.indicatorsEnabled); if (picasso.loggingEnabled) { log(OWNER_MAIN, VERB_COMPLETED, request.plainId(), "from " + MEMORY); } if (callback != null) { callback.onSuccess(); } return; } } if (setPlaceholder) { setPlaceholder(target, getPlaceholderDrawable()); } Action action = new ImageViewAction(picasso, target, request, errorDrawable, errorResId, noFade, callback); picasso.enqueueAndSubmit(action); } }
public class class_name { public void into(@NonNull ImageView target, @Nullable Callback callback) { long started = System.nanoTime(); checkMain(); if (target == null) { throw new IllegalArgumentException("Target must not be null."); } if (!data.hasImage()) { picasso.cancelRequest(target); // depends on control dependency: [if], data = [none] if (setPlaceholder) { setPlaceholder(target, getPlaceholderDrawable()); // depends on control dependency: [if], data = [none] } return; // depends on control dependency: [if], data = [none] } if (deferred) { if (data.hasSize()) { throw new IllegalStateException("Fit cannot be used with resize."); } int width = target.getWidth(); int height = target.getHeight(); if (width == 0 || height == 0) { if (setPlaceholder) { setPlaceholder(target, getPlaceholderDrawable()); // depends on control dependency: [if], data = [none] } picasso.defer(target, new DeferredRequestCreator(this, target, callback)); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } data.resize(width, height); // depends on control dependency: [if], data = [none] } Request request = createRequest(started); if (shouldReadFromMemoryCache(request.memoryPolicy)) { Bitmap bitmap = picasso.quickMemoryCacheCheck(request.key); if (bitmap != null) { picasso.cancelRequest(target); // depends on control dependency: [if], data = [none] RequestHandler.Result result = new RequestHandler.Result(bitmap, MEMORY); setResult(target, picasso.context, result, noFade, picasso.indicatorsEnabled); // depends on control dependency: [if], data = [none] if (picasso.loggingEnabled) { log(OWNER_MAIN, VERB_COMPLETED, request.plainId(), "from " + MEMORY); // depends on control dependency: [if], data = [none] } if (callback != null) { callback.onSuccess(); // depends on control dependency: [if], data = [none] } return; // depends on control dependency: [if], data = [none] } } if (setPlaceholder) { setPlaceholder(target, getPlaceholderDrawable()); // depends on control dependency: [if], data = [none] } Action action = new ImageViewAction(picasso, target, request, errorDrawable, errorResId, noFade, callback); picasso.enqueueAndSubmit(action); } }
public class class_name { public Observable<ServiceResponse<Page<SkuInfoInner>>> listWorkerPoolSkusNextWithServiceResponseAsync(final String nextPageLink) { return listWorkerPoolSkusNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<SkuInfoInner>>, Observable<ServiceResponse<Page<SkuInfoInner>>>>() { @Override public Observable<ServiceResponse<Page<SkuInfoInner>>> call(ServiceResponse<Page<SkuInfoInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listWorkerPoolSkusNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public Observable<ServiceResponse<Page<SkuInfoInner>>> listWorkerPoolSkusNextWithServiceResponseAsync(final String nextPageLink) { return listWorkerPoolSkusNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<SkuInfoInner>>, Observable<ServiceResponse<Page<SkuInfoInner>>>>() { @Override public Observable<ServiceResponse<Page<SkuInfoInner>>> call(ServiceResponse<Page<SkuInfoInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); // depends on control dependency: [if], data = [none] } return Observable.just(page).concatWith(listWorkerPoolSkusNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public java.lang.String getUfsFingerprint() { java.lang.Object ref = ufsFingerprint_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { ufsFingerprint_ = s; } return s; } } }
public class class_name { public java.lang.String getUfsFingerprint() { java.lang.Object ref = ufsFingerprint_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; // depends on control dependency: [if], data = [none] } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { ufsFingerprint_ = s; // depends on control dependency: [if], data = [none] } return s; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void insert_us(final DeviceData deviceData, final int[] argin) { final short[] val = new short[argin.length]; for (int i = 0 ; i<argin.length ; i++) { val[i] = (short) (argin[i] & 0xFFFF); } DevVarUShortArrayHelper.insert(deviceData.getAny(), val); } }
public class class_name { public void insert_us(final DeviceData deviceData, final int[] argin) { final short[] val = new short[argin.length]; for (int i = 0 ; i<argin.length ; i++) { val[i] = (short) (argin[i] & 0xFFFF); // depends on control dependency: [for], data = [i] } DevVarUShortArrayHelper.insert(deviceData.getAny(), val); } }
public class class_name { @Override public void loadStatementAnnotationMap(StatementAnnotationMapTable samt) throws SQLException { Map<Integer, Set<AnnotationPair>> sidAnnotationIndex = samt.getStatementAnnotationPairsIndex(); PreparedStatement saps = getPreparedStatement(STATEMENT_ANNOTATION_SQL); final Set<Entry<Integer, Set<AnnotationPair>>> entries = sidAnnotationIndex.entrySet(); for (final Entry<Integer, Set<AnnotationPair>> entry : entries) { final Integer sid = entry.getKey(); for (final AnnotationPair annotation : entry.getValue()) { // XXX offset saps.setInt(1, sid + 1); // XXX offset saps.setInt(2, annotation.getAnnotationValueId() + 1); saps.addBatch(); } } saps.executeBatch(); } }
public class class_name { @Override public void loadStatementAnnotationMap(StatementAnnotationMapTable samt) throws SQLException { Map<Integer, Set<AnnotationPair>> sidAnnotationIndex = samt.getStatementAnnotationPairsIndex(); PreparedStatement saps = getPreparedStatement(STATEMENT_ANNOTATION_SQL); final Set<Entry<Integer, Set<AnnotationPair>>> entries = sidAnnotationIndex.entrySet(); for (final Entry<Integer, Set<AnnotationPair>> entry : entries) { final Integer sid = entry.getKey(); for (final AnnotationPair annotation : entry.getValue()) { // XXX offset saps.setInt(1, sid + 1); // depends on control dependency: [for], data = [none] // XXX offset saps.setInt(2, annotation.getAnnotationValueId() + 1); // depends on control dependency: [for], data = [annotation] saps.addBatch(); // depends on control dependency: [for], data = [none] } } saps.executeBatch(); } }
public class class_name { public void setFullFileName(String fullFileName) { fullFileName = StringSupport.replaceAll(fullFileName, "\\", "/"); fullFileName = StringSupport.replaceAll(fullFileName, "//", "/"); int lastFileSeparator = fullFileName.lastIndexOf('/'); if (lastFileSeparator != -1) { path = fullFileName.substring(0, lastFileSeparator); } else { path = ""; } setFileName(fullFileName.substring(lastFileSeparator + 1, fullFileName.length())); } }
public class class_name { public void setFullFileName(String fullFileName) { fullFileName = StringSupport.replaceAll(fullFileName, "\\", "/"); fullFileName = StringSupport.replaceAll(fullFileName, "//", "/"); int lastFileSeparator = fullFileName.lastIndexOf('/'); if (lastFileSeparator != -1) { path = fullFileName.substring(0, lastFileSeparator); // depends on control dependency: [if], data = [none] } else { path = ""; // depends on control dependency: [if], data = [none] } setFileName(fullFileName.substring(lastFileSeparator + 1, fullFileName.length())); } }
public class class_name { @Override public E poll() { // local load of field to avoid repeated loads after volatile reads final long[] sBuffer = sequenceBuffer; final long mask = this.mask; long cIndex; long seq; long seqOffset; long expectedSeq; long pIndex = -1; // start with bogus value, hope we don't need it do { cIndex = lvConsumerIndex(); seqOffset = calcSequenceOffset(cIndex, mask); seq = lvSequence(sBuffer, seqOffset); expectedSeq = cIndex + 1; if (seq < expectedSeq) { // slot has not been moved by producer if (cIndex >= pIndex && // test against cached pIndex cIndex == (pIndex = lvProducerIndex())) { // update pIndex if we must // strict empty check, this ensures [Queue.poll() == null iff isEmpty()] return null; } else { seq = expectedSeq + 1; // trip another go around } } } while (seq > expectedSeq || // another consumer beat us to it !casConsumerIndex(cIndex, cIndex + 1)); // failed the CAS final long offset = calcElementOffset(cIndex, mask); final E e = lpElement(buffer, offset); assert e != null; soElement(buffer, offset, null); soSequence(sBuffer, seqOffset, cIndex + mask + 1);// i.e. seq += capacity return e; } }
public class class_name { @Override public E poll() { // local load of field to avoid repeated loads after volatile reads final long[] sBuffer = sequenceBuffer; final long mask = this.mask; long cIndex; long seq; long seqOffset; long expectedSeq; long pIndex = -1; // start with bogus value, hope we don't need it do { cIndex = lvConsumerIndex(); seqOffset = calcSequenceOffset(cIndex, mask); seq = lvSequence(sBuffer, seqOffset); expectedSeq = cIndex + 1; if (seq < expectedSeq) { // slot has not been moved by producer if (cIndex >= pIndex && // test against cached pIndex cIndex == (pIndex = lvProducerIndex())) { // update pIndex if we must // strict empty check, this ensures [Queue.poll() == null iff isEmpty()] return null; // depends on control dependency: [if], data = [none] } else { seq = expectedSeq + 1; // trip another go around // depends on control dependency: [if], data = [none] } } } while (seq > expectedSeq || // another consumer beat us to it !casConsumerIndex(cIndex, cIndex + 1)); // failed the CAS final long offset = calcElementOffset(cIndex, mask); final E e = lpElement(buffer, offset); assert e != null; soElement(buffer, offset, null); soSequence(sBuffer, seqOffset, cIndex + mask + 1);// i.e. seq += capacity return e; } }
public class class_name { @POST @Path("/worker") @Consumes(MediaType.APPLICATION_JSON) @ResourceFilters(ConfigResourceFilter.class) public Response setWorkerConfig( final WorkerBehaviorConfig workerBehaviorConfig, @HeaderParam(AuditManager.X_DRUID_AUTHOR) @DefaultValue("") final String author, @HeaderParam(AuditManager.X_DRUID_COMMENT) @DefaultValue("") final String comment, @Context final HttpServletRequest req ) { final SetResult setResult = configManager.set( WorkerBehaviorConfig.CONFIG_KEY, workerBehaviorConfig, new AuditInfo(author, comment, req.getRemoteAddr()) ); if (setResult.isOk()) { log.info("Updating Worker configs: %s", workerBehaviorConfig); return Response.ok().build(); } else { return Response.status(Response.Status.BAD_REQUEST).build(); } } }
public class class_name { @POST @Path("/worker") @Consumes(MediaType.APPLICATION_JSON) @ResourceFilters(ConfigResourceFilter.class) public Response setWorkerConfig( final WorkerBehaviorConfig workerBehaviorConfig, @HeaderParam(AuditManager.X_DRUID_AUTHOR) @DefaultValue("") final String author, @HeaderParam(AuditManager.X_DRUID_COMMENT) @DefaultValue("") final String comment, @Context final HttpServletRequest req ) { final SetResult setResult = configManager.set( WorkerBehaviorConfig.CONFIG_KEY, workerBehaviorConfig, new AuditInfo(author, comment, req.getRemoteAddr()) ); if (setResult.isOk()) { log.info("Updating Worker configs: %s", workerBehaviorConfig); // depends on control dependency: [if], data = [none] return Response.ok().build(); // depends on control dependency: [if], data = [none] } else { return Response.status(Response.Status.BAD_REQUEST).build(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean addTransactionAware(TransactionAware txAware) { // If the txAware is newly added, call startTx as well if there is an active transaction boolean added = txAwares.add(txAware); if (added && currentTx != null) { txAware.startTx(currentTx); } return added; } }
public class class_name { public boolean addTransactionAware(TransactionAware txAware) { // If the txAware is newly added, call startTx as well if there is an active transaction boolean added = txAwares.add(txAware); if (added && currentTx != null) { txAware.startTx(currentTx); // depends on control dependency: [if], data = [none] } return added; } }
public class class_name { private void addFilesFromDir(File dir) { File[] files = dir.listFiles(); for (int i = 0; i < files.length; i++) { if (!files[i].isDirectory()) { mFiles.add(files[i]); } else if (mRecursive) { addFilesFromDir(files[i]); } } } }
public class class_name { private void addFilesFromDir(File dir) { File[] files = dir.listFiles(); for (int i = 0; i < files.length; i++) { if (!files[i].isDirectory()) { mFiles.add(files[i]); // depends on control dependency: [if], data = [none] } else if (mRecursive) { addFilesFromDir(files[i]); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void sort() { if (!sorted) { sort(heap, Math.min(k,n)); sorted = true; } } }
public class class_name { public void sort() { if (!sorted) { sort(heap, Math.min(k,n)); // depends on control dependency: [if], data = [none] sorted = true; // depends on control dependency: [if], data = [none] } } }
public class class_name { String getKeyPrefix(StatementPartitioning partitioning, DeterminismMode detMode, String joinOrder) { // no caching for inferred yet if (partitioning.isInferred()) { return null; } String joinOrderPrefix = "#"; if (joinOrder != null) { joinOrderPrefix += joinOrder; } boolean partitioned = partitioning.wasSpecifiedAsSingle(); return joinOrderPrefix + String.valueOf(detMode.toChar()) + (partitioned ? "P#" : "R#"); } }
public class class_name { String getKeyPrefix(StatementPartitioning partitioning, DeterminismMode detMode, String joinOrder) { // no caching for inferred yet if (partitioning.isInferred()) { return null; // depends on control dependency: [if], data = [none] } String joinOrderPrefix = "#"; if (joinOrder != null) { joinOrderPrefix += joinOrder; // depends on control dependency: [if], data = [none] } boolean partitioned = partitioning.wasSpecifiedAsSingle(); return joinOrderPrefix + String.valueOf(detMode.toChar()) + (partitioned ? "P#" : "R#"); } }
public class class_name { protected synchronized HierarchicalType getDataType(String type) { HierarchicalType dataType = typeInstances.get(type); //todo: are there still cases where type can be null? if (dataType == null) { dataType = createDataType(type); typeInstances.put(type, dataType); } return dataType; } }
public class class_name { protected synchronized HierarchicalType getDataType(String type) { HierarchicalType dataType = typeInstances.get(type); //todo: are there still cases where type can be null? if (dataType == null) { dataType = createDataType(type); // depends on control dependency: [if], data = [none] typeInstances.put(type, dataType); // depends on control dependency: [if], data = [none] } return dataType; } }
public class class_name { protected void createFireEventMethods(Collection<EventEntryDescriptor> mEventEntries) { if (mEventEntries == null) return; for (EventEntryDescriptor mEventEntry : mEventEntries) { if (mEventEntry.isFired()) { String methodName = "fire" + mEventEntry.getEventName(); CtMethod method = (CtMethod) abstractMethods.get(methodName); if (method == null) { method = (CtMethod) superClassesAbstractMethods .get(methodName); } if (method != null) { try { // copy method from abstract to concrete class CtMethod concreteMethod = CtNewMethod.copy(method, sbbConcreteClass, null); // create the method body String concreteMethodBody = "{"; concreteMethodBody += getEventTypeIDInstantionString(mEventEntry); concreteMethodBody += SbbAbstractMethodHandler.class .getName() + ".fireEvent(sbbEntity,eventTypeID"; for (int i = 0; i < method.getParameterTypes().length; i++) { concreteMethodBody += ",$" + (i + 1); } concreteMethodBody += ");}"; if (logger.isTraceEnabled()) { logger.trace("Generated method " + methodName + " , body = " + concreteMethodBody); } concreteMethod.setBody(concreteMethodBody); sbbConcreteClass.addMethod(concreteMethod); } catch (Exception e) { throw new SLEEException("Cannot compile method " + method.getName(), e); } } } } } }
public class class_name { protected void createFireEventMethods(Collection<EventEntryDescriptor> mEventEntries) { if (mEventEntries == null) return; for (EventEntryDescriptor mEventEntry : mEventEntries) { if (mEventEntry.isFired()) { String methodName = "fire" + mEventEntry.getEventName(); CtMethod method = (CtMethod) abstractMethods.get(methodName); if (method == null) { method = (CtMethod) superClassesAbstractMethods .get(methodName); // depends on control dependency: [if], data = [none] } if (method != null) { try { // copy method from abstract to concrete class CtMethod concreteMethod = CtNewMethod.copy(method, sbbConcreteClass, null); // create the method body String concreteMethodBody = "{"; concreteMethodBody += getEventTypeIDInstantionString(mEventEntry); concreteMethodBody += SbbAbstractMethodHandler.class .getName() + ".fireEvent(sbbEntity,eventTypeID"; for (int i = 0; i < method.getParameterTypes().length; i++) { concreteMethodBody += ",$" + (i + 1); } concreteMethodBody += ");}"; if (logger.isTraceEnabled()) { logger.trace("Generated method " + methodName + " , body = " + concreteMethodBody); // depends on control dependency: [if], data = [none] } concreteMethod.setBody(concreteMethodBody); // depends on control dependency: [if], data = [none] sbbConcreteClass.addMethod(concreteMethod); // depends on control dependency: [if], data = [none] } catch (Exception e) { // depends on control dependency: [if], data = [none] throw new SLEEException("Cannot compile method " + method.getName(), e); } } } } } }
public class class_name { public void marshall(IdentityProviderType identityProviderType, ProtocolMarshaller protocolMarshaller) { if (identityProviderType == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(identityProviderType.getUserPoolId(), USERPOOLID_BINDING); protocolMarshaller.marshall(identityProviderType.getProviderName(), PROVIDERNAME_BINDING); protocolMarshaller.marshall(identityProviderType.getProviderType(), PROVIDERTYPE_BINDING); protocolMarshaller.marshall(identityProviderType.getProviderDetails(), PROVIDERDETAILS_BINDING); protocolMarshaller.marshall(identityProviderType.getAttributeMapping(), ATTRIBUTEMAPPING_BINDING); protocolMarshaller.marshall(identityProviderType.getIdpIdentifiers(), IDPIDENTIFIERS_BINDING); protocolMarshaller.marshall(identityProviderType.getLastModifiedDate(), LASTMODIFIEDDATE_BINDING); protocolMarshaller.marshall(identityProviderType.getCreationDate(), CREATIONDATE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(IdentityProviderType identityProviderType, ProtocolMarshaller protocolMarshaller) { if (identityProviderType == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(identityProviderType.getUserPoolId(), USERPOOLID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(identityProviderType.getProviderName(), PROVIDERNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(identityProviderType.getProviderType(), PROVIDERTYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(identityProviderType.getProviderDetails(), PROVIDERDETAILS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(identityProviderType.getAttributeMapping(), ATTRIBUTEMAPPING_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(identityProviderType.getIdpIdentifiers(), IDPIDENTIFIERS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(identityProviderType.getLastModifiedDate(), LASTMODIFIEDDATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(identityProviderType.getCreationDate(), CREATIONDATE_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 final void putCharLittleEndian(int index, char value) { if (LITTLE_ENDIAN) { putChar(index, value); } else { putChar(index, Character.reverseBytes(value)); } } }
public class class_name { public final void putCharLittleEndian(int index, char value) { if (LITTLE_ENDIAN) { putChar(index, value); // depends on control dependency: [if], data = [none] } else { putChar(index, Character.reverseBytes(value)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void addDate(ICalDate date, boolean floating, TimeZone tz) { if (date != null && date.hasTime() && !floating && tz != null) { dates.add(date); } } }
public class class_name { public void addDate(ICalDate date, boolean floating, TimeZone tz) { if (date != null && date.hasTime() && !floating && tz != null) { dates.add(date); // depends on control dependency: [if], data = [(date] } } }
public class class_name { public static boolean getF(GrayU8 image, int x, int y) { if (image.isInBounds(x, y)) { return image.get(x, y) != 0; } else { return false; } } }
public class class_name { public static boolean getF(GrayU8 image, int x, int y) { if (image.isInBounds(x, y)) { return image.get(x, y) != 0; // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { public DateFormat getDateFormat(int dateStyle, int timeStyle) { if (dateStyle == DF_NONE && timeStyle == DF_NONE || dateStyle < 0 || dateStyle >= DF_LIMIT || timeStyle < 0 || timeStyle >= DF_LIMIT) { throw new IllegalArgumentException("Illegal date format style arguments"); } DateFormat result = null; if (dateFormats != null) { result = dateFormats[dateStyle][timeStyle]; } if (result != null) { result = (DateFormat) result.clone(); // clone for safety // Not sure overriding configuration is what we really want... result.setTimeZone(getTimeZone()); } else { result = guessDateFormat(dateStyle, timeStyle); } return result; } }
public class class_name { public DateFormat getDateFormat(int dateStyle, int timeStyle) { if (dateStyle == DF_NONE && timeStyle == DF_NONE || dateStyle < 0 || dateStyle >= DF_LIMIT || timeStyle < 0 || timeStyle >= DF_LIMIT) { throw new IllegalArgumentException("Illegal date format style arguments"); } DateFormat result = null; if (dateFormats != null) { result = dateFormats[dateStyle][timeStyle]; // depends on control dependency: [if], data = [none] } if (result != null) { result = (DateFormat) result.clone(); // clone for safety // depends on control dependency: [if], data = [none] // Not sure overriding configuration is what we really want... result.setTimeZone(getTimeZone()); // depends on control dependency: [if], data = [none] } else { result = guessDateFormat(dateStyle, timeStyle); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { @VisibleForTesting void exitIdleMode() { syncContext.throwIfNotInThisSynchronizationContext(); if (shutdown.get() || panicMode) { return; } if (inUseStateAggregator.isInUse()) { // Cancel the timer now, so that a racing due timer will not put Channel on idleness // when the caller of exitIdleMode() is about to use the returned loadBalancer. cancelIdleTimer(false); } else { // exitIdleMode() may be called outside of inUseStateAggregator.handleNotInUse() while // isInUse() == false, in which case we still need to schedule the timer. rescheduleIdleTimer(); } if (lbHelper != null) { return; } channelLogger.log(ChannelLogLevel.INFO, "Exiting idle mode"); LbHelperImpl lbHelper = new LbHelperImpl(); lbHelper.lb = loadBalancerFactory.newLoadBalancer(lbHelper); // Delay setting lbHelper until fully initialized, since loadBalancerFactory is user code and // may throw. We don't want to confuse our state, even if we will enter panic mode. this.lbHelper = lbHelper; NameResolverObserver observer = new NameResolverObserver(lbHelper, nameResolver); nameResolver.start(observer); nameResolverStarted = true; } }
public class class_name { @VisibleForTesting void exitIdleMode() { syncContext.throwIfNotInThisSynchronizationContext(); if (shutdown.get() || panicMode) { return; // depends on control dependency: [if], data = [none] } if (inUseStateAggregator.isInUse()) { // Cancel the timer now, so that a racing due timer will not put Channel on idleness // when the caller of exitIdleMode() is about to use the returned loadBalancer. cancelIdleTimer(false); // depends on control dependency: [if], data = [none] } else { // exitIdleMode() may be called outside of inUseStateAggregator.handleNotInUse() while // isInUse() == false, in which case we still need to schedule the timer. rescheduleIdleTimer(); // depends on control dependency: [if], data = [none] } if (lbHelper != null) { return; // depends on control dependency: [if], data = [none] } channelLogger.log(ChannelLogLevel.INFO, "Exiting idle mode"); LbHelperImpl lbHelper = new LbHelperImpl(); lbHelper.lb = loadBalancerFactory.newLoadBalancer(lbHelper); // Delay setting lbHelper until fully initialized, since loadBalancerFactory is user code and // may throw. We don't want to confuse our state, even if we will enter panic mode. this.lbHelper = lbHelper; NameResolverObserver observer = new NameResolverObserver(lbHelper, nameResolver); nameResolver.start(observer); nameResolverStarted = true; } }
public class class_name { public synchronized void clear() { for (int i = 0; i < planes; i++) { readPointer[i] = writePointer[i] = 0; bytesToRead[i] = 0; bytesToWrite[i] = buffer[i].capacity(); } } }
public class class_name { public synchronized void clear() { for (int i = 0; i < planes; i++) { readPointer[i] = writePointer[i] = 0; // depends on control dependency: [for], data = [i] bytesToRead[i] = 0; // depends on control dependency: [for], data = [i] bytesToWrite[i] = buffer[i].capacity(); // depends on control dependency: [for], data = [i] } } }
public class class_name { private void writeTask(Task mpxjTask, List<net.sf.mpxj.planner.schema.Task> taskList) throws JAXBException { net.sf.mpxj.planner.schema.Task plannerTask = m_factory.createTask(); taskList.add(plannerTask); plannerTask.setEnd(getDateTimeString(mpxjTask.getFinish())); plannerTask.setId(getIntegerString(mpxjTask.getUniqueID())); plannerTask.setName(getString(mpxjTask.getName())); plannerTask.setNote(mpxjTask.getNotes()); plannerTask.setPercentComplete(getIntegerString(mpxjTask.getPercentageWorkComplete())); plannerTask.setPriority(mpxjTask.getPriority() == null ? null : getIntegerString(mpxjTask.getPriority().getValue() * 10)); plannerTask.setScheduling(getScheduling(mpxjTask.getType())); plannerTask.setStart(getDateTimeString(DateHelper.getDayStartDate(mpxjTask.getStart()))); if (mpxjTask.getMilestone()) { plannerTask.setType("milestone"); } else { plannerTask.setType("normal"); } plannerTask.setWork(getDurationString(mpxjTask.getWork())); plannerTask.setWorkStart(getDateTimeString(mpxjTask.getStart())); ConstraintType mpxjConstraintType = mpxjTask.getConstraintType(); if (mpxjConstraintType != ConstraintType.AS_SOON_AS_POSSIBLE) { Constraint plannerConstraint = m_factory.createConstraint(); plannerTask.setConstraint(plannerConstraint); if (mpxjConstraintType == ConstraintType.START_NO_EARLIER_THAN) { plannerConstraint.setType("start-no-earlier-than"); } else { if (mpxjConstraintType == ConstraintType.MUST_START_ON) { plannerConstraint.setType("must-start-on"); } } plannerConstraint.setTime(getDateTimeString(mpxjTask.getConstraintDate())); } // // Write predecessors // writePredecessors(mpxjTask, plannerTask); m_eventManager.fireTaskWrittenEvent(mpxjTask); // // Write child tasks // List<net.sf.mpxj.planner.schema.Task> childTaskList = plannerTask.getTask(); for (Task task : mpxjTask.getChildTasks()) { writeTask(task, childTaskList); } } }
public class class_name { private void writeTask(Task mpxjTask, List<net.sf.mpxj.planner.schema.Task> taskList) throws JAXBException { net.sf.mpxj.planner.schema.Task plannerTask = m_factory.createTask(); taskList.add(plannerTask); plannerTask.setEnd(getDateTimeString(mpxjTask.getFinish())); plannerTask.setId(getIntegerString(mpxjTask.getUniqueID())); plannerTask.setName(getString(mpxjTask.getName())); plannerTask.setNote(mpxjTask.getNotes()); plannerTask.setPercentComplete(getIntegerString(mpxjTask.getPercentageWorkComplete())); plannerTask.setPriority(mpxjTask.getPriority() == null ? null : getIntegerString(mpxjTask.getPriority().getValue() * 10)); plannerTask.setScheduling(getScheduling(mpxjTask.getType())); plannerTask.setStart(getDateTimeString(DateHelper.getDayStartDate(mpxjTask.getStart()))); if (mpxjTask.getMilestone()) { plannerTask.setType("milestone"); } else { plannerTask.setType("normal"); } plannerTask.setWork(getDurationString(mpxjTask.getWork())); plannerTask.setWorkStart(getDateTimeString(mpxjTask.getStart())); ConstraintType mpxjConstraintType = mpxjTask.getConstraintType(); if (mpxjConstraintType != ConstraintType.AS_SOON_AS_POSSIBLE) { Constraint plannerConstraint = m_factory.createConstraint(); plannerTask.setConstraint(plannerConstraint); if (mpxjConstraintType == ConstraintType.START_NO_EARLIER_THAN) { plannerConstraint.setType("start-no-earlier-than"); // depends on control dependency: [if], data = [none] } else { if (mpxjConstraintType == ConstraintType.MUST_START_ON) { plannerConstraint.setType("must-start-on"); // depends on control dependency: [if], data = [none] } } plannerConstraint.setTime(getDateTimeString(mpxjTask.getConstraintDate())); } // // Write predecessors // writePredecessors(mpxjTask, plannerTask); m_eventManager.fireTaskWrittenEvent(mpxjTask); // // Write child tasks // List<net.sf.mpxj.planner.schema.Task> childTaskList = plannerTask.getTask(); for (Task task : mpxjTask.getChildTasks()) { writeTask(task, childTaskList); } } }
public class class_name { public void addZone(String id, Component zone, String constraints) { // is there already a zone with this id? Component previousZone = getZone(id); if (previousZone != null) { remove(previousZone); idToZones.remove(id); } if (zone instanceof JComponent) { JComponent jc = (JComponent) zone; if (jc.getBorder() == null || jc.getBorder() instanceof UIResource) { if (jc instanceof JLabel) { jc.setBorder( new CompoundBorder(zoneBorder, new EmptyBorder(0, 2, 0, 2))); ((JLabel) jc).setText(" "); } else { jc.setBorder(zoneBorder); } } } add(zone, constraints); idToZones.put(id, zone); } }
public class class_name { public void addZone(String id, Component zone, String constraints) { // is there already a zone with this id? Component previousZone = getZone(id); if (previousZone != null) { remove(previousZone); // depends on control dependency: [if], data = [(previousZone] idToZones.remove(id); // depends on control dependency: [if], data = [none] } if (zone instanceof JComponent) { JComponent jc = (JComponent) zone; if (jc.getBorder() == null || jc.getBorder() instanceof UIResource) { if (jc instanceof JLabel) { jc.setBorder( new CompoundBorder(zoneBorder, new EmptyBorder(0, 2, 0, 2))); // depends on control dependency: [if], data = [none] ((JLabel) jc).setText(" "); // depends on control dependency: [if], data = [none] } else { jc.setBorder(zoneBorder); // depends on control dependency: [if], data = [none] } } } add(zone, constraints); idToZones.put(id, zone); } }
public class class_name { @Override protected ImmutableList<String> parseElements(String s) { ImmutableList.Builder<String> titleCollection = ImmutableList.builder(); Optional<XmlElement> childOpt = XmlConverter.getChildOpt(s, "query", "imageusage"); if (childOpt.isPresent()) { for (XmlElement element : childOpt.get().getChildren("iu")) { titleCollection.add(element.getAttributeValue("title")); } } return titleCollection.build(); } }
public class class_name { @Override protected ImmutableList<String> parseElements(String s) { ImmutableList.Builder<String> titleCollection = ImmutableList.builder(); Optional<XmlElement> childOpt = XmlConverter.getChildOpt(s, "query", "imageusage"); if (childOpt.isPresent()) { for (XmlElement element : childOpt.get().getChildren("iu")) { titleCollection.add(element.getAttributeValue("title")); // depends on control dependency: [for], data = [element] } } return titleCollection.build(); } }
public class class_name { private final void _tryUnlink() { if (0 >= _cursorCount && _state == LOGICALLY_UNLINKED) { _previousLink._nextLink = _nextLink; _nextLink._previousLink = _previousLink; _previousLink = null; _nextLink = null; // Defect 240039 //_parent = null; _state = PHYSICALLY_UNLINKED; } } }
public class class_name { private final void _tryUnlink() { if (0 >= _cursorCount && _state == LOGICALLY_UNLINKED) { _previousLink._nextLink = _nextLink; // depends on control dependency: [if], data = [none] _nextLink._previousLink = _previousLink; // depends on control dependency: [if], data = [none] _previousLink = null; // depends on control dependency: [if], data = [none] _nextLink = null; // depends on control dependency: [if], data = [none] // Defect 240039 //_parent = null; _state = PHYSICALLY_UNLINKED; // depends on control dependency: [if], data = [none] } } }
public class class_name { static boolean isErrorStatus(HttpResponse httpResponse, HttpResponseDecodeData decodeData) { final int[] expectedStatuses = decodeData.expectedStatusCodes(); if (expectedStatuses != null) { return !contains(expectedStatuses, httpResponse.statusCode()); } else { return httpResponse.statusCode() / 100 != 2; } } }
public class class_name { static boolean isErrorStatus(HttpResponse httpResponse, HttpResponseDecodeData decodeData) { final int[] expectedStatuses = decodeData.expectedStatusCodes(); if (expectedStatuses != null) { return !contains(expectedStatuses, httpResponse.statusCode()); // depends on control dependency: [if], data = [(expectedStatuses] } else { return httpResponse.statusCode() / 100 != 2; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String stripHtmlFromPropertyIfNecessary(String propertyName, String value) { if (propertyName.equals(CmsPropertyDefinition.PROPERTY_DESCRIPTION_HTML)) { try { return CmsHtmlExtractor.extractText(value, CmsEncoder.ENCODING_UTF_8); } catch (ParserException | UnsupportedEncodingException e) { LOG.warn("Could not strip HTML from property value. Returning the original value.", e); } } return value; } }
public class class_name { public static String stripHtmlFromPropertyIfNecessary(String propertyName, String value) { if (propertyName.equals(CmsPropertyDefinition.PROPERTY_DESCRIPTION_HTML)) { try { return CmsHtmlExtractor.extractText(value, CmsEncoder.ENCODING_UTF_8); // depends on control dependency: [try], data = [none] } catch (ParserException | UnsupportedEncodingException e) { LOG.warn("Could not strip HTML from property value. Returning the original value.", e); } // depends on control dependency: [catch], data = [none] } return value; } }
public class class_name { private Set<Tuple> getOnceTupleDefs( final List<VarDef> combinedVars) { try { return new HashSet<Tuple>( IteratorUtils.toList( IteratorUtils.transformedIterator( getOnceTuples(), tupleRef -> toTuple( combinedVars, tupleRef)))); } catch( Exception e) { throw new IllegalStateException( "Invalid once-only tuple definition", e); } } }
public class class_name { private Set<Tuple> getOnceTupleDefs( final List<VarDef> combinedVars) { try { return new HashSet<Tuple>( IteratorUtils.toList( IteratorUtils.transformedIterator( getOnceTuples(), tupleRef -> toTuple( combinedVars, tupleRef)))); // depends on control dependency: [try], data = [none] } catch( Exception e) { throw new IllegalStateException( "Invalid once-only tuple definition", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Set<String> getAllConfiguredTenantNames() { final Settings roles = getRolesSettings(); if (roles == null || roles.isEmpty()) { return Collections.emptySet(); } final Set<String> configuredTenants = new HashSet<>(); for (String sgRole : roles.names()) { Settings tenants = roles.getByPrefix(sgRole + ".tenants."); if (tenants != null) { configuredTenants.addAll(tenants.names()); } } return Collections.unmodifiableSet(configuredTenants); } }
public class class_name { public Set<String> getAllConfiguredTenantNames() { final Settings roles = getRolesSettings(); if (roles == null || roles.isEmpty()) { return Collections.emptySet(); // depends on control dependency: [if], data = [none] } final Set<String> configuredTenants = new HashSet<>(); for (String sgRole : roles.names()) { Settings tenants = roles.getByPrefix(sgRole + ".tenants."); if (tenants != null) { configuredTenants.addAll(tenants.names()); // depends on control dependency: [if], data = [(tenants] } } return Collections.unmodifiableSet(configuredTenants); } }
public class class_name { public Menu getContextMenu() { if (menu == null) { menu = new Menu(); menu.addItem(new AttributesAction(mapWidget)); menu.addItem(new MenuItemSeparator()); menu.addItem(new UndoOperationAction(mapWidget, this)); menu.addItem(new CancelEditingAction(mapWidget, (ParentEditController) parent)); menu.addItem(new SaveEditingAction(mapWidget, (ParentEditController) parent)); menu.addItem(new MenuItemSeparator()); menu.addItem(new ToggleGeometricInfoAction(this)); } return menu; } }
public class class_name { public Menu getContextMenu() { if (menu == null) { menu = new Menu(); // depends on control dependency: [if], data = [none] menu.addItem(new AttributesAction(mapWidget)); // depends on control dependency: [if], data = [none] menu.addItem(new MenuItemSeparator()); // depends on control dependency: [if], data = [none] menu.addItem(new UndoOperationAction(mapWidget, this)); // depends on control dependency: [if], data = [none] menu.addItem(new CancelEditingAction(mapWidget, (ParentEditController) parent)); // depends on control dependency: [if], data = [none] menu.addItem(new SaveEditingAction(mapWidget, (ParentEditController) parent)); // depends on control dependency: [if], data = [none] menu.addItem(new MenuItemSeparator()); // depends on control dependency: [if], data = [none] menu.addItem(new ToggleGeometricInfoAction(this)); // depends on control dependency: [if], data = [none] } return menu; } }
public class class_name { private List<Object> populate(Class<?> clazz, EntityMetadata metadata, Object rowId, List<String> relationNames, MetamodelImpl metaModel) { List<Object> result; if (isCql3Enabled(metadata)) { result = cqlClient.find(metaModel, metadata, rowId, relationNames); } else { result = (List<Object>) find(clazz, relationNames, relationNames != null, metadata, rowId); } return result; } }
public class class_name { private List<Object> populate(Class<?> clazz, EntityMetadata metadata, Object rowId, List<String> relationNames, MetamodelImpl metaModel) { List<Object> result; if (isCql3Enabled(metadata)) { result = cqlClient.find(metaModel, metadata, rowId, relationNames); // depends on control dependency: [if], data = [none] } else { result = (List<Object>) find(clazz, relationNames, relationNames != null, metadata, rowId); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public void load(InputStream stream, String separator) throws IOException, PropertiesException { try(DataInputStream data = new DataInputStream(stream); Reader reader = new InputStreamReader(data); BufferedReader br = new BufferedReader(reader)) { String line; StringBuilder buffer = new StringBuilder(); while ((line = br.readLine()) != null) { if(Strings.trimRight(line).startsWith(LINE_COMMENT_START)) { // comment line, skip! continue; } else { // now check if multi-line property if(line.endsWith(CONTINUE_ON_NEW_LINE)) { // middle line in multi-line, add and skip parsing buffer.append(line.replaceFirst("\\\\$", "")); continue; } else { // ordinary line, or end of multi-line: add and parse buffer.append(line); } } line = buffer.toString().trim(); buffer.setLength(0); int index = -1; if(line.length() > 0 && (index = line.lastIndexOf(separator)) != -1) { String key = line.substring(0, index).trim(); String value = line.substring(index + separator.length()).trim(); if("@".equals(key)) { logger.trace("including and overriding values defined so far with file '{}'", value); load(value, separator); } else { logger.trace("adding '{}' => '{}'", key, value); this.put(key.trim(), value.trim()); } } } if(buffer.length() > 0) { logger.warn("multi-line property '{}' is not properly terminated", buffer); } } } }
public class class_name { public void load(InputStream stream, String separator) throws IOException, PropertiesException { try(DataInputStream data = new DataInputStream(stream); Reader reader = new InputStreamReader(data); BufferedReader br = new BufferedReader(reader)) { String line; StringBuilder buffer = new StringBuilder(); while ((line = br.readLine()) != null) { if(Strings.trimRight(line).startsWith(LINE_COMMENT_START)) { // comment line, skip! continue; } else { // now check if multi-line property if(line.endsWith(CONTINUE_ON_NEW_LINE)) { // middle line in multi-line, add and skip parsing buffer.append(line.replaceFirst("\\\\$", "")); // depends on control dependency: [if], data = [none] continue; } else { // ordinary line, or end of multi-line: add and parse buffer.append(line); // depends on control dependency: [if], data = [none] } } line = buffer.toString().trim(); buffer.setLength(0); int index = -1; if(line.length() > 0 && (index = line.lastIndexOf(separator)) != -1) { String key = line.substring(0, index).trim(); String value = line.substring(index + separator.length()).trim(); if("@".equals(key)) { logger.trace("including and overriding values defined so far with file '{}'", value); // depends on control dependency: [if], data = [none] load(value, separator); // depends on control dependency: [if], data = [none] } else { logger.trace("adding '{}' => '{}'", key, value); // depends on control dependency: [if], data = [none] this.put(key.trim(), value.trim()); // depends on control dependency: [if], data = [none] } } } if(buffer.length() > 0) { logger.warn("multi-line property '{}' is not properly terminated", buffer); } } } }
public class class_name { public DescribeLoadBalancerAttributesResult withAttributes(LoadBalancerAttribute... attributes) { if (this.attributes == null) { setAttributes(new java.util.ArrayList<LoadBalancerAttribute>(attributes.length)); } for (LoadBalancerAttribute ele : attributes) { this.attributes.add(ele); } return this; } }
public class class_name { public DescribeLoadBalancerAttributesResult withAttributes(LoadBalancerAttribute... attributes) { if (this.attributes == null) { setAttributes(new java.util.ArrayList<LoadBalancerAttribute>(attributes.length)); // depends on control dependency: [if], data = [none] } for (LoadBalancerAttribute ele : attributes) { this.attributes.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public EEnum getImageEncodingRECID() { if (imageEncodingRECIDEEnum == null) { imageEncodingRECIDEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(117); } return imageEncodingRECIDEEnum; } }
public class class_name { public EEnum getImageEncodingRECID() { if (imageEncodingRECIDEEnum == null) { imageEncodingRECIDEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(117); // depends on control dependency: [if], data = [none] } return imageEncodingRECIDEEnum; } }
public class class_name { private static Queue<String> removePrefix(final List<String> input) { if (input.size() < 2) { return new LinkedList<>(input); } String resultingPrefix = ""; final String previousGreatestCommonPrefix = input.get(0).trim(); String greatestCommonPrefix = ""; for (int i = 1; i < input.size(); i++) { final String previousLine = input.get(i - 1).trim(); final String currentLine = input.get(i).trim(); greatestCommonPrefix = ExceptionParser.greatestCommonPrefix(previousLine, currentLine); resultingPrefix = ExceptionParser.greatestCommonPrefix(previousGreatestCommonPrefix, greatestCommonPrefix); if (resultingPrefix.length() == 0) { break; } } final int prefixLength = resultingPrefix.length(); final boolean hasPrefix = prefixLength > 0; final Queue<String> result = new LinkedList<>(); for (final String line : input) { final String line2 = line.trim(); if (hasPrefix) { result.add(line2.substring(prefixLength)); } else { result.add(line2); } } return result; } }
public class class_name { private static Queue<String> removePrefix(final List<String> input) { if (input.size() < 2) { return new LinkedList<>(input); // depends on control dependency: [if], data = [none] } String resultingPrefix = ""; final String previousGreatestCommonPrefix = input.get(0).trim(); String greatestCommonPrefix = ""; for (int i = 1; i < input.size(); i++) { final String previousLine = input.get(i - 1).trim(); final String currentLine = input.get(i).trim(); greatestCommonPrefix = ExceptionParser.greatestCommonPrefix(previousLine, currentLine); // depends on control dependency: [for], data = [none] resultingPrefix = ExceptionParser.greatestCommonPrefix(previousGreatestCommonPrefix, greatestCommonPrefix); // depends on control dependency: [for], data = [none] if (resultingPrefix.length() == 0) { break; } } final int prefixLength = resultingPrefix.length(); final boolean hasPrefix = prefixLength > 0; final Queue<String> result = new LinkedList<>(); for (final String line : input) { final String line2 = line.trim(); if (hasPrefix) { result.add(line2.substring(prefixLength)); // depends on control dependency: [if], data = [none] } else { result.add(line2); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { public SecureUTF8String makePassword(SecureUTF8String masterPassword, Account account, final String inputText, final String username) throws Exception { // HMAC algorithm requires a key that is >0 length. if ( account.isHmac() && masterPassword.length() == 0 ) { return new SecureUTF8String(); } LeetLevel leetLevel = account.getLeetLevel(); //int count = 0; int length = account.getLength(); SecureUTF8String output = null; SecureUTF8String data = null; try { if (account.getCharacterSet().length() < 2) throw new Exception("Account contains a character set that is too short"); data = new SecureUTF8String(getModifiedInputText(inputText, account) + username + account.getModifier()); // Use leet before hashing if (account.getLeetType() == LeetType.BEFORE || account.getLeetType() == LeetType.BOTH) { LeetEncoder.leetConvert(leetLevel, masterPassword); LeetEncoder.leetConvert(leetLevel, data); } // Perform the actual hashing output = hashTheData(masterPassword, data, account); // Use leet after hashing if (account.getLeetType() == LeetType.AFTER || account.getLeetType() == LeetType.BOTH) { LeetEncoder.leetConvert(leetLevel, output); } // Apply the prefix if (account.getPrefix().length() > 0) { SecureCharArray prefix = new SecureCharArray(account.getPrefix()); output.prepend(prefix); prefix.erase(); } // Handle the suffix output.resize(length, true); if (account.getSuffix().length() > 0) { SecureCharArray suffix = new SecureCharArray(account.getSuffix()); // If the suffix is larger than the entire password (not smart), then // just replace the output with a section of the suffix that fits if (length < suffix.size()) { output.replace(suffix); output.resize(length, true); } // Otherwise insert the prefix where it fits else { output.resize(length - suffix.size(), true); output.append(suffix); } suffix.erase(); } } catch (Exception e) { if (output != null) output.erase(); throw e; } finally { // not really needed... but here for completeness if (data != null) data.erase(); } return output; } }
public class class_name { public SecureUTF8String makePassword(SecureUTF8String masterPassword, Account account, final String inputText, final String username) throws Exception { // HMAC algorithm requires a key that is >0 length. if ( account.isHmac() && masterPassword.length() == 0 ) { return new SecureUTF8String(); } LeetLevel leetLevel = account.getLeetLevel(); //int count = 0; int length = account.getLength(); SecureUTF8String output = null; SecureUTF8String data = null; try { if (account.getCharacterSet().length() < 2) throw new Exception("Account contains a character set that is too short"); data = new SecureUTF8String(getModifiedInputText(inputText, account) + username + account.getModifier()); // Use leet before hashing if (account.getLeetType() == LeetType.BEFORE || account.getLeetType() == LeetType.BOTH) { LeetEncoder.leetConvert(leetLevel, masterPassword); // depends on control dependency: [if], data = [none] LeetEncoder.leetConvert(leetLevel, data); // depends on control dependency: [if], data = [none] } // Perform the actual hashing output = hashTheData(masterPassword, data, account); // Use leet after hashing if (account.getLeetType() == LeetType.AFTER || account.getLeetType() == LeetType.BOTH) { LeetEncoder.leetConvert(leetLevel, output); // depends on control dependency: [if], data = [none] } // Apply the prefix if (account.getPrefix().length() > 0) { SecureCharArray prefix = new SecureCharArray(account.getPrefix()); output.prepend(prefix); // depends on control dependency: [if], data = [none] prefix.erase(); // depends on control dependency: [if], data = [none] } // Handle the suffix output.resize(length, true); if (account.getSuffix().length() > 0) { SecureCharArray suffix = new SecureCharArray(account.getSuffix()); // If the suffix is larger than the entire password (not smart), then // just replace the output with a section of the suffix that fits if (length < suffix.size()) { output.replace(suffix); // depends on control dependency: [if], data = [none] output.resize(length, true); // depends on control dependency: [if], data = [(length] } // Otherwise insert the prefix where it fits else { output.resize(length - suffix.size(), true); // depends on control dependency: [if], data = [(length] output.append(suffix); // depends on control dependency: [if], data = [none] } suffix.erase(); // depends on control dependency: [if], data = [none] } } catch (Exception e) { if (output != null) output.erase(); throw e; } finally { // not really needed... but here for completeness if (data != null) data.erase(); } return output; } }
public class class_name { public static String getUriPath(String value) { try { URL url = new URL(value); return url.getPath(); } catch (MalformedURLException e) { return value; } } }
public class class_name { public static String getUriPath(String value) { try { URL url = new URL(value); return url.getPath(); // depends on control dependency: [try], data = [none] } catch (MalformedURLException e) { return value; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public List<SQLResultSet> executeNativeSQLSynchronized( NativeSQLQuery nativeSQLQueryParam) { if(nativeSQLQueryParam == null) { return null; } if(nativeSQLQueryParam.getDatasourceName() == null || nativeSQLQueryParam.getDatasourceName().isEmpty()) { throw new FluidClientException( "No data-source name provided. Not allowed.", FluidClientException.ErrorCode.FIELD_VALIDATE); } //No query to execute... if((nativeSQLQueryParam.getQuery() == null || nativeSQLQueryParam.getQuery().isEmpty()) && (nativeSQLQueryParam.getStoredProcedure() == null || nativeSQLQueryParam.getStoredProcedure().isEmpty())) { return null; } //Validate the echo... this.setEchoIfNotSet(nativeSQLQueryParam); //Start a new request... String uniqueReqId = this.initNewRequest(); //Send the actual message... this.sendMessage(nativeSQLQueryParam, uniqueReqId); try { List<SQLResultSet> returnValue = this.getHandler(uniqueReqId).getCF().get( this.getTimeoutInMillis(),TimeUnit.MILLISECONDS); //Connection was closed.. this is a problem.... if(this.getHandler(uniqueReqId).isConnectionClosed()) { throw new FluidClientException( "SQLUtil-WebSocket-ExecuteNativeSQL: " + "The connection was closed by the server prior to the response received.", FluidClientException.ErrorCode.IO_ERROR); } return returnValue; } //Interrupted... catch (InterruptedException exceptParam) { throw new FluidClientException( "SQLUtil-WebSocket-ExecuteNativeSQL: " + exceptParam.getMessage(), exceptParam, FluidClientException.ErrorCode.STATEMENT_EXECUTION_ERROR); } //Error on the web-socket... catch (ExecutionException executeProblem) { Throwable cause = executeProblem.getCause(); //Fluid client exception... if(cause instanceof FluidClientException) { throw (FluidClientException)cause; } else { throw new FluidClientException( "SQLUtil-WebSocket-ExecuteNativeSQL: " + cause.getMessage(), cause, FluidClientException.ErrorCode.STATEMENT_EXECUTION_ERROR); } } //Timeout... catch (TimeoutException eParam) { throw new FluidClientException( "SQLUtil-WebSocket-ExecuteNativeSQL: Timeout while waiting for all return data. There were '" +this.getHandler(uniqueReqId).getReturnValue().size() +"' items after a Timeout of "+( TimeUnit.MILLISECONDS.toSeconds(this.getTimeoutInMillis()))+" seconds." ,FluidClientException.ErrorCode.IO_ERROR); } finally { this.removeHandler(uniqueReqId); } } }
public class class_name { public List<SQLResultSet> executeNativeSQLSynchronized( NativeSQLQuery nativeSQLQueryParam) { if(nativeSQLQueryParam == null) { return null; // depends on control dependency: [if], data = [none] } if(nativeSQLQueryParam.getDatasourceName() == null || nativeSQLQueryParam.getDatasourceName().isEmpty()) { throw new FluidClientException( "No data-source name provided. Not allowed.", FluidClientException.ErrorCode.FIELD_VALIDATE); } //No query to execute... if((nativeSQLQueryParam.getQuery() == null || nativeSQLQueryParam.getQuery().isEmpty()) && (nativeSQLQueryParam.getStoredProcedure() == null || nativeSQLQueryParam.getStoredProcedure().isEmpty())) { return null; // depends on control dependency: [if], data = [none] } //Validate the echo... this.setEchoIfNotSet(nativeSQLQueryParam); //Start a new request... String uniqueReqId = this.initNewRequest(); //Send the actual message... this.sendMessage(nativeSQLQueryParam, uniqueReqId); try { List<SQLResultSet> returnValue = this.getHandler(uniqueReqId).getCF().get( this.getTimeoutInMillis(),TimeUnit.MILLISECONDS); //Connection was closed.. this is a problem.... if(this.getHandler(uniqueReqId).isConnectionClosed()) { throw new FluidClientException( "SQLUtil-WebSocket-ExecuteNativeSQL: " + "The connection was closed by the server prior to the response received.", FluidClientException.ErrorCode.IO_ERROR); } return returnValue; // depends on control dependency: [try], data = [none] } //Interrupted... catch (InterruptedException exceptParam) { throw new FluidClientException( "SQLUtil-WebSocket-ExecuteNativeSQL: " + exceptParam.getMessage(), exceptParam, FluidClientException.ErrorCode.STATEMENT_EXECUTION_ERROR); } // depends on control dependency: [catch], data = [none] //Error on the web-socket... catch (ExecutionException executeProblem) { Throwable cause = executeProblem.getCause(); //Fluid client exception... if(cause instanceof FluidClientException) { throw (FluidClientException)cause; } else { throw new FluidClientException( "SQLUtil-WebSocket-ExecuteNativeSQL: " + cause.getMessage(), cause, FluidClientException.ErrorCode.STATEMENT_EXECUTION_ERROR); } } // depends on control dependency: [catch], data = [none] //Timeout... catch (TimeoutException eParam) { throw new FluidClientException( "SQLUtil-WebSocket-ExecuteNativeSQL: Timeout while waiting for all return data. There were '" +this.getHandler(uniqueReqId).getReturnValue().size() +"' items after a Timeout of "+( TimeUnit.MILLISECONDS.toSeconds(this.getTimeoutInMillis()))+" seconds." ,FluidClientException.ErrorCode.IO_ERROR); } // depends on control dependency: [catch], data = [none] finally { this.removeHandler(uniqueReqId); } } }
public class class_name { public String retrieveEndpointName(J2EEName j2eeName) { for (Entry<String, J2EEName> entry : endpointNameJ2EENameMap.entrySet()) { if (entry.getValue().equals(j2eeName)) { return entry.getKey(); } } return null; } }
public class class_name { public String retrieveEndpointName(J2EEName j2eeName) { for (Entry<String, J2EEName> entry : endpointNameJ2EENameMap.entrySet()) { if (entry.getValue().equals(j2eeName)) { return entry.getKey(); // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public static Set<InvokableAnnotatedMethod<?>> getDecoratorMethods(BeanManagerImpl beanManager, WeldDecorator<?> decorator) { ImmutableSet.Builder<InvokableAnnotatedMethod<?>> builder = ImmutableSet.builder(); for (Type type : decorator.getDecoratedTypes()) { EnhancedAnnotatedType<?> weldClass = getEnhancedAnnotatedTypeOfDecoratedType(beanManager, type); for (EnhancedAnnotatedMethod<?, ?> method : weldClass.getDeclaredEnhancedMethods()) { if (decorator.getEnhancedAnnotated().getEnhancedMethod(method.getSignature()) != null) { builder.add(InvokableAnnotatedMethod.of(method.slim())); } } } return builder.build(); } }
public class class_name { public static Set<InvokableAnnotatedMethod<?>> getDecoratorMethods(BeanManagerImpl beanManager, WeldDecorator<?> decorator) { ImmutableSet.Builder<InvokableAnnotatedMethod<?>> builder = ImmutableSet.builder(); for (Type type : decorator.getDecoratedTypes()) { EnhancedAnnotatedType<?> weldClass = getEnhancedAnnotatedTypeOfDecoratedType(beanManager, type); for (EnhancedAnnotatedMethod<?, ?> method : weldClass.getDeclaredEnhancedMethods()) { if (decorator.getEnhancedAnnotated().getEnhancedMethod(method.getSignature()) != null) { builder.add(InvokableAnnotatedMethod.of(method.slim())); // depends on control dependency: [if], data = [none] } } } return builder.build(); } }
public class class_name { protected Response addContentPropertiesToResponse(ResponseBuilder response, Map<String, String> properties) { if (properties != null) { // Set Accept-Ranges header properties.remove(HttpHeaders.ACCEPT_RANGES); response.header(HttpHeaders.ACCEPT_RANGES, HttpHeaders.ACCEPT_RANGES_BYTES); // Set Content-Type header String contentMimetype = // content-mimetype header properties.remove(StorageProvider.PROPERTIES_CONTENT_MIMETYPE); String contentType = // Content-Type header properties.remove(HttpHeaders.CONTENT_TYPE); if (null != contentMimetype && validMimetype(contentMimetype)) { response.header(HttpHeaders.CONTENT_TYPE, contentMimetype); } else if (null != contentType && validMimetype(contentType)) { response.header(HttpHeaders.CONTENT_TYPE, contentType); } else { response.header(HttpHeaders.CONTENT_TYPE, DEFAULT_MIME); } // Set Content-Length header String contentSize = // content-size header properties.remove(StorageProvider.PROPERTIES_CONTENT_SIZE); String contentLength = // Content-Length header properties.remove(HttpHeaders.CONTENT_LENGTH); if (null != contentSize) { response.header(HttpHeaders.CONTENT_LENGTH, contentSize); } else if (null != contentLength) { response.header(HttpHeaders.CONTENT_LENGTH, contentLength); } // Set Last-Modified header String contentModified = // content-modified header properties.remove(StorageProvider.PROPERTIES_CONTENT_MODIFIED); String lastModified = // Last-Modified header properties.remove(HttpHeaders.LAST_MODIFIED); if (null != contentModified) { response.header(HttpHeaders.LAST_MODIFIED, contentModified); } else if (null != lastModified) { response.header(HttpHeaders.LAST_MODIFIED, lastModified); } // Set ETag and Content-MD5 headers String contentChecksum = // content-checksum header properties.remove(StorageProvider.PROPERTIES_CONTENT_CHECKSUM); String contentMdFive = // content-md5 header properties.remove(StorageProvider.PROPERTIES_CONTENT_MD5); String contentMd5 = // Content-MD5 header properties.remove(HttpHeaders.CONTENT_MD5); String etag = // ETag header properties.remove(HttpHeaders.ETAG); if (null != contentChecksum) { response.header(HttpHeaders.CONTENT_MD5, contentChecksum); response.header(HttpHeaders.ETAG, contentChecksum); } else if (null != contentMdFive) { response.header(HttpHeaders.CONTENT_MD5, contentMdFive); response.header(HttpHeaders.ETAG, contentMdFive); } else if (null != contentMd5) { response.header(HttpHeaders.CONTENT_MD5, contentMd5); response.header(HttpHeaders.ETAG, contentMd5); } else if (null != etag) { response.header(HttpHeaders.CONTENT_MD5, etag); response.header(HttpHeaders.ETAG, etag); } // Set the remaining property values as headers Iterator<String> propertiesNames = properties.keySet().iterator(); while (propertiesNames.hasNext()) { String propertiesName = propertiesNames.next(); String propertiesValue = properties.get(propertiesName); if (propertiesName.equals(HttpHeaders.DATE) || propertiesName.equals(HttpHeaders.CONNECTION)) { // Ignore this value } else if (propertiesName.equals(HttpHeaders.ACCEPT_RANGES) || propertiesName.equals(HttpHeaders.AGE) || propertiesName.equals(HttpHeaders.CACHE_CONTROL) || propertiesName.equals(HttpHeaders.CONTENT_ENCODING) || propertiesName.equals(HttpHeaders.CONTENT_LANGUAGE) || propertiesName.equals(HttpHeaders.CONTENT_LOCATION) || propertiesName.equals(HttpHeaders.CONTENT_RANGE) || propertiesName.equals(HttpHeaders.EXPIRES) || propertiesName.equals(HttpHeaders.LOCATION) || propertiesName.equals(HttpHeaders.PRAGMA) || propertiesName.equals(HttpHeaders.RETRY_AFTER) || propertiesName.equals(HttpHeaders.SERVER) || propertiesName.equals(HttpHeaders.TRANSFER_ENCODING) || propertiesName.equals(HttpHeaders.UPGRADE) || propertiesName.equals(HttpHeaders.WARNING)) { // Pass through as a standard http header response.header(propertiesName, propertiesValue); } else { // Custom header, append prefix response.header(HEADER_PREFIX + propertiesName, propertiesValue); } } } return response.build(); } }
public class class_name { protected Response addContentPropertiesToResponse(ResponseBuilder response, Map<String, String> properties) { if (properties != null) { // Set Accept-Ranges header properties.remove(HttpHeaders.ACCEPT_RANGES); // depends on control dependency: [if], data = [none] response.header(HttpHeaders.ACCEPT_RANGES, HttpHeaders.ACCEPT_RANGES_BYTES); // depends on control dependency: [if], data = [none] // Set Content-Type header String contentMimetype = // content-mimetype header properties.remove(StorageProvider.PROPERTIES_CONTENT_MIMETYPE); String contentType = // Content-Type header properties.remove(HttpHeaders.CONTENT_TYPE); if (null != contentMimetype && validMimetype(contentMimetype)) { response.header(HttpHeaders.CONTENT_TYPE, contentMimetype); // depends on control dependency: [if], data = [none] } else if (null != contentType && validMimetype(contentType)) { response.header(HttpHeaders.CONTENT_TYPE, contentType); // depends on control dependency: [if], data = [none] } else { response.header(HttpHeaders.CONTENT_TYPE, DEFAULT_MIME); // depends on control dependency: [if], data = [none] } // Set Content-Length header String contentSize = // content-size header properties.remove(StorageProvider.PROPERTIES_CONTENT_SIZE); String contentLength = // Content-Length header properties.remove(HttpHeaders.CONTENT_LENGTH); if (null != contentSize) { response.header(HttpHeaders.CONTENT_LENGTH, contentSize); // depends on control dependency: [if], data = [contentSize)] } else if (null != contentLength) { response.header(HttpHeaders.CONTENT_LENGTH, contentLength); // depends on control dependency: [if], data = [contentLength)] } // Set Last-Modified header String contentModified = // content-modified header properties.remove(StorageProvider.PROPERTIES_CONTENT_MODIFIED); String lastModified = // Last-Modified header properties.remove(HttpHeaders.LAST_MODIFIED); if (null != contentModified) { response.header(HttpHeaders.LAST_MODIFIED, contentModified); // depends on control dependency: [if], data = [contentModified)] } else if (null != lastModified) { response.header(HttpHeaders.LAST_MODIFIED, lastModified); // depends on control dependency: [if], data = [lastModified)] } // Set ETag and Content-MD5 headers String contentChecksum = // content-checksum header properties.remove(StorageProvider.PROPERTIES_CONTENT_CHECKSUM); String contentMdFive = // content-md5 header properties.remove(StorageProvider.PROPERTIES_CONTENT_MD5); String contentMd5 = // Content-MD5 header properties.remove(HttpHeaders.CONTENT_MD5); String etag = // ETag header properties.remove(HttpHeaders.ETAG); if (null != contentChecksum) { response.header(HttpHeaders.CONTENT_MD5, contentChecksum); // depends on control dependency: [if], data = [contentChecksum)] response.header(HttpHeaders.ETAG, contentChecksum); // depends on control dependency: [if], data = [contentChecksum)] } else if (null != contentMdFive) { response.header(HttpHeaders.CONTENT_MD5, contentMdFive); // depends on control dependency: [if], data = [contentMdFive)] response.header(HttpHeaders.ETAG, contentMdFive); // depends on control dependency: [if], data = [contentMdFive)] } else if (null != contentMd5) { response.header(HttpHeaders.CONTENT_MD5, contentMd5); // depends on control dependency: [if], data = [contentMd5)] response.header(HttpHeaders.ETAG, contentMd5); // depends on control dependency: [if], data = [contentMd5)] } else if (null != etag) { response.header(HttpHeaders.CONTENT_MD5, etag); // depends on control dependency: [if], data = [etag)] response.header(HttpHeaders.ETAG, etag); // depends on control dependency: [if], data = [etag)] } // Set the remaining property values as headers Iterator<String> propertiesNames = properties.keySet().iterator(); while (propertiesNames.hasNext()) { String propertiesName = propertiesNames.next(); String propertiesValue = properties.get(propertiesName); if (propertiesName.equals(HttpHeaders.DATE) || propertiesName.equals(HttpHeaders.CONNECTION)) { // Ignore this value } else if (propertiesName.equals(HttpHeaders.ACCEPT_RANGES) || propertiesName.equals(HttpHeaders.AGE) || propertiesName.equals(HttpHeaders.CACHE_CONTROL) || propertiesName.equals(HttpHeaders.CONTENT_ENCODING) || propertiesName.equals(HttpHeaders.CONTENT_LANGUAGE) || propertiesName.equals(HttpHeaders.CONTENT_LOCATION) || propertiesName.equals(HttpHeaders.CONTENT_RANGE) || propertiesName.equals(HttpHeaders.EXPIRES) || propertiesName.equals(HttpHeaders.LOCATION) || propertiesName.equals(HttpHeaders.PRAGMA) || propertiesName.equals(HttpHeaders.RETRY_AFTER) || propertiesName.equals(HttpHeaders.SERVER) || propertiesName.equals(HttpHeaders.TRANSFER_ENCODING) || propertiesName.equals(HttpHeaders.UPGRADE) || propertiesName.equals(HttpHeaders.WARNING)) { // Pass through as a standard http header response.header(propertiesName, propertiesValue); // depends on control dependency: [if], data = [none] } else { // Custom header, append prefix response.header(HEADER_PREFIX + propertiesName, propertiesValue); // depends on control dependency: [if], data = [none] } } } return response.build(); } }
public class class_name { public static void defineCopyBridges(ClassFile cf, Class leaf) { for (Class c : gatherAllBridgeTypes(new HashSet<Class>(), leaf)) { if (c != Object.class) { defineCopyBridge(cf, leaf, c); } } } }
public class class_name { public static void defineCopyBridges(ClassFile cf, Class leaf) { for (Class c : gatherAllBridgeTypes(new HashSet<Class>(), leaf)) { if (c != Object.class) { defineCopyBridge(cf, leaf, c); // depends on control dependency: [if], data = [(c] } } } }
public class class_name { private void resetWatcher() { // Stop the current watcher. stopWatcher(); // Update the template & target directories, based on the provided configuration directory. if( this.templatesDIR == null ) { this.logger.warning( "The templates directory was not specified. DM templating is temporarily disabled." ); } else if( this.outputDIR == null ) { this.logger.warning( "The templates directory was not specified. DM templating is temporarily disabled." ); } else { this.templateWatcher = new TemplateWatcher( this, this.templatesDIR, this.pollInterval ); this.templateWatcher.start(); } } }
public class class_name { private void resetWatcher() { // Stop the current watcher. stopWatcher(); // Update the template & target directories, based on the provided configuration directory. if( this.templatesDIR == null ) { this.logger.warning( "The templates directory was not specified. DM templating is temporarily disabled." ); // depends on control dependency: [if], data = [none] } else if( this.outputDIR == null ) { this.logger.warning( "The templates directory was not specified. DM templating is temporarily disabled." ); // depends on control dependency: [if], data = [none] } else { this.templateWatcher = new TemplateWatcher( this, this.templatesDIR, this.pollInterval ); // depends on control dependency: [if], data = [none] this.templateWatcher.start(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(GetSpeechSynthesisTaskRequest getSpeechSynthesisTaskRequest, ProtocolMarshaller protocolMarshaller) { if (getSpeechSynthesisTaskRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getSpeechSynthesisTaskRequest.getTaskId(), TASKID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetSpeechSynthesisTaskRequest getSpeechSynthesisTaskRequest, ProtocolMarshaller protocolMarshaller) { if (getSpeechSynthesisTaskRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getSpeechSynthesisTaskRequest.getTaskId(), TASKID_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 SuppressionInfo withExtendedSuppressions( Symbol sym, VisitorState state, Set<Class<? extends Annotation>> customSuppressionAnnosToLookFor) { boolean newInGeneratedCode = inGeneratedCode || isGenerated(sym, state); boolean anyModification = newInGeneratedCode != inGeneratedCode; /* Handle custom suppression annotations. */ Set<Class<? extends Annotation>> newCustomSuppressions = null; for (Class<? extends Annotation> annotationType : customSuppressionAnnosToLookFor) { // Don't need to check already-suppressed annos if (customSuppressions.contains(annotationType)) { continue; } if (ASTHelpers.hasAnnotation(sym, annotationType, state)) { anyModification = true; if (newCustomSuppressions == null) { newCustomSuppressions = new HashSet<>(customSuppressions); } newCustomSuppressions.add(annotationType); } } /* Handle {@code @SuppressWarnings} and {@code @SuppressLint}. */ Set<String> newSuppressions = null; // Iterate over annotations on this symbol, looking for SuppressWarnings for (Attribute.Compound attr : sym.getAnnotationMirrors()) { if ((attr.type.tsym == state.getSymtab().suppressWarningsType.tsym) || attr.type.tsym.getQualifiedName().contentEquals("android.annotation.SuppressLint")) { for (Pair<MethodSymbol, Attribute> value : attr.values) { if (value.fst.name.contentEquals("value")) { if (value.snd instanceof Attribute.Array) { // SuppressWarnings/SuppressLint take an array for (Attribute suppress : ((Attribute.Array) value.snd).values) { String suppressedWarning = (String) suppress.getValue(); if (!suppressWarningsStrings.contains(suppressedWarning)) { anyModification = true; if (newSuppressions == null) { newSuppressions = new HashSet<>(suppressWarningsStrings); } newSuppressions.add(suppressedWarning); } } } else { throw new RuntimeException( "Expected SuppressWarnings/SuppressLint annotation to take array type"); } } } } } // Since this is invoked every time we descend into a new node, let's save some garbage // by returning the same instance if there were no changes. if (!anyModification) { return this; } if (newCustomSuppressions == null) { newCustomSuppressions = customSuppressions; } if (newSuppressions == null) { newSuppressions = suppressWarningsStrings; } return new SuppressionInfo(newSuppressions, newCustomSuppressions, newInGeneratedCode); } }
public class class_name { public SuppressionInfo withExtendedSuppressions( Symbol sym, VisitorState state, Set<Class<? extends Annotation>> customSuppressionAnnosToLookFor) { boolean newInGeneratedCode = inGeneratedCode || isGenerated(sym, state); boolean anyModification = newInGeneratedCode != inGeneratedCode; /* Handle custom suppression annotations. */ Set<Class<? extends Annotation>> newCustomSuppressions = null; for (Class<? extends Annotation> annotationType : customSuppressionAnnosToLookFor) { // Don't need to check already-suppressed annos if (customSuppressions.contains(annotationType)) { continue; } if (ASTHelpers.hasAnnotation(sym, annotationType, state)) { anyModification = true; // depends on control dependency: [if], data = [none] if (newCustomSuppressions == null) { newCustomSuppressions = new HashSet<>(customSuppressions); // depends on control dependency: [if], data = [none] } newCustomSuppressions.add(annotationType); // depends on control dependency: [if], data = [none] } } /* Handle {@code @SuppressWarnings} and {@code @SuppressLint}. */ Set<String> newSuppressions = null; // Iterate over annotations on this symbol, looking for SuppressWarnings for (Attribute.Compound attr : sym.getAnnotationMirrors()) { if ((attr.type.tsym == state.getSymtab().suppressWarningsType.tsym) || attr.type.tsym.getQualifiedName().contentEquals("android.annotation.SuppressLint")) { for (Pair<MethodSymbol, Attribute> value : attr.values) { if (value.fst.name.contentEquals("value")) { if (value.snd instanceof Attribute.Array) { // SuppressWarnings/SuppressLint take an array for (Attribute suppress : ((Attribute.Array) value.snd).values) { String suppressedWarning = (String) suppress.getValue(); if (!suppressWarningsStrings.contains(suppressedWarning)) { anyModification = true; if (newSuppressions == null) { newSuppressions = new HashSet<>(suppressWarningsStrings); } newSuppressions.add(suppressedWarning); } } } else { throw new RuntimeException( "Expected SuppressWarnings/SuppressLint annotation to take array type"); } } } } } // Since this is invoked every time we descend into a new node, let's save some garbage // by returning the same instance if there were no changes. if (!anyModification) { return this; } if (newCustomSuppressions == null) { newCustomSuppressions = customSuppressions; } if (newSuppressions == null) { newSuppressions = suppressWarningsStrings; } return new SuppressionInfo(newSuppressions, newCustomSuppressions, newInGeneratedCode); } }
public class class_name { public <TRO> TransformedRuleContext<DPO, RI, RO, TRO> transform(Transformer<Collection<RO>, TRO> resultHandlerInputTransformer) { List<Transformer> transformers = new ArrayList<Transformer>(); if (resultHandlerInputTransformer != null) { transformers.add(resultHandlerInputTransformer); } return new TransformedRuleContext<DPO, RI, RO, TRO>(addedTriggers, addedDataProviders, dataProviderToRuleMapping, addedRuleInputTransformers, addedRules, GeneralValidator.MappingStrategy.JOIN, transformers); } }
public class class_name { public <TRO> TransformedRuleContext<DPO, RI, RO, TRO> transform(Transformer<Collection<RO>, TRO> resultHandlerInputTransformer) { List<Transformer> transformers = new ArrayList<Transformer>(); if (resultHandlerInputTransformer != null) { transformers.add(resultHandlerInputTransformer); // depends on control dependency: [if], data = [(resultHandlerInputTransformer] } return new TransformedRuleContext<DPO, RI, RO, TRO>(addedTriggers, addedDataProviders, dataProviderToRuleMapping, addedRuleInputTransformers, addedRules, GeneralValidator.MappingStrategy.JOIN, transformers); } }
public class class_name { public boolean executeKeyEvent(KeyEvent event) { mTempRect.setEmpty(); if (!canScroll()) { if (isFocused() && event.getKeyCode() != KeyEvent.KEYCODE_BACK) { View currentFocused = findFocus(); if (currentFocused == this) currentFocused = null; View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, View.FOCUS_DOWN); return nextFocused != null && nextFocused != this && nextFocused.requestFocus(View.FOCUS_DOWN); } return false; } boolean handled = false; if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_DPAD_UP: if (!event.isAltPressed()) { handled = arrowScroll(View.FOCUS_UP); } else { handled = fullScroll(View.FOCUS_UP); } break; case KeyEvent.KEYCODE_DPAD_DOWN: if (!event.isAltPressed()) { handled = arrowScroll(View.FOCUS_DOWN); } else { handled = fullScroll(View.FOCUS_DOWN); } break; case KeyEvent.KEYCODE_SPACE: pageScroll(event.isShiftPressed() ? View.FOCUS_UP : View.FOCUS_DOWN); break; } } return handled; } }
public class class_name { public boolean executeKeyEvent(KeyEvent event) { mTempRect.setEmpty(); if (!canScroll()) { if (isFocused() && event.getKeyCode() != KeyEvent.KEYCODE_BACK) { View currentFocused = findFocus(); if (currentFocused == this) currentFocused = null; View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, View.FOCUS_DOWN); return nextFocused != null && nextFocused != this && nextFocused.requestFocus(View.FOCUS_DOWN); // depends on control dependency: [if], data = [none] } return false; // depends on control dependency: [if], data = [none] } boolean handled = false; if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_DPAD_UP: if (!event.isAltPressed()) { handled = arrowScroll(View.FOCUS_UP); // depends on control dependency: [if], data = [none] } else { handled = fullScroll(View.FOCUS_UP); // depends on control dependency: [if], data = [none] } break; case KeyEvent.KEYCODE_DPAD_DOWN: if (!event.isAltPressed()) { handled = arrowScroll(View.FOCUS_DOWN); // depends on control dependency: [if], data = [none] } else { handled = fullScroll(View.FOCUS_DOWN); // depends on control dependency: [if], data = [none] } break; case KeyEvent.KEYCODE_SPACE: pageScroll(event.isShiftPressed() ? View.FOCUS_UP : View.FOCUS_DOWN); break; } } return handled; } }
public class class_name { private void processContextEntry(ServiceReference<JAASLoginContextEntry> ref) { String id = (String) ref.getProperty(KEY_ID); String[] modulePids = (String[]) ref.getProperty(JAASLoginContextEntry.CFG_KEY_LOGIN_MODULE_REF); boolean changedEntryContext = false; if (modulePids == null || modulePids.length == 0) { // There are no modules specified if (JAASConfigurationImpl.defaultEntryIds.contains(id)) { // OK for default context entries to have no modules jaasLoginContextEntries.putReference(id, ref); changedEntryContext = true; } else { // make sure it was not previously registered Tr.error(tc, "JAAS_LOGIN_CONTEXT_ENTRY_HAS_NO_LOGIN_MODULE", id); changedEntryContext |= jaasLoginContextEntries.removeReference(id, ref); } } else { jaasLoginContextEntries.putReference(id, ref); changedEntryContext = true; } if (changedEntryContext) { modified(properties); } } }
public class class_name { private void processContextEntry(ServiceReference<JAASLoginContextEntry> ref) { String id = (String) ref.getProperty(KEY_ID); String[] modulePids = (String[]) ref.getProperty(JAASLoginContextEntry.CFG_KEY_LOGIN_MODULE_REF); boolean changedEntryContext = false; if (modulePids == null || modulePids.length == 0) { // There are no modules specified if (JAASConfigurationImpl.defaultEntryIds.contains(id)) { // OK for default context entries to have no modules jaasLoginContextEntries.putReference(id, ref); // depends on control dependency: [if], data = [none] changedEntryContext = true; // depends on control dependency: [if], data = [none] } else { // make sure it was not previously registered Tr.error(tc, "JAAS_LOGIN_CONTEXT_ENTRY_HAS_NO_LOGIN_MODULE", id); // depends on control dependency: [if], data = [none] changedEntryContext |= jaasLoginContextEntries.removeReference(id, ref); // depends on control dependency: [if], data = [none] } } else { jaasLoginContextEntries.putReference(id, ref); // depends on control dependency: [if], data = [none] changedEntryContext = true; // depends on control dependency: [if], data = [none] } if (changedEntryContext) { modified(properties); // depends on control dependency: [if], data = [none] } } }
public class class_name { private GenericCriteriaPrompt getPromptValue(FieldType field, byte[] block) { int textOffset = getPromptOffset(block); String value = MPPUtility.getUnicodeString(m_criteriaData, m_criteriaTextStart + textOffset); GenericCriteriaPrompt prompt = new GenericCriteriaPrompt(field.getDataType(), value); if (m_prompts != null) { m_prompts.add(prompt); } return prompt; } }
public class class_name { private GenericCriteriaPrompt getPromptValue(FieldType field, byte[] block) { int textOffset = getPromptOffset(block); String value = MPPUtility.getUnicodeString(m_criteriaData, m_criteriaTextStart + textOffset); GenericCriteriaPrompt prompt = new GenericCriteriaPrompt(field.getDataType(), value); if (m_prompts != null) { m_prompts.add(prompt); // depends on control dependency: [if], data = [none] } return prompt; } }
public class class_name { @Override protected void initGraphics() { super.initGraphics(); mouseEventHandler = e -> { final EventType TYPE = e.getEventType(); final Label SRC = (Label) e.getSource(); if (MouseEvent.MOUSE_PRESSED == TYPE) { if (SRC.equals(minusLabel)) { decrement(); } else if (SRC.equals(plusLabel)) { increment(); } } else if (MouseEvent.MOUSE_RELEASED == TYPE) { if (SRC.equals(minusLabel)) { minusLabel.setTextFill(tile.getForegroundColor()); minusLabel.setBorder(new Border(new BorderStroke(tile.getForegroundColor(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(size * 0.01)))); } else if (SRC.equals(plusLabel)) { plusLabel.setTextFill(tile.getForegroundColor()); plusLabel.setBorder(new Border(new BorderStroke(tile.getForegroundColor(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(size * 0.01)))); } } }; titleText = new Text(); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); text = new Text(tile.getText()); text.setFill(tile.getUnitColor()); Helper.enableNode(text, tile.isTextVisible()); valueText = new Text(String.format(locale, formatString, ((tile.getValue() - minValue) / range * 100))); valueText.setFill(tile.getValueColor()); Helper.enableNode(valueText, tile.isValueVisible()); unitText = new Text(tile.getUnit()); unitText.setFill(tile.getUnitColor()); Helper.enableNode(unitText, !tile.getUnit().isEmpty()); valueUnitFlow = new TextFlow(valueText, unitText); valueUnitFlow.setTextAlignment(TextAlignment.RIGHT); description = new Label(tile.getDescription()); description.setAlignment(tile.getDescriptionAlignment()); description.setWrapText(true); description.setTextFill(tile.getTextColor()); Helper.enableNode(description, !tile.getDescription().isEmpty()); plusLabel = new Label("+"); plusLabel.setAlignment(Pos.CENTER); plusLabel.setEffect(shadow); plusLabel.setPickOnBounds(false); minusLabel = new Label("-"); minusLabel.setAlignment(Pos.CENTER); minusLabel.setEffect(shadow); minusLabel.setPickOnBounds(false); getPane().getChildren().addAll(titleText, text, valueUnitFlow, description, minusLabel, plusLabel); } }
public class class_name { @Override protected void initGraphics() { super.initGraphics(); mouseEventHandler = e -> { final EventType TYPE = e.getEventType(); final Label SRC = (Label) e.getSource(); if (MouseEvent.MOUSE_PRESSED == TYPE) { if (SRC.equals(minusLabel)) { decrement(); // depends on control dependency: [if], data = [none] } else if (SRC.equals(plusLabel)) { increment(); // depends on control dependency: [if], data = [none] } } else if (MouseEvent.MOUSE_RELEASED == TYPE) { if (SRC.equals(minusLabel)) { minusLabel.setTextFill(tile.getForegroundColor()); // depends on control dependency: [if], data = [none] minusLabel.setBorder(new Border(new BorderStroke(tile.getForegroundColor(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(size * 0.01)))); // depends on control dependency: [if], data = [none] } else if (SRC.equals(plusLabel)) { plusLabel.setTextFill(tile.getForegroundColor()); // depends on control dependency: [if], data = [none] plusLabel.setBorder(new Border(new BorderStroke(tile.getForegroundColor(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(size * 0.01)))); // depends on control dependency: [if], data = [none] } } }; titleText = new Text(); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); text = new Text(tile.getText()); text.setFill(tile.getUnitColor()); Helper.enableNode(text, tile.isTextVisible()); valueText = new Text(String.format(locale, formatString, ((tile.getValue() - minValue) / range * 100))); valueText.setFill(tile.getValueColor()); Helper.enableNode(valueText, tile.isValueVisible()); unitText = new Text(tile.getUnit()); unitText.setFill(tile.getUnitColor()); Helper.enableNode(unitText, !tile.getUnit().isEmpty()); valueUnitFlow = new TextFlow(valueText, unitText); valueUnitFlow.setTextAlignment(TextAlignment.RIGHT); description = new Label(tile.getDescription()); description.setAlignment(tile.getDescriptionAlignment()); description.setWrapText(true); description.setTextFill(tile.getTextColor()); Helper.enableNode(description, !tile.getDescription().isEmpty()); plusLabel = new Label("+"); plusLabel.setAlignment(Pos.CENTER); plusLabel.setEffect(shadow); plusLabel.setPickOnBounds(false); minusLabel = new Label("-"); minusLabel.setAlignment(Pos.CENTER); minusLabel.setEffect(shadow); minusLabel.setPickOnBounds(false); getPane().getChildren().addAll(titleText, text, valueUnitFlow, description, minusLabel, plusLabel); } }
public class class_name { static void createInstance(@NonNull Application application, @NonNull ApptentiveConfiguration configuration) { final String apptentiveKey = configuration.getApptentiveKey(); final String apptentiveSignature = configuration.getApptentiveSignature(); final String baseURL = configuration.getBaseURL(); final boolean shouldEncryptStorage = configuration.shouldEncryptStorage(); // set log message sanitizing ApptentiveLog.setShouldSanitizeLogMessages(configuration.shouldSanitizeLogMessages()); // set log level before we initialize log monitor since log monitor can override it as well ApptentiveLog.overrideLogLevel(configuration.getLogLevel()); // troubleshooting mode if (configuration.isTroubleshootingModeEnabled()) { // initialize log writer ApptentiveLog.initializeLogWriter(application.getApplicationContext(), LOG_HISTORY_SIZE); // try initializing log monitor LogMonitor.startSession(application.getApplicationContext(), apptentiveKey, apptentiveSignature); } else { ApptentiveLog.i(TROUBLESHOOT, "Troubleshooting is disabled in the app configuration"); } synchronized (ApptentiveInternal.class) { if (sApptentiveInternal == null) { try { ApptentiveLog.i("Registering Apptentive Android SDK %s", Constants.getApptentiveSdkVersion()); ApptentiveLog.v("ApptentiveKey=%s ApptentiveSignature=%s", apptentiveKey, apptentiveSignature); sApptentiveInternal = new ApptentiveInternal(application, apptentiveKey, apptentiveSignature, baseURL, shouldEncryptStorage); dispatchOnConversationQueue(new DispatchTask() { @Override protected void execute() { sApptentiveInternal.start(); } }); ApptentiveActivityLifecycleCallbacks.register(application); } catch (Exception e) { ApptentiveLog.e(e, "Exception while initializing ApptentiveInternal instance"); logException(e); } } else { ApptentiveLog.w("Apptentive instance is already initialized"); } } } }
public class class_name { static void createInstance(@NonNull Application application, @NonNull ApptentiveConfiguration configuration) { final String apptentiveKey = configuration.getApptentiveKey(); final String apptentiveSignature = configuration.getApptentiveSignature(); final String baseURL = configuration.getBaseURL(); final boolean shouldEncryptStorage = configuration.shouldEncryptStorage(); // set log message sanitizing ApptentiveLog.setShouldSanitizeLogMessages(configuration.shouldSanitizeLogMessages()); // set log level before we initialize log monitor since log monitor can override it as well ApptentiveLog.overrideLogLevel(configuration.getLogLevel()); // troubleshooting mode if (configuration.isTroubleshootingModeEnabled()) { // initialize log writer ApptentiveLog.initializeLogWriter(application.getApplicationContext(), LOG_HISTORY_SIZE); // depends on control dependency: [if], data = [none] // try initializing log monitor LogMonitor.startSession(application.getApplicationContext(), apptentiveKey, apptentiveSignature); // depends on control dependency: [if], data = [none] } else { ApptentiveLog.i(TROUBLESHOOT, "Troubleshooting is disabled in the app configuration"); // depends on control dependency: [if], data = [none] } synchronized (ApptentiveInternal.class) { if (sApptentiveInternal == null) { try { ApptentiveLog.i("Registering Apptentive Android SDK %s", Constants.getApptentiveSdkVersion()); // depends on control dependency: [try], data = [none] ApptentiveLog.v("ApptentiveKey=%s ApptentiveSignature=%s", apptentiveKey, apptentiveSignature); // depends on control dependency: [try], data = [none] sApptentiveInternal = new ApptentiveInternal(application, apptentiveKey, apptentiveSignature, baseURL, shouldEncryptStorage); // depends on control dependency: [try], data = [none] dispatchOnConversationQueue(new DispatchTask() { @Override protected void execute() { sApptentiveInternal.start(); } }); // depends on control dependency: [try], data = [none] ApptentiveActivityLifecycleCallbacks.register(application); // depends on control dependency: [try], data = [none] } catch (Exception e) { ApptentiveLog.e(e, "Exception while initializing ApptentiveInternal instance"); logException(e); } // depends on control dependency: [catch], data = [none] } else { ApptentiveLog.w("Apptentive instance is already initialized"); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static boolean JVMSupportsLargeMappedFiles() { String arch = System.getProperty("os.arch"); if(arch==null || !arch.contains("64")) { return false; } if(isWindows()) return false; //TODO better check for 32bit JVM return true; } }
public class class_name { public static boolean JVMSupportsLargeMappedFiles() { String arch = System.getProperty("os.arch"); if(arch==null || !arch.contains("64")) { return false; // depends on control dependency: [if], data = [none] } if(isWindows()) return false; //TODO better check for 32bit JVM return true; } }
public class class_name { public ResolveInfo getDefaultActivity() { synchronized (mInstanceLock) { ensureConsistentState(); if (!mActivities.isEmpty()) { return mActivities.get(0).resolveInfo; } } return null; } }
public class class_name { public ResolveInfo getDefaultActivity() { synchronized (mInstanceLock) { ensureConsistentState(); if (!mActivities.isEmpty()) { return mActivities.get(0).resolveInfo; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { protected IPromise<JsonObject> getDistributions(String module) { Promise res = new Promise(); // http://registry.npmjs.org/-/package/react/dist-tags http.getContent(config.getRepo()+"/-/package/"+module+"/dist-tags").then( (cont,err) -> { if ( cont != null ) { JsonObject parse = Json.parse(cont).asObject(); res.resolve(parse); } else { res.reject(err); } }); return res; } }
public class class_name { protected IPromise<JsonObject> getDistributions(String module) { Promise res = new Promise(); // http://registry.npmjs.org/-/package/react/dist-tags http.getContent(config.getRepo()+"/-/package/"+module+"/dist-tags").then( (cont,err) -> { if ( cont != null ) { JsonObject parse = Json.parse(cont).asObject(); res.resolve(parse); // depends on control dependency: [if], data = [none] } else { res.reject(err); // depends on control dependency: [if], data = [none] } }); return res; } }
public class class_name { public ChronoOperator<PlainDate> asNextExactEvent() { return date -> { int year = date.getYear(); int month = AnnualDate.this.getMonth().getValue(); int dom = AnnualDate.this.getDayOfMonth(); if ((month < date.getMonth()) || ((month == date.getMonth()) && (dom <= date.getDayOfMonth()))) { year++; } if ((month == 2) && (dom == 29)) { while (!GregorianMath.isLeapYear(year)) { year++; } } return PlainDate.of(year, month, dom); }; } }
public class class_name { public ChronoOperator<PlainDate> asNextExactEvent() { return date -> { int year = date.getYear(); int month = AnnualDate.this.getMonth().getValue(); int dom = AnnualDate.this.getDayOfMonth(); if ((month < date.getMonth()) || ((month == date.getMonth()) && (dom <= date.getDayOfMonth()))) { year++; // depends on control dependency: [if], data = [none] } if ((month == 2) && (dom == 29)) { while (!GregorianMath.isLeapYear(year)) { year++; // depends on control dependency: [while], data = [none] } } return PlainDate.of(year, month, dom); }; } }
public class class_name { public PlaybackState getFurthestPlaybackState() { PlaybackState result = null; for (PlaybackState state : playbackStateMap.values()) { if (result == null || result.position < state.position) { result = state; } } return result; } }
public class class_name { public PlaybackState getFurthestPlaybackState() { PlaybackState result = null; for (PlaybackState state : playbackStateMap.values()) { if (result == null || result.position < state.position) { result = state; // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { public static Method findMethodByAnnotationTag(Object target,String tag) { Method[] methods=target.getClass().getDeclaredMethods(); for(Method m:methods) { AnnotationTag function=m.getAnnotation(AnnotationTag.class); if(function!=null && function.tag().equals(tag)) { return m; } } return null; } }
public class class_name { public static Method findMethodByAnnotationTag(Object target,String tag) { Method[] methods=target.getClass().getDeclaredMethods(); for(Method m:methods) { AnnotationTag function=m.getAnnotation(AnnotationTag.class); if(function!=null && function.tag().equals(tag)) { return m; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public long writeLocked (@Nonnull final LongSupplier aSupplier) { writeLock ().lock (); try { return aSupplier.getAsLong (); } finally { writeLock ().unlock (); } } }
public class class_name { public long writeLocked (@Nonnull final LongSupplier aSupplier) { writeLock ().lock (); try { return aSupplier.getAsLong (); // depends on control dependency: [try], data = [none] } finally { writeLock ().unlock (); } } }
public class class_name { public boolean showPrompts(String name, String instruction, KBIPrompt[] prompts) { for (int i = 0; i < prompts.length; i++) { prompts[i].setResponse(password); } return true; } }
public class class_name { public boolean showPrompts(String name, String instruction, KBIPrompt[] prompts) { for (int i = 0; i < prompts.length; i++) { prompts[i].setResponse(password); // depends on control dependency: [for], data = [i] } return true; } }
public class class_name { @Override public K ceilingKey(K key) { Entry<K, V> entry = entry(key, null); Entry<K, V> ceiling = entrySet.ceiling(entry); if (ceiling != null) { return ceiling.getKey(); } return null; } }
public class class_name { @Override public K ceilingKey(K key) { Entry<K, V> entry = entry(key, null); Entry<K, V> ceiling = entrySet.ceiling(entry); if (ceiling != null) { return ceiling.getKey(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { protected void paintItem(final WTree tree, final WTree.ExpandMode mode, final TreeItemModel model, final List<Integer> rowIndex, final XmlStringBuilder xml, final Set<String> selectedRows, final Set<String> expandedRows) { String itemId = model.getItemId(rowIndex); boolean selected = selectedRows.remove(itemId); boolean expandable = model.isExpandable(rowIndex) && model.hasChildren(rowIndex); boolean expanded = expandedRows.remove(itemId); TreeItemImage image = model.getItemImage(rowIndex); String url = null; if (image != null) { url = tree.getItemImageUrl(image, itemId); } xml.appendTagOpen("ui:treeitem"); xml.appendAttribute("id", tree.getItemIdPrefix() + itemId); xml.appendAttribute("label", model.getItemLabel(rowIndex)); xml.appendOptionalUrlAttribute("imageUrl", url); xml.appendOptionalAttribute("selected", selected, "true"); xml.appendOptionalAttribute("expandable", expandable, "true"); xml.appendOptionalAttribute("open", expandable && expanded, "true"); xml.appendClose(); if (expandable && (mode == WTree.ExpandMode.CLIENT || expanded)) { // Get actual child count int children = model.getChildCount(rowIndex); if (children > 0) { for (int i = 0; i < children; i++) { // Add next level List<Integer> nextRow = new ArrayList<>(rowIndex); nextRow.add(i); paintItem(tree, mode, model, nextRow, xml, selectedRows, expandedRows); } } } xml.appendEndTag("ui:treeitem"); } }
public class class_name { protected void paintItem(final WTree tree, final WTree.ExpandMode mode, final TreeItemModel model, final List<Integer> rowIndex, final XmlStringBuilder xml, final Set<String> selectedRows, final Set<String> expandedRows) { String itemId = model.getItemId(rowIndex); boolean selected = selectedRows.remove(itemId); boolean expandable = model.isExpandable(rowIndex) && model.hasChildren(rowIndex); boolean expanded = expandedRows.remove(itemId); TreeItemImage image = model.getItemImage(rowIndex); String url = null; if (image != null) { url = tree.getItemImageUrl(image, itemId); // depends on control dependency: [if], data = [(image] } xml.appendTagOpen("ui:treeitem"); xml.appendAttribute("id", tree.getItemIdPrefix() + itemId); xml.appendAttribute("label", model.getItemLabel(rowIndex)); xml.appendOptionalUrlAttribute("imageUrl", url); xml.appendOptionalAttribute("selected", selected, "true"); xml.appendOptionalAttribute("expandable", expandable, "true"); xml.appendOptionalAttribute("open", expandable && expanded, "true"); xml.appendClose(); if (expandable && (mode == WTree.ExpandMode.CLIENT || expanded)) { // Get actual child count int children = model.getChildCount(rowIndex); if (children > 0) { for (int i = 0; i < children; i++) { // Add next level List<Integer> nextRow = new ArrayList<>(rowIndex); nextRow.add(i); // depends on control dependency: [for], data = [i] paintItem(tree, mode, model, nextRow, xml, selectedRows, expandedRows); // depends on control dependency: [for], data = [none] } } } xml.appendEndTag("ui:treeitem"); } }
public class class_name { public void deleteByColumn(String schemaName, String tableName, String columnName, Object columnValue) { try { handler.deleteRow(columnValue, schemaName, tableName); KunderaCoreUtils.printQuery("Delete data from " + tableName + " for PK " + columnValue, showQuery); } catch (IOException ioex) { log.error("Error during get columns by key. Caused by: .", ioex); throw new PersistenceException(ioex); } } }
public class class_name { public void deleteByColumn(String schemaName, String tableName, String columnName, Object columnValue) { try { handler.deleteRow(columnValue, schemaName, tableName); // depends on control dependency: [try], data = [none] KunderaCoreUtils.printQuery("Delete data from " + tableName + " for PK " + columnValue, showQuery); // depends on control dependency: [try], data = [none] } catch (IOException ioex) { log.error("Error during get columns by key. Caused by: .", ioex); throw new PersistenceException(ioex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(DirectConnectGateway directConnectGateway, ProtocolMarshaller protocolMarshaller) { if (directConnectGateway == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(directConnectGateway.getDirectConnectGatewayId(), DIRECTCONNECTGATEWAYID_BINDING); protocolMarshaller.marshall(directConnectGateway.getDirectConnectGatewayName(), DIRECTCONNECTGATEWAYNAME_BINDING); protocolMarshaller.marshall(directConnectGateway.getAmazonSideAsn(), AMAZONSIDEASN_BINDING); protocolMarshaller.marshall(directConnectGateway.getOwnerAccount(), OWNERACCOUNT_BINDING); protocolMarshaller.marshall(directConnectGateway.getDirectConnectGatewayState(), DIRECTCONNECTGATEWAYSTATE_BINDING); protocolMarshaller.marshall(directConnectGateway.getStateChangeError(), STATECHANGEERROR_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DirectConnectGateway directConnectGateway, ProtocolMarshaller protocolMarshaller) { if (directConnectGateway == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(directConnectGateway.getDirectConnectGatewayId(), DIRECTCONNECTGATEWAYID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(directConnectGateway.getDirectConnectGatewayName(), DIRECTCONNECTGATEWAYNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(directConnectGateway.getAmazonSideAsn(), AMAZONSIDEASN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(directConnectGateway.getOwnerAccount(), OWNERACCOUNT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(directConnectGateway.getDirectConnectGatewayState(), DIRECTCONNECTGATEWAYSTATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(directConnectGateway.getStateChangeError(), STATECHANGEERROR_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static void writeClassifier(LinearClassifier<?, ?> classifier, String writePath) { try { IOUtils.writeObjectToFile(classifier, writePath); } catch (Exception e) { throw new RuntimeException("Serialization failed: "+e.getMessage(), e); } } }
public class class_name { public static void writeClassifier(LinearClassifier<?, ?> classifier, String writePath) { try { IOUtils.writeObjectToFile(classifier, writePath); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new RuntimeException("Serialization failed: "+e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static void nodeWalker(NodeList childNodes, NodeElementParser parser) throws ParseException { for (int i = 0; i < childNodes.getLength(); i++) { Node item = childNodes.item(i); String node = item.getNodeName(); if(item.getNodeType() == Node.ELEMENT_NODE){ parser.parse(item); } nodeWalker(item.getChildNodes(), parser); } } }
public class class_name { public static void nodeWalker(NodeList childNodes, NodeElementParser parser) throws ParseException { for (int i = 0; i < childNodes.getLength(); i++) { Node item = childNodes.item(i); String node = item.getNodeName(); if(item.getNodeType() == Node.ELEMENT_NODE){ parser.parse(item); // depends on control dependency: [if], data = [none] } nodeWalker(item.getChildNodes(), parser); } } }
public class class_name { private void updateDefault(final Instance _inst, final String _value) { try { final Update update = new Update(_inst); update.add("Default", _value); update.execute(); } catch (final EFapsException e) { DBPropertiesUpdate.LOG.error("updateDefault(String, String)", e); } } }
public class class_name { private void updateDefault(final Instance _inst, final String _value) { try { final Update update = new Update(_inst); update.add("Default", _value); // depends on control dependency: [try], data = [none] update.execute(); // depends on control dependency: [try], data = [none] } catch (final EFapsException e) { DBPropertiesUpdate.LOG.error("updateDefault(String, String)", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void findPluginsForDescriptor(final CommandLinePluginDescriptor<?> pluginDescriptor) { final ClassFinder classFinder = new ClassFinder(); pluginDescriptor.getPackageNames().forEach( pkg -> classFinder.find(pkg, pluginDescriptor.getPluginBaseClass())); final Set<Class<?>> pluginClasses = classFinder.getClasses(); for (Class<?> c : pluginClasses) { if (pluginDescriptor.includePluginClass(c)) { try { final Object plugin = pluginDescriptor.createInstanceForPlugin(c); createArgumentDefinitions(plugin, pluginDescriptor); } catch (InstantiationException | IllegalAccessException e) { throw new CommandLineException.CommandLineParserInternalException("Problem making an instance of plugin " + c + " Do check that the class has a non-arg constructor", e); } } } } }
public class class_name { private void findPluginsForDescriptor(final CommandLinePluginDescriptor<?> pluginDescriptor) { final ClassFinder classFinder = new ClassFinder(); pluginDescriptor.getPackageNames().forEach( pkg -> classFinder.find(pkg, pluginDescriptor.getPluginBaseClass())); final Set<Class<?>> pluginClasses = classFinder.getClasses(); for (Class<?> c : pluginClasses) { if (pluginDescriptor.includePluginClass(c)) { try { final Object plugin = pluginDescriptor.createInstanceForPlugin(c); createArgumentDefinitions(plugin, pluginDescriptor); // depends on control dependency: [try], data = [none] } catch (InstantiationException | IllegalAccessException e) { throw new CommandLineException.CommandLineParserInternalException("Problem making an instance of plugin " + c + " Do check that the class has a non-arg constructor", e); } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { public Access chooseDatasetAccess(List<Access> accessList) { if (accessList.size() == 0) return null; Access access = null; if (preferAccess != null) { for (ServiceType type : preferAccess) { access = findAccessByServiceType(accessList, type); if (access != null) break; } } // the order indicates preference if (access == null) access = findAccessByServiceType(accessList, ServiceType.CdmRemote); if (access == null) access = findAccessByServiceType(accessList, ServiceType.DODS); if (access == null) access = findAccessByServiceType(accessList, ServiceType.OPENDAP); if (access == null) access = findAccessByServiceType(accessList, ServiceType.DAP4); if (access == null) access = findAccessByServiceType(accessList, ServiceType.File); // should mean that it can be opened through netcdf API if (access == null) access = findAccessByServiceType(accessList, ServiceType.HTTPServer); // should mean that it can be opened through netcdf API /* look for HTTP with format we can read if (access == null) { Access tryAccess = findAccessByServiceType(accessList, ServiceType.HTTPServer); if (tryAccess != null) { DataFormatType format = tryAccess.getDataFormatType(); // these are the file types we can read if ((DataFormatType.NCML == format) || (DataFormatType.NETCDF == format)) { // removed 4/4/2015 jc //if ((DataFormatType.BUFR == format) || (DataFormatType.GINI == format) || (DataFormatType.GRIB1 == format) // || (DataFormatType.GRIB2 == format) || (DataFormatType.HDF5 == format) || (DataFormatType.NCML == format) // || (DataFormatType.NETCDF == format) || (DataFormatType.NEXRAD2 == format) || (DataFormatType.NIDS == format)) { access = tryAccess; } } } */ // ADDE if (access == null) access = findAccessByServiceType(accessList, ServiceType.ADDE); // RESOLVER if (access == null) { access = findAccessByServiceType(accessList, ServiceType.Resolver); } return access; } }
public class class_name { public Access chooseDatasetAccess(List<Access> accessList) { if (accessList.size() == 0) return null; Access access = null; if (preferAccess != null) { for (ServiceType type : preferAccess) { access = findAccessByServiceType(accessList, type); // depends on control dependency: [for], data = [type] if (access != null) break; } } // the order indicates preference if (access == null) access = findAccessByServiceType(accessList, ServiceType.CdmRemote); if (access == null) access = findAccessByServiceType(accessList, ServiceType.DODS); if (access == null) access = findAccessByServiceType(accessList, ServiceType.OPENDAP); if (access == null) access = findAccessByServiceType(accessList, ServiceType.DAP4); if (access == null) access = findAccessByServiceType(accessList, ServiceType.File); // should mean that it can be opened through netcdf API if (access == null) access = findAccessByServiceType(accessList, ServiceType.HTTPServer); // should mean that it can be opened through netcdf API /* look for HTTP with format we can read if (access == null) { Access tryAccess = findAccessByServiceType(accessList, ServiceType.HTTPServer); if (tryAccess != null) { DataFormatType format = tryAccess.getDataFormatType(); // these are the file types we can read if ((DataFormatType.NCML == format) || (DataFormatType.NETCDF == format)) { // removed 4/4/2015 jc //if ((DataFormatType.BUFR == format) || (DataFormatType.GINI == format) || (DataFormatType.GRIB1 == format) // || (DataFormatType.GRIB2 == format) || (DataFormatType.HDF5 == format) || (DataFormatType.NCML == format) // || (DataFormatType.NETCDF == format) || (DataFormatType.NEXRAD2 == format) || (DataFormatType.NIDS == format)) { access = tryAccess; } } } */ // ADDE if (access == null) access = findAccessByServiceType(accessList, ServiceType.ADDE); // RESOLVER if (access == null) { access = findAccessByServiceType(accessList, ServiceType.Resolver); // depends on control dependency: [if], data = [(access] } return access; } }
public class class_name { public synchronized <T extends EventListener> void add(Class<T> type, T listener) { assert listener != null; if (this.listeners == NULL) { // if this is the first listener added, // initialize the lists this.listeners = new Object[] {type, listener}; } else { // Otherwise copy the array and add the new listener final int i = this.listeners.length; final Object[] tmp = new Object[i + 2]; System.arraycopy(this.listeners, 0, tmp, 0, i); tmp[i] = type; tmp[i + 1] = listener; this.listeners = tmp; } } }
public class class_name { public synchronized <T extends EventListener> void add(Class<T> type, T listener) { assert listener != null; if (this.listeners == NULL) { // if this is the first listener added, // initialize the lists this.listeners = new Object[] {type, listener}; // depends on control dependency: [if], data = [none] } else { // Otherwise copy the array and add the new listener final int i = this.listeners.length; final Object[] tmp = new Object[i + 2]; System.arraycopy(this.listeners, 0, tmp, 0, i); // depends on control dependency: [if], data = [(this.listeners] tmp[i] = type; // depends on control dependency: [if], data = [none] tmp[i + 1] = listener; // depends on control dependency: [if], data = [none] this.listeners = tmp; // depends on control dependency: [if], data = [none] } } }
public class class_name { private String utf8UrlEncode(String value) { try { return URLEncoder.encode(value, "UTF-8"); } catch (UnsupportedEncodingException e) { Error err = new AssertionError( "The Java platform guarantees UTF-8 support, but it seemingly is not present."); err.initCause(e); throw err; } } }
public class class_name { private String utf8UrlEncode(String value) { try { return URLEncoder.encode(value, "UTF-8"); // depends on control dependency: [try], data = [none] } catch (UnsupportedEncodingException e) { Error err = new AssertionError( "The Java platform guarantees UTF-8 support, but it seemingly is not present."); err.initCause(e); throw err; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private List<ResolvedLocation> pickBestCandidates(final List<List<ResolvedLocation>> allCandidates) { // initialize return object List<ResolvedLocation> bestCandidates = new ArrayList<ResolvedLocation>(); // variables used in heuristic matching Set<CountryCode> countries; Set<String> states; float score; // initial values for variables controlling recursion float newMaxScore = 0; float oldMaxScore; // controls window of Lucene hits for each location considered // context-based heuristic matching, initialized as a "magic // number" of *3* based on tests of the "Springfield Problem" int candidateDepth = 3; // keep searching deeper & deeper for better combinations of // candidate matches, as long as the scores are improving do { // reset the threshold for recursion oldMaxScore = newMaxScore; // loop through all combinations up to the specified depth. // first recursive call for each depth starts at index 0 for (List<ResolvedLocation> combo : generateAllCombos(allCandidates, 0, candidateDepth)) { // these lists store the country codes & admin1 codes for each candidate countries = EnumSet.noneOf(CountryCode.class); states = new HashSet<String>(); for (ResolvedLocation location: combo) { countries.add(location.getGeoname().getPrimaryCountryCode()); states.add(location.getGeoname().getPrimaryCountryCode() + location.getGeoname().getAdmin1Code()); } // calculate a score for this particular combination based on commonality // of country codes & admin1 codes, and the cost of searching this deep // TODO: tune this score calculation! score = ((float)allCandidates.size() / (countries.size() + states.size())) / candidateDepth; /* *********************************************************** * "So, at last we meet for the first time for the last time." * * The fact that you're interested enough in CLAVIN to be * reading this means we're interested in talking with you. * * Are you looking for a job, or are you in need of a * customized solution built around CLAVIN? * * Drop us a line at clavin@bericotechnologies.com * * "What's the matter, Colonel Sandurz? CHICKEN?" * **********************************************************/ // if this is the best we've seen during this loop, update the return value if (score > newMaxScore) { newMaxScore = score; bestCandidates = combo; } } // search one level deeper in the next loop candidateDepth++; } while (newMaxScore > oldMaxScore); // keep searching while the scores are monotonically increasing return bestCandidates; } }
public class class_name { private List<ResolvedLocation> pickBestCandidates(final List<List<ResolvedLocation>> allCandidates) { // initialize return object List<ResolvedLocation> bestCandidates = new ArrayList<ResolvedLocation>(); // variables used in heuristic matching Set<CountryCode> countries; Set<String> states; float score; // initial values for variables controlling recursion float newMaxScore = 0; float oldMaxScore; // controls window of Lucene hits for each location considered // context-based heuristic matching, initialized as a "magic // number" of *3* based on tests of the "Springfield Problem" int candidateDepth = 3; // keep searching deeper & deeper for better combinations of // candidate matches, as long as the scores are improving do { // reset the threshold for recursion oldMaxScore = newMaxScore; // loop through all combinations up to the specified depth. // first recursive call for each depth starts at index 0 for (List<ResolvedLocation> combo : generateAllCombos(allCandidates, 0, candidateDepth)) { // these lists store the country codes & admin1 codes for each candidate countries = EnumSet.noneOf(CountryCode.class); // depends on control dependency: [for], data = [none] states = new HashSet<String>(); // depends on control dependency: [for], data = [none] for (ResolvedLocation location: combo) { countries.add(location.getGeoname().getPrimaryCountryCode()); // depends on control dependency: [for], data = [location] states.add(location.getGeoname().getPrimaryCountryCode() + location.getGeoname().getAdmin1Code()); // depends on control dependency: [for], data = [location] } // calculate a score for this particular combination based on commonality // of country codes & admin1 codes, and the cost of searching this deep // TODO: tune this score calculation! score = ((float)allCandidates.size() / (countries.size() + states.size())) / candidateDepth; // depends on control dependency: [for], data = [none] /* *********************************************************** * "So, at last we meet for the first time for the last time." * * The fact that you're interested enough in CLAVIN to be * reading this means we're interested in talking with you. * * Are you looking for a job, or are you in need of a * customized solution built around CLAVIN? * * Drop us a line at clavin@bericotechnologies.com * * "What's the matter, Colonel Sandurz? CHICKEN?" * **********************************************************/ // if this is the best we've seen during this loop, update the return value if (score > newMaxScore) { newMaxScore = score; // depends on control dependency: [if], data = [none] bestCandidates = combo; // depends on control dependency: [if], data = [none] } } // search one level deeper in the next loop candidateDepth++; } while (newMaxScore > oldMaxScore); // keep searching while the scores are monotonically increasing return bestCandidates; } }
public class class_name { public int bwt() { final int[] SA = this.SA; final byte[] T = this.T; final int n = this.n; final int[] bucketA = new int[BUCKET_A_SIZE]; final int[] bucketB = new int[BUCKET_B_SIZE]; if (n == 0) { return 0; } if (n == 1) { SA[0] = T[0]; return 0; } int m = sortTypeBstar(bucketA, bucketB); if (0 < m) { return constructBWT(bucketA, bucketB); } return 0; } }
public class class_name { public int bwt() { final int[] SA = this.SA; final byte[] T = this.T; final int n = this.n; final int[] bucketA = new int[BUCKET_A_SIZE]; final int[] bucketB = new int[BUCKET_B_SIZE]; if (n == 0) { return 0; // depends on control dependency: [if], data = [none] } if (n == 1) { SA[0] = T[0]; // depends on control dependency: [if], data = [none] return 0; // depends on control dependency: [if], data = [none] } int m = sortTypeBstar(bucketA, bucketB); if (0 < m) { return constructBWT(bucketA, bucketB); // depends on control dependency: [if], data = [none] } return 0; } }
public class class_name { public Effects animate(Object stringOrProperties, int duration, Easing easing, Function... funcs) { final Properties p = (stringOrProperties instanceof String) ? (Properties) $$((String) stringOrProperties) : (Properties) stringOrProperties; if (p.getStr("duration") != null) { duration = p.getInt("duration"); } duration = Math.abs(duration); for (Element e : elements()) { GQAnimation a = createAnimation(); a.setEasing(easing).setProperties(p).setElement(e).setCallback(funcs); queueAnimation(a, duration); } return this; } }
public class class_name { public Effects animate(Object stringOrProperties, int duration, Easing easing, Function... funcs) { final Properties p = (stringOrProperties instanceof String) ? (Properties) $$((String) stringOrProperties) : (Properties) stringOrProperties; if (p.getStr("duration") != null) { duration = p.getInt("duration"); // depends on control dependency: [if], data = [none] } duration = Math.abs(duration); for (Element e : elements()) { GQAnimation a = createAnimation(); a.setEasing(easing).setProperties(p).setElement(e).setCallback(funcs); // depends on control dependency: [for], data = [e] queueAnimation(a, duration); // depends on control dependency: [for], data = [e] } return this; } }
public class class_name { @Override public void cacheResult( List<CommerceDiscountUserSegmentRel> commerceDiscountUserSegmentRels) { for (CommerceDiscountUserSegmentRel commerceDiscountUserSegmentRel : commerceDiscountUserSegmentRels) { if (entityCache.getResult( CommerceDiscountUserSegmentRelModelImpl.ENTITY_CACHE_ENABLED, CommerceDiscountUserSegmentRelImpl.class, commerceDiscountUserSegmentRel.getPrimaryKey()) == null) { cacheResult(commerceDiscountUserSegmentRel); } else { commerceDiscountUserSegmentRel.resetOriginalValues(); } } } }
public class class_name { @Override public void cacheResult( List<CommerceDiscountUserSegmentRel> commerceDiscountUserSegmentRels) { for (CommerceDiscountUserSegmentRel commerceDiscountUserSegmentRel : commerceDiscountUserSegmentRels) { if (entityCache.getResult( CommerceDiscountUserSegmentRelModelImpl.ENTITY_CACHE_ENABLED, CommerceDiscountUserSegmentRelImpl.class, commerceDiscountUserSegmentRel.getPrimaryKey()) == null) { cacheResult(commerceDiscountUserSegmentRel); // depends on control dependency: [if], data = [none] } else { commerceDiscountUserSegmentRel.resetOriginalValues(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private static void enqueueCallbackTask(final ShufflerParams shufflerParams, final String url, final String taskName) { RetryHelper.runWithRetries(callable(new Runnable() { @Override public void run() { String hostname = ModulesServiceFactory.getModulesService().getVersionHostname( shufflerParams.getCallbackModule(), shufflerParams.getCallbackVersion()); Queue queue = QueueFactory.getQueue(shufflerParams.getCallbackQueue()); String separater = shufflerParams.getCallbackPath().contains("?") ? "&" : "?"; try { queue.add(TaskOptions.Builder.withUrl(shufflerParams.getCallbackPath() + separater + url) .method(TaskOptions.Method.GET).header("Host", hostname).taskName(taskName)); } catch (TaskAlreadyExistsException e) { // harmless dup. } } }), RETRY_PARAMS, EXCEPTION_HANDLER); } }
public class class_name { private static void enqueueCallbackTask(final ShufflerParams shufflerParams, final String url, final String taskName) { RetryHelper.runWithRetries(callable(new Runnable() { @Override public void run() { String hostname = ModulesServiceFactory.getModulesService().getVersionHostname( shufflerParams.getCallbackModule(), shufflerParams.getCallbackVersion()); Queue queue = QueueFactory.getQueue(shufflerParams.getCallbackQueue()); String separater = shufflerParams.getCallbackPath().contains("?") ? "&" : "?"; try { queue.add(TaskOptions.Builder.withUrl(shufflerParams.getCallbackPath() + separater + url) .method(TaskOptions.Method.GET).header("Host", hostname).taskName(taskName)); // depends on control dependency: [try], data = [none] } catch (TaskAlreadyExistsException e) { // harmless dup. } // depends on control dependency: [catch], data = [none] } }), RETRY_PARAMS, EXCEPTION_HANDLER); } }
public class class_name { private static void createToolsFrame() { // put UI in a JFrame frame = new JFrame("NetCDF (" + DIALOG_VERSION + ") Tools"); ui = new ToolsUI(prefs, frame); frame.setIconImage(BAMutil.getImage("netcdfUI")); frame.addWindowListener(new WindowAdapter() { @Override public void windowActivated(final WindowEvent e) { ToolsSplashScreen.getSharedInstance().setVisible(false); } @Override public void windowClosing(final WindowEvent e) { if (! done) { exit(); } } }); frame.getContentPane().add(ui); final Rectangle have = frame.getGraphicsConfiguration().getBounds(); final Rectangle def = new Rectangle(50, 50, 800, 800); Rectangle want = (Rectangle) prefs.getBean(FRAME_SIZE, def); if (want.getX() > have.getWidth() - 25) { // may be off screen when switcing between 2 monitor system want = def; } frame.setBounds(want); frame.pack(); frame.setBounds(want); // in case a dataset was on the command line if (wantDataset != null) { setDataset(); } } }
public class class_name { private static void createToolsFrame() { // put UI in a JFrame frame = new JFrame("NetCDF (" + DIALOG_VERSION + ") Tools"); ui = new ToolsUI(prefs, frame); frame.setIconImage(BAMutil.getImage("netcdfUI")); frame.addWindowListener(new WindowAdapter() { @Override public void windowActivated(final WindowEvent e) { ToolsSplashScreen.getSharedInstance().setVisible(false); } @Override public void windowClosing(final WindowEvent e) { if (! done) { exit(); // depends on control dependency: [if], data = [none] } } }); frame.getContentPane().add(ui); final Rectangle have = frame.getGraphicsConfiguration().getBounds(); final Rectangle def = new Rectangle(50, 50, 800, 800); Rectangle want = (Rectangle) prefs.getBean(FRAME_SIZE, def); if (want.getX() > have.getWidth() - 25) { // may be off screen when switcing between 2 monitor system want = def; // depends on control dependency: [if], data = [none] } frame.setBounds(want); frame.pack(); frame.setBounds(want); // in case a dataset was on the command line if (wantDataset != null) { setDataset(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(ResultSetMetadata resultSetMetadata, ProtocolMarshaller protocolMarshaller) { if (resultSetMetadata == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(resultSetMetadata.getColumnCount(), COLUMNCOUNT_BINDING); protocolMarshaller.marshall(resultSetMetadata.getColumnMetadata(), COLUMNMETADATA_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ResultSetMetadata resultSetMetadata, ProtocolMarshaller protocolMarshaller) { if (resultSetMetadata == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(resultSetMetadata.getColumnCount(), COLUMNCOUNT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(resultSetMetadata.getColumnMetadata(), COLUMNMETADATA_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private boolean hasExpansionExpressionInArguments() { Expression[] args = _expr().getArgs(); if( args == null ) { return false; } for( Expression arg: args ) { List<IMemberExpansionExpression> l = new ArrayList<>(); if( arg.getContainedParsedElementsByType( IMemberExpansionExpression.class, l ) ) { for( IMemberExpansionExpression expr: l ) { if( isInThisNew( expr ) ) { return true; } } } List<BeanMethodCallExpression> list = new ArrayList<>(); if( arg.getContainedParsedElementsByType( BeanMethodCallExpression.class, list ) ) { for( BeanMethodCallExpression expr: list ) { if( expr.isExpansion() && isInThisNew( expr ) ) { return true; } } } } return false; } }
public class class_name { private boolean hasExpansionExpressionInArguments() { Expression[] args = _expr().getArgs(); if( args == null ) { return false; // depends on control dependency: [if], data = [none] } for( Expression arg: args ) { List<IMemberExpansionExpression> l = new ArrayList<>(); if( arg.getContainedParsedElementsByType( IMemberExpansionExpression.class, l ) ) { for( IMemberExpansionExpression expr: l ) { if( isInThisNew( expr ) ) { return true; // depends on control dependency: [if], data = [none] } } } List<BeanMethodCallExpression> list = new ArrayList<>(); if( arg.getContainedParsedElementsByType( BeanMethodCallExpression.class, list ) ) { for( BeanMethodCallExpression expr: list ) { if( expr.isExpansion() && isInThisNew( expr ) ) { return true; // depends on control dependency: [if], data = [none] } } } } return false; } }
public class class_name { @Override public EClass getIfcEdge() { if (ifcEdgeEClass == null) { ifcEdgeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(206); } return ifcEdgeEClass; } }
public class class_name { @Override public EClass getIfcEdge() { if (ifcEdgeEClass == null) { ifcEdgeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(206); // depends on control dependency: [if], data = [none] } return ifcEdgeEClass; } }
public class class_name { public String readUntil(String sentinels) { int index=Integer.MAX_VALUE; for(char s: sentinels.toCharArray()) { int i = str.indexOf(s, cursor); if(i>=0) index = Math.min(i, index); } if(index>=0 && index<Integer.MAX_VALUE) { String result = str.substring(cursor, index); cursor = index+1; return result; } throw new ParseException("terminator not found"); } }
public class class_name { public String readUntil(String sentinels) { int index=Integer.MAX_VALUE; for(char s: sentinels.toCharArray()) { int i = str.indexOf(s, cursor); if(i>=0) index = Math.min(i, index); } if(index>=0 && index<Integer.MAX_VALUE) { String result = str.substring(cursor, index); cursor = index+1; // depends on control dependency: [if], data = [none] return result; // depends on control dependency: [if], data = [none] } throw new ParseException("terminator not found"); } }
public class class_name { protected PropertyFilter preparePropertyFilter() { final Map<String, String> generatedDefaultMap = prepareGeneratedDefaultMap(); if (generatedDefaultMap.isEmpty()) { // mainly here return doPrepareEmbeddedPropertyFilter(); } else { return doPrepareWrappedDefaultablePropertyFilter(generatedDefaultMap); } } }
public class class_name { protected PropertyFilter preparePropertyFilter() { final Map<String, String> generatedDefaultMap = prepareGeneratedDefaultMap(); if (generatedDefaultMap.isEmpty()) { // mainly here return doPrepareEmbeddedPropertyFilter(); // depends on control dependency: [if], data = [none] } else { return doPrepareWrappedDefaultablePropertyFilter(generatedDefaultMap); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void onTimerEvent(TimerEvent event, ActivityContextInterface aci) { if (getFinalReplySent()) { aci.detach(sbbContext.getSbbLocalObject()); final DialogActivity dialog = (DialogActivity) aci.getActivity(); try { dialog.sendRequest(dialog.createRequest(Request.BYE)); } catch (Exception e) { getTracer().severe("failure while processing timer event", e); } } else { // detach from the server tx activity aci.detach(sbbContext.getSbbLocalObject()); final ServerTransaction serverTransaction = (ServerTransaction) aci.getActivity(); try { // create dialog activity and attach to it final DialogActivity dialog = (DialogActivity) sleeSipProvider .getNewDialog(serverTransaction); final ActivityContextInterfaceExt dialogAci = (ActivityContextInterfaceExt) sipActivityContextInterfaceFactory .getActivityContextInterface(dialog); dialogAci.attach(sbbContext.getSbbLocalObject()); // send 200 ok Response response = messageFactory.createResponse(Response.OK,serverTransaction.getRequest()); response.addHeader(getContactHeader()); serverTransaction.sendResponse(response); setFinalReplySent(true); // set timer of 30 secs on the dialog aci to send bye timerFacility.setTimer(dialogAci, null, System.currentTimeMillis() + 60000L, getTimerOptions()); } catch (Exception e) { getTracer().severe("failure while sending 200 OK response", e); } } } }
public class class_name { public void onTimerEvent(TimerEvent event, ActivityContextInterface aci) { if (getFinalReplySent()) { aci.detach(sbbContext.getSbbLocalObject()); // depends on control dependency: [if], data = [none] final DialogActivity dialog = (DialogActivity) aci.getActivity(); try { dialog.sendRequest(dialog.createRequest(Request.BYE)); // depends on control dependency: [try], data = [none] } catch (Exception e) { getTracer().severe("failure while processing timer event", e); } // depends on control dependency: [catch], data = [none] } else { // detach from the server tx activity aci.detach(sbbContext.getSbbLocalObject()); // depends on control dependency: [if], data = [none] final ServerTransaction serverTransaction = (ServerTransaction) aci.getActivity(); try { // create dialog activity and attach to it final DialogActivity dialog = (DialogActivity) sleeSipProvider .getNewDialog(serverTransaction); final ActivityContextInterfaceExt dialogAci = (ActivityContextInterfaceExt) sipActivityContextInterfaceFactory .getActivityContextInterface(dialog); dialogAci.attach(sbbContext.getSbbLocalObject()); // depends on control dependency: [try], data = [none] // send 200 ok Response response = messageFactory.createResponse(Response.OK,serverTransaction.getRequest()); response.addHeader(getContactHeader()); // depends on control dependency: [try], data = [none] serverTransaction.sendResponse(response); // depends on control dependency: [try], data = [none] setFinalReplySent(true); // depends on control dependency: [try], data = [none] // set timer of 30 secs on the dialog aci to send bye timerFacility.setTimer(dialogAci, null, System.currentTimeMillis() + 60000L, getTimerOptions()); // depends on control dependency: [try], data = [none] } catch (Exception e) { getTracer().severe("failure while sending 200 OK response", e); } // depends on control dependency: [catch], data = [none] } } }