code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public Object invoke(MethodInvocation invocation) throws Throwable { ProxyMethodInvocation proxyMethodInvocation = (ProxyMethodInvocation) invocation; TargetMetaDef targetMetaDef = targetMetaRequestsHolder.getTargetMetaRequest().getTargetMetaDef(); if (targetMetaDef.isEJB()) return invocation.proceed(); if (!isPoolabe(targetMetaDef)) { // Debug.logVerbose("[JdonFramework] target service is not Poolable: " // + targetMetaDef.getClassName() + " pool unactiive", module); return invocation.proceed(); // 下一个interceptor } Debug.logVerbose("[JdonFramework] enter PoolInterceptor", module); CommonsPoolFactory commonsPoolFactory = getCommonsPoolFactoryCache(targetMetaDef); Pool pool = commonsPoolFactory.getPool(); Object poa = null; Object result = null; try { poa = pool.acquirePoolable(); Debug.logVerbose("[JdonFramework] borrow a object:" + targetMetaDef.getClassName() + " id:" + poa.hashCode() + " from pool", module); Debug.logVerbose("[JdonFramework]pool state: active=" + pool.getNumActive() + " free=" + pool.getNumIdle(), module); // set the object that borrowed from pool to MethodInvocation // so later other Interceptors or MethodInvocation can use it! proxyMethodInvocation.setThis(poa); result = invocation.proceed(); } catch (Exception ex) { Debug.logError(ex, module); } finally { if (poa != null) { pool.releasePoolable(poa); Debug.logVerbose("[JdonFramework] realease a object:" + targetMetaDef.getClassName() + " to pool", module); } } return result; } }
public class class_name { public Object invoke(MethodInvocation invocation) throws Throwable { ProxyMethodInvocation proxyMethodInvocation = (ProxyMethodInvocation) invocation; TargetMetaDef targetMetaDef = targetMetaRequestsHolder.getTargetMetaRequest().getTargetMetaDef(); if (targetMetaDef.isEJB()) return invocation.proceed(); if (!isPoolabe(targetMetaDef)) { // Debug.logVerbose("[JdonFramework] target service is not Poolable: " // + targetMetaDef.getClassName() + " pool unactiive", module); return invocation.proceed(); // 下一个interceptor } Debug.logVerbose("[JdonFramework] enter PoolInterceptor", module); CommonsPoolFactory commonsPoolFactory = getCommonsPoolFactoryCache(targetMetaDef); Pool pool = commonsPoolFactory.getPool(); Object poa = null; Object result = null; try { poa = pool.acquirePoolable(); Debug.logVerbose("[JdonFramework] borrow a object:" + targetMetaDef.getClassName() + " id:" + poa.hashCode() + " from pool", module); Debug.logVerbose("[JdonFramework]pool state: active=" + pool.getNumActive() + " free=" + pool.getNumIdle(), module); // set the object that borrowed from pool to MethodInvocation // so later other Interceptors or MethodInvocation can use it! proxyMethodInvocation.setThis(poa); result = invocation.proceed(); } catch (Exception ex) { Debug.logError(ex, module); } finally { if (poa != null) { pool.releasePoolable(poa); // depends on control dependency: [if], data = [(poa] Debug.logVerbose("[JdonFramework] realease a object:" + targetMetaDef.getClassName() + " to pool", module); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { private static List<CardinalitySpec> createChildren( Map<String, Object> rawSpec ) { List<CardinalitySpec> children = new ArrayList<>(); Set<String> actualKeys = new HashSet<>(); for ( String keyString : rawSpec.keySet() ) { Object rawRhs = rawSpec.get( keyString ); CardinalitySpec childSpec; if ( rawRhs instanceof Map ) { childSpec = new CardinalityCompositeSpec( keyString, (Map<String, Object>) rawRhs ); } else { childSpec = new CardinalityLeafSpec( keyString, rawRhs ); } String childCanonicalString = childSpec.pathElement.getCanonicalForm(); if ( actualKeys.contains( childCanonicalString ) ) { throw new IllegalArgumentException( "Duplicate canonical CardinalityTransform key found : " + childCanonicalString ); } actualKeys.add( childCanonicalString ); children.add( childSpec ); } return children; } }
public class class_name { private static List<CardinalitySpec> createChildren( Map<String, Object> rawSpec ) { List<CardinalitySpec> children = new ArrayList<>(); Set<String> actualKeys = new HashSet<>(); for ( String keyString : rawSpec.keySet() ) { Object rawRhs = rawSpec.get( keyString ); CardinalitySpec childSpec; if ( rawRhs instanceof Map ) { childSpec = new CardinalityCompositeSpec( keyString, (Map<String, Object>) rawRhs ); // depends on control dependency: [if], data = [none] } else { childSpec = new CardinalityLeafSpec( keyString, rawRhs ); // depends on control dependency: [if], data = [none] } String childCanonicalString = childSpec.pathElement.getCanonicalForm(); if ( actualKeys.contains( childCanonicalString ) ) { throw new IllegalArgumentException( "Duplicate canonical CardinalityTransform key found : " + childCanonicalString ); } actualKeys.add( childCanonicalString ); // depends on control dependency: [for], data = [none] children.add( childSpec ); // depends on control dependency: [for], data = [none] } return children; } }
public class class_name { private StoredDatabaseInfo registerPrimaryDatabase(boolean readOnly, Layout layout) throws Exception { if (getStorableType() == StoredDatabaseInfo.class) { // Can't register itself in itself. return null; } Repository repo = mRepository.getRootRepository(); StoredDatabaseInfo info; try { info = repo.storageFor(StoredDatabaseInfo.class).prepare(); } catch (SupportException e) { return null; } info.setDatabaseName(getStorableType().getName()); // Try to insert metadata up to three times. boolean top = true; for (int retryCount = 3;;) { try { Transaction txn; if (top) { txn = repo.enterTopTransaction(IsolationLevel.READ_COMMITTED); } else { txn = repo.enterTransaction(IsolationLevel.READ_COMMITTED); } txn.setForUpdate(true); try { if (!info.tryLoad()) { if (layout == null) { info.setEvolutionStrategy(StoredDatabaseInfo.EVOLUTION_NONE); } else { info.setEvolutionStrategy(StoredDatabaseInfo.EVOLUTION_STANDARD); } info.setCreationTimestamp(System.currentTimeMillis()); info.setVersionNumber(0); if (!readOnly) { info.insert(); } } txn.commit(); } finally { txn.exit(); } break; } catch (UniqueConstraintException e) { // This might be caused by a transient replication error. Retry // a few times before throwing exception. Wait up to a second // before each retry. retryCount = e.backoff(e, retryCount, 1000); } catch (FetchException e) { if (e instanceof FetchDeadlockException || e instanceof FetchTimeoutException) { // Might be caused by coarse locks. Switch to nested // transaction to share the locks. if (top) { top = false; retryCount = e.backoff(e, retryCount, 100); continue; } } throw e; } catch (PersistException e) { if (e instanceof PersistDeadlockException || e instanceof PersistTimeoutException){ // Might be caused by coarse locks. Switch to nested // transaction to share the locks. if (top) { top = false; retryCount = e.backoff(e, retryCount, 100); continue; } } throw e; } } return info; } }
public class class_name { private StoredDatabaseInfo registerPrimaryDatabase(boolean readOnly, Layout layout) throws Exception { if (getStorableType() == StoredDatabaseInfo.class) { // Can't register itself in itself. return null; } Repository repo = mRepository.getRootRepository(); StoredDatabaseInfo info; try { info = repo.storageFor(StoredDatabaseInfo.class).prepare(); } catch (SupportException e) { return null; } info.setDatabaseName(getStorableType().getName()); // Try to insert metadata up to three times. boolean top = true; for (int retryCount = 3;;) { try { Transaction txn; if (top) { txn = repo.enterTopTransaction(IsolationLevel.READ_COMMITTED); // depends on control dependency: [if], data = [none] } else { txn = repo.enterTransaction(IsolationLevel.READ_COMMITTED); // depends on control dependency: [if], data = [none] } txn.setForUpdate(true); // depends on control dependency: [try], data = [none] try { if (!info.tryLoad()) { if (layout == null) { info.setEvolutionStrategy(StoredDatabaseInfo.EVOLUTION_NONE); // depends on control dependency: [if], data = [none] } else { info.setEvolutionStrategy(StoredDatabaseInfo.EVOLUTION_STANDARD); // depends on control dependency: [if], data = [none] } info.setCreationTimestamp(System.currentTimeMillis()); // depends on control dependency: [if], data = [none] info.setVersionNumber(0); // depends on control dependency: [if], data = [none] if (!readOnly) { info.insert(); // depends on control dependency: [if], data = [none] } } txn.commit(); // depends on control dependency: [try], data = [none] } finally { txn.exit(); } break; } catch (UniqueConstraintException e) { // This might be caused by a transient replication error. Retry // a few times before throwing exception. Wait up to a second // before each retry. retryCount = e.backoff(e, retryCount, 1000); } catch (FetchException e) { // depends on control dependency: [catch], data = [none] if (e instanceof FetchDeadlockException || e instanceof FetchTimeoutException) { // Might be caused by coarse locks. Switch to nested // transaction to share the locks. if (top) { top = false; // depends on control dependency: [if], data = [none] retryCount = e.backoff(e, retryCount, 100); // depends on control dependency: [if], data = [none] continue; } } throw e; } catch (PersistException e) { // depends on control dependency: [catch], data = [none] if (e instanceof PersistDeadlockException || e instanceof PersistTimeoutException){ // Might be caused by coarse locks. Switch to nested // transaction to share the locks. if (top) { top = false; // depends on control dependency: [if], data = [none] retryCount = e.backoff(e, retryCount, 100); // depends on control dependency: [if], data = [none] continue; } } throw e; } // depends on control dependency: [catch], data = [none] } return info; } }
public class class_name { public double overlapRadiusDegree(SphereCluster other) { double[] center0 = getCenter(); double radius0 = getRadius(); double[] center1 = other.getCenter(); double radius1 = other.getRadius(); double radiusBig; double radiusSmall; if(radius0 < radius1){ radiusBig = radius1; radiusSmall = radius0; } else{ radiusBig = radius0; radiusSmall = radius1; } double dist = 0; for (int i = 0; i < center0.length; i++) { double delta = center0[i] - center1[i]; dist += delta * delta; } dist = Math.sqrt(dist); if(dist > radiusSmall + radiusBig) return 0; if(dist + radiusSmall <= radiusBig){ //one lies within the other return 1; } else{ return (radiusSmall+radiusBig-dist)/(2*radiusSmall); } } }
public class class_name { public double overlapRadiusDegree(SphereCluster other) { double[] center0 = getCenter(); double radius0 = getRadius(); double[] center1 = other.getCenter(); double radius1 = other.getRadius(); double radiusBig; double radiusSmall; if(radius0 < radius1){ radiusBig = radius1; // depends on control dependency: [if], data = [none] radiusSmall = radius0; // depends on control dependency: [if], data = [none] } else{ radiusBig = radius0; // depends on control dependency: [if], data = [none] radiusSmall = radius1; // depends on control dependency: [if], data = [none] } double dist = 0; for (int i = 0; i < center0.length; i++) { double delta = center0[i] - center1[i]; dist += delta * delta; // depends on control dependency: [for], data = [none] } dist = Math.sqrt(dist); if(dist > radiusSmall + radiusBig) return 0; if(dist + radiusSmall <= radiusBig){ //one lies within the other return 1; // depends on control dependency: [if], data = [none] } else{ return (radiusSmall+radiusBig-dist)/(2*radiusSmall); // depends on control dependency: [if], data = [none] } } }
public class class_name { static Map<String, String> parseResourceLabels(@Nullable String rawEnvLabels) { if (rawEnvLabels == null) { return Collections.<String, String>emptyMap(); } else { Map<String, String> labels = new HashMap<String, String>(); String[] rawLabels = rawEnvLabels.split(LABEL_LIST_SPLITTER, -1); for (String rawLabel : rawLabels) { String[] keyValuePair = rawLabel.split(LABEL_KEY_VALUE_SPLITTER, -1); if (keyValuePair.length != 2) { continue; } String key = keyValuePair[0].trim(); String value = keyValuePair[1].trim().replaceAll("^\"|\"$", ""); Utils.checkArgument(isValidAndNotEmpty(key), "Label key" + ERROR_MESSAGE_INVALID_CHARS); Utils.checkArgument(isValid(value), "Label value" + ERROR_MESSAGE_INVALID_VALUE); labels.put(key, value); } return Collections.unmodifiableMap(labels); } } }
public class class_name { static Map<String, String> parseResourceLabels(@Nullable String rawEnvLabels) { if (rawEnvLabels == null) { return Collections.<String, String>emptyMap(); // depends on control dependency: [if], data = [none] } else { Map<String, String> labels = new HashMap<String, String>(); String[] rawLabels = rawEnvLabels.split(LABEL_LIST_SPLITTER, -1); for (String rawLabel : rawLabels) { String[] keyValuePair = rawLabel.split(LABEL_KEY_VALUE_SPLITTER, -1); if (keyValuePair.length != 2) { continue; } String key = keyValuePair[0].trim(); String value = keyValuePair[1].trim().replaceAll("^\"|\"$", ""); Utils.checkArgument(isValidAndNotEmpty(key), "Label key" + ERROR_MESSAGE_INVALID_CHARS); // depends on control dependency: [for], data = [none] Utils.checkArgument(isValid(value), "Label value" + ERROR_MESSAGE_INVALID_VALUE); // depends on control dependency: [for], data = [none] labels.put(key, value); // depends on control dependency: [for], data = [none] } return Collections.unmodifiableMap(labels); // depends on control dependency: [if], data = [none] } } }
public class class_name { HystrixMetricsPublisherThreadPool getPublisherForThreadPool(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolMetrics metrics, HystrixThreadPoolProperties properties) { // attempt to retrieve from cache first HystrixMetricsPublisherThreadPool publisher = threadPoolPublishers.get(threadPoolKey.name()); if (publisher != null) { return publisher; } // it doesn't exist so we need to create it publisher = HystrixPlugins.getInstance().getMetricsPublisher().getMetricsPublisherForThreadPool(threadPoolKey, metrics, properties); // attempt to store it (race other threads) HystrixMetricsPublisherThreadPool existing = threadPoolPublishers.putIfAbsent(threadPoolKey.name(), publisher); if (existing == null) { // we won the thread-race to store the instance we created so initialize it publisher.initialize(); // done registering, return instance that got cached return publisher; } else { // we lost so return 'existing' and let the one we created be garbage collected // without calling initialize() on it return existing; } } }
public class class_name { HystrixMetricsPublisherThreadPool getPublisherForThreadPool(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolMetrics metrics, HystrixThreadPoolProperties properties) { // attempt to retrieve from cache first HystrixMetricsPublisherThreadPool publisher = threadPoolPublishers.get(threadPoolKey.name()); if (publisher != null) { return publisher; // depends on control dependency: [if], data = [none] } // it doesn't exist so we need to create it publisher = HystrixPlugins.getInstance().getMetricsPublisher().getMetricsPublisherForThreadPool(threadPoolKey, metrics, properties); // attempt to store it (race other threads) HystrixMetricsPublisherThreadPool existing = threadPoolPublishers.putIfAbsent(threadPoolKey.name(), publisher); if (existing == null) { // we won the thread-race to store the instance we created so initialize it publisher.initialize(); // depends on control dependency: [if], data = [none] // done registering, return instance that got cached return publisher; // depends on control dependency: [if], data = [none] } else { // we lost so return 'existing' and let the one we created be garbage collected // without calling initialize() on it return existing; // depends on control dependency: [if], data = [none] } } }
public class class_name { public Counter<K1> sumInnerCounter() { Counter<K1> summed = new ClassicCounter<K1>(); for (K1 key : this.firstKeySet()) { summed.incrementCount(key, this.getCounter(key).totalCount()); } return summed; } }
public class class_name { public Counter<K1> sumInnerCounter() { Counter<K1> summed = new ClassicCounter<K1>(); for (K1 key : this.firstKeySet()) { summed.incrementCount(key, this.getCounter(key).totalCount()); // depends on control dependency: [for], data = [key] } return summed; } }
public class class_name { private Set<String> getServersThatHasAllClusters(Map<String, Set<String>> clusterMap, Set<String> queryClusters) { Set<String> remainingServers = clusterMap.keySet(); for (String cluster : queryClusters) { for (Map.Entry<String, Set<String>> serverConfig : clusterMap.entrySet()) { if (!serverConfig.getValue().contains(cluster)) { remainingServers.remove(serverConfig.getKey()); } } } return remainingServers; } }
public class class_name { private Set<String> getServersThatHasAllClusters(Map<String, Set<String>> clusterMap, Set<String> queryClusters) { Set<String> remainingServers = clusterMap.keySet(); for (String cluster : queryClusters) { for (Map.Entry<String, Set<String>> serverConfig : clusterMap.entrySet()) { if (!serverConfig.getValue().contains(cluster)) { remainingServers.remove(serverConfig.getKey()); // depends on control dependency: [if], data = [none] } } } return remainingServers; } }
public class class_name { public static boolean copyModuleMetaDataSlot(MetaDataEvent<ModuleMetaData> event, MetaDataSlot slot) { Container container = event.getContainer(); MetaData metaData = event.getMetaData(); try { // For now, we just need to copy from WebModuleInfo, and ClientModuleInfo // Supports EJB in WAR and ManagedBean in Client ExtendedModuleInfo moduleInfo = (ExtendedModuleInfo) container.adapt(NonPersistentCache.class).getFromCache(WebModuleInfo.class); if (moduleInfo == null) { moduleInfo = (ExtendedModuleInfo) container.adapt(NonPersistentCache.class).getFromCache(ClientModuleInfo.class); } if (moduleInfo != null) { ModuleMetaData primaryMetaData = moduleInfo.getMetaData(); if (metaData != primaryMetaData) { Object slotData = primaryMetaData.getMetaData(slot); if (slotData == null) { // The caller is required to populate slot data. throw new IllegalStateException(); } metaData.setMetaData(slot, slotData); return true; } } } catch (UnableToAdaptException e) { throw new UnsupportedOperationException(e); } return false; } }
public class class_name { public static boolean copyModuleMetaDataSlot(MetaDataEvent<ModuleMetaData> event, MetaDataSlot slot) { Container container = event.getContainer(); MetaData metaData = event.getMetaData(); try { // For now, we just need to copy from WebModuleInfo, and ClientModuleInfo // Supports EJB in WAR and ManagedBean in Client ExtendedModuleInfo moduleInfo = (ExtendedModuleInfo) container.adapt(NonPersistentCache.class).getFromCache(WebModuleInfo.class); if (moduleInfo == null) { moduleInfo = (ExtendedModuleInfo) container.adapt(NonPersistentCache.class).getFromCache(ClientModuleInfo.class); // depends on control dependency: [if], data = [none] } if (moduleInfo != null) { ModuleMetaData primaryMetaData = moduleInfo.getMetaData(); if (metaData != primaryMetaData) { Object slotData = primaryMetaData.getMetaData(slot); if (slotData == null) { // The caller is required to populate slot data. throw new IllegalStateException(); } metaData.setMetaData(slot, slotData); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } } } catch (UnableToAdaptException e) { throw new UnsupportedOperationException(e); } // depends on control dependency: [catch], data = [none] return false; } }
public class class_name { public synchronized Map<String, Dependency> getPluginDependencies() throws MojoExecutionException { if (this.pluginDependencies == null) { final String groupId = getConfig("plugin.groupId"); //$NON-NLS-1$ final String artifactId = getConfig("plugin.artifactId"); //$NON-NLS-1$ final String pluginArtifactKey = ArtifactUtils.versionlessKey(groupId, artifactId); final Set<Artifact> dependencies = resolveDependencies(pluginArtifactKey, true); final Map<String, Dependency> deps = new TreeMap<>(); for (final Artifact artifact : dependencies) { final Dependency dep = toDependency(artifact); deps.put(ArtifactUtils.versionlessKey(artifact), dep); } this.pluginDependencies = deps; } return this.pluginDependencies; } }
public class class_name { public synchronized Map<String, Dependency> getPluginDependencies() throws MojoExecutionException { if (this.pluginDependencies == null) { final String groupId = getConfig("plugin.groupId"); //$NON-NLS-1$ final String artifactId = getConfig("plugin.artifactId"); //$NON-NLS-1$ final String pluginArtifactKey = ArtifactUtils.versionlessKey(groupId, artifactId); final Set<Artifact> dependencies = resolveDependencies(pluginArtifactKey, true); final Map<String, Dependency> deps = new TreeMap<>(); for (final Artifact artifact : dependencies) { final Dependency dep = toDependency(artifact); deps.put(ArtifactUtils.versionlessKey(artifact), dep); // depends on control dependency: [for], data = [artifact] } this.pluginDependencies = deps; // depends on control dependency: [if], data = [none] } return this.pluginDependencies; } }
public class class_name { @FFDCIgnore(NoSuchAlgorithmException.class) public static String createLookupKey(String realm, String userid, @Sensitive String password) { String lookupKey = null; if (realm != null && userid != null && password != null) { try { String hashedPassword = getHashedPassword(password); lookupKey = realm + KEY_SEPARATOR + userid + KEY_SEPARATOR + hashedPassword; } catch (NoSuchAlgorithmException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "There was a problem creating the lookup key.", e); } } } return lookupKey; } }
public class class_name { @FFDCIgnore(NoSuchAlgorithmException.class) public static String createLookupKey(String realm, String userid, @Sensitive String password) { String lookupKey = null; if (realm != null && userid != null && password != null) { try { String hashedPassword = getHashedPassword(password); lookupKey = realm + KEY_SEPARATOR + userid + KEY_SEPARATOR + hashedPassword; // depends on control dependency: [try], data = [none] } catch (NoSuchAlgorithmException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "There was a problem creating the lookup key.", e); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } return lookupKey; } }
public class class_name { public static int crc16(byte[] bytes, int off, int len) { int crc = 0x0000; int end = off + len; for (int i = off; i < end; i++) { crc = doCrc(bytes[i], crc); } return crc & 0xFFFF; } }
public class class_name { public static int crc16(byte[] bytes, int off, int len) { int crc = 0x0000; int end = off + len; for (int i = off; i < end; i++) { crc = doCrc(bytes[i], crc); // depends on control dependency: [for], data = [i] } return crc & 0xFFFF; } }
public class class_name { public void load(@Nonnull final Preferences preferences) { this.config.loadFrom(preferences); loadFrom(this.config, preferences); this.changeNotificationAllowed = false; try { // Common behaviour options this.checkBoxShowHiddenFiles.setSelected(preferences.getBoolean("showHiddenFiles", true)); //NOI18N this.checkboxTrimTopicText.setSelected(preferences.getBoolean("trimTopicText", false)); //NOI18N this.checkboxUseInsideBrowser.setSelected(preferences.getBoolean("useInsideBrowser", false)); //NOI18N this.checkboxRelativePathsForFilesInTheProject.setSelected(preferences.getBoolean("makeRelativePathToProject", true)); //NOI18N this.checkBoxUnfoldCollapsedTarget.setSelected(preferences.getBoolean("unfoldCollapsedTarget", true)); //NOI18N this.checkBoxCopyColorInfoToNewAllowed.setSelected(preferences.getBoolean("copyColorInfoToNewChildAllowed", true)); //NOI18N this.checkBoxKnowledgeFolderAutogenerationAllowed.setSelected(preferences.getBoolean(PREFERENCE_KEY_KNOWLEDGEFOLDER_ALLOWED, false)); // third part options final String pathToGraphViz = preferences.get("plantuml.dotpath", null); this.textFieldPathToGraphvizDot.setText(pathToGraphViz == null ? "" : pathToGraphViz); // Metrics this.checkboxMetricsAllowed.setSelected(MetricsService.getInstance().isEnabled()); } finally { this.changeNotificationAllowed = true; } } }
public class class_name { public void load(@Nonnull final Preferences preferences) { this.config.loadFrom(preferences); loadFrom(this.config, preferences); this.changeNotificationAllowed = false; try { // Common behaviour options this.checkBoxShowHiddenFiles.setSelected(preferences.getBoolean("showHiddenFiles", true)); //NOI18N // depends on control dependency: [try], data = [none] this.checkboxTrimTopicText.setSelected(preferences.getBoolean("trimTopicText", false)); //NOI18N // depends on control dependency: [try], data = [none] this.checkboxUseInsideBrowser.setSelected(preferences.getBoolean("useInsideBrowser", false)); //NOI18N // depends on control dependency: [try], data = [none] this.checkboxRelativePathsForFilesInTheProject.setSelected(preferences.getBoolean("makeRelativePathToProject", true)); //NOI18N // depends on control dependency: [try], data = [none] this.checkBoxUnfoldCollapsedTarget.setSelected(preferences.getBoolean("unfoldCollapsedTarget", true)); //NOI18N // depends on control dependency: [try], data = [none] this.checkBoxCopyColorInfoToNewAllowed.setSelected(preferences.getBoolean("copyColorInfoToNewChildAllowed", true)); //NOI18N // depends on control dependency: [try], data = [none] this.checkBoxKnowledgeFolderAutogenerationAllowed.setSelected(preferences.getBoolean(PREFERENCE_KEY_KNOWLEDGEFOLDER_ALLOWED, false)); // depends on control dependency: [try], data = [none] // third part options final String pathToGraphViz = preferences.get("plantuml.dotpath", null); this.textFieldPathToGraphvizDot.setText(pathToGraphViz == null ? "" : pathToGraphViz); // depends on control dependency: [try], data = [none] // Metrics this.checkboxMetricsAllowed.setSelected(MetricsService.getInstance().isEnabled()); // depends on control dependency: [try], data = [none] } finally { this.changeNotificationAllowed = true; } } }
public class class_name { void setStartPoint(StandardRoadConnection desiredConnection) { final StandardRoadConnection oldPoint = getBeginPoint(StandardRoadConnection.class); if (oldPoint != null) { oldPoint.removeConnectedSegment(this, true); } this.firstConnection = desiredConnection; if (desiredConnection != null) { final Point2d pts = desiredConnection.getPoint(); if (pts != null) { setPointAt(0, pts, true); } desiredConnection.addConnectedSegment(this, true); } } }
public class class_name { void setStartPoint(StandardRoadConnection desiredConnection) { final StandardRoadConnection oldPoint = getBeginPoint(StandardRoadConnection.class); if (oldPoint != null) { oldPoint.removeConnectedSegment(this, true); // depends on control dependency: [if], data = [none] } this.firstConnection = desiredConnection; if (desiredConnection != null) { final Point2d pts = desiredConnection.getPoint(); if (pts != null) { setPointAt(0, pts, true); // depends on control dependency: [if], data = [none] } desiredConnection.addConnectedSegment(this, true); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static double[][] computeMinMax(Relation<? extends NumberVector> relation) { int dim = RelationUtil.dimensionality(relation); double[] mins = new double[dim], maxs = new double[dim]; for(int i = 0; i < dim; i++) { mins[i] = Double.MAX_VALUE; maxs[i] = -Double.MAX_VALUE; } for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { final NumberVector o = relation.get(iditer); for(int d = 0; d < dim; d++) { final double v = o.doubleValue(d); mins[d] = (v < mins[d]) ? v : mins[d]; maxs[d] = (v > maxs[d]) ? v : maxs[d]; } } return new double[][] { mins, maxs }; } }
public class class_name { public static double[][] computeMinMax(Relation<? extends NumberVector> relation) { int dim = RelationUtil.dimensionality(relation); double[] mins = new double[dim], maxs = new double[dim]; for(int i = 0; i < dim; i++) { mins[i] = Double.MAX_VALUE; // depends on control dependency: [for], data = [i] maxs[i] = -Double.MAX_VALUE; // depends on control dependency: [for], data = [i] } for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { final NumberVector o = relation.get(iditer); for(int d = 0; d < dim; d++) { final double v = o.doubleValue(d); mins[d] = (v < mins[d]) ? v : mins[d]; // depends on control dependency: [for], data = [d] maxs[d] = (v > maxs[d]) ? v : maxs[d]; // depends on control dependency: [for], data = [d] } } return new double[][] { mins, maxs }; } }
public class class_name { public static List<Job> qstat(String name) { final CommandLine cmdLine = new CommandLine(COMMAND_QSTAT); cmdLine.addArgument(PARAMETER_FULL_STATUS); if (StringUtils.isNotBlank(name)) { cmdLine.addArgument(name); } final OutputStream out = new ByteArrayOutputStream(); final OutputStream err = new ByteArrayOutputStream(); DefaultExecuteResultHandler resultHandler; try { resultHandler = execute(cmdLine, null, out, err); resultHandler.waitFor(DEFAULT_TIMEOUT); } catch (ExecuteException e) { throw new PBSException("Failed to execute qstat command: " + e.getMessage(), e); } catch (IOException e) { throw new PBSException("Failed to execute qstat command: " + e.getMessage(), e); } catch (InterruptedException e) { throw new PBSException("Failed to execute qstat command: " + e.getMessage(), e); } final int exitValue = resultHandler.getExitValue(); LOGGER.info("qstat exit value: " + exitValue); final List<Job> jobs; try { jobs = QSTAT_JOBS_PARSER.parse(out.toString()); } catch (ParseException pe) { throw new PBSException("Failed to parse qstat jobs output: " + pe.getMessage(), pe); } return (jobs == null ? new ArrayList<Job>(0) : jobs); } }
public class class_name { public static List<Job> qstat(String name) { final CommandLine cmdLine = new CommandLine(COMMAND_QSTAT); cmdLine.addArgument(PARAMETER_FULL_STATUS); if (StringUtils.isNotBlank(name)) { cmdLine.addArgument(name); // depends on control dependency: [if], data = [none] } final OutputStream out = new ByteArrayOutputStream(); final OutputStream err = new ByteArrayOutputStream(); DefaultExecuteResultHandler resultHandler; try { resultHandler = execute(cmdLine, null, out, err); // depends on control dependency: [try], data = [none] resultHandler.waitFor(DEFAULT_TIMEOUT); // depends on control dependency: [try], data = [none] } catch (ExecuteException e) { throw new PBSException("Failed to execute qstat command: " + e.getMessage(), e); } catch (IOException e) { // depends on control dependency: [catch], data = [none] throw new PBSException("Failed to execute qstat command: " + e.getMessage(), e); } catch (InterruptedException e) { // depends on control dependency: [catch], data = [none] throw new PBSException("Failed to execute qstat command: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] final int exitValue = resultHandler.getExitValue(); LOGGER.info("qstat exit value: " + exitValue); final List<Job> jobs; try { jobs = QSTAT_JOBS_PARSER.parse(out.toString()); // depends on control dependency: [try], data = [none] } catch (ParseException pe) { throw new PBSException("Failed to parse qstat jobs output: " + pe.getMessage(), pe); } // depends on control dependency: [catch], data = [none] return (jobs == null ? new ArrayList<Job>(0) : jobs); } }
public class class_name { public long getLogoHeight() { try { val items = getLogoUrls(); if (!items.isEmpty()) { return items.iterator().next().getHeight(); } } catch (final Exception e) { LOGGER.debug(e.getMessage(), e); } return DEFAULT_IMAGE_SIZE; } }
public class class_name { public long getLogoHeight() { try { val items = getLogoUrls(); if (!items.isEmpty()) { return items.iterator().next().getHeight(); // depends on control dependency: [if], data = [none] } } catch (final Exception e) { LOGGER.debug(e.getMessage(), e); } // depends on control dependency: [catch], data = [none] return DEFAULT_IMAGE_SIZE; } }
public class class_name { protected void connectionErrorOccurred() { if (tc.isEntryEnabled()) { Tr.entry(this, tc, "connectionErrorOccurred"); } connectionErrorOccurred(null); if (tc.isEntryEnabled()) { Tr.exit(this, tc, "connectionErrorOccurred"); } } }
public class class_name { protected void connectionErrorOccurred() { if (tc.isEntryEnabled()) { Tr.entry(this, tc, "connectionErrorOccurred"); // depends on control dependency: [if], data = [none] } connectionErrorOccurred(null); if (tc.isEntryEnabled()) { Tr.exit(this, tc, "connectionErrorOccurred"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static final boolean endsWithDelimiter(byte[] bytes, int endPos, byte[] delim) { if (endPos < delim.length - 1) { return false; } for (int pos = 0; pos < delim.length; ++pos) { if (delim[pos] != bytes[endPos - delim.length + 1 + pos]) { return false; } } return true; } }
public class class_name { public static final boolean endsWithDelimiter(byte[] bytes, int endPos, byte[] delim) { if (endPos < delim.length - 1) { return false; // depends on control dependency: [if], data = [none] } for (int pos = 0; pos < delim.length; ++pos) { if (delim[pos] != bytes[endPos - delim.length + 1 + pos]) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { private Locale getWorkplaceLocale() { Locale result = OpenCms.getWorkplaceManager().getWorkplaceLocale(getCmsObject()); if (result == null) { result = CmsLocaleManager.getDefaultLocale(); } if (result == null) { result = Locale.getDefault(); } return result; } }
public class class_name { private Locale getWorkplaceLocale() { Locale result = OpenCms.getWorkplaceManager().getWorkplaceLocale(getCmsObject()); if (result == null) { result = CmsLocaleManager.getDefaultLocale(); // depends on control dependency: [if], data = [none] } if (result == null) { result = Locale.getDefault(); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { @Override public String toConstraintString() throws DapException { assert this.first != UNDEFINED && this.stride != UNDEFINED && this.stop != UNDEFINED; StringBuilder buf = new StringBuilder(); buf.append("["); boolean first = true; for(Slice sub: this.subslices) { if(!first) buf.append(","); first = false; if((sub.stop - sub.first) == 0) { buf.append("0"); } else if(sub.stride == 1) { if((sub.stop - sub.first) == 1) buf.append(sub.first); else buf.append(String.format("%d:%d", sub.first, sub.stop - 1)); } else buf.append(String.format("%d:%d:%d", sub.first, sub.stride, sub.stop - 1)); } buf.append("]"); return buf.toString(); } }
public class class_name { @Override public String toConstraintString() throws DapException { assert this.first != UNDEFINED && this.stride != UNDEFINED && this.stop != UNDEFINED; StringBuilder buf = new StringBuilder(); buf.append("["); boolean first = true; for(Slice sub: this.subslices) { if(!first) buf.append(","); first = false; if((sub.stop - sub.first) == 0) { buf.append("0"); // depends on control dependency: [if], data = [none] } else if(sub.stride == 1) { if((sub.stop - sub.first) == 1) buf.append(sub.first); else buf.append(String.format("%d:%d", sub.first, sub.stop - 1)); } else buf.append(String.format("%d:%d:%d", sub.first, sub.stride, sub.stop - 1)); } buf.append("]"); return buf.toString(); } }
public class class_name { protected static SipPrincipal findPrincipal(MobicentsSipServletRequest request, String authorization, String realmName, String securityDomain, Deployment deployment, ServletInfo servletInfo, SipStack sipStack) { // System.out.println("Authorization token : " + authorization); // Validate the authorization credentials format if (authorization == null) { return (null); } if (!authorization.startsWith("Digest ")) { return (null); } String tmpAuthorization = authorization.substring(7).trim(); // Bugzilla 37132: http://issues.apache.org/bugzilla/show_bug.cgi?id=37132 // The solution of 37132 doesn't work with : // response="2d05f1206becab904c1f311f205b405b",cnonce="5644k1k670",username="admin",nc=00000001,qop=auth,nonce="b6c73ab509830b8c0897984f6b0526e8",realm="sip-servlets-realm",opaque="9ed6d115d11f505f9ee20f6a68654cc2",uri="sip:192.168.1.142",algorithm=MD5 // That's why I am going back to simple comma (Vladimir). TODO: Review this. String[] tokens = tmpAuthorization.split(",");// (?=(?:[^\"]*\"[^\"]*\")+$)"); String userName = null; String nOnce = null; String nc = null; String cnonce = null; String qop = null; String uri = null; String response = null; String method = request.getMethod(); for (int i = 0; i < tokens.length; i++) { String currentToken = tokens[i]; if (currentToken.length() == 0) { continue; } int equalSign = currentToken.indexOf('='); if (equalSign < 0) { return null; } String currentTokenName = currentToken.substring(0, equalSign).trim(); String currentTokenValue = currentToken.substring(equalSign + 1).trim(); if ("username".equals(currentTokenName)) { userName = removeQuotes(currentTokenValue); } if ("realm".equals(currentTokenName)) { realmName = removeQuotes(currentTokenValue, true); } if ("nonce".equals(currentTokenName)) { nOnce = removeQuotes(currentTokenValue); } if ("nc".equals(currentTokenName)) { nc = removeQuotes(currentTokenValue); } if ("cnonce".equals(currentTokenName)) { cnonce = removeQuotes(currentTokenValue); } if ("qop".equals(currentTokenName)) { qop = removeQuotes(currentTokenValue); DigestQop qopObj = DigestQop.forName(qop); } if ("uri".equals(currentTokenName)) { uri = removeQuotes(currentTokenValue); } if ("response".equals(currentTokenName)) { response = removeQuotes(currentTokenValue); } } if ((userName == null) || (realmName == null) || (nOnce == null) || (uri == null) || (response == null)) { return null; } // Second MD5 digest used to calculate the digest : // MD5(Method + ":" + uri) String a2 = method + ":" + uri; // System.out.println("A2:" + a2); byte[] buffer = null; synchronized (md5Helper) { buffer = md5Helper.digest(a2.getBytes()); } String md5a2 = MD5_ENCODER.encode(buffer); // taken from // https://github.com/jbossas/jboss-as/blob/7.1.2.Final/web/src/main/java/org/jboss/as/web/security/SecurityContextAssociationValve.java#L86 SecurityContext sc = SecurityActions.getSecurityContext(); if (sc == null) { if (log.isDebugEnabled()) { log.debug("Security Domain " + securityDomain + " for Realm " + realmName); } if (securityDomain == null) { if (log.isDebugEnabled()) { log.debug("Security Domain is null using default security domain " + SIPSecurityConstants.DEFAULT_SIP_APPLICATION_POLICY + " for Realm " + realmName); } securityDomain = SIPSecurityConstants.DEFAULT_SIP_APPLICATION_POLICY; } sc = SecurityActions.createSecurityContext(securityDomain); SecurityActions.setSecurityContextOnAssociation(sc); } try { Properties users = new Properties(); String dir = System.getProperty("jboss.server.config.dir"); String fileName = "sip-servlets-users.properties"; boolean storedPasswordIsA1Hash = true; if (sipStack instanceof SipStackImpl) { Properties stackProperties = ((SipStackImpl) sipStack).getConfigurationProperties(); fileName = stackProperties.getProperty(SipDigestAuthenticationMechanism.DIGEST_AUTH_USERS_PROPERTIES, "sip-servlets-users.properties"); storedPasswordIsA1Hash = Boolean.parseBoolean(stackProperties.getProperty( SipDigestAuthenticationMechanism.DIGEST_AUTH_PASSWORD_IS_A1HASH, "true")); } try { users = SipDigestAuthenticationMechanism.loadProperties(dir + "/" + fileName, dir + "/" + fileName); } catch (IOException e) { log.warn("Failed to load user properties file from location " + dir + "/" + fileName + ", please check digest security config in standalone and mss sip stack property files!"); } String storedPassword = users.getProperty(userName, ""); Account account = SipDigestAuthenticationMechanism.authenticate(userName, storedPassword, response, nOnce, nc, cnonce, method, uri, qop, realmName, md5a2, deployment, storedPasswordIsA1Hash); if (account == null) { return null; } else { return (new UndertowSipPrincipal(account, deployment, servletInfo)); } } finally { SecurityActions.clearSecurityContext(); SecurityRolesAssociation.setSecurityRoles(null); } } }
public class class_name { protected static SipPrincipal findPrincipal(MobicentsSipServletRequest request, String authorization, String realmName, String securityDomain, Deployment deployment, ServletInfo servletInfo, SipStack sipStack) { // System.out.println("Authorization token : " + authorization); // Validate the authorization credentials format if (authorization == null) { return (null); // depends on control dependency: [if], data = [null)] } if (!authorization.startsWith("Digest ")) { return (null); // depends on control dependency: [if], data = [none] } String tmpAuthorization = authorization.substring(7).trim(); // Bugzilla 37132: http://issues.apache.org/bugzilla/show_bug.cgi?id=37132 // The solution of 37132 doesn't work with : // response="2d05f1206becab904c1f311f205b405b",cnonce="5644k1k670",username="admin",nc=00000001,qop=auth,nonce="b6c73ab509830b8c0897984f6b0526e8",realm="sip-servlets-realm",opaque="9ed6d115d11f505f9ee20f6a68654cc2",uri="sip:192.168.1.142",algorithm=MD5 // That's why I am going back to simple comma (Vladimir). TODO: Review this. String[] tokens = tmpAuthorization.split(",");// (?=(?:[^\"]*\"[^\"]*\")+$)"); String userName = null; String nOnce = null; String nc = null; String cnonce = null; String qop = null; String uri = null; String response = null; String method = request.getMethod(); for (int i = 0; i < tokens.length; i++) { String currentToken = tokens[i]; if (currentToken.length() == 0) { continue; } int equalSign = currentToken.indexOf('='); if (equalSign < 0) { return null; // depends on control dependency: [if], data = [none] } String currentTokenName = currentToken.substring(0, equalSign).trim(); String currentTokenValue = currentToken.substring(equalSign + 1).trim(); if ("username".equals(currentTokenName)) { userName = removeQuotes(currentTokenValue); // depends on control dependency: [if], data = [none] } if ("realm".equals(currentTokenName)) { realmName = removeQuotes(currentTokenValue, true); // depends on control dependency: [if], data = [none] } if ("nonce".equals(currentTokenName)) { nOnce = removeQuotes(currentTokenValue); // depends on control dependency: [if], data = [none] } if ("nc".equals(currentTokenName)) { nc = removeQuotes(currentTokenValue); // depends on control dependency: [if], data = [none] } if ("cnonce".equals(currentTokenName)) { cnonce = removeQuotes(currentTokenValue); // depends on control dependency: [if], data = [none] } if ("qop".equals(currentTokenName)) { qop = removeQuotes(currentTokenValue); // depends on control dependency: [if], data = [none] DigestQop qopObj = DigestQop.forName(qop); } if ("uri".equals(currentTokenName)) { uri = removeQuotes(currentTokenValue); // depends on control dependency: [if], data = [none] } if ("response".equals(currentTokenName)) { response = removeQuotes(currentTokenValue); // depends on control dependency: [if], data = [none] } } if ((userName == null) || (realmName == null) || (nOnce == null) || (uri == null) || (response == null)) { return null; // depends on control dependency: [if], data = [none] } // Second MD5 digest used to calculate the digest : // MD5(Method + ":" + uri) String a2 = method + ":" + uri; // System.out.println("A2:" + a2); byte[] buffer = null; synchronized (md5Helper) { buffer = md5Helper.digest(a2.getBytes()); } String md5a2 = MD5_ENCODER.encode(buffer); // taken from // https://github.com/jbossas/jboss-as/blob/7.1.2.Final/web/src/main/java/org/jboss/as/web/security/SecurityContextAssociationValve.java#L86 SecurityContext sc = SecurityActions.getSecurityContext(); if (sc == null) { if (log.isDebugEnabled()) { log.debug("Security Domain " + securityDomain + " for Realm " + realmName); // depends on control dependency: [if], data = [none] } if (securityDomain == null) { if (log.isDebugEnabled()) { log.debug("Security Domain is null using default security domain " + SIPSecurityConstants.DEFAULT_SIP_APPLICATION_POLICY + " for Realm " + realmName); // depends on control dependency: [if], data = [none] } securityDomain = SIPSecurityConstants.DEFAULT_SIP_APPLICATION_POLICY; // depends on control dependency: [if], data = [none] } sc = SecurityActions.createSecurityContext(securityDomain); // depends on control dependency: [if], data = [none] SecurityActions.setSecurityContextOnAssociation(sc); // depends on control dependency: [if], data = [(sc] } try { Properties users = new Properties(); String dir = System.getProperty("jboss.server.config.dir"); String fileName = "sip-servlets-users.properties"; boolean storedPasswordIsA1Hash = true; if (sipStack instanceof SipStackImpl) { Properties stackProperties = ((SipStackImpl) sipStack).getConfigurationProperties(); fileName = stackProperties.getProperty(SipDigestAuthenticationMechanism.DIGEST_AUTH_USERS_PROPERTIES, "sip-servlets-users.properties"); // depends on control dependency: [if], data = [none] storedPasswordIsA1Hash = Boolean.parseBoolean(stackProperties.getProperty( SipDigestAuthenticationMechanism.DIGEST_AUTH_PASSWORD_IS_A1HASH, "true")); // depends on control dependency: [if], data = [none] } try { users = SipDigestAuthenticationMechanism.loadProperties(dir + "/" + fileName, dir + "/" + fileName); // depends on control dependency: [try], data = [none] } catch (IOException e) { log.warn("Failed to load user properties file from location " + dir + "/" + fileName + ", please check digest security config in standalone and mss sip stack property files!"); } // depends on control dependency: [catch], data = [none] String storedPassword = users.getProperty(userName, ""); Account account = SipDigestAuthenticationMechanism.authenticate(userName, storedPassword, response, nOnce, nc, cnonce, method, uri, qop, realmName, md5a2, deployment, storedPasswordIsA1Hash); if (account == null) { return null; // depends on control dependency: [if], data = [none] } else { return (new UndertowSipPrincipal(account, deployment, servletInfo)); // depends on control dependency: [if], data = [(account] } } finally { SecurityActions.clearSecurityContext(); SecurityRolesAssociation.setSecurityRoles(null); } } }
public class class_name { public static Range sum(Range range1, Range range2) { if (range1.getMinimum().doubleValue() <= range2.getMinimum().doubleValue()) { if (range1.getMaximum().doubleValue() >= range2.getMaximum().doubleValue()) { return range1; } else { return range(range1.getMinimum().doubleValue(), range2.getMaximum().doubleValue()); } } else { if (range1.getMaximum().doubleValue() >= range2.getMaximum().doubleValue()) { return range(range2.getMinimum().doubleValue(), range1.getMaximum().doubleValue()); } else { return range2; } } } }
public class class_name { public static Range sum(Range range1, Range range2) { if (range1.getMinimum().doubleValue() <= range2.getMinimum().doubleValue()) { if (range1.getMaximum().doubleValue() >= range2.getMaximum().doubleValue()) { return range1; // depends on control dependency: [if], data = [none] } else { return range(range1.getMinimum().doubleValue(), range2.getMaximum().doubleValue()); // depends on control dependency: [if], data = [none] } } else { if (range1.getMaximum().doubleValue() >= range2.getMaximum().doubleValue()) { return range(range2.getMinimum().doubleValue(), range1.getMaximum().doubleValue()); // depends on control dependency: [if], data = [none] } else { return range2; // depends on control dependency: [if], data = [none] } } } }
public class class_name { private Reader getPushBackReader(Reader source) throws ParseException { PushbackReader pushbackReader = new PushbackReader(source); int c; try { c = pushbackReader.read(); if (c == -1) { return null; } pushbackReader.unread(c); } catch (IOException e) { throw new ParseException("Failed to find out if the source to parse is empty or not", e); } return pushbackReader; } }
public class class_name { private Reader getPushBackReader(Reader source) throws ParseException { PushbackReader pushbackReader = new PushbackReader(source); int c; try { c = pushbackReader.read(); if (c == -1) { return null; // depends on control dependency: [if], data = [none] } pushbackReader.unread(c); } catch (IOException e) { throw new ParseException("Failed to find out if the source to parse is empty or not", e); } return pushbackReader; } }
public class class_name { private static void clean(Element e, String tag) { Elements targetList = getElementsByTag(e, tag); boolean isEmbed = "object".equalsIgnoreCase(tag) || "embed".equalsIgnoreCase(tag) || "iframe".equalsIgnoreCase(tag); for (Element target : targetList) { Matcher matcher = Patterns.get(Patterns.RegEx.VIDEO).matcher( target.outerHtml()); if (isEmbed && matcher.find()) { continue; } target.remove(); } } }
public class class_name { private static void clean(Element e, String tag) { Elements targetList = getElementsByTag(e, tag); boolean isEmbed = "object".equalsIgnoreCase(tag) || "embed".equalsIgnoreCase(tag) || "iframe".equalsIgnoreCase(tag); for (Element target : targetList) { Matcher matcher = Patterns.get(Patterns.RegEx.VIDEO).matcher( target.outerHtml()); if (isEmbed && matcher.find()) { continue; } target.remove(); // depends on control dependency: [for], data = [target] } } }
public class class_name { public String getStartingCategory(CmsObject cms, String referencePath) { String ret = ""; if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_category) && CmsStringUtil.isEmptyOrWhitespaceOnly(m_property)) { ret = "/"; } else if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_property)) { ret = m_category; } else { // use the given property from the right file if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(referencePath)) { try { ret = cms.readPropertyObject(referencePath, m_property, true).getValue("/"); } catch (CmsException ex) { // should never happen if (LOG.isErrorEnabled()) { LOG.error(ex.getLocalizedMessage(), ex); } } } } if (!ret.endsWith("/")) { ret += "/"; } if (ret.startsWith("/")) { ret = ret.substring(1); } return ret; } }
public class class_name { public String getStartingCategory(CmsObject cms, String referencePath) { String ret = ""; if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_category) && CmsStringUtil.isEmptyOrWhitespaceOnly(m_property)) { ret = "/"; // depends on control dependency: [if], data = [none] } else if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_property)) { ret = m_category; // depends on control dependency: [if], data = [none] } else { // use the given property from the right file if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(referencePath)) { try { ret = cms.readPropertyObject(referencePath, m_property, true).getValue("/"); // depends on control dependency: [try], data = [none] } catch (CmsException ex) { // should never happen if (LOG.isErrorEnabled()) { LOG.error(ex.getLocalizedMessage(), ex); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } } if (!ret.endsWith("/")) { ret += "/"; // depends on control dependency: [if], data = [none] } if (ret.startsWith("/")) { ret = ret.substring(1); // depends on control dependency: [if], data = [none] } return ret; } }
public class class_name { public int loadIndeces(List<RowIndexEntry> rowIndexEntries, int startIndex) { int updatedStartIndex = input.loadIndeces(rowIndexEntries, startIndex); int numIndeces = rowIndexEntries.size(); indeces = new int[numIndeces + 1]; int i = 0; for (RowIndexEntry rowIndexEntry : rowIndexEntries) { indeces[i] = (int) rowIndexEntry.getPositions(updatedStartIndex); i++; } return updatedStartIndex + 1; } }
public class class_name { public int loadIndeces(List<RowIndexEntry> rowIndexEntries, int startIndex) { int updatedStartIndex = input.loadIndeces(rowIndexEntries, startIndex); int numIndeces = rowIndexEntries.size(); indeces = new int[numIndeces + 1]; int i = 0; for (RowIndexEntry rowIndexEntry : rowIndexEntries) { indeces[i] = (int) rowIndexEntry.getPositions(updatedStartIndex); // depends on control dependency: [for], data = [rowIndexEntry] i++; // depends on control dependency: [for], data = [none] } return updatedStartIndex + 1; } }
public class class_name { private static IAtomContainer roundUpIfNeeded(IAtomContainer anon) { IChemObjectBuilder bldr = anon.getBuilder(); if ((anon.getAtomCount() & 0x1) != 0) { IBond bond = anon.removeBond(anon.getBondCount() - 1); IAtom dummy = bldr.newInstance(IAtom.class, "C"); anon.addAtom(dummy); anon.addBond(bldr.newInstance(IBond.class, bond.getBegin(), dummy, IBond.Order.SINGLE)); anon.addBond(bldr.newInstance(IBond.class, dummy, bond.getEnd(), IBond.Order.SINGLE)); } return anon; } }
public class class_name { private static IAtomContainer roundUpIfNeeded(IAtomContainer anon) { IChemObjectBuilder bldr = anon.getBuilder(); if ((anon.getAtomCount() & 0x1) != 0) { IBond bond = anon.removeBond(anon.getBondCount() - 1); IAtom dummy = bldr.newInstance(IAtom.class, "C"); anon.addAtom(dummy); // depends on control dependency: [if], data = [none] anon.addBond(bldr.newInstance(IBond.class, bond.getBegin(), dummy, IBond.Order.SINGLE)); // depends on control dependency: [if], data = [none] anon.addBond(bldr.newInstance(IBond.class, dummy, bond.getEnd(), IBond.Order.SINGLE)); // depends on control dependency: [if], data = [none] } return anon; } }
public class class_name { @Override public <R> OperationResult<R> executeWithFailover(Operation<CL, R> op, RetryPolicy retry) throws ConnectionException { //Tracing operation OperationTracer opsTracer = config.getOperationTracer(); final AstyanaxContext context = opsTracer.getAstyanaxContext(); if(context != null) { opsTracer.onCall(context, op); } retry.begin(); ConnectionException lastException = null; do { try { OperationResult<R> result = newExecuteWithFailover(op).tryOperation(op); retry.success(); if(context != null) opsTracer.onSuccess(context, op); return result; } catch (OperationException e) { if(context != null) opsTracer.onException(context, op, e); retry.failure(e); throw e; } catch (ConnectionException e) { lastException = e; } if (retry.allowRetry()) { LOG.debug("Retry policy[" + retry.toString() + "] will allow a subsequent retry for operation [" + op.getClass() + "] on keyspace [" + op.getKeyspace() + "] on pinned host[" + op.getPinnedHost() + "]"); } } while (retry.allowRetry()); if(context != null && lastException != null) opsTracer.onException(context, op, lastException); retry.failure(lastException); throw lastException; } }
public class class_name { @Override public <R> OperationResult<R> executeWithFailover(Operation<CL, R> op, RetryPolicy retry) throws ConnectionException { //Tracing operation OperationTracer opsTracer = config.getOperationTracer(); final AstyanaxContext context = opsTracer.getAstyanaxContext(); if(context != null) { opsTracer.onCall(context, op); } retry.begin(); ConnectionException lastException = null; do { try { OperationResult<R> result = newExecuteWithFailover(op).tryOperation(op); retry.success(); // depends on control dependency: [try], data = [none] if(context != null) opsTracer.onSuccess(context, op); return result; // depends on control dependency: [try], data = [none] } catch (OperationException e) { if(context != null) opsTracer.onException(context, op, e); retry.failure(e); throw e; } // depends on control dependency: [catch], data = [none] catch (ConnectionException e) { lastException = e; } // depends on control dependency: [catch], data = [none] if (retry.allowRetry()) { LOG.debug("Retry policy[" + retry.toString() + "] will allow a subsequent retry for operation [" + op.getClass() + "] on keyspace [" + op.getKeyspace() + "] on pinned host[" + op.getPinnedHost() + "]"); // depends on control dependency: [if], data = [none] } } while (retry.allowRetry()); if(context != null && lastException != null) opsTracer.onException(context, op, lastException); retry.failure(lastException); throw lastException; } }
public class class_name { private void updateTokenWaitTime(long waitForMillis) { final long newTime = millisFromNow(waitForMillis); boolean done; do { long oldTime = tokenWaitUntil.get(); // If the new wait until time exceeds current one, update it; otherwise just skip the loop. if (oldTime < newTime) { done = tokenWaitUntil.compareAndSet(oldTime, newTime); } else { done = true; } } while (!done); } }
public class class_name { private void updateTokenWaitTime(long waitForMillis) { final long newTime = millisFromNow(waitForMillis); boolean done; do { long oldTime = tokenWaitUntil.get(); // If the new wait until time exceeds current one, update it; otherwise just skip the loop. if (oldTime < newTime) { done = tokenWaitUntil.compareAndSet(oldTime, newTime); // depends on control dependency: [if], data = [(oldTime] } else { done = true; // depends on control dependency: [if], data = [none] } } while (!done); } }
public class class_name { @Override public int compareTo(final QueueInfo other) { int retVal = 1; if (other != null) { if (this.name != null && other.name != null) { retVal = this.name.compareTo(other.name); } else if (this.name == null) { retVal = (other.name == null) ? 0 : -1; } } return retVal; } }
public class class_name { @Override public int compareTo(final QueueInfo other) { int retVal = 1; if (other != null) { if (this.name != null && other.name != null) { retVal = this.name.compareTo(other.name); // depends on control dependency: [if], data = [none] } else if (this.name == null) { retVal = (other.name == null) ? 0 : -1; // depends on control dependency: [if], data = [null)] } } return retVal; } }
public class class_name { public Set<String> getAttributeNamesSkipGenerated(boolean managed) { //TODO: can cache this, but will need a cache for managed=true an another for managed=false Set<String> attributesNames = new CaseInsensitiveSet(getAttributeNamesSkipId()); if(managed){ attributesNames.remove("created_at"); attributesNames.remove("updated_at"); } attributesNames.remove(versionColumn); return attributesNames; } }
public class class_name { public Set<String> getAttributeNamesSkipGenerated(boolean managed) { //TODO: can cache this, but will need a cache for managed=true an another for managed=false Set<String> attributesNames = new CaseInsensitiveSet(getAttributeNamesSkipId()); if(managed){ attributesNames.remove("created_at"); // depends on control dependency: [if], data = [none] attributesNames.remove("updated_at"); // depends on control dependency: [if], data = [none] } attributesNames.remove(versionColumn); return attributesNames; } }
public class class_name { protected static HyperBoundingBox computeBounds(NumberVector[] samples) { assert(samples.length > 0) : "Cannot compute bounding box of empty set."; // Compute bounds: final int dimensions = samples[0].getDimensionality(); final double[] min = new double[dimensions]; final double[] max = new double[dimensions]; NumberVector first = samples[0]; for(int d = 0; d < dimensions; d++) { min[d] = max[d] = first.doubleValue(d); } for(int i = 1; i < samples.length; i++) { NumberVector v = samples[i]; for(int d = 0; d < dimensions; d++) { final double c = v.doubleValue(d); min[d] = c < min[d] ? c : min[d]; max[d] = c > max[d] ? c : max[d]; } } return new HyperBoundingBox(min, max); } }
public class class_name { protected static HyperBoundingBox computeBounds(NumberVector[] samples) { assert(samples.length > 0) : "Cannot compute bounding box of empty set."; // Compute bounds: final int dimensions = samples[0].getDimensionality(); final double[] min = new double[dimensions]; final double[] max = new double[dimensions]; NumberVector first = samples[0]; for(int d = 0; d < dimensions; d++) { min[d] = max[d] = first.doubleValue(d); // depends on control dependency: [for], data = [d] } for(int i = 1; i < samples.length; i++) { NumberVector v = samples[i]; for(int d = 0; d < dimensions; d++) { final double c = v.doubleValue(d); min[d] = c < min[d] ? c : min[d]; // depends on control dependency: [for], data = [d] max[d] = c > max[d] ? c : max[d]; // depends on control dependency: [for], data = [d] } } return new HyperBoundingBox(min, max); } }
public class class_name { public ImmutableList<Class<?>> getClassObjects(final String param) { final ImmutableList.Builder<Class<?>> ret = ImmutableList.builder(); for (final String className : getStringList(param)) { try { ret.add(getClassObjectForString(className)); } catch (ClassNotFoundException e) { throw new ParameterConversionException(fullString(param), className, e, "class"); } } return ret.build(); } }
public class class_name { public ImmutableList<Class<?>> getClassObjects(final String param) { final ImmutableList.Builder<Class<?>> ret = ImmutableList.builder(); for (final String className : getStringList(param)) { try { ret.add(getClassObjectForString(className)); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException e) { throw new ParameterConversionException(fullString(param), className, e, "class"); } // depends on control dependency: [catch], data = [none] } return ret.build(); } }
public class class_name { public final void client(final InputStream inputStream, final OutputStream outputStream) { String host = parsedArguments.getString("host"); String port = parsedArguments.getString("port"); try (Socket socketClient = new Socket(host, Integer.parseInt(port)); BufferedReader inFromUser = new BufferedReader( new InputStreamReader(System.in, UTF_8)); BufferedWriter outToUser = new BufferedWriter( new OutputStreamWriter(System.out, UTF_8)); BufferedWriter outToServer = new BufferedWriter( new OutputStreamWriter(socketClient.getOutputStream(), UTF_8)); BufferedReader inFromServer = new BufferedReader( new InputStreamReader(socketClient.getInputStream(), "UTF-8"));) { // send data to server socket StringBuilder inText = new StringBuilder(); String line; while ((line = inFromUser.readLine()) != null) { inText.append(line).append("\n"); } inText.append("<ENDOFDOCUMENT>").append("\n"); outToServer.write(inText.toString()); outToServer.flush(); // get data from server StringBuilder sb = new StringBuilder(); String kafString; while ((kafString = inFromServer.readLine()) != null) { sb.append(kafString).append("\n"); } outToUser.write(sb.toString()); } catch (UnsupportedEncodingException e) { // this cannot happen but... throw new AssertionError("UTF-8 not supported"); } catch (UnknownHostException e) { System.err.println("ERROR: Unknown hostname or IP address!"); System.exit(1); } catch (NumberFormatException e) { System.err.println("Port number not correct!"); System.exit(1); } catch (IOException e) { e.printStackTrace(); } } }
public class class_name { public final void client(final InputStream inputStream, final OutputStream outputStream) { String host = parsedArguments.getString("host"); String port = parsedArguments.getString("port"); try (Socket socketClient = new Socket(host, Integer.parseInt(port)); BufferedReader inFromUser = new BufferedReader( new InputStreamReader(System.in, UTF_8)); BufferedWriter outToUser = new BufferedWriter( new OutputStreamWriter(System.out, UTF_8)); BufferedWriter outToServer = new BufferedWriter( new OutputStreamWriter(socketClient.getOutputStream(), UTF_8)); BufferedReader inFromServer = new BufferedReader( new InputStreamReader(socketClient.getInputStream(), "UTF-8"));) { // send data to server socket StringBuilder inText = new StringBuilder(); String line; while ((line = inFromUser.readLine()) != null) { inText.append(line).append("\n"); // depends on control dependency: [while], data = [none] } inText.append("<ENDOFDOCUMENT>").append("\n"); outToServer.write(inText.toString()); outToServer.flush(); // get data from server StringBuilder sb = new StringBuilder(); String kafString; while ((kafString = inFromServer.readLine()) != null) { sb.append(kafString).append("\n"); // depends on control dependency: [while], data = [none] } outToUser.write(sb.toString()); } catch (UnsupportedEncodingException e) { // this cannot happen but... throw new AssertionError("UTF-8 not supported"); } catch (UnknownHostException e) { System.err.println("ERROR: Unknown hostname or IP address!"); System.exit(1); } catch (NumberFormatException e) { System.err.println("Port number not correct!"); System.exit(1); } catch (IOException e) { e.printStackTrace(); } } }
public class class_name { private Content getClassLinks(LinkInfoImpl.Kind context, Collection<?> list) { Object[] typeList = list.toArray(); Content dd = new HtmlTree(HtmlTag.DD); boolean isFirst = true; for (Object item : typeList) { if (!isFirst) { Content separator = new StringContent(", "); dd.addContent(separator); } else { isFirst = false; } if (item instanceof ClassDoc) { Content link = getLink(new LinkInfoImpl(configuration, context, (ClassDoc)item)); dd.addContent(link); } else { Content link = getLink(new LinkInfoImpl(configuration, context, (Type)item)); dd.addContent(link); } } return dd; } }
public class class_name { private Content getClassLinks(LinkInfoImpl.Kind context, Collection<?> list) { Object[] typeList = list.toArray(); Content dd = new HtmlTree(HtmlTag.DD); boolean isFirst = true; for (Object item : typeList) { if (!isFirst) { Content separator = new StringContent(", "); dd.addContent(separator); // depends on control dependency: [if], data = [none] } else { isFirst = false; // depends on control dependency: [if], data = [none] } if (item instanceof ClassDoc) { Content link = getLink(new LinkInfoImpl(configuration, context, (ClassDoc)item)); dd.addContent(link); // depends on control dependency: [if], data = [none] } else { Content link = getLink(new LinkInfoImpl(configuration, context, (Type)item)); dd.addContent(link); // depends on control dependency: [if], data = [none] } } return dd; } }
public class class_name { public static Object[] values( TypedArgument... arguments ) { Object[] values = new Object[arguments.length]; for ( int i = 0; i < values.length; i++ ) { values[i] = arguments[i].value; } return values; } }
public class class_name { public static Object[] values( TypedArgument... arguments ) { Object[] values = new Object[arguments.length]; for ( int i = 0; i < values.length; i++ ) { values[i] = arguments[i].value; // depends on control dependency: [for], data = [i] } return values; } }
public class class_name { @Override public void registerListener(LifecycleListener listener) { if(listener == null) throw new NullPointerException("listener is null"); synchronized(_lock) { if(_listeners == null || !_listeners.contains(listener)) { Set<LifecycleListener> listeners = new HashSet<LifecycleListener>(); if(_listeners != null) listeners.addAll(_listeners); listeners.add(listener); _listeners = Collections.unmodifiableSet(listeners); if(_stateChangeDispatcher == null) { _stateChangeDispatcher = new StateChangeDispatcher(); _stateChangeDispatcher.setDaemon(true); _stateChangeDispatcher.start(); } if(_state == State.CONNECTED) { // since the listener is new and the client is already connected, we need to send // the connected event to this listener! _stateChangeDispatcher.addEvent(Arrays.asList(listener), null, State.CONNECTED); } } } } }
public class class_name { @Override public void registerListener(LifecycleListener listener) { if(listener == null) throw new NullPointerException("listener is null"); synchronized(_lock) { if(_listeners == null || !_listeners.contains(listener)) { Set<LifecycleListener> listeners = new HashSet<LifecycleListener>(); if(_listeners != null) listeners.addAll(_listeners); listeners.add(listener); // depends on control dependency: [if], data = [none] _listeners = Collections.unmodifiableSet(listeners); // depends on control dependency: [if], data = [none] if(_stateChangeDispatcher == null) { _stateChangeDispatcher = new StateChangeDispatcher(); // depends on control dependency: [if], data = [none] _stateChangeDispatcher.setDaemon(true); // depends on control dependency: [if], data = [none] _stateChangeDispatcher.start(); // depends on control dependency: [if], data = [none] } if(_state == State.CONNECTED) { // since the listener is new and the client is already connected, we need to send // the connected event to this listener! _stateChangeDispatcher.addEvent(Arrays.asList(listener), null, State.CONNECTED); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public void send(SIBusMessage msg, SITransaction tran) throws SISessionUnavailableException, SISessionDroppedException, SIConnectionUnavailableException, SIConnectionDroppedException, SIResourceException, SIConnectionLostException, SILimitExceededException, SIErrorException, SINotAuthorizedException, SIIncorrectCallException, SINotPossibleInCurrentConfigurationException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "send", new Object[] {msg, tran}); try { closeLock.readLock().lockInterruptibly(); try { checkAlreadyClosed(); // XCT Instrumentation for SIBus //lohith liberty change /* if(XctSettings.isAnyEnabled()) { Xct xct = Xct.current(); if(xct.annotationsEnabled()) { Annotation annotation= new Annotation(XctJmsConstants.XCT_SIBUS).add(XctJmsConstants.XCT_PROXY_SEND); annotation.associate(XctJmsConstants.XCT_DEST_NAME,getDestinationAddress().getDestinationName()); annotation.add(new Annotation(XctJmsConstants.XCT_DEST_TYPE).add(destType.toString())); String transacted = XctJmsConstants.XCT_TRANSACTED_FALSE; if (tran !=null) transacted = XctJmsConstants.XCT_TRANSACTED_TRUE; annotation.add(new Annotation(XctJmsConstants.XCT_TRANSACTED).add(transacted)); annotation.add(new Annotation(XctJmsConstants.XCT_RELIABILITY).add(msg.getReliability().toString())); xct.begin(annotation); } else xct.begin(); String xctCorrelationIDString = Xct.current().toString(); msg.setXctCorrelationID(xctCorrelationIDString); }*/ // Now we need to synchronise on the transaction object if there is one. if (tran != null) { synchronized (tran) { // Check transaction is in a valid state. // Enlisted for an XA UOW and not rolledback or // completed for a local transaction. if (!((Transaction) tran).isValid()) { throw new SIIncorrectCallException( nls.getFormattedMessage("TRANSACTION_COMPLETE_SICO1022", null, null) ); } _send(msg, tran); } } else { _send(msg, null); } //lohith liberty change /*if(XctSettings.isAnyEnabled()) { Xct xct = Xct.current(); if(xct.annotationsEnabled()) { Annotation annotation= new Annotation(XctJmsConstants.XCT_SIBUS).add(XctJmsConstants.XCT_PROXY_SEND); xct.end(annotation); } else xct.end(); }*/ } finally { closeLock.readLock().unlock(); } } catch (InterruptedException e) { // No FFDC code needed } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "send"); } }
public class class_name { public void send(SIBusMessage msg, SITransaction tran) throws SISessionUnavailableException, SISessionDroppedException, SIConnectionUnavailableException, SIConnectionDroppedException, SIResourceException, SIConnectionLostException, SILimitExceededException, SIErrorException, SINotAuthorizedException, SIIncorrectCallException, SINotPossibleInCurrentConfigurationException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "send", new Object[] {msg, tran}); try { closeLock.readLock().lockInterruptibly(); try { checkAlreadyClosed(); // depends on control dependency: [try], data = [none] // XCT Instrumentation for SIBus //lohith liberty change /* if(XctSettings.isAnyEnabled()) { Xct xct = Xct.current(); if(xct.annotationsEnabled()) { Annotation annotation= new Annotation(XctJmsConstants.XCT_SIBUS).add(XctJmsConstants.XCT_PROXY_SEND); annotation.associate(XctJmsConstants.XCT_DEST_NAME,getDestinationAddress().getDestinationName()); annotation.add(new Annotation(XctJmsConstants.XCT_DEST_TYPE).add(destType.toString())); String transacted = XctJmsConstants.XCT_TRANSACTED_FALSE; if (tran !=null) transacted = XctJmsConstants.XCT_TRANSACTED_TRUE; annotation.add(new Annotation(XctJmsConstants.XCT_TRANSACTED).add(transacted)); annotation.add(new Annotation(XctJmsConstants.XCT_RELIABILITY).add(msg.getReliability().toString())); xct.begin(annotation); } else xct.begin(); String xctCorrelationIDString = Xct.current().toString(); msg.setXctCorrelationID(xctCorrelationIDString); }*/ // Now we need to synchronise on the transaction object if there is one. if (tran != null) { synchronized (tran) // depends on control dependency: [if], data = [(tran] { // Check transaction is in a valid state. // Enlisted for an XA UOW and not rolledback or // completed for a local transaction. if (!((Transaction) tran).isValid()) { throw new SIIncorrectCallException( nls.getFormattedMessage("TRANSACTION_COMPLETE_SICO1022", null, null) ); } _send(msg, tran); } } else { _send(msg, null); // depends on control dependency: [if], data = [null)] } //lohith liberty change /*if(XctSettings.isAnyEnabled()) { Xct xct = Xct.current(); if(xct.annotationsEnabled()) { Annotation annotation= new Annotation(XctJmsConstants.XCT_SIBUS).add(XctJmsConstants.XCT_PROXY_SEND); xct.end(annotation); } else xct.end(); }*/ } finally { closeLock.readLock().unlock(); } } catch (InterruptedException e) { // No FFDC code needed } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "send"); } }
public class class_name { public void removeDeployableUnit(DeployableUnitID deployableUnitID) { if (logger.isTraceEnabled()) { logger.trace("Removing DU with id: " + deployableUnitID); } if (deployableUnitID == null) throw new NullPointerException("null id"); deployableUnits.remove(deployableUnitID); } }
public class class_name { public void removeDeployableUnit(DeployableUnitID deployableUnitID) { if (logger.isTraceEnabled()) { logger.trace("Removing DU with id: " + deployableUnitID); // depends on control dependency: [if], data = [none] } if (deployableUnitID == null) throw new NullPointerException("null id"); deployableUnits.remove(deployableUnitID); } }
public class class_name { @Override public MtasTokenCollection createTokenCollection(Reader reader) throws MtasParserException, MtasConfigException { Boolean hasRoot = rootTag == null ? true : false; Boolean parsingContent = contentTag == null ? true : false; String textContent = null; Integer unknownAncestors = 0; Integer lastOffset = 0; AtomicInteger position = new AtomicInteger(0); Map<String, Set<Integer>> idPositions = new HashMap<>(); Map<String, Integer[]> idOffsets = new HashMap<>(); Map<String, Map<Integer, Set<String>>> updateList = createUpdateList(); Map<String, List<MtasParserObject>> currentList = createCurrentList(); Map<String, Map<String, String>> variables = createVariables(); tokenCollection = new MtasTokenCollection(); MtasTokenIdFactory mtasTokenIdFactory = new MtasTokenIdFactory(); XMLInputFactory factory = XMLInputFactory.newInstance(); try { XMLStreamReader streamReader = factory.createXMLStreamReader(reader); QName qname; try { int event = streamReader.getEventType(); MtasParserType<?> currentType; MtasParserType<?> tmpCurrentType; MtasParserType<?> tmpVariableType; MtasParserObject currentObject = null; MtasParserObject variableObject = null; while (true) { switch (event) { case XMLStreamConstants.START_DOCUMENT: log.debug("start of document"); String encodingScheme = streamReader.getCharacterEncodingScheme(); if (encodingScheme == null) { //ignore for now log.info("No encodingScheme found, assume utf-8"); //throw new MtasParserException("No encodingScheme found"); } else if (!encodingScheme.equalsIgnoreCase("utf-8")) { throw new MtasParserException( "XML not UTF-8 encoded but '" + encodingScheme + "'"); } break; case XMLStreamConstants.END_DOCUMENT: log.debug("end of document"); break; case XMLStreamConstants.SPACE: // set offset (end of start-element) lastOffset = streamReader.getLocation().getCharacterOffset(); break; case XMLStreamConstants.START_ELEMENT: // get data qname = streamReader.getName(); // check for rootTag if (!hasRoot) { if (qname.equals(getQName(rootTag))) { hasRoot = true; } else { throw new MtasParserException("No " + rootTag); } // parse content } else { if ((tmpVariableType = variableTypes.get(qname)) != null) { variableObject = new MtasParserObject(tmpVariableType); collectAttributes(variableObject, streamReader); computeVariablesFromObject(variableObject, currentList, variables); } if (parsingContent) { // check for relation : not within word, not within // groupAnnotation if ((currentList.get(MAPPING_TYPE_WORD).isEmpty()) && (currentList.get(MAPPING_TYPE_GROUP_ANNOTATION) .isEmpty()) && (tmpCurrentType = relationTypes.get(qname)) != null) { currentObject = new MtasParserObject(tmpCurrentType); collectAttributes(currentObject, streamReader); currentObject.setUnknownAncestorNumber(unknownAncestors); currentObject.setRealOffsetStart(lastOffset); if (!prevalidateObject(currentObject, currentList)) { unknownAncestors++; } else { currentType = tmpCurrentType; currentList.get(MAPPING_TYPE_RELATION).add(currentObject); unknownAncestors = 0; } // check for relation annotation: not within word, but within // relation } else if ((currentList.get(MAPPING_TYPE_WORD).isEmpty()) && (!currentList.get(MAPPING_TYPE_RELATION).isEmpty()) && (tmpCurrentType = relationAnnotationTypes .get(qname)) != null) { currentObject = new MtasParserObject(tmpCurrentType); collectAttributes(currentObject, streamReader); currentObject.setUnknownAncestorNumber(unknownAncestors); currentObject.setRealOffsetStart(lastOffset); if (!prevalidateObject(currentObject, currentList)) { unknownAncestors++; } else { currentType = tmpCurrentType; currentList.get(MAPPING_TYPE_RELATION_ANNOTATION) .add(currentObject); unknownAncestors = 0; } // check for group: not within word, not within relation, not // within groupAnnotation } else if ((currentList.get(MAPPING_TYPE_WORD).isEmpty()) && (currentList.get(MAPPING_TYPE_RELATION).isEmpty()) && (currentList.get(MAPPING_TYPE_GROUP_ANNOTATION) .isEmpty()) && (tmpCurrentType = groupTypes.get(qname)) != null) { currentObject = new MtasParserObject(tmpCurrentType); collectAttributes(currentObject, streamReader); currentObject.setUnknownAncestorNumber(unknownAncestors); currentObject.setRealOffsetStart(lastOffset); if (!prevalidateObject(currentObject, currentList)) { unknownAncestors++; } else { currentType = tmpCurrentType; currentList.get(MAPPING_TYPE_GROUP).add(currentObject); unknownAncestors = 0; } // check for group annotation: not within word, not within // relation, but within group } else if ((currentList.get(MAPPING_TYPE_WORD).isEmpty()) && (currentList.get(MAPPING_TYPE_RELATION).isEmpty()) && (!currentList.get(MAPPING_TYPE_GROUP).isEmpty()) && (tmpCurrentType = groupAnnotationTypes .get(qname)) != null) { currentObject = new MtasParserObject(tmpCurrentType); collectAttributes(currentObject, streamReader); currentObject.setUnknownAncestorNumber(unknownAncestors); currentObject.setRealOffsetStart(lastOffset); if (!prevalidateObject(currentObject, currentList)) { unknownAncestors++; } else { currentType = tmpCurrentType; currentList.get(MAPPING_TYPE_GROUP_ANNOTATION) .add(currentObject); unknownAncestors = 0; } // check for word: not within relation, not within // groupAnnotation, not within word, not within wordAnnotation } else if ((currentList.get(MAPPING_TYPE_RELATION).isEmpty()) && (currentList.get(MAPPING_TYPE_GROUP_ANNOTATION) .isEmpty()) && (currentList.get(MAPPING_TYPE_WORD).isEmpty()) && (currentList.get(MAPPING_TYPE_WORD_ANNOTATION).isEmpty()) && (tmpCurrentType = wordTypes.get(qname)) != null) { currentObject = new MtasParserObject(tmpCurrentType); collectAttributes(currentObject, streamReader); currentObject.setUnknownAncestorNumber(unknownAncestors); currentObject.setOffsetStart(lastOffset); currentObject.setRealOffsetStart(lastOffset); if (!prevalidateObject(currentObject, currentList)) { unknownAncestors++; } else { currentType = tmpCurrentType; currentObject.addPosition(position.getAndIncrement()); currentList.get(MAPPING_TYPE_WORD).add(currentObject); unknownAncestors = 0; } // check for word annotation: not within relation, not within // groupAnnotation, but within word } else if ((currentList.get(MAPPING_TYPE_RELATION).isEmpty()) && (currentList.get(MAPPING_TYPE_GROUP_ANNOTATION) .isEmpty()) && (!currentList.get(MAPPING_TYPE_WORD).isEmpty()) && (tmpCurrentType = wordAnnotationTypes .get(qname)) != null) { currentObject = new MtasParserObject(tmpCurrentType); collectAttributes(currentObject, streamReader); currentObject.addPositions(currentList.get(MAPPING_TYPE_WORD) .get((currentList.get(MAPPING_TYPE_WORD).size() - 1)) .getPositions()); currentObject.setUnknownAncestorNumber(unknownAncestors); currentObject.setRealOffsetStart(lastOffset); if (!prevalidateObject(currentObject, currentList)) { unknownAncestors++; } else { currentType = tmpCurrentType; currentList.get(MAPPING_TYPE_WORD_ANNOTATION) .add(currentObject); unknownAncestors = 0; } // check for references: within relation } else if (!currentList.get(MAPPING_TYPE_RELATION).isEmpty() && (tmpCurrentType = refTypes.get(qname)) != null) { currentObject = new MtasParserObject(tmpCurrentType); collectAttributes(currentObject, streamReader); currentObject.setUnknownAncestorNumber(unknownAncestors); currentObject.setRealOffsetStart(lastOffset); if (!prevalidateObject(currentObject, currentList)) { unknownAncestors++; } else { currentType = tmpCurrentType; currentList.get(MAPPING_TYPE_REF).add(currentObject); unknownAncestors = 0; // add reference to ancestor relations for (MtasParserObject currentRelation : currentList .get(MAPPING_TYPE_RELATION)) { currentRelation.addRefId(currentObject .getAttribute(currentType.getRefAttributeName())); // register mapping for relation (for recursive relations) SortedSet<String> keyMapList; if (currentRelation.getId() != null) { if (relationKeyMap .containsKey(currentRelation.getId())) { keyMapList = relationKeyMap .get(currentRelation.getId()); } else { keyMapList = new TreeSet<>(); relationKeyMap.put(currentRelation.getId(), keyMapList); } keyMapList.add(currentObject .getAttribute(currentType.getRefAttributeName())); } } } } else { unknownAncestors++; } // check for start content } else if (qname.equals(getQName(contentTag))) { parsingContent = true; // unexpected } else if (!allowNonContent) { throw new MtasParserException( "Unexpected " + qname.getLocalPart() + " in document"); } } // set offset (end of start-element) lastOffset = streamReader.getLocation().getCharacterOffset(); break; case XMLStreamConstants.END_ELEMENT: // set offset (end of end-element) lastOffset = streamReader.getLocation().getCharacterOffset(); // get data qname = streamReader.getName(); // parse content if (parsingContent) { if (unknownAncestors > 0) { unknownAncestors--; // check for reference: because otherwise currentList should // contain no references } else if (!currentList.get(MAPPING_TYPE_REF).isEmpty()) { if ((currentType = refTypes.get(qname)) != null) { currentObject = currentList.get(MAPPING_TYPE_REF) .remove(currentList.get(MAPPING_TYPE_REF).size() - 1); assert currentObject.getType() .equals(currentType) : "object expected to be " + currentObject.getType().getName() + ", not " + currentType.getName(); assert unknownAncestors == 0 : "error in administration " + currentObject.getType().getName(); // ignore text and realOffset: not relevant idPositions.put(currentObject.getId(), currentObject.getPositions()); idOffsets.put(currentObject.getId(), currentObject.getOffset()); currentObject.updateMappings(idPositions, idOffsets); unknownAncestors = currentObject.getUnknownAncestorNumber(); computeMappingsFromObject(mtasTokenIdFactory, currentObject, currentList, updateList); } else { // this shouldn't happen } // check for wordAnnotation: because otherwise currentList // should contain no wordAnnotations } else if (!currentList.get(MAPPING_TYPE_WORD_ANNOTATION) .isEmpty()) { if ((currentType = wordAnnotationTypes.get(qname)) != null) { currentObject = currentList.get(MAPPING_TYPE_WORD_ANNOTATION) .remove( currentList.get(MAPPING_TYPE_WORD_ANNOTATION).size() - 1); assert currentObject.getType() .equals(currentType) : "object expected to be " + currentObject.getType().getName() + ", not " + currentType.getName(); assert unknownAncestors == 0 : "error in administration " + currentObject.getType().getName(); currentObject.setRealOffsetEnd(lastOffset); idPositions.put(currentObject.getId(), currentObject.getPositions()); idOffsets.put(currentObject.getId(), currentObject.getOffset()); // offset always null, so update later with word (should be // possible) if ((currentObject.getId() != null) && (!currentList.get(MAPPING_TYPE_WORD).isEmpty())) { currentList.get(MAPPING_TYPE_WORD) .get((currentList.get(MAPPING_TYPE_WORD).size() - 1)) .addUpdateableIdWithOffset(currentObject.getId()); } currentObject.updateMappings(idPositions, idOffsets); unknownAncestors = currentObject.getUnknownAncestorNumber(); computeMappingsFromObject(mtasTokenIdFactory, currentObject, currentList, updateList); } else { // this shouldn't happen } // check for word: because otherwise currentList should contain // no words } else if (!currentList.get(MAPPING_TYPE_WORD).isEmpty()) { if ((currentType = wordTypes.get(qname)) != null) { currentObject = currentList.get(MAPPING_TYPE_WORD) .remove(currentList.get(MAPPING_TYPE_WORD).size() - 1); assert currentObject.getType() .equals(currentType) : "object expected to be " + currentObject.getType().getName() + ", not " + currentType.getName(); assert unknownAncestors == 0 : "error in administration " + currentObject.getType().getName(); currentObject.setOffsetEnd(lastOffset); currentObject.setRealOffsetEnd(lastOffset); // update ancestor groups with position and offset for (MtasParserObject currentGroup : currentList .get(MAPPING_TYPE_GROUP)) { currentGroup.addPositions(currentObject.getPositions()); currentGroup.addOffsetStart(currentObject.getOffsetStart()); currentGroup.addOffsetEnd(currentObject.getOffsetEnd()); } idPositions.put(currentObject.getId(), currentObject.getPositions()); idOffsets.put(currentObject.getId(), currentObject.getOffset()); currentObject.updateMappings(idPositions, idOffsets); unknownAncestors = currentObject.getUnknownAncestorNumber(); computeMappingsFromObject(mtasTokenIdFactory, currentObject, currentList, updateList); } else { // this shouldn't happen } // check for group annotation: because otherwise currentList // should contain no groupAnnotations } else if (!currentList.get(MAPPING_TYPE_GROUP_ANNOTATION) .isEmpty()) { if ((currentType = groupAnnotationTypes.get(qname)) != null) { currentObject = currentList.get(MAPPING_TYPE_GROUP_ANNOTATION) .remove( currentList.get(MAPPING_TYPE_GROUP_ANNOTATION).size() - 1); assert currentObject.getType() .equals(currentType) : "object expected to be " + currentObject.getType().getName() + ", not " + currentType.getName(); assert unknownAncestors == 0 : "error in administration " + currentObject.getType().getName(); currentObject.setRealOffsetEnd(lastOffset); idPositions.put(currentObject.getId(), currentObject.getPositions()); idOffsets.put(currentObject.getId(), currentObject.getOffset()); currentObject.updateMappings(idPositions, idOffsets); unknownAncestors = currentObject.getUnknownAncestorNumber(); computeMappingsFromObject(mtasTokenIdFactory, currentObject, currentList, updateList); } else { // this shouldn't happen } // check for relation annotation } else if (!currentList.get(MAPPING_TYPE_RELATION_ANNOTATION) .isEmpty()) { if ((currentType = relationAnnotationTypes .get(qname)) != null) { currentObject = currentList .get(MAPPING_TYPE_RELATION_ANNOTATION).remove(currentList .get(MAPPING_TYPE_RELATION_ANNOTATION).size() - 1); assert currentObject.getType() .equals(currentType) : "object expected to be " + currentObject.getType().getName() + ", not " + currentType.getName(); assert unknownAncestors == 0 : "error in administration " + currentObject.getType().getName(); currentObject.setRealOffsetEnd(lastOffset); idPositions.put(currentObject.getId(), currentObject.getPositions()); idOffsets.put(currentObject.getId(), currentObject.getOffset()); currentObject.updateMappings(idPositions, idOffsets); unknownAncestors = currentObject.getUnknownAncestorNumber(); computeMappingsFromObject(mtasTokenIdFactory, currentObject, currentList, updateList); } else { // this shouldn't happen } // check for relation } else if (!currentList.get(MAPPING_TYPE_RELATION).isEmpty()) { if ((currentType = relationTypes.get(qname)) != null) { currentObject = currentList.get(MAPPING_TYPE_RELATION).remove( currentList.get(MAPPING_TYPE_RELATION).size() - 1); assert currentObject.getType() .equals(currentType) : "object expected to be " + currentObject.getType().getName() + ", not " + currentType.getName(); assert unknownAncestors == 0 : "error in administration " + currentObject.getType().getName(); // ignore text: should not occur currentObject.setRealOffsetEnd(lastOffset); idPositions.put(currentObject.getId(), currentObject.getPositions()); idOffsets.put(currentObject.getId(), currentObject.getOffset()); currentObject.updateMappings(idPositions, idOffsets); unknownAncestors = currentObject.getUnknownAncestorNumber(); computeMappingsFromObject(mtasTokenIdFactory, currentObject, currentList, updateList); } else { // this shouldn't happen } // check for group } else if (!currentList.get(MAPPING_TYPE_GROUP).isEmpty()) { if ((currentType = groupTypes.get(qname)) != null) { currentObject = currentList.get(MAPPING_TYPE_GROUP) .remove(currentList.get(MAPPING_TYPE_GROUP).size() - 1); assert currentObject.getType() .equals(currentType) : "object expected to be " + currentObject.getType().getName() + ", not " + currentType.getName(); assert unknownAncestors == 0 : "error in administration " + currentObject.getType().getName(); // ignore text: should not occur currentObject.setRealOffsetEnd(lastOffset); idPositions.put(currentObject.getId(), currentObject.getPositions()); idOffsets.put(currentObject.getId(), currentObject.getOffset()); currentObject.updateMappings(idPositions, idOffsets); unknownAncestors = currentObject.getUnknownAncestorNumber(); computeMappingsFromObject(mtasTokenIdFactory, currentObject, currentList, updateList); } else { unknownAncestors--; } } else if (qname.equals(getQName("text"))) { parsingContent = false; assert unknownAncestors == 0 : "error in administration unknownAncestors"; assert currentList.get(MAPPING_TYPE_REF) .isEmpty() : "error in administration references"; assert currentList.get(MAPPING_TYPE_GROUP) .isEmpty() : "error in administration groups"; assert currentList.get(MAPPING_TYPE_GROUP_ANNOTATION) .isEmpty() : "error in administration groupAnnotations"; assert currentList.get(MAPPING_TYPE_WORD) .isEmpty() : "error in administration words"; assert currentList.get(MAPPING_TYPE_WORD_ANNOTATION) .isEmpty() : "error in administration wordAnnotations"; assert currentList.get(MAPPING_TYPE_RELATION) .isEmpty() : "error in administration relations"; assert currentList.get(MAPPING_TYPE_RELATION_ANNOTATION) .isEmpty() : "error in administration relationAnnotations"; } } // forget text textContent = null; break; case XMLStreamConstants.CHARACTERS: // set offset (end of start-element) lastOffset = streamReader.getLocation().getCharacterOffset(); // check for text if (streamReader.hasText()) { textContent = streamReader.getText(); } if (currentObject != null && unknownAncestors.equals(0)) { currentObject.addText(textContent); } break; default: break; } if (!streamReader.hasNext()) { break; } event = streamReader.next(); } } finally { streamReader.close(); } // final checks assert unknownAncestors == 0 : "error in administration unknownAncestors"; assert hasRoot : "no " + rootTag; } catch (XMLStreamException e) { log.debug(e); throw new MtasParserException("No valid XML: " + e.getMessage()); } // update tokens with variable for (Entry<Integer, Set<String>> updateItem : updateList .get(UPDATE_TYPE_VARIABLE).entrySet()) { MtasToken token = tokenCollection.get(updateItem.getKey()); String encodedPrefix = token.getPrefix(); String encodedPostfix = token.getPostfix(); token.setValue(decodeAndUpdateWithVariables(encodedPrefix, encodedPostfix, variables)); } // update tokens with offset for (Entry<Integer, Set<String>> updateItem : updateList .get(UPDATE_TYPE_OFFSET).entrySet()) { Set<String> refIdList = new HashSet<>(); for (String refId : updateItem.getValue()) { if (idPositions.containsKey(refId)) { refIdList.add(refId); } if (relationKeyMap.containsKey(refId)) { refIdList.addAll(recursiveCollect(refId, relationKeyMap, 10)); } } for (String refId : refIdList) { Integer[] refOffset = idOffsets.get(refId); Integer tokenId = updateItem.getKey(); if (tokenId != null && refOffset != null) { MtasToken token = tokenCollection.get(tokenId); token.addOffset(refOffset[0], refOffset[1]); } } } // update tokens with position for (Entry<Integer, Set<String>> updateItem : updateList .get(UPDATE_TYPE_POSITION).entrySet()) { HashSet<String> refIdList = new HashSet<>(); for (String refId : updateItem.getValue()) { if (idPositions.containsKey(refId)) { refIdList.add(refId); } if (relationKeyMap.containsKey(refId)) { refIdList.addAll(recursiveCollect(refId, relationKeyMap, 10)); } } for (String refId : refIdList) { Set<Integer> refPositions = idPositions.get(refId); Integer tokenId = updateItem.getKey(); if (tokenId != null && refPositions != null) { MtasToken token = tokenCollection.get(tokenId); token.addPositions(refPositions); } } } // final check tokenCollection.check(autorepair, makeunique); return tokenCollection; } }
public class class_name { @Override public MtasTokenCollection createTokenCollection(Reader reader) throws MtasParserException, MtasConfigException { Boolean hasRoot = rootTag == null ? true : false; Boolean parsingContent = contentTag == null ? true : false; String textContent = null; Integer unknownAncestors = 0; Integer lastOffset = 0; AtomicInteger position = new AtomicInteger(0); Map<String, Set<Integer>> idPositions = new HashMap<>(); Map<String, Integer[]> idOffsets = new HashMap<>(); Map<String, Map<Integer, Set<String>>> updateList = createUpdateList(); Map<String, List<MtasParserObject>> currentList = createCurrentList(); Map<String, Map<String, String>> variables = createVariables(); tokenCollection = new MtasTokenCollection(); MtasTokenIdFactory mtasTokenIdFactory = new MtasTokenIdFactory(); XMLInputFactory factory = XMLInputFactory.newInstance(); try { XMLStreamReader streamReader = factory.createXMLStreamReader(reader); QName qname; try { int event = streamReader.getEventType(); MtasParserType<?> currentType; MtasParserType<?> tmpCurrentType; MtasParserType<?> tmpVariableType; MtasParserObject currentObject = null; MtasParserObject variableObject = null; while (true) { switch (event) { case XMLStreamConstants.START_DOCUMENT: log.debug("start of document"); String encodingScheme = streamReader.getCharacterEncodingScheme(); if (encodingScheme == null) { //ignore for now log.info("No encodingScheme found, assume utf-8"); // depends on control dependency: [if], data = [none] //throw new MtasParserException("No encodingScheme found"); } else if (!encodingScheme.equalsIgnoreCase("utf-8")) { throw new MtasParserException( "XML not UTF-8 encoded but '" + encodingScheme + "'"); } break; case XMLStreamConstants.END_DOCUMENT: log.debug("end of document"); break; case XMLStreamConstants.SPACE: // set offset (end of start-element) lastOffset = streamReader.getLocation().getCharacterOffset(); break; case XMLStreamConstants.START_ELEMENT: // get data qname = streamReader.getName(); // check for rootTag if (!hasRoot) { if (qname.equals(getQName(rootTag))) { hasRoot = true; // depends on control dependency: [if], data = [none] } else { throw new MtasParserException("No " + rootTag); } // parse content } else { if ((tmpVariableType = variableTypes.get(qname)) != null) { variableObject = new MtasParserObject(tmpVariableType); // depends on control dependency: [if], data = [none] collectAttributes(variableObject, streamReader); // depends on control dependency: [if], data = [none] computeVariablesFromObject(variableObject, currentList, variables); // depends on control dependency: [if], data = [none] } if (parsingContent) { // check for relation : not within word, not within // groupAnnotation if ((currentList.get(MAPPING_TYPE_WORD).isEmpty()) && (currentList.get(MAPPING_TYPE_GROUP_ANNOTATION) .isEmpty()) && (tmpCurrentType = relationTypes.get(qname)) != null) { currentObject = new MtasParserObject(tmpCurrentType); // depends on control dependency: [if], data = [none] collectAttributes(currentObject, streamReader); // depends on control dependency: [if], data = [none] currentObject.setUnknownAncestorNumber(unknownAncestors); // depends on control dependency: [if], data = [none] currentObject.setRealOffsetStart(lastOffset); // depends on control dependency: [if], data = [none] if (!prevalidateObject(currentObject, currentList)) { unknownAncestors++; // depends on control dependency: [if], data = [none] } else { currentType = tmpCurrentType; // depends on control dependency: [if], data = [none] currentList.get(MAPPING_TYPE_RELATION).add(currentObject); // depends on control dependency: [if], data = [none] unknownAncestors = 0; // depends on control dependency: [if], data = [none] } // check for relation annotation: not within word, but within // relation } else if ((currentList.get(MAPPING_TYPE_WORD).isEmpty()) && (!currentList.get(MAPPING_TYPE_RELATION).isEmpty()) && (tmpCurrentType = relationAnnotationTypes .get(qname)) != null) { currentObject = new MtasParserObject(tmpCurrentType); // depends on control dependency: [if], data = [none] collectAttributes(currentObject, streamReader); // depends on control dependency: [if], data = [none] currentObject.setUnknownAncestorNumber(unknownAncestors); // depends on control dependency: [if], data = [none] currentObject.setRealOffsetStart(lastOffset); // depends on control dependency: [if], data = [none] if (!prevalidateObject(currentObject, currentList)) { unknownAncestors++; // depends on control dependency: [if], data = [none] } else { currentType = tmpCurrentType; // depends on control dependency: [if], data = [none] currentList.get(MAPPING_TYPE_RELATION_ANNOTATION) .add(currentObject); // depends on control dependency: [if], data = [none] unknownAncestors = 0; // depends on control dependency: [if], data = [none] } // check for group: not within word, not within relation, not // within groupAnnotation } else if ((currentList.get(MAPPING_TYPE_WORD).isEmpty()) && (currentList.get(MAPPING_TYPE_RELATION).isEmpty()) && (currentList.get(MAPPING_TYPE_GROUP_ANNOTATION) .isEmpty()) && (tmpCurrentType = groupTypes.get(qname)) != null) { currentObject = new MtasParserObject(tmpCurrentType); // depends on control dependency: [if], data = [none] collectAttributes(currentObject, streamReader); // depends on control dependency: [if], data = [none] currentObject.setUnknownAncestorNumber(unknownAncestors); // depends on control dependency: [if], data = [none] currentObject.setRealOffsetStart(lastOffset); // depends on control dependency: [if], data = [none] if (!prevalidateObject(currentObject, currentList)) { unknownAncestors++; // depends on control dependency: [if], data = [none] } else { currentType = tmpCurrentType; // depends on control dependency: [if], data = [none] currentList.get(MAPPING_TYPE_GROUP).add(currentObject); // depends on control dependency: [if], data = [none] unknownAncestors = 0; // depends on control dependency: [if], data = [none] } // check for group annotation: not within word, not within // relation, but within group } else if ((currentList.get(MAPPING_TYPE_WORD).isEmpty()) && (currentList.get(MAPPING_TYPE_RELATION).isEmpty()) && (!currentList.get(MAPPING_TYPE_GROUP).isEmpty()) && (tmpCurrentType = groupAnnotationTypes .get(qname)) != null) { currentObject = new MtasParserObject(tmpCurrentType); // depends on control dependency: [if], data = [none] collectAttributes(currentObject, streamReader); // depends on control dependency: [if], data = [none] currentObject.setUnknownAncestorNumber(unknownAncestors); // depends on control dependency: [if], data = [none] currentObject.setRealOffsetStart(lastOffset); // depends on control dependency: [if], data = [none] if (!prevalidateObject(currentObject, currentList)) { unknownAncestors++; // depends on control dependency: [if], data = [none] } else { currentType = tmpCurrentType; // depends on control dependency: [if], data = [none] currentList.get(MAPPING_TYPE_GROUP_ANNOTATION) .add(currentObject); // depends on control dependency: [if], data = [none] unknownAncestors = 0; // depends on control dependency: [if], data = [none] } // check for word: not within relation, not within // groupAnnotation, not within word, not within wordAnnotation } else if ((currentList.get(MAPPING_TYPE_RELATION).isEmpty()) && (currentList.get(MAPPING_TYPE_GROUP_ANNOTATION) .isEmpty()) && (currentList.get(MAPPING_TYPE_WORD).isEmpty()) && (currentList.get(MAPPING_TYPE_WORD_ANNOTATION).isEmpty()) && (tmpCurrentType = wordTypes.get(qname)) != null) { currentObject = new MtasParserObject(tmpCurrentType); // depends on control dependency: [if], data = [none] collectAttributes(currentObject, streamReader); // depends on control dependency: [if], data = [none] currentObject.setUnknownAncestorNumber(unknownAncestors); // depends on control dependency: [if], data = [none] currentObject.setOffsetStart(lastOffset); // depends on control dependency: [if], data = [none] currentObject.setRealOffsetStart(lastOffset); // depends on control dependency: [if], data = [none] if (!prevalidateObject(currentObject, currentList)) { unknownAncestors++; // depends on control dependency: [if], data = [none] } else { currentType = tmpCurrentType; // depends on control dependency: [if], data = [none] currentObject.addPosition(position.getAndIncrement()); // depends on control dependency: [if], data = [none] currentList.get(MAPPING_TYPE_WORD).add(currentObject); // depends on control dependency: [if], data = [none] unknownAncestors = 0; // depends on control dependency: [if], data = [none] } // check for word annotation: not within relation, not within // groupAnnotation, but within word } else if ((currentList.get(MAPPING_TYPE_RELATION).isEmpty()) && (currentList.get(MAPPING_TYPE_GROUP_ANNOTATION) .isEmpty()) && (!currentList.get(MAPPING_TYPE_WORD).isEmpty()) && (tmpCurrentType = wordAnnotationTypes .get(qname)) != null) { currentObject = new MtasParserObject(tmpCurrentType); // depends on control dependency: [if], data = [none] collectAttributes(currentObject, streamReader); // depends on control dependency: [if], data = [none] currentObject.addPositions(currentList.get(MAPPING_TYPE_WORD) .get((currentList.get(MAPPING_TYPE_WORD).size() - 1)) .getPositions()); // depends on control dependency: [if], data = [none] currentObject.setUnknownAncestorNumber(unknownAncestors); // depends on control dependency: [if], data = [none] currentObject.setRealOffsetStart(lastOffset); // depends on control dependency: [if], data = [none] if (!prevalidateObject(currentObject, currentList)) { unknownAncestors++; // depends on control dependency: [if], data = [none] } else { currentType = tmpCurrentType; // depends on control dependency: [if], data = [none] currentList.get(MAPPING_TYPE_WORD_ANNOTATION) .add(currentObject); // depends on control dependency: [if], data = [none] unknownAncestors = 0; // depends on control dependency: [if], data = [none] } // check for references: within relation } else if (!currentList.get(MAPPING_TYPE_RELATION).isEmpty() && (tmpCurrentType = refTypes.get(qname)) != null) { currentObject = new MtasParserObject(tmpCurrentType); // depends on control dependency: [if], data = [none] collectAttributes(currentObject, streamReader); // depends on control dependency: [if], data = [none] currentObject.setUnknownAncestorNumber(unknownAncestors); // depends on control dependency: [if], data = [none] currentObject.setRealOffsetStart(lastOffset); // depends on control dependency: [if], data = [none] if (!prevalidateObject(currentObject, currentList)) { unknownAncestors++; // depends on control dependency: [if], data = [none] } else { currentType = tmpCurrentType; // depends on control dependency: [if], data = [none] currentList.get(MAPPING_TYPE_REF).add(currentObject); // depends on control dependency: [if], data = [none] unknownAncestors = 0; // depends on control dependency: [if], data = [none] // add reference to ancestor relations for (MtasParserObject currentRelation : currentList .get(MAPPING_TYPE_RELATION)) { currentRelation.addRefId(currentObject .getAttribute(currentType.getRefAttributeName())); // depends on control dependency: [for], data = [currentRelation] // register mapping for relation (for recursive relations) SortedSet<String> keyMapList; if (currentRelation.getId() != null) { if (relationKeyMap .containsKey(currentRelation.getId())) { keyMapList = relationKeyMap .get(currentRelation.getId()); // depends on control dependency: [if], data = [none] } else { keyMapList = new TreeSet<>(); // depends on control dependency: [if], data = [none] relationKeyMap.put(currentRelation.getId(), keyMapList); // depends on control dependency: [if], data = [none] } keyMapList.add(currentObject .getAttribute(currentType.getRefAttributeName())); // depends on control dependency: [if], data = [none] } } } } else { unknownAncestors++; // depends on control dependency: [if], data = [none] } // check for start content } else if (qname.equals(getQName(contentTag))) { parsingContent = true; // depends on control dependency: [if], data = [none] // unexpected } else if (!allowNonContent) { throw new MtasParserException( "Unexpected " + qname.getLocalPart() + " in document"); } } // set offset (end of start-element) lastOffset = streamReader.getLocation().getCharacterOffset(); break; case XMLStreamConstants.END_ELEMENT: // set offset (end of end-element) lastOffset = streamReader.getLocation().getCharacterOffset(); // get data qname = streamReader.getName(); // parse content if (parsingContent) { if (unknownAncestors > 0) { unknownAncestors--; // depends on control dependency: [if], data = [none] // check for reference: because otherwise currentList should // contain no references } else if (!currentList.get(MAPPING_TYPE_REF).isEmpty()) { if ((currentType = refTypes.get(qname)) != null) { currentObject = currentList.get(MAPPING_TYPE_REF) .remove(currentList.get(MAPPING_TYPE_REF).size() - 1); // depends on control dependency: [if], data = [none] assert currentObject.getType() .equals(currentType) : "object expected to be " + currentObject.getType().getName() + ", not " + currentType.getName(); // depends on control dependency: [if], data = [none] assert unknownAncestors == 0 : "error in administration " + currentObject.getType().getName(); // depends on control dependency: [if], data = [none] // ignore text and realOffset: not relevant idPositions.put(currentObject.getId(), currentObject.getPositions()); // depends on control dependency: [if], data = [none] idOffsets.put(currentObject.getId(), currentObject.getOffset()); // depends on control dependency: [if], data = [none] currentObject.updateMappings(idPositions, idOffsets); // depends on control dependency: [if], data = [none] unknownAncestors = currentObject.getUnknownAncestorNumber(); // depends on control dependency: [if], data = [none] computeMappingsFromObject(mtasTokenIdFactory, currentObject, currentList, updateList); // depends on control dependency: [if], data = [none] } else { // this shouldn't happen } // check for wordAnnotation: because otherwise currentList // should contain no wordAnnotations } else if (!currentList.get(MAPPING_TYPE_WORD_ANNOTATION) .isEmpty()) { if ((currentType = wordAnnotationTypes.get(qname)) != null) { currentObject = currentList.get(MAPPING_TYPE_WORD_ANNOTATION) .remove( currentList.get(MAPPING_TYPE_WORD_ANNOTATION).size() - 1); // depends on control dependency: [if], data = [none] assert currentObject.getType() .equals(currentType) : "object expected to be " + currentObject.getType().getName() + ", not " + currentType.getName(); // depends on control dependency: [if], data = [none] assert unknownAncestors == 0 : "error in administration " + currentObject.getType().getName(); // depends on control dependency: [if], data = [none] currentObject.setRealOffsetEnd(lastOffset); // depends on control dependency: [if], data = [none] idPositions.put(currentObject.getId(), currentObject.getPositions()); // depends on control dependency: [if], data = [none] idOffsets.put(currentObject.getId(), currentObject.getOffset()); // depends on control dependency: [if], data = [none] // offset always null, so update later with word (should be // possible) if ((currentObject.getId() != null) && (!currentList.get(MAPPING_TYPE_WORD).isEmpty())) { currentList.get(MAPPING_TYPE_WORD) .get((currentList.get(MAPPING_TYPE_WORD).size() - 1)) .addUpdateableIdWithOffset(currentObject.getId()); // depends on control dependency: [if], data = [none] } currentObject.updateMappings(idPositions, idOffsets); // depends on control dependency: [if], data = [none] unknownAncestors = currentObject.getUnknownAncestorNumber(); // depends on control dependency: [if], data = [none] computeMappingsFromObject(mtasTokenIdFactory, currentObject, currentList, updateList); // depends on control dependency: [if], data = [none] } else { // this shouldn't happen } // check for word: because otherwise currentList should contain // no words } else if (!currentList.get(MAPPING_TYPE_WORD).isEmpty()) { if ((currentType = wordTypes.get(qname)) != null) { currentObject = currentList.get(MAPPING_TYPE_WORD) .remove(currentList.get(MAPPING_TYPE_WORD).size() - 1); // depends on control dependency: [if], data = [none] assert currentObject.getType() .equals(currentType) : "object expected to be " + currentObject.getType().getName() + ", not " + currentType.getName(); // depends on control dependency: [if], data = [none] assert unknownAncestors == 0 : "error in administration " + currentObject.getType().getName(); // depends on control dependency: [if], data = [none] currentObject.setOffsetEnd(lastOffset); // depends on control dependency: [if], data = [none] currentObject.setRealOffsetEnd(lastOffset); // depends on control dependency: [if], data = [none] // update ancestor groups with position and offset for (MtasParserObject currentGroup : currentList .get(MAPPING_TYPE_GROUP)) { currentGroup.addPositions(currentObject.getPositions()); // depends on control dependency: [for], data = [currentGroup] currentGroup.addOffsetStart(currentObject.getOffsetStart()); // depends on control dependency: [for], data = [currentGroup] currentGroup.addOffsetEnd(currentObject.getOffsetEnd()); // depends on control dependency: [for], data = [currentGroup] } idPositions.put(currentObject.getId(), currentObject.getPositions()); // depends on control dependency: [if], data = [none] idOffsets.put(currentObject.getId(), currentObject.getOffset()); // depends on control dependency: [if], data = [none] currentObject.updateMappings(idPositions, idOffsets); // depends on control dependency: [if], data = [none] unknownAncestors = currentObject.getUnknownAncestorNumber(); // depends on control dependency: [if], data = [none] computeMappingsFromObject(mtasTokenIdFactory, currentObject, currentList, updateList); // depends on control dependency: [if], data = [none] } else { // this shouldn't happen } // check for group annotation: because otherwise currentList // should contain no groupAnnotations } else if (!currentList.get(MAPPING_TYPE_GROUP_ANNOTATION) .isEmpty()) { if ((currentType = groupAnnotationTypes.get(qname)) != null) { currentObject = currentList.get(MAPPING_TYPE_GROUP_ANNOTATION) .remove( currentList.get(MAPPING_TYPE_GROUP_ANNOTATION).size() - 1); // depends on control dependency: [if], data = [none] assert currentObject.getType() .equals(currentType) : "object expected to be " + currentObject.getType().getName() + ", not " + currentType.getName(); // depends on control dependency: [if], data = [none] assert unknownAncestors == 0 : "error in administration " + currentObject.getType().getName(); // depends on control dependency: [if], data = [none] currentObject.setRealOffsetEnd(lastOffset); // depends on control dependency: [if], data = [none] idPositions.put(currentObject.getId(), currentObject.getPositions()); // depends on control dependency: [if], data = [none] idOffsets.put(currentObject.getId(), currentObject.getOffset()); // depends on control dependency: [if], data = [none] currentObject.updateMappings(idPositions, idOffsets); // depends on control dependency: [if], data = [none] unknownAncestors = currentObject.getUnknownAncestorNumber(); // depends on control dependency: [if], data = [none] computeMappingsFromObject(mtasTokenIdFactory, currentObject, currentList, updateList); // depends on control dependency: [if], data = [none] } else { // this shouldn't happen } // check for relation annotation } else if (!currentList.get(MAPPING_TYPE_RELATION_ANNOTATION) .isEmpty()) { if ((currentType = relationAnnotationTypes .get(qname)) != null) { currentObject = currentList .get(MAPPING_TYPE_RELATION_ANNOTATION).remove(currentList .get(MAPPING_TYPE_RELATION_ANNOTATION).size() - 1); // depends on control dependency: [if], data = [none] assert currentObject.getType() .equals(currentType) : "object expected to be " + currentObject.getType().getName() + ", not " + currentType.getName(); // depends on control dependency: [if], data = [none] assert unknownAncestors == 0 : "error in administration " + currentObject.getType().getName(); // depends on control dependency: [if], data = [none] currentObject.setRealOffsetEnd(lastOffset); // depends on control dependency: [if], data = [none] idPositions.put(currentObject.getId(), currentObject.getPositions()); // depends on control dependency: [if], data = [none] idOffsets.put(currentObject.getId(), currentObject.getOffset()); // depends on control dependency: [if], data = [none] currentObject.updateMappings(idPositions, idOffsets); // depends on control dependency: [if], data = [none] unknownAncestors = currentObject.getUnknownAncestorNumber(); // depends on control dependency: [if], data = [none] computeMappingsFromObject(mtasTokenIdFactory, currentObject, currentList, updateList); // depends on control dependency: [if], data = [none] } else { // this shouldn't happen } // check for relation } else if (!currentList.get(MAPPING_TYPE_RELATION).isEmpty()) { if ((currentType = relationTypes.get(qname)) != null) { currentObject = currentList.get(MAPPING_TYPE_RELATION).remove( currentList.get(MAPPING_TYPE_RELATION).size() - 1); // depends on control dependency: [if], data = [none] assert currentObject.getType() .equals(currentType) : "object expected to be " + currentObject.getType().getName() + ", not " + currentType.getName(); // depends on control dependency: [if], data = [none] assert unknownAncestors == 0 : "error in administration " + currentObject.getType().getName(); // depends on control dependency: [if], data = [none] // ignore text: should not occur currentObject.setRealOffsetEnd(lastOffset); // depends on control dependency: [if], data = [none] idPositions.put(currentObject.getId(), currentObject.getPositions()); // depends on control dependency: [if], data = [none] idOffsets.put(currentObject.getId(), currentObject.getOffset()); // depends on control dependency: [if], data = [none] currentObject.updateMappings(idPositions, idOffsets); // depends on control dependency: [if], data = [none] unknownAncestors = currentObject.getUnknownAncestorNumber(); // depends on control dependency: [if], data = [none] computeMappingsFromObject(mtasTokenIdFactory, currentObject, currentList, updateList); // depends on control dependency: [if], data = [none] } else { // this shouldn't happen } // check for group } else if (!currentList.get(MAPPING_TYPE_GROUP).isEmpty()) { if ((currentType = groupTypes.get(qname)) != null) { currentObject = currentList.get(MAPPING_TYPE_GROUP) .remove(currentList.get(MAPPING_TYPE_GROUP).size() - 1); // depends on control dependency: [if], data = [none] assert currentObject.getType() .equals(currentType) : "object expected to be " + currentObject.getType().getName() + ", not " + currentType.getName(); // depends on control dependency: [if], data = [none] assert unknownAncestors == 0 : "error in administration " + currentObject.getType().getName(); // depends on control dependency: [if], data = [none] // ignore text: should not occur currentObject.setRealOffsetEnd(lastOffset); // depends on control dependency: [if], data = [none] idPositions.put(currentObject.getId(), currentObject.getPositions()); // depends on control dependency: [if], data = [none] idOffsets.put(currentObject.getId(), currentObject.getOffset()); // depends on control dependency: [if], data = [none] currentObject.updateMappings(idPositions, idOffsets); // depends on control dependency: [if], data = [none] unknownAncestors = currentObject.getUnknownAncestorNumber(); // depends on control dependency: [if], data = [none] computeMappingsFromObject(mtasTokenIdFactory, currentObject, currentList, updateList); // depends on control dependency: [if], data = [none] } else { unknownAncestors--; // depends on control dependency: [if], data = [none] } } else if (qname.equals(getQName("text"))) { parsingContent = false; // depends on control dependency: [if], data = [none] assert unknownAncestors == 0 : "error in administration unknownAncestors"; assert currentList.get(MAPPING_TYPE_REF) .isEmpty() : "error in administration references"; assert currentList.get(MAPPING_TYPE_GROUP) .isEmpty() : "error in administration groups"; assert currentList.get(MAPPING_TYPE_GROUP_ANNOTATION) .isEmpty() : "error in administration groupAnnotations"; assert currentList.get(MAPPING_TYPE_WORD) .isEmpty() : "error in administration words"; assert currentList.get(MAPPING_TYPE_WORD_ANNOTATION) .isEmpty() : "error in administration wordAnnotations"; assert currentList.get(MAPPING_TYPE_RELATION) .isEmpty() : "error in administration relations"; assert currentList.get(MAPPING_TYPE_RELATION_ANNOTATION) .isEmpty() : "error in administration relationAnnotations"; } } // forget text textContent = null; break; case XMLStreamConstants.CHARACTERS: // set offset (end of start-element) lastOffset = streamReader.getLocation().getCharacterOffset(); // check for text if (streamReader.hasText()) { textContent = streamReader.getText(); // depends on control dependency: [if], data = [none] } if (currentObject != null && unknownAncestors.equals(0)) { currentObject.addText(textContent); // depends on control dependency: [if], data = [none] } break; default: break; } if (!streamReader.hasNext()) { break; } event = streamReader.next(); // depends on control dependency: [while], data = [none] } } finally { streamReader.close(); } // final checks assert unknownAncestors == 0 : "error in administration unknownAncestors"; assert hasRoot : "no " + rootTag; } catch (XMLStreamException e) { log.debug(e); throw new MtasParserException("No valid XML: " + e.getMessage()); } // update tokens with variable for (Entry<Integer, Set<String>> updateItem : updateList .get(UPDATE_TYPE_VARIABLE).entrySet()) { MtasToken token = tokenCollection.get(updateItem.getKey()); String encodedPrefix = token.getPrefix(); String encodedPostfix = token.getPostfix(); token.setValue(decodeAndUpdateWithVariables(encodedPrefix, encodedPostfix, variables)); } // update tokens with offset for (Entry<Integer, Set<String>> updateItem : updateList .get(UPDATE_TYPE_OFFSET).entrySet()) { Set<String> refIdList = new HashSet<>(); for (String refId : updateItem.getValue()) { if (idPositions.containsKey(refId)) { refIdList.add(refId); // depends on control dependency: [if], data = [none] } if (relationKeyMap.containsKey(refId)) { refIdList.addAll(recursiveCollect(refId, relationKeyMap, 10)); // depends on control dependency: [if], data = [none] } } for (String refId : refIdList) { Integer[] refOffset = idOffsets.get(refId); Integer tokenId = updateItem.getKey(); if (tokenId != null && refOffset != null) { MtasToken token = tokenCollection.get(tokenId); token.addOffset(refOffset[0], refOffset[1]); // depends on control dependency: [if], data = [none] } } } // update tokens with position for (Entry<Integer, Set<String>> updateItem : updateList .get(UPDATE_TYPE_POSITION).entrySet()) { HashSet<String> refIdList = new HashSet<>(); for (String refId : updateItem.getValue()) { if (idPositions.containsKey(refId)) { refIdList.add(refId); // depends on control dependency: [if], data = [none] } if (relationKeyMap.containsKey(refId)) { refIdList.addAll(recursiveCollect(refId, relationKeyMap, 10)); // depends on control dependency: [if], data = [none] } } for (String refId : refIdList) { Set<Integer> refPositions = idPositions.get(refId); Integer tokenId = updateItem.getKey(); if (tokenId != null && refPositions != null) { MtasToken token = tokenCollection.get(tokenId); token.addPositions(refPositions); // depends on control dependency: [if], data = [none] } } } // final check tokenCollection.check(autorepair, makeunique); return tokenCollection; } }
public class class_name { public static int getMaxIndex(DoubleMatrix1D v){ int maxIndex = -1; double maxValue = -Double.MAX_VALUE; for(int i=0; i<v.size(); i++){ if(v.getQuick(i)>maxValue){ maxIndex = i; maxValue = v.getQuick(i); } } return maxIndex; } }
public class class_name { public static int getMaxIndex(DoubleMatrix1D v){ int maxIndex = -1; double maxValue = -Double.MAX_VALUE; for(int i=0; i<v.size(); i++){ if(v.getQuick(i)>maxValue){ maxIndex = i; // depends on control dependency: [if], data = [none] maxValue = v.getQuick(i); // depends on control dependency: [if], data = [none] } } return maxIndex; } }
public class class_name { public static String getString(@NonNull final Context context, @StyleRes final int themeResourceId, @AttrRes final int resourceId) { Condition.INSTANCE.ensureNotNull(context, "The context may not be null"); TypedArray typedArray = null; try { typedArray = obtainStyledAttributes(context, themeResourceId, resourceId); String string = typedArray.getString(0); if (string == null) { throw new NotFoundException( "Resource ID #0x" + Integer.toHexString(resourceId) + " is not valid"); } return string; } finally { if (typedArray != null) { typedArray.recycle(); } } } }
public class class_name { public static String getString(@NonNull final Context context, @StyleRes final int themeResourceId, @AttrRes final int resourceId) { Condition.INSTANCE.ensureNotNull(context, "The context may not be null"); TypedArray typedArray = null; try { typedArray = obtainStyledAttributes(context, themeResourceId, resourceId); // depends on control dependency: [try], data = [none] String string = typedArray.getString(0); if (string == null) { throw new NotFoundException( "Resource ID #0x" + Integer.toHexString(resourceId) + " is not valid"); } return string; // depends on control dependency: [try], data = [none] } finally { if (typedArray != null) { typedArray.recycle(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void append(Map<?, ?> map) { if (map == null || map.size() == 0) return; for (Map.Entry<?, ?> entry : map.entrySet()) { put(StringConverter.toString(entry.getKey()), StringConverter.toNullableString(entry.getValue())); } } }
public class class_name { public void append(Map<?, ?> map) { if (map == null || map.size() == 0) return; for (Map.Entry<?, ?> entry : map.entrySet()) { put(StringConverter.toString(entry.getKey()), StringConverter.toNullableString(entry.getValue())); // depends on control dependency: [for], data = [entry] } } }
public class class_name { public String getDefaultSystemName() { // No system name set, check the base menus for domain or default properties Environment env = this.getEnvironment(); Map<String, Object> properties = new HashMap<String, Object>(); properties.put(DBConstants.SYSTEM_NAME, "base"); BaseApplication app = new MainApplication(env, properties, null); try { Task task = new AutoTask(app, null, properties); RecordOwner recordOwner = new BaseProcess(task, null, properties); Record menus = Record.makeRecordFromClassName(MenusModel.THICK_CLASS, recordOwner); menus.getField(Menus.CODE).setString(ResourceConstants.DEFAULT_RESOURCE); menus.setKeyArea(MenusModel.CODE_KEY); if (menus.seek(null)) return ((PropertiesField)menus.getField(Menus.PARAMS)).getProperty(DBConstants.SYSTEM_NAME); } catch (DBException e) { e.printStackTrace(); } finally { env.removeApplication(app); app.setEnvironment(null); app.free(); } return Utility.DEFAULT_SYSTEM_SUFFIX; } }
public class class_name { public String getDefaultSystemName() { // No system name set, check the base menus for domain or default properties Environment env = this.getEnvironment(); Map<String, Object> properties = new HashMap<String, Object>(); properties.put(DBConstants.SYSTEM_NAME, "base"); BaseApplication app = new MainApplication(env, properties, null); try { Task task = new AutoTask(app, null, properties); RecordOwner recordOwner = new BaseProcess(task, null, properties); Record menus = Record.makeRecordFromClassName(MenusModel.THICK_CLASS, recordOwner); menus.getField(Menus.CODE).setString(ResourceConstants.DEFAULT_RESOURCE); // depends on control dependency: [try], data = [none] menus.setKeyArea(MenusModel.CODE_KEY); // depends on control dependency: [try], data = [none] if (menus.seek(null)) return ((PropertiesField)menus.getField(Menus.PARAMS)).getProperty(DBConstants.SYSTEM_NAME); } catch (DBException e) { e.printStackTrace(); } finally { // depends on control dependency: [catch], data = [none] env.removeApplication(app); app.setEnvironment(null); app.free(); } return Utility.DEFAULT_SYSTEM_SUFFIX; } }
public class class_name { public static int compareVersion(String v1, String v2) { if (v1.equals(v2)) { return 0; } String[] version1Array = v1.split("[._]"); String[] version2Array = v2.split("[._]"); int index = 0; int minLen = Math.min(version1Array.length, version2Array.length); long diff = 0; while (index < minLen && (diff = Long.parseLong(version1Array[index]) - Long.parseLong(version2Array[index])) == 0) { index++; } if (diff == 0) { for (int i = index; i < version1Array.length; i++) { if (Long.parseLong(version1Array[i]) > 0) { return 1; } } for (int i = index; i < version2Array.length; i++) { if (Long.parseLong(version2Array[i]) > 0) { return -1; } } return 0; } else { return diff > 0 ? 1 : -1; } } }
public class class_name { public static int compareVersion(String v1, String v2) { if (v1.equals(v2)) { return 0; // depends on control dependency: [if], data = [none] } String[] version1Array = v1.split("[._]"); String[] version2Array = v2.split("[._]"); int index = 0; int minLen = Math.min(version1Array.length, version2Array.length); long diff = 0; while (index < minLen && (diff = Long.parseLong(version1Array[index]) - Long.parseLong(version2Array[index])) == 0) { index++; // depends on control dependency: [while], data = [none] } if (diff == 0) { for (int i = index; i < version1Array.length; i++) { if (Long.parseLong(version1Array[i]) > 0) { return 1; // depends on control dependency: [if], data = [none] } } for (int i = index; i < version2Array.length; i++) { if (Long.parseLong(version2Array[i]) > 0) { return -1; // depends on control dependency: [if], data = [none] } } return 0; // depends on control dependency: [if], data = [none] } else { return diff > 0 ? 1 : -1; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void deletePageOrResource(Resource resource) { Page configPage = resource.adaptTo(Page.class); if (configPage != null) { try { log.trace("! Delete page {}", configPage.getPath()); PageManager pageManager = configPage.getPageManager(); pageManager.delete(configPage, false); } catch (WCMException ex) { throw convertWCMException("Unable to delete configuration page at " + resource.getPath(), ex); } } else { try { log.trace("! Delete resource {}", resource.getPath()); resource.getResourceResolver().delete(resource); } catch (PersistenceException ex) { throw convertPersistenceException("Unable to delete configuration resource at " + resource.getPath(), ex); } } } }
public class class_name { public static void deletePageOrResource(Resource resource) { Page configPage = resource.adaptTo(Page.class); if (configPage != null) { try { log.trace("! Delete page {}", configPage.getPath()); // depends on control dependency: [try], data = [none] PageManager pageManager = configPage.getPageManager(); pageManager.delete(configPage, false); // depends on control dependency: [try], data = [none] } catch (WCMException ex) { throw convertWCMException("Unable to delete configuration page at " + resource.getPath(), ex); } // depends on control dependency: [catch], data = [none] } else { try { log.trace("! Delete resource {}", resource.getPath()); // depends on control dependency: [try], data = [none] resource.getResourceResolver().delete(resource); // depends on control dependency: [try], data = [none] } catch (PersistenceException ex) { throw convertPersistenceException("Unable to delete configuration resource at " + resource.getPath(), ex); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { private BytesRef computeMaximumFilteredPayload(String value, BytesRef payload, String filter) { // do magic with filter if (value != null) { if (payload != null) { Float payloadFloat = PayloadHelper.decodeFloat(payload.bytes, payload.offset); Float valueFloat = Float.parseFloat(value); return new BytesRef( PayloadHelper.encodeFloat(Math.max(payloadFloat, valueFloat))); } else { return new BytesRef(PayloadHelper.encodeFloat(Float.parseFloat(value))); } } else { return payload; } } }
public class class_name { private BytesRef computeMaximumFilteredPayload(String value, BytesRef payload, String filter) { // do magic with filter if (value != null) { if (payload != null) { Float payloadFloat = PayloadHelper.decodeFloat(payload.bytes, payload.offset); Float valueFloat = Float.parseFloat(value); return new BytesRef( PayloadHelper.encodeFloat(Math.max(payloadFloat, valueFloat))); // depends on control dependency: [if], data = [none] } else { return new BytesRef(PayloadHelper.encodeFloat(Float.parseFloat(value))); // depends on control dependency: [if], data = [none] } } else { return payload; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override @SuppressWarnings("unchecked") public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if (mVerbose) Log.v(TAG, "onCreateViewHolder: " + viewType); final RecyclerView.ViewHolder holder = mOnCreateViewHolderListener.onPreCreateViewHolder(this, parent, viewType); //set the adapter holder.itemView.setTag(R.id.fastadapter_item_adapter, FastAdapter.this); if (mAttachDefaultListeners) { //handle click behavior EventHookUtil.attachToView(fastAdapterViewClickListener, holder, holder.itemView); //handle long click behavior EventHookUtil.attachToView(fastAdapterViewLongClickListener, holder, holder.itemView); //handle touch behavior EventHookUtil.attachToView(fastAdapterViewTouchListener, holder, holder.itemView); } return mOnCreateViewHolderListener.onPostCreateViewHolder(this, holder); } }
public class class_name { @Override @SuppressWarnings("unchecked") public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if (mVerbose) Log.v(TAG, "onCreateViewHolder: " + viewType); final RecyclerView.ViewHolder holder = mOnCreateViewHolderListener.onPreCreateViewHolder(this, parent, viewType); //set the adapter holder.itemView.setTag(R.id.fastadapter_item_adapter, FastAdapter.this); if (mAttachDefaultListeners) { //handle click behavior EventHookUtil.attachToView(fastAdapterViewClickListener, holder, holder.itemView); // depends on control dependency: [if], data = [none] //handle long click behavior EventHookUtil.attachToView(fastAdapterViewLongClickListener, holder, holder.itemView); // depends on control dependency: [if], data = [none] //handle touch behavior EventHookUtil.attachToView(fastAdapterViewTouchListener, holder, holder.itemView); // depends on control dependency: [if], data = [none] } return mOnCreateViewHolderListener.onPostCreateViewHolder(this, holder); } }
public class class_name { @Override public byte[] encrypt(byte[] data, KeyType keyType) { final Key key = getKeyByType(keyType); final int inputLen = data.length; final int maxBlockSize = this.encryptBlockSize < 0 ? inputLen : this.encryptBlockSize; lock.lock(); try (ByteArrayOutputStream out = new ByteArrayOutputStream();) { cipher.init(Cipher.ENCRYPT_MODE, key); int offSet = 0; byte[] cache; // 剩余长度 int remainLength = inputLen; // 对数据分段加密 while (remainLength > 0) { cache = cipher.doFinal(data, offSet, Math.min(remainLength, maxBlockSize)); out.write(cache, 0, cache.length); offSet += maxBlockSize; remainLength = inputLen - offSet; } return out.toByteArray(); } catch (Exception e) { throw new CryptoException(e); } finally { lock.unlock(); } } }
public class class_name { @Override public byte[] encrypt(byte[] data, KeyType keyType) { final Key key = getKeyByType(keyType); final int inputLen = data.length; final int maxBlockSize = this.encryptBlockSize < 0 ? inputLen : this.encryptBlockSize; lock.lock(); try (ByteArrayOutputStream out = new ByteArrayOutputStream();) { cipher.init(Cipher.ENCRYPT_MODE, key); int offSet = 0; byte[] cache; // 剩余长度 int remainLength = inputLen; // 对数据分段加密 while (remainLength > 0) { cache = cipher.doFinal(data, offSet, Math.min(remainLength, maxBlockSize)); // depends on control dependency: [while], data = [(remainLength] out.write(cache, 0, cache.length); // depends on control dependency: [while], data = [none] offSet += maxBlockSize; // depends on control dependency: [while], data = [none] remainLength = inputLen - offSet; // depends on control dependency: [while], data = [none] } return out.toByteArray(); } catch (Exception e) { throw new CryptoException(e); } finally { lock.unlock(); } } }
public class class_name { public ExtensionElement removeExtension(ExtensionElement extension) { String key = XmppStringUtils.generateKey(extension.getElementName(), extension.getNamespace()); synchronized (packetExtensions) { List<ExtensionElement> list = packetExtensions.getAll(key); boolean removed = list.remove(extension); if (removed) { return extension; } } return null; } }
public class class_name { public ExtensionElement removeExtension(ExtensionElement extension) { String key = XmppStringUtils.generateKey(extension.getElementName(), extension.getNamespace()); synchronized (packetExtensions) { List<ExtensionElement> list = packetExtensions.getAll(key); boolean removed = list.remove(extension); if (removed) { return extension; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public static void forward( String contextRelativePath, RequestDispatcher dispatcher, HttpServletRequest request, HttpServletResponse response, Map<String,?> args ) throws ServletException, IOException { // Track original page when first accessed final String oldOriginal = getOriginalPage(request); try { // Set original request path if not already set if(oldOriginal == null) { setOriginalPage(request, request.getServletPath()); } // Keep old dispatch page to restore final String oldDispatchPage = getDispatchedPage(request); try { // Store as new relative path source setDispatchedPage(request, contextRelativePath); // Keep old arguments to restore final Object oldArgs = request.getAttribute(Dispatcher.ARG_MAP_REQUEST_ATTRIBUTE_NAME); try { // Set new arguments request.setAttribute( Dispatcher.ARG_MAP_REQUEST_ATTRIBUTE_NAME, args==null ? null : AoCollections.optimalUnmodifiableMap(args) ); // Perform dispatch dispatcher.forward(request, response); } finally { // Restore any previous args request.setAttribute(Dispatcher.ARG_MAP_REQUEST_ATTRIBUTE_NAME, oldArgs); } } finally { setDispatchedPage(request, oldDispatchPage); } } finally { if(oldOriginal == null) { setOriginalPage(request, null); } } } }
public class class_name { public static void forward( String contextRelativePath, RequestDispatcher dispatcher, HttpServletRequest request, HttpServletResponse response, Map<String,?> args ) throws ServletException, IOException { // Track original page when first accessed final String oldOriginal = getOriginalPage(request); try { // Set original request path if not already set if(oldOriginal == null) { setOriginalPage(request, request.getServletPath()); // depends on control dependency: [if], data = [none] } // Keep old dispatch page to restore final String oldDispatchPage = getDispatchedPage(request); try { // Store as new relative path source setDispatchedPage(request, contextRelativePath); // depends on control dependency: [try], data = [none] // Keep old arguments to restore final Object oldArgs = request.getAttribute(Dispatcher.ARG_MAP_REQUEST_ATTRIBUTE_NAME); try { // Set new arguments request.setAttribute( Dispatcher.ARG_MAP_REQUEST_ATTRIBUTE_NAME, args==null ? null : AoCollections.optimalUnmodifiableMap(args) ); // depends on control dependency: [try], data = [none] // Perform dispatch dispatcher.forward(request, response); // depends on control dependency: [try], data = [none] } finally { // Restore any previous args request.setAttribute(Dispatcher.ARG_MAP_REQUEST_ATTRIBUTE_NAME, oldArgs); } } finally { setDispatchedPage(request, oldDispatchPage); } } finally { if(oldOriginal == null) { setOriginalPage(request, null); // depends on control dependency: [if], data = [null)] } } } }
public class class_name { private void generateBeanInfo(ClassDoc classDoc) throws Exception { String beanInfoJavaFileName = classDoc.getTypeNameForFile() + "BeanInfo.java"; String beanInfoJavaFilePath = beanInfoJavaFileName; String packageName = classDoc.getPackageName(); if (packageName != null) { // Create the file path using the package beanInfoJavaFilePath = packageName.replace('.', '/') + "/" + beanInfoJavaFileName; } File dest = null; if (mDest != null) { dest = new File(mDest, beanInfoJavaFilePath); } else { dest = new File(beanInfoJavaFilePath); } if (dest.exists()) { if (dest.canWrite()) { //printWarning("File exists: " + beanInfoJavaFileName); } else { // Attempt to overwrite the file via delete if (dest.delete()) { //printWarning("File exists: " + beanInfoJavaFileName); } else { printWarning("File exists and cannot be written: " + beanInfoJavaFileName); return; } } } BeanDocContext context = null; try { context = new BeanDocContext(this, dest); if (mTemplate != null) { printNotice("Creating BeanInfo: " + beanInfoJavaFilePath); mTemplate.execute(context, new Object[] { classDoc }); } else { printWarning("No template"); } } finally { if (context != null) { context.close(); } } } }
public class class_name { private void generateBeanInfo(ClassDoc classDoc) throws Exception { String beanInfoJavaFileName = classDoc.getTypeNameForFile() + "BeanInfo.java"; String beanInfoJavaFilePath = beanInfoJavaFileName; String packageName = classDoc.getPackageName(); if (packageName != null) { // Create the file path using the package beanInfoJavaFilePath = packageName.replace('.', '/') + "/" + beanInfoJavaFileName; } File dest = null; if (mDest != null) { dest = new File(mDest, beanInfoJavaFilePath); } else { dest = new File(beanInfoJavaFilePath); } if (dest.exists()) { if (dest.canWrite()) { //printWarning("File exists: " + beanInfoJavaFileName); } else { // Attempt to overwrite the file via delete if (dest.delete()) { //printWarning("File exists: " + beanInfoJavaFileName); } else { printWarning("File exists and cannot be written: " + beanInfoJavaFileName); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } } BeanDocContext context = null; try { context = new BeanDocContext(this, dest); if (mTemplate != null) { printNotice("Creating BeanInfo: " + beanInfoJavaFilePath); mTemplate.execute(context, new Object[] { classDoc }); } else { printWarning("No template"); } } finally { if (context != null) { context.close(); } } } }
public class class_name { public static Button createIconButton(String name, String description, Resource icon, String buttonStyle) { Button button = new Button(name); button.setIcon(icon, name); button.setDescription(description); button.addStyleName(OpenCmsTheme.APP_BUTTON); button.addStyleName(ValoTheme.BUTTON_BORDERLESS); button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); if (buttonStyle != null) { button.addStyleName(buttonStyle); } if ((icon instanceof CmsCssIcon) && ((CmsCssIcon)icon).hasAdditionalButtonStyle()) { button.addStyleName(((CmsCssIcon)icon).getAdditionalButtonStyle()); } return button; } }
public class class_name { public static Button createIconButton(String name, String description, Resource icon, String buttonStyle) { Button button = new Button(name); button.setIcon(icon, name); button.setDescription(description); button.addStyleName(OpenCmsTheme.APP_BUTTON); button.addStyleName(ValoTheme.BUTTON_BORDERLESS); button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); if (buttonStyle != null) { button.addStyleName(buttonStyle); // depends on control dependency: [if], data = [(buttonStyle] } if ((icon instanceof CmsCssIcon) && ((CmsCssIcon)icon).hasAdditionalButtonStyle()) { button.addStyleName(((CmsCssIcon)icon).getAdditionalButtonStyle()); // depends on control dependency: [if], data = [none] } return button; } }
public class class_name { public String getExpandedString(String key, int behavior) { String s = getString(key); Matcher matcher = sysPropVarPattern.matcher(s); int previousEnd = 0; StringBuffer sb = new StringBuffer(); String varName, varValue; String condlVal; // Conditional : value while (matcher.find()) { varName = matcher.group(1); condlVal = ((matcher.groupCount() > 1) ? matcher.group(2) : null); varValue = System.getProperty(varName); if (condlVal != null) { // Replace varValue (the value to be substituted), with // the post-:+ portion of the expression. varValue = ((varValue == null) ? "" : condlVal.replaceAll("\\Q$" + varName + "\\E\\b", RefCapablePropertyResourceBundle.literalize( varValue))); } if (varValue == null) switch (behavior) { case THROW_BEHAVIOR: throw new RuntimeException( "No Sys Property set for variable '" + varName + "' in property value (" + s + ")."); case EMPTYSTRING_BEHAVIOR: varValue = ""; case NOOP_BEHAVIOR: break; default: throw new RuntimeException( "Undefined value for behavior: " + behavior); } sb.append(s.substring(previousEnd, matcher.start()) + ((varValue == null) ? matcher.group() : varValue)); previousEnd = matcher.end(); } return (previousEnd < 1) ? s : (sb.toString() + s.substring(previousEnd)); } }
public class class_name { public String getExpandedString(String key, int behavior) { String s = getString(key); Matcher matcher = sysPropVarPattern.matcher(s); int previousEnd = 0; StringBuffer sb = new StringBuffer(); String varName, varValue; String condlVal; // Conditional : value while (matcher.find()) { varName = matcher.group(1); // depends on control dependency: [while], data = [none] condlVal = ((matcher.groupCount() > 1) ? matcher.group(2) : null); // depends on control dependency: [while], data = [none] varValue = System.getProperty(varName); // depends on control dependency: [while], data = [none] if (condlVal != null) { // Replace varValue (the value to be substituted), with // the post-:+ portion of the expression. varValue = ((varValue == null) ? "" : condlVal.replaceAll("\\Q$" + varName + "\\E\\b", RefCapablePropertyResourceBundle.literalize( varValue))); // depends on control dependency: [if], data = [null)] } if (varValue == null) switch (behavior) { case THROW_BEHAVIOR: throw new RuntimeException( "No Sys Property set for variable '" + varName + "' in property value (" + s + ")."); case EMPTYSTRING_BEHAVIOR: varValue = ""; case NOOP_BEHAVIOR: break; default: throw new RuntimeException( "Undefined value for behavior: " + behavior); } sb.append(s.substring(previousEnd, matcher.start()) + ((varValue == null) ? matcher.group() : varValue)); // depends on control dependency: [while], data = [none] previousEnd = matcher.end(); // depends on control dependency: [while], data = [none] } return (previousEnd < 1) ? s : (sb.toString() + s.substring(previousEnd)); } }
public class class_name { public boolean runScheduler() { IScheduler scheduler = null; String statemgrClass = Context.stateManagerClass(config); IStateManager statemgr; try { // create an instance of state manager statemgr = ReflectionUtils.newInstance(statemgrClass); } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) { LOG.log(Level.SEVERE, "Failed to instantiate instances using config: " + config, e); return false; } SchedulerServer server = null; boolean isSuccessful = false; // Put it in a try block so that we can always clean resources try { // initialize the state manager statemgr.initialize(config); // TODO(mfu): timeout should read from config SchedulerStateManagerAdaptor adaptor = new SchedulerStateManagerAdaptor(statemgr, 5000); // get a packed plan and schedule it PackingPlans.PackingPlan serializedPackingPlan = adaptor.getPackingPlan(topology.getName()); if (serializedPackingPlan == null) { LOG.log(Level.SEVERE, "Failed to fetch PackingPlan for topology:{0} from the state manager", topology.getName()); return false; } LOG.log(Level.INFO, "Packing plan fetched from state: {0}", serializedPackingPlan); PackingPlan packedPlan = new PackingPlanProtoDeserializer().fromProto(serializedPackingPlan); // build the runtime config LauncherUtils launcherUtils = LauncherUtils.getInstance(); Config runtime = Config.newBuilder() .putAll(launcherUtils.createPrimaryRuntime(topology)) .putAll(launcherUtils.createAdaptorRuntime(adaptor)) .put(Key.SCHEDULER_SHUTDOWN, getShutdown()) .put(Key.SCHEDULER_PROPERTIES, properties) .build(); Config ytruntime = launcherUtils.createConfigWithPackingDetails(runtime, packedPlan); // invoke scheduler scheduler = launcherUtils.getSchedulerInstance(config, ytruntime); if (scheduler == null) { return false; } isSuccessful = scheduler.onSchedule(packedPlan); if (!isSuccessful) { LOG.severe("Failed to schedule topology"); return false; } // Failures in server initialization throw exceptions // get the scheduler server endpoint for receiving requests server = getServer(ytruntime, scheduler, schedulerServerPort); // start the server to manage runtime requests server.start(); // write the scheduler location to state manager // Make sure it happens after IScheduler.onScheduler isSuccessful = SchedulerUtils.setSchedulerLocation( runtime, String.format("%s:%d", server.getHost(), server.getPort()), scheduler); if (isSuccessful) { // wait until kill request or some interrupt occurs if the scheduler starts successfully LOG.info("Waiting for termination... "); Runtime.schedulerShutdown(ytruntime).await(); } } catch (IOException e) { LOG.log(Level.SEVERE, "Failed to start server", e); return false; } finally { // Clean the resources if (server != null) { server.stop(); } // 4. Close the resources SysUtils.closeIgnoringExceptions(scheduler); SysUtils.closeIgnoringExceptions(statemgr); } return isSuccessful; } }
public class class_name { public boolean runScheduler() { IScheduler scheduler = null; String statemgrClass = Context.stateManagerClass(config); IStateManager statemgr; try { // create an instance of state manager statemgr = ReflectionUtils.newInstance(statemgrClass); // depends on control dependency: [try], data = [none] } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) { LOG.log(Level.SEVERE, "Failed to instantiate instances using config: " + config, e); return false; } // depends on control dependency: [catch], data = [none] SchedulerServer server = null; boolean isSuccessful = false; // Put it in a try block so that we can always clean resources try { // initialize the state manager statemgr.initialize(config); // depends on control dependency: [try], data = [none] // TODO(mfu): timeout should read from config SchedulerStateManagerAdaptor adaptor = new SchedulerStateManagerAdaptor(statemgr, 5000); // get a packed plan and schedule it PackingPlans.PackingPlan serializedPackingPlan = adaptor.getPackingPlan(topology.getName()); if (serializedPackingPlan == null) { LOG.log(Level.SEVERE, "Failed to fetch PackingPlan for topology:{0} from the state manager", topology.getName()); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } LOG.log(Level.INFO, "Packing plan fetched from state: {0}", serializedPackingPlan); // depends on control dependency: [try], data = [none] PackingPlan packedPlan = new PackingPlanProtoDeserializer().fromProto(serializedPackingPlan); // build the runtime config LauncherUtils launcherUtils = LauncherUtils.getInstance(); Config runtime = Config.newBuilder() .putAll(launcherUtils.createPrimaryRuntime(topology)) .putAll(launcherUtils.createAdaptorRuntime(adaptor)) .put(Key.SCHEDULER_SHUTDOWN, getShutdown()) .put(Key.SCHEDULER_PROPERTIES, properties) .build(); Config ytruntime = launcherUtils.createConfigWithPackingDetails(runtime, packedPlan); // invoke scheduler scheduler = launcherUtils.getSchedulerInstance(config, ytruntime); // depends on control dependency: [try], data = [none] if (scheduler == null) { return false; // depends on control dependency: [if], data = [none] } isSuccessful = scheduler.onSchedule(packedPlan); // depends on control dependency: [try], data = [none] if (!isSuccessful) { LOG.severe("Failed to schedule topology"); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } // Failures in server initialization throw exceptions // get the scheduler server endpoint for receiving requests server = getServer(ytruntime, scheduler, schedulerServerPort); // depends on control dependency: [try], data = [none] // start the server to manage runtime requests server.start(); // depends on control dependency: [try], data = [none] // write the scheduler location to state manager // Make sure it happens after IScheduler.onScheduler isSuccessful = SchedulerUtils.setSchedulerLocation( runtime, String.format("%s:%d", server.getHost(), server.getPort()), scheduler); // depends on control dependency: [try], data = [none] if (isSuccessful) { // wait until kill request or some interrupt occurs if the scheduler starts successfully LOG.info("Waiting for termination... "); // depends on control dependency: [if], data = [none] Runtime.schedulerShutdown(ytruntime).await(); // depends on control dependency: [if], data = [none] } } catch (IOException e) { LOG.log(Level.SEVERE, "Failed to start server", e); return false; } finally { // depends on control dependency: [catch], data = [none] // Clean the resources if (server != null) { server.stop(); // depends on control dependency: [if], data = [none] } // 4. Close the resources SysUtils.closeIgnoringExceptions(scheduler); SysUtils.closeIgnoringExceptions(statemgr); } return isSuccessful; } }
public class class_name { private synchronized Collection<GenericMatchInfo> findLocal(String text, int start, EnumSet<GenericNameType> types) { GenericNameSearchHandler handler = new GenericNameSearchHandler(types); _gnamesTrie.find(text, start, handler); if (handler.getMaxMatchLen() == (text.length() - start) || _gnamesTrieFullyLoaded) { // perfect match return handler.getMatches(); } // All names are not yet loaded into the local trie. // Load all available names into the trie. This could be very heavy. Set<String> tzIDs = TimeZone.getAvailableIDs(SystemTimeZoneType.CANONICAL, null, null); for (String tzID : tzIDs) { loadStrings(tzID); } _gnamesTrieFullyLoaded = true; // now, try it again handler.resetResults(); _gnamesTrie.find(text, start, handler); return handler.getMatches(); } }
public class class_name { private synchronized Collection<GenericMatchInfo> findLocal(String text, int start, EnumSet<GenericNameType> types) { GenericNameSearchHandler handler = new GenericNameSearchHandler(types); _gnamesTrie.find(text, start, handler); if (handler.getMaxMatchLen() == (text.length() - start) || _gnamesTrieFullyLoaded) { // perfect match return handler.getMatches(); // depends on control dependency: [if], data = [none] } // All names are not yet loaded into the local trie. // Load all available names into the trie. This could be very heavy. Set<String> tzIDs = TimeZone.getAvailableIDs(SystemTimeZoneType.CANONICAL, null, null); for (String tzID : tzIDs) { loadStrings(tzID); // depends on control dependency: [for], data = [tzID] } _gnamesTrieFullyLoaded = true; // now, try it again handler.resetResults(); _gnamesTrie.find(text, start, handler); return handler.getMatches(); } }
public class class_name { private void truncateFile(List<FileEntry> entries) { long startTime = 0; if (trace) startTime = timeService.wallClockTime(); int reclaimedSpace = 0; int removedEntries = 0; long truncateOffset = -1; for (Iterator<FileEntry> it = entries.iterator() ; it.hasNext(); ) { FileEntry fe = it.next(); // Till we have free entries at the end of the file, // we can remove them and contract the file to release disk // space. if (!fe.isLocked() && ((fe.offset + fe.size) == filePos)) { truncateOffset = fe.offset; filePos = fe.offset; freeList.remove(fe); it.remove(); reclaimedSpace += fe.size; removedEntries++; } else { break; } } if (truncateOffset > 0) { try { channel.truncate(truncateOffset); } catch (IOException e) { throw new PersistenceException("Error while truncating file", e); } } if (trace) { log.tracef("Removed entries: %d, Reclaimed Space: %d, Free Entries %d", removedEntries, reclaimedSpace, freeList.size()); log.tracef("Time taken for truncateFile: %d (ms)", timeService.wallClockTime() - startTime); } } }
public class class_name { private void truncateFile(List<FileEntry> entries) { long startTime = 0; if (trace) startTime = timeService.wallClockTime(); int reclaimedSpace = 0; int removedEntries = 0; long truncateOffset = -1; for (Iterator<FileEntry> it = entries.iterator() ; it.hasNext(); ) { FileEntry fe = it.next(); // Till we have free entries at the end of the file, // we can remove them and contract the file to release disk // space. if (!fe.isLocked() && ((fe.offset + fe.size) == filePos)) { truncateOffset = fe.offset; // depends on control dependency: [if], data = [none] filePos = fe.offset; // depends on control dependency: [if], data = [none] freeList.remove(fe); // depends on control dependency: [if], data = [none] it.remove(); // depends on control dependency: [if], data = [none] reclaimedSpace += fe.size; // depends on control dependency: [if], data = [none] removedEntries++; // depends on control dependency: [if], data = [none] } else { break; } } if (truncateOffset > 0) { try { channel.truncate(truncateOffset); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new PersistenceException("Error while truncating file", e); } // depends on control dependency: [catch], data = [none] } if (trace) { log.tracef("Removed entries: %d, Reclaimed Space: %d, Free Entries %d", removedEntries, reclaimedSpace, freeList.size()); // depends on control dependency: [if], data = [none] log.tracef("Time taken for truncateFile: %d (ms)", timeService.wallClockTime() - startTime); // depends on control dependency: [if], data = [none] } } }
public class class_name { private ArrayList<Pair<String, ?>> getKeyValues() { ArrayList<Pair<String, ?>> keyValPair = new ArrayList<>(); Map<String, ?> map = preferenceUtils.getAll(); Set<String> strings = map.keySet(); Object value; for (String key : strings) { if (!key.contains(SharedPreferenceUtils.keyTestMode)) { value = map.get(key); keyValPair.add(new Pair<String, Object>(key, value)); } } return keyValPair; } }
public class class_name { private ArrayList<Pair<String, ?>> getKeyValues() { ArrayList<Pair<String, ?>> keyValPair = new ArrayList<>(); Map<String, ?> map = preferenceUtils.getAll(); Set<String> strings = map.keySet(); Object value; for (String key : strings) { if (!key.contains(SharedPreferenceUtils.keyTestMode)) { value = map.get(key); // depends on control dependency: [if], data = [none] keyValPair.add(new Pair<String, Object>(key, value)); // depends on control dependency: [if], data = [none] } } return keyValPair; } }
public class class_name { private void addType(final Queue<String> typeQueue, final AbstractSchemaNode schemaNode) { final String _extendsClass = schemaNode.getProperty(SchemaNode.extendsClass); if (_extendsClass != null) { typeQueue.add(StringUtils.substringBefore(_extendsClass, "<")); } final String _interfaces = schemaNode.getProperty(SchemaNode.implementsInterfaces); if (_interfaces != null) { for (final String iface : _interfaces.split("[, ]+")) { typeQueue.add(iface); } } } }
public class class_name { private void addType(final Queue<String> typeQueue, final AbstractSchemaNode schemaNode) { final String _extendsClass = schemaNode.getProperty(SchemaNode.extendsClass); if (_extendsClass != null) { typeQueue.add(StringUtils.substringBefore(_extendsClass, "<")); // depends on control dependency: [if], data = [(_extendsClass] } final String _interfaces = schemaNode.getProperty(SchemaNode.implementsInterfaces); if (_interfaces != null) { for (final String iface : _interfaces.split("[, ]+")) { typeQueue.add(iface); // depends on control dependency: [for], data = [iface] } } } }
public class class_name { public static boolean copyFile(File source, File dest) { // if(!source.renameTo(new File(dest,source.getName()))) { // return false; // } else { // return true; // } try { FileInputStream in = new FileInputStream(source); FileOutputStream out = new FileOutputStream(dest); try { FileChannel canalFuente = in.getChannel(); FileChannel canalDestino = out.getChannel(); // canalFuente.transferTo(0, canalFuente.size(), canalDestino); long count = 0; long size = canalFuente.size(); while ((count += canalDestino.transferFrom(canalFuente, count, size - count)) < size) ; } catch (IOException e) { log.error("copiando ficheros orig:'" + source.getAbsolutePath() + "' destino:'" + dest.getAbsolutePath() + "'", e); return false; } finally { // try { // in.close(); // } catch (IOException e) { // } // try { // out.close(); // } catch (IOException e) { // } IOUtils.closeQuietly(in); IOUtils.closeQuietly(out); } } catch (FileNotFoundException e) { log.error("copiando ficheros orig:'" + source.getAbsolutePath() + "' destino:'" + dest.getAbsolutePath() + "'", e); return false; } return true; } }
public class class_name { public static boolean copyFile(File source, File dest) { // if(!source.renameTo(new File(dest,source.getName()))) { // return false; // } else { // return true; // } try { FileInputStream in = new FileInputStream(source); FileOutputStream out = new FileOutputStream(dest); try { FileChannel canalFuente = in.getChannel(); FileChannel canalDestino = out.getChannel(); // canalFuente.transferTo(0, canalFuente.size(), canalDestino); long count = 0; long size = canalFuente.size(); while ((count += canalDestino.transferFrom(canalFuente, count, size - count)) < size) ; } catch (IOException e) { log.error("copiando ficheros orig:'" + source.getAbsolutePath() + "' destino:'" + dest.getAbsolutePath() + "'", e); return false; } finally { // depends on control dependency: [catch], data = [none] // try { // in.close(); // } catch (IOException e) { // } // try { // out.close(); // } catch (IOException e) { // } IOUtils.closeQuietly(in); IOUtils.closeQuietly(out); } } catch (FileNotFoundException e) { log.error("copiando ficheros orig:'" + source.getAbsolutePath() + "' destino:'" + dest.getAbsolutePath() + "'", e); return false; } // depends on control dependency: [catch], data = [none] return true; } }
public class class_name { void showCrumbs(boolean show) { if (show) { m_crumbs.removeStyleName(OpenCmsTheme.HIDDEN); CmsAppWorkplaceUi.get().enableGlobalShortcuts(); } else { m_crumbs.addStyleName(OpenCmsTheme.HIDDEN); CmsAppWorkplaceUi.get().disableGlobalShortcuts(); } } }
public class class_name { void showCrumbs(boolean show) { if (show) { m_crumbs.removeStyleName(OpenCmsTheme.HIDDEN); // depends on control dependency: [if], data = [none] CmsAppWorkplaceUi.get().enableGlobalShortcuts(); // depends on control dependency: [if], data = [none] } else { m_crumbs.addStyleName(OpenCmsTheme.HIDDEN); // depends on control dependency: [if], data = [none] CmsAppWorkplaceUi.get().disableGlobalShortcuts(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void add(Chromosome element) { if (population.size() == populationSize) { cullOperator.cullPopulation(); } population.add(element); Collections.sort(population, chromosomeComparator); triggerPopulationChangedListeners(population); } }
public class class_name { public void add(Chromosome element) { if (population.size() == populationSize) { cullOperator.cullPopulation(); // depends on control dependency: [if], data = [none] } population.add(element); Collections.sort(population, chromosomeComparator); triggerPopulationChangedListeners(population); } }
public class class_name { public void marshall(DescribeIdentityRequest describeIdentityRequest, ProtocolMarshaller protocolMarshaller) { if (describeIdentityRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeIdentityRequest.getIdentityId(), IDENTITYID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DescribeIdentityRequest describeIdentityRequest, ProtocolMarshaller protocolMarshaller) { if (describeIdentityRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeIdentityRequest.getIdentityId(), IDENTITYID_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("unchecked") public ManagedIndex build() { List<IndexChangeAdapter> changeAdapters = new ArrayList<>(); ProvidedIndex<?> index = null; switch (defn.getKind()) { case VALUE: index = buildMultiValueIndex(context, defn, workspaceName, nodeTypesSupplier, matcher); for (int i = 0; i < defn.size(); i++) { IndexColumnDefinition columnDef = defn.getColumnDefinition(i); PropertyType type = determineActualPropertyType(columnDef); if (isPrimaryTypeIndex(columnDef, type)) { changeAdapters.add(IndexChangeAdapters.forPrimaryType(context, matcher, workspaceName, index)); } else if (isMixinTypesIndex(columnDef, type)) { changeAdapters.add(IndexChangeAdapters.forMixinTypes(context, matcher, workspaceName, index)); } else if (isNodeNameIndex(columnDef, type)) { changeAdapters.add(IndexChangeAdapters.forNodeName(context, matcher, workspaceName, index)); } else if (isNodeLocalNameIndex(columnDef, type)) { changeAdapters.add(IndexChangeAdapters.forNodeLocalName(context, matcher, workspaceName, index)); } else if (isNodePathIndex(columnDef, type)) { changeAdapters.add(IndexChangeAdapters.forNodePath(context, matcher, workspaceName, index)); } else if (isNodeDepthIndex(columnDef, type)) { changeAdapters.add(IndexChangeAdapters.forNodeDepth(context, matcher, workspaceName, index)); } else { // This is a generic index for a property ... Name propertyName = name(columnDef.getPropertyName()); assert propertyName != null; ValueFactory<?> valueFactory = context.getValueFactories().getValueFactory(type); changeAdapters.add(IndexChangeAdapters.forProperty(context, matcher, workspaceName, propertyName, valueFactory, index)); } } break; case UNIQUE_VALUE: index = buildUniqueValueIndex(context, defn, workspaceName, nodeTypesSupplier, matcher); for (int i = 0; i < defn.size(); i++) { IndexColumnDefinition columnDef = defn.getColumnDefinition(i); PropertyType type = determineActualPropertyType(columnDef); Name propertyName = name(columnDef.getPropertyName()); assert propertyName != null; ValueFactory<?> valueFactory = context.getValueFactories().getValueFactory(type); changeAdapters.add(IndexChangeAdapters.forUniqueValuedProperty(context, matcher, workspaceName, propertyName, valueFactory, index)); } break; case ENUMERATED_VALUE: index = buildEnumeratedIndex(context, defn, workspaceName, nodeTypesSupplier, matcher); for (int i = 0; i < defn.size(); i++) { IndexColumnDefinition columnDef = defn.getColumnDefinition(i); Name propertyName = name(columnDef.getPropertyName()); assert propertyName != null; changeAdapters.add(IndexChangeAdapters.forEnumeratedProperty(context, matcher, workspaceName, propertyName, index)); } break; case NODE_TYPE: index = buildNodeTypeIndex(context, defn, workspaceName, nodeTypesSupplier, matcher); if (defn.size() > 1) { throw new IllegalArgumentException("Cannot have a multi column node-type index"); } String property = defn.getColumnDefinition(0).getPropertyName(); if (property == null) { property = defn.getName(); } changeAdapters.add(IndexChangeAdapters.forNodeTypes(property, context, matcher, workspaceName, index)); break; case TEXT: index = buildTextIndex(context, defn, workspaceName, nodeTypesSupplier, matcher); ValueFactory<String> valueFactory = (ValueFactory<String>)context.getValueFactories().getValueFactory(PropertyType.STRING); for (int i = 0; i < defn.size(); i++) { IndexColumnDefinition columnDef = defn.getColumnDefinition(i); PropertyType type = determineActualPropertyType(columnDef); Name propertyName = name(columnDef.getPropertyName()); assert propertyName != null; if (isNodeNameIndex(columnDef, type)) { // FTS on jcr:name changeAdapters.add(IndexChangeAdapters.forNodeName(context, matcher, workspaceName, index)); } else if (isNodeLocalNameIndex(columnDef, type)) { // FTS on mode:localName changeAdapters.add(IndexChangeAdapters.forNodeLocalName(context, matcher, workspaceName, index)); } else if (isNodePathIndex(columnDef, type)) { // FTS on jcr:path changeAdapters.add(IndexChangeAdapters.forNodePath(context, matcher, workspaceName, index)); } else { // default to a property.... changeAdapters.add(IndexChangeAdapters.forTextProperty(context, matcher, workspaceName, propertyName, valueFactory, index)); } } break; default: { throw new IllegalArgumentException("Unexpected index kind on: " + defn); } } assert !changeAdapters.isEmpty(); IndexChangeAdapter adapter = changeAdapters.size() == 1 ? changeAdapters.get(0) : IndexChangeAdapters.forMultipleColumns(context, matcher, workspaceName, index, changeAdapters); return new DefaultManagedIndex(index, adapter); } }
public class class_name { @SuppressWarnings("unchecked") public ManagedIndex build() { List<IndexChangeAdapter> changeAdapters = new ArrayList<>(); ProvidedIndex<?> index = null; switch (defn.getKind()) { case VALUE: index = buildMultiValueIndex(context, defn, workspaceName, nodeTypesSupplier, matcher); for (int i = 0; i < defn.size(); i++) { IndexColumnDefinition columnDef = defn.getColumnDefinition(i); PropertyType type = determineActualPropertyType(columnDef); if (isPrimaryTypeIndex(columnDef, type)) { changeAdapters.add(IndexChangeAdapters.forPrimaryType(context, matcher, workspaceName, index)); // depends on control dependency: [if], data = [none] } else if (isMixinTypesIndex(columnDef, type)) { changeAdapters.add(IndexChangeAdapters.forMixinTypes(context, matcher, workspaceName, index)); // depends on control dependency: [if], data = [none] } else if (isNodeNameIndex(columnDef, type)) { changeAdapters.add(IndexChangeAdapters.forNodeName(context, matcher, workspaceName, index)); // depends on control dependency: [if], data = [none] } else if (isNodeLocalNameIndex(columnDef, type)) { changeAdapters.add(IndexChangeAdapters.forNodeLocalName(context, matcher, workspaceName, index)); // depends on control dependency: [if], data = [none] } else if (isNodePathIndex(columnDef, type)) { changeAdapters.add(IndexChangeAdapters.forNodePath(context, matcher, workspaceName, index)); // depends on control dependency: [if], data = [none] } else if (isNodeDepthIndex(columnDef, type)) { changeAdapters.add(IndexChangeAdapters.forNodeDepth(context, matcher, workspaceName, index)); // depends on control dependency: [if], data = [none] } else { // This is a generic index for a property ... Name propertyName = name(columnDef.getPropertyName()); assert propertyName != null; ValueFactory<?> valueFactory = context.getValueFactories().getValueFactory(type); changeAdapters.add(IndexChangeAdapters.forProperty(context, matcher, workspaceName, propertyName, valueFactory, index)); // depends on control dependency: [if], data = [none] } } break; case UNIQUE_VALUE: index = buildUniqueValueIndex(context, defn, workspaceName, nodeTypesSupplier, matcher); for (int i = 0; i < defn.size(); i++) { IndexColumnDefinition columnDef = defn.getColumnDefinition(i); PropertyType type = determineActualPropertyType(columnDef); Name propertyName = name(columnDef.getPropertyName()); assert propertyName != null; ValueFactory<?> valueFactory = context.getValueFactories().getValueFactory(type); changeAdapters.add(IndexChangeAdapters.forUniqueValuedProperty(context, matcher, workspaceName, propertyName, valueFactory, index)); // depends on control dependency: [for], data = [none] } break; case ENUMERATED_VALUE: index = buildEnumeratedIndex(context, defn, workspaceName, nodeTypesSupplier, matcher); for (int i = 0; i < defn.size(); i++) { IndexColumnDefinition columnDef = defn.getColumnDefinition(i); Name propertyName = name(columnDef.getPropertyName()); assert propertyName != null; changeAdapters.add(IndexChangeAdapters.forEnumeratedProperty(context, matcher, workspaceName, propertyName, index)); // depends on control dependency: [for], data = [none] } break; case NODE_TYPE: index = buildNodeTypeIndex(context, defn, workspaceName, nodeTypesSupplier, matcher); if (defn.size() > 1) { throw new IllegalArgumentException("Cannot have a multi column node-type index"); } String property = defn.getColumnDefinition(0).getPropertyName(); if (property == null) { property = defn.getName(); // depends on control dependency: [if], data = [none] } changeAdapters.add(IndexChangeAdapters.forNodeTypes(property, context, matcher, workspaceName, index)); break; case TEXT: index = buildTextIndex(context, defn, workspaceName, nodeTypesSupplier, matcher); ValueFactory<String> valueFactory = (ValueFactory<String>)context.getValueFactories().getValueFactory(PropertyType.STRING); for (int i = 0; i < defn.size(); i++) { IndexColumnDefinition columnDef = defn.getColumnDefinition(i); PropertyType type = determineActualPropertyType(columnDef); Name propertyName = name(columnDef.getPropertyName()); assert propertyName != null; if (isNodeNameIndex(columnDef, type)) { // FTS on jcr:name changeAdapters.add(IndexChangeAdapters.forNodeName(context, matcher, workspaceName, index)); // depends on control dependency: [if], data = [none] } else if (isNodeLocalNameIndex(columnDef, type)) { // FTS on mode:localName changeAdapters.add(IndexChangeAdapters.forNodeLocalName(context, matcher, workspaceName, index)); // depends on control dependency: [if], data = [none] } else if (isNodePathIndex(columnDef, type)) { // FTS on jcr:path changeAdapters.add(IndexChangeAdapters.forNodePath(context, matcher, workspaceName, index)); // depends on control dependency: [if], data = [none] } else { // default to a property.... changeAdapters.add(IndexChangeAdapters.forTextProperty(context, matcher, workspaceName, propertyName, valueFactory, index)); // depends on control dependency: [if], data = [none] } } break; default: { throw new IllegalArgumentException("Unexpected index kind on: " + defn); } } assert !changeAdapters.isEmpty(); IndexChangeAdapter adapter = changeAdapters.size() == 1 ? changeAdapters.get(0) : IndexChangeAdapters.forMultipleColumns(context, matcher, workspaceName, index, changeAdapters); return new DefaultManagedIndex(index, adapter); } }
public class class_name { public static Iterator iterator(final DefaultTableModel self) { return new Iterator() { private int row = 0; public boolean hasNext() { return row > -1 && row < self.getRowCount(); } public Object next() { int cols = self.getColumnCount(); Object[] rowData = new Object[cols]; for (int col = 0; col < cols; col++) { rowData[col] = self.getValueAt(row, col); } row++; return rowData; } public void remove() { if (hasNext()) self.removeRow(row--); } }; } }
public class class_name { public static Iterator iterator(final DefaultTableModel self) { return new Iterator() { private int row = 0; public boolean hasNext() { return row > -1 && row < self.getRowCount(); } public Object next() { int cols = self.getColumnCount(); Object[] rowData = new Object[cols]; for (int col = 0; col < cols; col++) { rowData[col] = self.getValueAt(row, col); // depends on control dependency: [for], data = [col] } row++; return rowData; } public void remove() { if (hasNext()) self.removeRow(row--); } }; } }
public class class_name { public ItemState read(ObjectReader in) throws UnknownClassIdException, IOException { // read id int key; if ((key = in.readInt()) != SerializationConstants.ITEM_STATE) { throw new UnknownClassIdException("There is unexpected class [" + key + "]"); } ItemState is = null; try { int state = in.readInt(); boolean isPersisted = in.readBoolean(); boolean eventFire = in.readBoolean(); QPath oldPath = null; if (in.readInt() == SerializationConstants.NOT_NULL_DATA) { byte[] buf = new byte[in.readInt()]; in.readFully(buf); oldPath = QPath.parse(new String(buf, Constants.DEFAULT_ENCODING)); } boolean isNodeData = in.readBoolean(); if (isNodeData) { PersistedNodeDataReader rdr = new PersistedNodeDataReader(); is = new ItemState(rdr.read(in), state, eventFire, null, false, isPersisted, oldPath); } else { PersistedPropertyDataReader rdr = new PersistedPropertyDataReader(holder, spoolConfig); is = new ItemState(rdr.read(in), state, eventFire, null, false, isPersisted, oldPath); } return is; } catch (EOFException e) { throw new StreamCorruptedException("Unexpected EOF in middle of data block."); } catch (IllegalPathException e) { throw new IOException("Data corrupted", e); } } }
public class class_name { public ItemState read(ObjectReader in) throws UnknownClassIdException, IOException { // read id int key; if ((key = in.readInt()) != SerializationConstants.ITEM_STATE) { throw new UnknownClassIdException("There is unexpected class [" + key + "]"); } ItemState is = null; try { int state = in.readInt(); boolean isPersisted = in.readBoolean(); boolean eventFire = in.readBoolean(); QPath oldPath = null; if (in.readInt() == SerializationConstants.NOT_NULL_DATA) { byte[] buf = new byte[in.readInt()]; in.readFully(buf); // depends on control dependency: [if], data = [none] oldPath = QPath.parse(new String(buf, Constants.DEFAULT_ENCODING)); // depends on control dependency: [if], data = [none] } boolean isNodeData = in.readBoolean(); if (isNodeData) { PersistedNodeDataReader rdr = new PersistedNodeDataReader(); is = new ItemState(rdr.read(in), state, eventFire, null, false, isPersisted, oldPath); // depends on control dependency: [if], data = [none] } else { PersistedPropertyDataReader rdr = new PersistedPropertyDataReader(holder, spoolConfig); is = new ItemState(rdr.read(in), state, eventFire, null, false, isPersisted, oldPath); // depends on control dependency: [if], data = [none] } return is; } catch (EOFException e) { throw new StreamCorruptedException("Unexpected EOF in middle of data block."); } catch (IllegalPathException e) { throw new IOException("Data corrupted", e); } } }
public class class_name { public Element getLastChildElement(final String elementName) { if (childNodes == null) { return null; } int from = childNodes.size() - 1; for (int i = from; i >= 0; i--) { Node child = childNodes.get(i); if (child.getNodeType() == NodeType.ELEMENT && elementName.equals(child.getNodeName())) { child.initSiblingNames(); return (Element) child; } } return null; } }
public class class_name { public Element getLastChildElement(final String elementName) { if (childNodes == null) { return null; // depends on control dependency: [if], data = [none] } int from = childNodes.size() - 1; for (int i = from; i >= 0; i--) { Node child = childNodes.get(i); if (child.getNodeType() == NodeType.ELEMENT && elementName.equals(child.getNodeName())) { child.initSiblingNames(); // depends on control dependency: [if], data = [none] return (Element) child; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public static MethodValues find(byte[] name, int offset, int length) { MethodValues key = (MethodValues) myMatcher.match(name, offset, length); if (null == key) { synchronized (MethodValues.class) { // protect against 2 threads getting here on the new value by // testing again inside a sync block key = (MethodValues) myMatcher.match(name, offset, length); if (null == key) { key = new MethodValues(new String(name, offset, length), true); key.undefined = true; } } // end-sync } return key; } }
public class class_name { public static MethodValues find(byte[] name, int offset, int length) { MethodValues key = (MethodValues) myMatcher.match(name, offset, length); if (null == key) { synchronized (MethodValues.class) { // depends on control dependency: [if], data = [none] // protect against 2 threads getting here on the new value by // testing again inside a sync block key = (MethodValues) myMatcher.match(name, offset, length); if (null == key) { key = new MethodValues(new String(name, offset, length), true); // depends on control dependency: [if], data = [none] key.undefined = true; // depends on control dependency: [if], data = [none] } } // end-sync } return key; } }
public class class_name { public long getSaving(Configuration conf) { try { DFSClient dfs = ((DistributedFileSystem)FileSystem.get(conf)).getClient(); Counters raidedCounters = stateToSourceCounters.get(RaidState.RAIDED); long physical = raidedCounters.getNumBytes() + parityCounters.getNumBytes(); long logical = raidedCounters.getNumLogical(); return logical * dfs.getDefaultReplication() - physical; } catch (Exception e) { return -1; } } }
public class class_name { public long getSaving(Configuration conf) { try { DFSClient dfs = ((DistributedFileSystem)FileSystem.get(conf)).getClient(); Counters raidedCounters = stateToSourceCounters.get(RaidState.RAIDED); long physical = raidedCounters.getNumBytes() + parityCounters.getNumBytes(); long logical = raidedCounters.getNumLogical(); return logical * dfs.getDefaultReplication() - physical; // depends on control dependency: [try], data = [none] } catch (Exception e) { return -1; } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public LexNameSet caseAVariableExp(AVariableExp node, FreeVarInfo info) throws AnalysisException { PDefinition d = info.globals.findName(node.getName(), NameScope.NAMESANDSTATE); if (d != null && af.createPDefinitionAssistant().isFunction(d)) { return new LexNameSet(); } if (d instanceof ARenamedDefinition) { ARenamedDefinition rd = (ARenamedDefinition)d; if (rd.getDef().getName() != null) { return new LexNameSet(rd.getDef().getName().getExplicit(true)); } } if (info.env.findName(node.getName(), NameScope.NAMESANDSTATE) == null) { return new LexNameSet(node.getName().getExplicit(true)); } else { return new LexNameSet(); // Already in local info.env, so not free } } }
public class class_name { @Override public LexNameSet caseAVariableExp(AVariableExp node, FreeVarInfo info) throws AnalysisException { PDefinition d = info.globals.findName(node.getName(), NameScope.NAMESANDSTATE); if (d != null && af.createPDefinitionAssistant().isFunction(d)) { return new LexNameSet(); } if (d instanceof ARenamedDefinition) { ARenamedDefinition rd = (ARenamedDefinition)d; if (rd.getDef().getName() != null) { return new LexNameSet(rd.getDef().getName().getExplicit(true)); // depends on control dependency: [if], data = [(rd.getDef().getName()] } } if (info.env.findName(node.getName(), NameScope.NAMESANDSTATE) == null) { return new LexNameSet(node.getName().getExplicit(true)); } else { return new LexNameSet(); // Already in local info.env, so not free } } }
public class class_name { private void finish(boolean commit) { for (Synchronization s : syncs) { s.beforeCompletion(); } if (commit) { status = Status.STATUS_COMMITTED; } else { status = Status.STATUS_ROLLEDBACK; } for (Synchronization s : syncs) { s.afterCompletion(status); } status = Status.STATUS_UNKNOWN; syncs.clear(); resources.clear(); } }
public class class_name { private void finish(boolean commit) { for (Synchronization s : syncs) { s.beforeCompletion(); // depends on control dependency: [for], data = [s] } if (commit) { status = Status.STATUS_COMMITTED; // depends on control dependency: [if], data = [none] } else { status = Status.STATUS_ROLLEDBACK; // depends on control dependency: [if], data = [none] } for (Synchronization s : syncs) { s.afterCompletion(status); // depends on control dependency: [for], data = [s] } status = Status.STATUS_UNKNOWN; syncs.clear(); resources.clear(); } }
public class class_name { public int length() { int ret = 0; if (data instanceof int[]) ret = 1; else if (data instanceof int[][]) ret = ((int[][]) data).length; else if (data instanceof int[][][]) { ret = ((int[][][]) data)[0].length; } return ret; } public Object getDicData() { return dicData; } public void setDicData(Object dicData) { this.dicData = dicData; } /** * 得到样本权重 * @return */ public float getWeight() { return weight; } /** * 设置权重 * @param weight */ public void setWeight(float weight) { this.weight = weight; if(weight==0f){ System.out.println("weight zero"); } } public String toString(){ StringBuilder sb= new StringBuilder(); sb.append(data.toString()); return sb.toString(); } }
public class class_name { public int length() { int ret = 0; if (data instanceof int[]) ret = 1; else if (data instanceof int[][]) ret = ((int[][]) data).length; else if (data instanceof int[][][]) { ret = ((int[][][]) data)[0].length; // depends on control dependency: [if], data = [none] } return ret; } public Object getDicData() { return dicData; } public void setDicData(Object dicData) { this.dicData = dicData; } /** * 得到样本权重 * @return */ public float getWeight() { return weight; } /** * 设置权重 * @param weight */ public void setWeight(float weight) { this.weight = weight; if(weight==0f){ System.out.println("weight zero"); // depends on control dependency: [if], data = [none] } } public String toString(){ StringBuilder sb= new StringBuilder(); sb.append(data.toString()); return sb.toString(); } }
public class class_name { @Override public boolean includesValues(String name, Collection<String> values) { Collection<String> propValues = properties.get(name); if (propValues == null) { return false; } return propValues.containsAll(values); } }
public class class_name { @Override public boolean includesValues(String name, Collection<String> values) { Collection<String> propValues = properties.get(name); if (propValues == null) { return false; // depends on control dependency: [if], data = [none] } return propValues.containsAll(values); } }
public class class_name { public void clearBugCounts() { for (int i = 0; i < totalErrors.length; i++) { totalErrors[i] = 0; } for (PackageStats stats : packageStatsMap.values()) { stats.clearBugCounts(); } } }
public class class_name { public void clearBugCounts() { for (int i = 0; i < totalErrors.length; i++) { totalErrors[i] = 0; // depends on control dependency: [for], data = [i] } for (PackageStats stats : packageStatsMap.values()) { stats.clearBugCounts(); // depends on control dependency: [for], data = [stats] } } }
public class class_name { @Action( semantics = SemanticsOf.SAFE ) @MemberOrder(sequence = "3") public List<FullCalendar2WicketToDoItem> complete() { final List<FullCalendar2WicketToDoItem> items = completeNoUi(); if(items.isEmpty()) { container.informUser("No to-do items have yet been completed :-("); } return items; } }
public class class_name { @Action( semantics = SemanticsOf.SAFE ) @MemberOrder(sequence = "3") public List<FullCalendar2WicketToDoItem> complete() { final List<FullCalendar2WicketToDoItem> items = completeNoUi(); if(items.isEmpty()) { container.informUser("No to-do items have yet been completed :-("); // depends on control dependency: [if], data = [none] } return items; } }
public class class_name { @Override public VariableExpression visitBuiltInType(BuiltInTypeContext ctx) { String text; if (asBoolean(ctx.VOID())) { text = ctx.VOID().getText(); } else if (asBoolean(ctx.BuiltInPrimitiveType())) { text = ctx.BuiltInPrimitiveType().getText(); } else { throw createParsingFailedException("Unsupported built-in type: " + ctx, ctx); } return configureAST(new VariableExpression(text), ctx); } }
public class class_name { @Override public VariableExpression visitBuiltInType(BuiltInTypeContext ctx) { String text; if (asBoolean(ctx.VOID())) { text = ctx.VOID().getText(); // depends on control dependency: [if], data = [none] } else if (asBoolean(ctx.BuiltInPrimitiveType())) { text = ctx.BuiltInPrimitiveType().getText(); // depends on control dependency: [if], data = [none] } else { throw createParsingFailedException("Unsupported built-in type: " + ctx, ctx); } return configureAST(new VariableExpression(text), ctx); } }
public class class_name { public String toJsonString() { try { JSONArray array = new JSONArray(); for (PebbleTuple t : tuples.values()) { array.put(serializeTuple(t)); } return array.toString(); } catch (JSONException je) { je.printStackTrace(); } return null; } }
public class class_name { public String toJsonString() { try { JSONArray array = new JSONArray(); for (PebbleTuple t : tuples.values()) { array.put(serializeTuple(t)); // depends on control dependency: [for], data = [t] } return array.toString(); // depends on control dependency: [try], data = [none] } catch (JSONException je) { je.printStackTrace(); } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { public InetSocketAddress getTrackerAddress() { TrackerAddressHolder holder; // 遍历连接地址,抓取当前有效的地址 for (int i = 0; i < trackerAddressCircular.size(); i++) { holder = trackerAddressCircular.next(); if (holder.canTryToConnect(retryAfterSecend)) { return holder.getAddress(); } } throw new FdfsUnavailableException("找不到可用的tracker " + getTrackerAddressConfigString()); } }
public class class_name { public InetSocketAddress getTrackerAddress() { TrackerAddressHolder holder; // 遍历连接地址,抓取当前有效的地址 for (int i = 0; i < trackerAddressCircular.size(); i++) { holder = trackerAddressCircular.next(); // depends on control dependency: [for], data = [none] if (holder.canTryToConnect(retryAfterSecend)) { return holder.getAddress(); // depends on control dependency: [if], data = [none] } } throw new FdfsUnavailableException("找不到可用的tracker " + getTrackerAddressConfigString()); } }
public class class_name { protected Properties collectProperties( CmsObject cms, CmsResource resource, Set<String> orgfilter, ObjectInfoImpl objectInfo) { CmsCmisTypeManager tm = m_repository.getTypeManager(); if (resource == null) { throw new IllegalArgumentException("Resource may not be null."); } // copy filter Set<String> filter = (orgfilter == null ? null : new LinkedHashSet<String>(orgfilter)); // find base type String typeId = null; List<String> relationSourceIds = new ArrayList<String>(); List<String> relationTargetIds = new ArrayList<String>(); try { List<CmsRelation> relations = cms.getRelationsForResource(resource, CmsRelationFilter.ALL); for (CmsRelation relation : relations) { if (resource.getStructureId().equals(relation.getSourceId())) { relationTargetIds.add(relation.getTargetId().toString()); } if (resource.getStructureId().equals(relation.getTargetId())) { relationSourceIds.add(relation.getSourceId().toString()); } } } catch (CmsException e) { throw new CmisStorageException(e.getLocalizedMessage(), e); } if (resource.isFolder()) { typeId = CmsCmisTypeManager.FOLDER_TYPE_ID; objectInfo.setBaseType(BaseTypeId.CMIS_FOLDER); objectInfo.setTypeId(typeId); objectInfo.setContentType(null); objectInfo.setFileName(null); objectInfo.setHasAcl(true); objectInfo.setHasContent(false); objectInfo.setVersionSeriesId(null); objectInfo.setIsCurrentVersion(true); objectInfo.setRelationshipSourceIds(relationSourceIds); objectInfo.setRelationshipTargetIds(relationTargetIds); objectInfo.setSupportsDescendants(true); objectInfo.setSupportsFolderTree(true); objectInfo.setSupportsPolicies(false); objectInfo.setSupportsRelationships(true); objectInfo.setWorkingCopyId(null); objectInfo.setWorkingCopyOriginalId(null); } else { typeId = CmsCmisTypeManager.DOCUMENT_TYPE_ID; objectInfo.setBaseType(BaseTypeId.CMIS_DOCUMENT); objectInfo.setTypeId(typeId); objectInfo.setHasAcl(true); objectInfo.setHasContent(true); objectInfo.setHasParent(true); objectInfo.setVersionSeriesId(null); objectInfo.setIsCurrentVersion(true); objectInfo.setRelationshipSourceIds(relationSourceIds); objectInfo.setRelationshipTargetIds(relationTargetIds); objectInfo.setSupportsDescendants(false); objectInfo.setSupportsFolderTree(false); objectInfo.setSupportsPolicies(false); objectInfo.setSupportsRelationships(true); objectInfo.setWorkingCopyId(null); objectInfo.setWorkingCopyOriginalId(null); } try { PropertiesImpl result = new PropertiesImpl(); String id = resource.getStructureId().toString(); addPropertyId(tm, result, typeId, filter, PropertyIds.OBJECT_ID, id); objectInfo.setId(id); String name = resource.getName(); if ("".equals(name)) { name = "/"; } addPropertyString(tm, result, typeId, filter, PropertyIds.NAME, name); objectInfo.setName(name); // created and modified by CmsUUID creatorId = resource.getUserCreated(); CmsUUID modifierId = resource.getUserLastModified(); String creatorName = creatorId.toString(); String modifierName = modifierId.toString(); try { CmsUser user = cms.readUser(creatorId); creatorName = user.getName(); } catch (CmsException e) { // ignore, use id as name } try { CmsUser user = cms.readUser(modifierId); modifierName = user.getName(); } catch (CmsException e) { // ignore, use id as name } addPropertyString(tm, result, typeId, filter, PropertyIds.CREATED_BY, creatorName); addPropertyString(tm, result, typeId, filter, PropertyIds.LAST_MODIFIED_BY, modifierName); objectInfo.setCreatedBy(creatorName); // creation and modification date GregorianCalendar lastModified = millisToCalendar(resource.getDateLastModified()); GregorianCalendar created = millisToCalendar(resource.getDateCreated()); addPropertyDateTime(tm, result, typeId, filter, PropertyIds.CREATION_DATE, created); addPropertyDateTime(tm, result, typeId, filter, PropertyIds.LAST_MODIFICATION_DATE, lastModified); objectInfo.setCreationDate(created); objectInfo.setLastModificationDate(lastModified); // change token - always null addPropertyString(tm, result, typeId, filter, PropertyIds.CHANGE_TOKEN, null); // directory or file if (resource.isFolder()) { // base type and type name addPropertyId(tm, result, typeId, filter, PropertyIds.BASE_TYPE_ID, BaseTypeId.CMIS_FOLDER.value()); addPropertyId( tm, result, typeId, filter, PropertyIds.OBJECT_TYPE_ID, CmsCmisTypeManager.FOLDER_TYPE_ID); String path = resource.getRootPath(); addPropertyString(tm, result, typeId, filter, PropertyIds.PATH, (path.length() == 0 ? "/" : path)); // folder properties if (resource.getRootPath().length() > 1) { CmsResource parent = cms.readParentFolder(resource.getStructureId()); addPropertyId(tm, result, typeId, filter, PropertyIds.PARENT_ID, ( parent.getStructureId().toString())); objectInfo.setHasParent(true); } else { addPropertyId(tm, result, typeId, filter, PropertyIds.PARENT_ID, null); objectInfo.setHasParent(false); } addPropertyIdList(tm, result, typeId, filter, PropertyIds.ALLOWED_CHILD_OBJECT_TYPE_IDS, null); } else { // base type and type name addPropertyId(tm, result, typeId, filter, PropertyIds.BASE_TYPE_ID, BaseTypeId.CMIS_DOCUMENT.value()); addPropertyId( tm, result, typeId, filter, PropertyIds.OBJECT_TYPE_ID, CmsCmisTypeManager.DOCUMENT_TYPE_ID); // file properties addPropertyBoolean(tm, result, typeId, filter, PropertyIds.IS_IMMUTABLE, false); addPropertyBoolean(tm, result, typeId, filter, PropertyIds.IS_LATEST_VERSION, true); addPropertyBoolean(tm, result, typeId, filter, PropertyIds.IS_MAJOR_VERSION, true); addPropertyBoolean(tm, result, typeId, filter, PropertyIds.IS_LATEST_MAJOR_VERSION, true); addPropertyString(tm, result, typeId, filter, PropertyIds.VERSION_LABEL, resource.getName()); addPropertyId( tm, result, typeId, filter, PropertyIds.VERSION_SERIES_ID, resource.getStructureId().toString()); addPropertyBoolean(tm, result, typeId, filter, PropertyIds.IS_VERSION_SERIES_CHECKED_OUT, false); addPropertyString(tm, result, typeId, filter, PropertyIds.VERSION_SERIES_CHECKED_OUT_BY, null); addPropertyString(tm, result, typeId, filter, PropertyIds.VERSION_SERIES_CHECKED_OUT_ID, null); addPropertyString(tm, result, typeId, filter, PropertyIds.CHECKIN_COMMENT, ""); addPropertyInteger(tm, result, typeId, filter, PropertyIds.CONTENT_STREAM_LENGTH, resource.getLength()); addPropertyString( tm, result, typeId, filter, PropertyIds.CONTENT_STREAM_MIME_TYPE, OpenCms.getResourceManager().getMimeType( resource.getRootPath(), null, CmsResourceManager.MIMETYPE_TEXT)); addPropertyString(tm, result, typeId, filter, PropertyIds.CONTENT_STREAM_FILE_NAME, resource.getName()); objectInfo.setHasContent(true); objectInfo.setContentType( OpenCms.getResourceManager().getMimeType( resource.getRootPath(), null, CmsResourceManager.MIMETYPE_TEXT)); objectInfo.setFileName(resource.getName()); addPropertyId(tm, result, typeId, filter, PropertyIds.CONTENT_STREAM_ID, null); } // normal OpenCms properties List<CmsProperty> props = cms.readPropertyObjects(resource, false); Set<String> propertiesToAdd = new LinkedHashSet<String>( m_repository.getTypeManager().getCmsPropertyNames()); for (CmsProperty prop : props) { addPropertyString( tm, result, typeId, filter, CmsCmisTypeManager.PROPERTY_PREFIX + prop.getName(), prop.getValue()); propertiesToAdd.remove(prop.getName()); } for (String propName : propertiesToAdd) { addPropertyString(tm, result, typeId, filter, CmsCmisTypeManager.PROPERTY_PREFIX + propName, null); } // inherited OpenCms properties List<CmsProperty> inheritedProps = cms.readPropertyObjects(resource, true); Set<String> inheritedPropertiesToAdd = new LinkedHashSet<String>( m_repository.getTypeManager().getCmsPropertyNames()); for (CmsProperty prop : inheritedProps) { addPropertyString( tm, result, typeId, filter, CmsCmisTypeManager.INHERITED_PREFIX + prop.getName(), prop.getValue()); inheritedPropertiesToAdd.remove(prop.getName()); } for (String propName : inheritedPropertiesToAdd) { addPropertyString(tm, result, typeId, filter, CmsCmisTypeManager.INHERITED_PREFIX + propName, null); } I_CmsResourceType resType = OpenCms.getResourceManager().getResourceType(resource); addPropertyString( tm, result, typeId, filter, CmsCmisTypeManager.PROPERTY_RESOURCE_TYPE, resType.getTypeName()); CmsCmisUtil.addDynamicProperties(cms, m_repository.getTypeManager(), result, typeId, resource, filter); return result; } catch (Exception e) { if (e instanceof CmisBaseException) { throw (CmisBaseException)e; } throw new CmisRuntimeException(e.getMessage(), e); } } }
public class class_name { protected Properties collectProperties( CmsObject cms, CmsResource resource, Set<String> orgfilter, ObjectInfoImpl objectInfo) { CmsCmisTypeManager tm = m_repository.getTypeManager(); if (resource == null) { throw new IllegalArgumentException("Resource may not be null."); } // copy filter Set<String> filter = (orgfilter == null ? null : new LinkedHashSet<String>(orgfilter)); // find base type String typeId = null; List<String> relationSourceIds = new ArrayList<String>(); List<String> relationTargetIds = new ArrayList<String>(); try { List<CmsRelation> relations = cms.getRelationsForResource(resource, CmsRelationFilter.ALL); for (CmsRelation relation : relations) { if (resource.getStructureId().equals(relation.getSourceId())) { relationTargetIds.add(relation.getTargetId().toString()); // depends on control dependency: [if], data = [none] } if (resource.getStructureId().equals(relation.getTargetId())) { relationSourceIds.add(relation.getSourceId().toString()); // depends on control dependency: [if], data = [none] } } } catch (CmsException e) { throw new CmisStorageException(e.getLocalizedMessage(), e); } // depends on control dependency: [catch], data = [none] if (resource.isFolder()) { typeId = CmsCmisTypeManager.FOLDER_TYPE_ID; // depends on control dependency: [if], data = [none] objectInfo.setBaseType(BaseTypeId.CMIS_FOLDER); // depends on control dependency: [if], data = [none] objectInfo.setTypeId(typeId); // depends on control dependency: [if], data = [none] objectInfo.setContentType(null); // depends on control dependency: [if], data = [none] objectInfo.setFileName(null); // depends on control dependency: [if], data = [none] objectInfo.setHasAcl(true); // depends on control dependency: [if], data = [none] objectInfo.setHasContent(false); // depends on control dependency: [if], data = [none] objectInfo.setVersionSeriesId(null); // depends on control dependency: [if], data = [none] objectInfo.setIsCurrentVersion(true); // depends on control dependency: [if], data = [none] objectInfo.setRelationshipSourceIds(relationSourceIds); // depends on control dependency: [if], data = [none] objectInfo.setRelationshipTargetIds(relationTargetIds); // depends on control dependency: [if], data = [none] objectInfo.setSupportsDescendants(true); // depends on control dependency: [if], data = [none] objectInfo.setSupportsFolderTree(true); // depends on control dependency: [if], data = [none] objectInfo.setSupportsPolicies(false); // depends on control dependency: [if], data = [none] objectInfo.setSupportsRelationships(true); // depends on control dependency: [if], data = [none] objectInfo.setWorkingCopyId(null); // depends on control dependency: [if], data = [none] objectInfo.setWorkingCopyOriginalId(null); // depends on control dependency: [if], data = [none] } else { typeId = CmsCmisTypeManager.DOCUMENT_TYPE_ID; // depends on control dependency: [if], data = [none] objectInfo.setBaseType(BaseTypeId.CMIS_DOCUMENT); // depends on control dependency: [if], data = [none] objectInfo.setTypeId(typeId); // depends on control dependency: [if], data = [none] objectInfo.setHasAcl(true); // depends on control dependency: [if], data = [none] objectInfo.setHasContent(true); // depends on control dependency: [if], data = [none] objectInfo.setHasParent(true); // depends on control dependency: [if], data = [none] objectInfo.setVersionSeriesId(null); // depends on control dependency: [if], data = [none] objectInfo.setIsCurrentVersion(true); // depends on control dependency: [if], data = [none] objectInfo.setRelationshipSourceIds(relationSourceIds); // depends on control dependency: [if], data = [none] objectInfo.setRelationshipTargetIds(relationTargetIds); // depends on control dependency: [if], data = [none] objectInfo.setSupportsDescendants(false); // depends on control dependency: [if], data = [none] objectInfo.setSupportsFolderTree(false); // depends on control dependency: [if], data = [none] objectInfo.setSupportsPolicies(false); // depends on control dependency: [if], data = [none] objectInfo.setSupportsRelationships(true); // depends on control dependency: [if], data = [none] objectInfo.setWorkingCopyId(null); // depends on control dependency: [if], data = [none] objectInfo.setWorkingCopyOriginalId(null); // depends on control dependency: [if], data = [none] } try { PropertiesImpl result = new PropertiesImpl(); String id = resource.getStructureId().toString(); addPropertyId(tm, result, typeId, filter, PropertyIds.OBJECT_ID, id); // depends on control dependency: [try], data = [none] objectInfo.setId(id); // depends on control dependency: [try], data = [none] String name = resource.getName(); if ("".equals(name)) { name = "/"; // depends on control dependency: [if], data = [none] } addPropertyString(tm, result, typeId, filter, PropertyIds.NAME, name); // depends on control dependency: [try], data = [none] objectInfo.setName(name); // depends on control dependency: [try], data = [none] // created and modified by CmsUUID creatorId = resource.getUserCreated(); CmsUUID modifierId = resource.getUserLastModified(); String creatorName = creatorId.toString(); String modifierName = modifierId.toString(); try { CmsUser user = cms.readUser(creatorId); creatorName = user.getName(); // depends on control dependency: [try], data = [none] } catch (CmsException e) { // ignore, use id as name } // depends on control dependency: [catch], data = [none] try { CmsUser user = cms.readUser(modifierId); modifierName = user.getName(); // depends on control dependency: [try], data = [none] } catch (CmsException e) { // ignore, use id as name } // depends on control dependency: [catch], data = [none] addPropertyString(tm, result, typeId, filter, PropertyIds.CREATED_BY, creatorName); // depends on control dependency: [try], data = [none] addPropertyString(tm, result, typeId, filter, PropertyIds.LAST_MODIFIED_BY, modifierName); // depends on control dependency: [try], data = [none] objectInfo.setCreatedBy(creatorName); // depends on control dependency: [try], data = [none] // creation and modification date GregorianCalendar lastModified = millisToCalendar(resource.getDateLastModified()); GregorianCalendar created = millisToCalendar(resource.getDateCreated()); addPropertyDateTime(tm, result, typeId, filter, PropertyIds.CREATION_DATE, created); // depends on control dependency: [try], data = [none] addPropertyDateTime(tm, result, typeId, filter, PropertyIds.LAST_MODIFICATION_DATE, lastModified); // depends on control dependency: [try], data = [none] objectInfo.setCreationDate(created); // depends on control dependency: [try], data = [none] objectInfo.setLastModificationDate(lastModified); // depends on control dependency: [try], data = [none] // change token - always null addPropertyString(tm, result, typeId, filter, PropertyIds.CHANGE_TOKEN, null); // depends on control dependency: [try], data = [none] // directory or file if (resource.isFolder()) { // base type and type name addPropertyId(tm, result, typeId, filter, PropertyIds.BASE_TYPE_ID, BaseTypeId.CMIS_FOLDER.value()); // depends on control dependency: [if], data = [none] addPropertyId( tm, result, typeId, filter, PropertyIds.OBJECT_TYPE_ID, CmsCmisTypeManager.FOLDER_TYPE_ID); // depends on control dependency: [if], data = [none] String path = resource.getRootPath(); addPropertyString(tm, result, typeId, filter, PropertyIds.PATH, (path.length() == 0 ? "/" : path)); // depends on control dependency: [if], data = [none] // folder properties if (resource.getRootPath().length() > 1) { CmsResource parent = cms.readParentFolder(resource.getStructureId()); addPropertyId(tm, result, typeId, filter, PropertyIds.PARENT_ID, ( parent.getStructureId().toString())); // depends on control dependency: [if], data = [none] objectInfo.setHasParent(true); // depends on control dependency: [if], data = [none] } else { addPropertyId(tm, result, typeId, filter, PropertyIds.PARENT_ID, null); // depends on control dependency: [if], data = [none] objectInfo.setHasParent(false); // depends on control dependency: [if], data = [none] } addPropertyIdList(tm, result, typeId, filter, PropertyIds.ALLOWED_CHILD_OBJECT_TYPE_IDS, null); // depends on control dependency: [if], data = [none] } else { // base type and type name addPropertyId(tm, result, typeId, filter, PropertyIds.BASE_TYPE_ID, BaseTypeId.CMIS_DOCUMENT.value()); // depends on control dependency: [if], data = [none] addPropertyId( tm, result, typeId, filter, PropertyIds.OBJECT_TYPE_ID, CmsCmisTypeManager.DOCUMENT_TYPE_ID); // depends on control dependency: [if], data = [none] // file properties addPropertyBoolean(tm, result, typeId, filter, PropertyIds.IS_IMMUTABLE, false); // depends on control dependency: [if], data = [none] addPropertyBoolean(tm, result, typeId, filter, PropertyIds.IS_LATEST_VERSION, true); // depends on control dependency: [if], data = [none] addPropertyBoolean(tm, result, typeId, filter, PropertyIds.IS_MAJOR_VERSION, true); // depends on control dependency: [if], data = [none] addPropertyBoolean(tm, result, typeId, filter, PropertyIds.IS_LATEST_MAJOR_VERSION, true); // depends on control dependency: [if], data = [none] addPropertyString(tm, result, typeId, filter, PropertyIds.VERSION_LABEL, resource.getName()); // depends on control dependency: [if], data = [none] addPropertyId( tm, result, typeId, filter, PropertyIds.VERSION_SERIES_ID, resource.getStructureId().toString()); // depends on control dependency: [if], data = [none] addPropertyBoolean(tm, result, typeId, filter, PropertyIds.IS_VERSION_SERIES_CHECKED_OUT, false); // depends on control dependency: [if], data = [none] addPropertyString(tm, result, typeId, filter, PropertyIds.VERSION_SERIES_CHECKED_OUT_BY, null); // depends on control dependency: [if], data = [none] addPropertyString(tm, result, typeId, filter, PropertyIds.VERSION_SERIES_CHECKED_OUT_ID, null); // depends on control dependency: [if], data = [none] addPropertyString(tm, result, typeId, filter, PropertyIds.CHECKIN_COMMENT, ""); // depends on control dependency: [if], data = [none] addPropertyInteger(tm, result, typeId, filter, PropertyIds.CONTENT_STREAM_LENGTH, resource.getLength()); // depends on control dependency: [if], data = [none] addPropertyString( tm, result, typeId, filter, PropertyIds.CONTENT_STREAM_MIME_TYPE, OpenCms.getResourceManager().getMimeType( resource.getRootPath(), null, CmsResourceManager.MIMETYPE_TEXT)); // depends on control dependency: [if], data = [none] addPropertyString(tm, result, typeId, filter, PropertyIds.CONTENT_STREAM_FILE_NAME, resource.getName()); // depends on control dependency: [if], data = [none] objectInfo.setHasContent(true); // depends on control dependency: [if], data = [none] objectInfo.setContentType( OpenCms.getResourceManager().getMimeType( resource.getRootPath(), null, CmsResourceManager.MIMETYPE_TEXT)); // depends on control dependency: [if], data = [none] objectInfo.setFileName(resource.getName()); // depends on control dependency: [if], data = [none] addPropertyId(tm, result, typeId, filter, PropertyIds.CONTENT_STREAM_ID, null); // depends on control dependency: [if], data = [none] } // normal OpenCms properties List<CmsProperty> props = cms.readPropertyObjects(resource, false); Set<String> propertiesToAdd = new LinkedHashSet<String>( m_repository.getTypeManager().getCmsPropertyNames()); for (CmsProperty prop : props) { addPropertyString( tm, result, typeId, filter, CmsCmisTypeManager.PROPERTY_PREFIX + prop.getName(), prop.getValue()); // depends on control dependency: [for], data = [none] propertiesToAdd.remove(prop.getName()); // depends on control dependency: [for], data = [prop] } for (String propName : propertiesToAdd) { addPropertyString(tm, result, typeId, filter, CmsCmisTypeManager.PROPERTY_PREFIX + propName, null); // depends on control dependency: [for], data = [propName] } // inherited OpenCms properties List<CmsProperty> inheritedProps = cms.readPropertyObjects(resource, true); Set<String> inheritedPropertiesToAdd = new LinkedHashSet<String>( m_repository.getTypeManager().getCmsPropertyNames()); for (CmsProperty prop : inheritedProps) { addPropertyString( tm, result, typeId, filter, CmsCmisTypeManager.INHERITED_PREFIX + prop.getName(), prop.getValue()); // depends on control dependency: [for], data = [none] inheritedPropertiesToAdd.remove(prop.getName()); // depends on control dependency: [for], data = [prop] } for (String propName : inheritedPropertiesToAdd) { addPropertyString(tm, result, typeId, filter, CmsCmisTypeManager.INHERITED_PREFIX + propName, null); // depends on control dependency: [for], data = [propName] } I_CmsResourceType resType = OpenCms.getResourceManager().getResourceType(resource); addPropertyString( tm, result, typeId, filter, CmsCmisTypeManager.PROPERTY_RESOURCE_TYPE, resType.getTypeName()); // depends on control dependency: [try], data = [none] CmsCmisUtil.addDynamicProperties(cms, m_repository.getTypeManager(), result, typeId, resource, filter); // depends on control dependency: [try], data = [none] return result; // depends on control dependency: [try], data = [none] } catch (Exception e) { if (e instanceof CmisBaseException) { throw (CmisBaseException)e; } throw new CmisRuntimeException(e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private int trMedian5(int ISAd, int v1, int v2, int v3, int v4, int v5) { int t; if (SA[ISAd + SA[v2]] > SA[ISAd + SA[v3]]) { t = v2; v2 = v3; v3 = t; } if (SA[ISAd + SA[v4]] > SA[ISAd + SA[v5]]) { t = v4; v4 = v5; v5 = t; } if (SA[ISAd + SA[v2]] > SA[ISAd + SA[v4]]) { t = v2; v2 = v4; v4 = t; t = v3; v3 = v5; v5 = t; } if (SA[ISAd + SA[v1]] > SA[ISAd + SA[v3]]) { t = v1; v1 = v3; v3 = t; } if (SA[ISAd + SA[v1]] > SA[ISAd + SA[v4]]) { t = v1; v1 = v4; v4 = t; t = v3; v3 = v5; v5 = t; } if (SA[ISAd + SA[v3]] > SA[ISAd + SA[v4]]) { return v4; } return v3; } }
public class class_name { private int trMedian5(int ISAd, int v1, int v2, int v3, int v4, int v5) { int t; if (SA[ISAd + SA[v2]] > SA[ISAd + SA[v3]]) { t = v2; // depends on control dependency: [if], data = [none] v2 = v3; // depends on control dependency: [if], data = [none] v3 = t; // depends on control dependency: [if], data = [none] } if (SA[ISAd + SA[v4]] > SA[ISAd + SA[v5]]) { t = v4; // depends on control dependency: [if], data = [none] v4 = v5; // depends on control dependency: [if], data = [none] v5 = t; // depends on control dependency: [if], data = [none] } if (SA[ISAd + SA[v2]] > SA[ISAd + SA[v4]]) { t = v2; // depends on control dependency: [if], data = [none] v2 = v4; // depends on control dependency: [if], data = [none] v4 = t; // depends on control dependency: [if], data = [none] t = v3; // depends on control dependency: [if], data = [none] v3 = v5; // depends on control dependency: [if], data = [none] v5 = t; // depends on control dependency: [if], data = [none] } if (SA[ISAd + SA[v1]] > SA[ISAd + SA[v3]]) { t = v1; // depends on control dependency: [if], data = [none] v1 = v3; // depends on control dependency: [if], data = [none] v3 = t; // depends on control dependency: [if], data = [none] } if (SA[ISAd + SA[v1]] > SA[ISAd + SA[v4]]) { t = v1; // depends on control dependency: [if], data = [none] v1 = v4; // depends on control dependency: [if], data = [none] v4 = t; // depends on control dependency: [if], data = [none] t = v3; // depends on control dependency: [if], data = [none] v3 = v5; // depends on control dependency: [if], data = [none] v5 = t; // depends on control dependency: [if], data = [none] } if (SA[ISAd + SA[v3]] > SA[ISAd + SA[v4]]) { return v4; // depends on control dependency: [if], data = [none] } return v3; } }
public class class_name { public static double lpow2(long m, int n) { if(m == 0) { return 0.0; } if(m == Long.MIN_VALUE) { return lpow2(Long.MIN_VALUE >> 1, n + 1); } if(m < 0) { return -lpow2(-m, n); } assert (m >= 0); int bitLength = magnitude(m); int shift = bitLength - 53; long exp = 1023L + 52 + n + shift; // Use long to avoid overflow. if(exp >= 0x7FF) { return Double.POSITIVE_INFINITY; } if(exp <= 0) { // Degenerated number (subnormal, assume 0 for bit 52) if(exp <= -54) { return 0.0; } return lpow2(m, n + 54) / 18014398509481984L; // 2^54 Exact. } // Normal number. long bits = (shift > 0) ? (m >> shift) + ((m >> (shift - 1)) & 1) : // Rounding. m << -shift; if(((bits >> 52) != 1) && (++exp >= 0x7FF)) { return Double.POSITIVE_INFINITY; } bits &= 0x000fffffffffffffL; // Clears MSB (bit 52) bits |= exp << 52; return Double.longBitsToDouble(bits); } }
public class class_name { public static double lpow2(long m, int n) { if(m == 0) { return 0.0; // depends on control dependency: [if], data = [none] } if(m == Long.MIN_VALUE) { return lpow2(Long.MIN_VALUE >> 1, n + 1); // depends on control dependency: [if], data = [none] } if(m < 0) { return -lpow2(-m, n); // depends on control dependency: [if], data = [none] } assert (m >= 0); int bitLength = magnitude(m); int shift = bitLength - 53; long exp = 1023L + 52 + n + shift; // Use long to avoid overflow. if(exp >= 0x7FF) { return Double.POSITIVE_INFINITY; // depends on control dependency: [if], data = [none] } if(exp <= 0) { // Degenerated number (subnormal, assume 0 for bit 52) if(exp <= -54) { return 0.0; // depends on control dependency: [if], data = [none] } return lpow2(m, n + 54) / 18014398509481984L; // 2^54 Exact. // depends on control dependency: [if], data = [none] } // Normal number. long bits = (shift > 0) ? (m >> shift) + ((m >> (shift - 1)) & 1) : // Rounding. m << -shift; if(((bits >> 52) != 1) && (++exp >= 0x7FF)) { return Double.POSITIVE_INFINITY; // depends on control dependency: [if], data = [none] } bits &= 0x000fffffffffffffL; // Clears MSB (bit 52) bits |= exp << 52; return Double.longBitsToDouble(bits); } }
public class class_name { protected String getModuleVersion() { StringBuilder sb = new StringBuilder(); int pcs = 0; for (String pc : projectVersion.split("\\.")) { if (pcs++ > 3) { break; } else { appendVersionPiece(sb, pc); } } appendVersionPiece(sb, buildNumber); return sb.toString(); } }
public class class_name { protected String getModuleVersion() { StringBuilder sb = new StringBuilder(); int pcs = 0; for (String pc : projectVersion.split("\\.")) { if (pcs++ > 3) { break; } else { appendVersionPiece(sb, pc); // depends on control dependency: [if], data = [none] } } appendVersionPiece(sb, buildNumber); return sb.toString(); } }
public class class_name { @Override public EClass getDownloadResult() { if (downloadResultEClass == null) { downloadResultEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(17); } return downloadResultEClass; } }
public class class_name { @Override public EClass getDownloadResult() { if (downloadResultEClass == null) { downloadResultEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(17); // depends on control dependency: [if], data = [none] } return downloadResultEClass; } }
public class class_name { @Override public List<Record> signalStartTrack(Record signal) { //(queue track) this.queuedTracks.addLast(signal); //(push info) if(info != null){ this.trackStack.push(info); } info = new TrackInfo(signal.content.toString(), signal.timesstamp); //(force print) if(signal.force()){ updateTracks(signal.depth+1); } //(return) return EMPTY; //don't send extra records } }
public class class_name { @Override public List<Record> signalStartTrack(Record signal) { //(queue track) this.queuedTracks.addLast(signal); //(push info) if(info != null){ this.trackStack.push(info); // depends on control dependency: [if], data = [(info] } info = new TrackInfo(signal.content.toString(), signal.timesstamp); //(force print) if(signal.force()){ updateTracks(signal.depth+1); // depends on control dependency: [if], data = [none] } //(return) return EMPTY; //don't send extra records } }
public class class_name { public static Iterable<BoxLegalHoldPolicy.Info> getAll( final BoxAPIConnection api, String policyName, int limit, String ... fields) { QueryStringBuilder builder = new QueryStringBuilder(); if (policyName != null) { builder.appendParam("policy_name", policyName); } if (fields.length > 0) { builder.appendParam("fields", fields); } return new BoxResourceIterable<BoxLegalHoldPolicy.Info>(api, ALL_LEGAL_HOLD_URL_TEMPLATE.buildWithQuery(api.getBaseURL(), builder.toString()), limit) { @Override protected BoxLegalHoldPolicy.Info factory(JsonObject jsonObject) { BoxLegalHoldPolicy policy = new BoxLegalHoldPolicy(api, jsonObject.get("id").asString()); return policy.new Info(jsonObject); } }; } }
public class class_name { public static Iterable<BoxLegalHoldPolicy.Info> getAll( final BoxAPIConnection api, String policyName, int limit, String ... fields) { QueryStringBuilder builder = new QueryStringBuilder(); if (policyName != null) { builder.appendParam("policy_name", policyName); // depends on control dependency: [if], data = [none] } if (fields.length > 0) { builder.appendParam("fields", fields); // depends on control dependency: [if], data = [none] } return new BoxResourceIterable<BoxLegalHoldPolicy.Info>(api, ALL_LEGAL_HOLD_URL_TEMPLATE.buildWithQuery(api.getBaseURL(), builder.toString()), limit) { @Override protected BoxLegalHoldPolicy.Info factory(JsonObject jsonObject) { BoxLegalHoldPolicy policy = new BoxLegalHoldPolicy(api, jsonObject.get("id").asString()); return policy.new Info(jsonObject); } }; } }
public class class_name { @Override public Value check(ILexNameToken name) { Value v = get(name); if (v != null) { return v; } if (freeVariables != null) { v = freeVariables.get(name); if (v != null) { return v; } } // A RootContext stops the name search from continuing down the // context chain. It first checks any state context, then goes // down to the global level. if (v == null) { if (stateCtxt != null) { v = stateCtxt.check(name); if (v != null) { return v; } } Context g = getGlobal(); if (g != this) { return g.check(name); } } return v; } }
public class class_name { @Override public Value check(ILexNameToken name) { Value v = get(name); if (v != null) { return v; // depends on control dependency: [if], data = [none] } if (freeVariables != null) { v = freeVariables.get(name); // depends on control dependency: [if], data = [none] if (v != null) { return v; // depends on control dependency: [if], data = [none] } } // A RootContext stops the name search from continuing down the // context chain. It first checks any state context, then goes // down to the global level. if (v == null) { if (stateCtxt != null) { v = stateCtxt.check(name); // depends on control dependency: [if], data = [none] if (v != null) { return v; // depends on control dependency: [if], data = [none] } } Context g = getGlobal(); if (g != this) { return g.check(name); // depends on control dependency: [if], data = [none] } } return v; } }
public class class_name { private void CheckCMYK(IfdTags metadata, int n) { // Samples per pixel if (!metadata.containsTagId(TiffTags.getTagId("SamplesPerPixel"))) { validation.addErrorLoc("Missing Samples Per Pixel", "IFD" + n); } // BitsPerSample if (!metadata.containsTagId(TiffTags.getTagId("BitsPerSample"))) { validation.addErrorLoc("Missing BitsPerSample", "IFD" + n); } } }
public class class_name { private void CheckCMYK(IfdTags metadata, int n) { // Samples per pixel if (!metadata.containsTagId(TiffTags.getTagId("SamplesPerPixel"))) { validation.addErrorLoc("Missing Samples Per Pixel", "IFD" + n); // depends on control dependency: [if], data = [none] } // BitsPerSample if (!metadata.containsTagId(TiffTags.getTagId("BitsPerSample"))) { validation.addErrorLoc("Missing BitsPerSample", "IFD" + n); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void onJoinComplete(Integer count, Result<Boolean> result) { if (count == null) { count = 0; } _joinState = _joinState.onJoinComplete(count, this); updatePodsFromHeartbeat(); waitForHubHeartbeat(count, result); if (_joinLifecycle.toActive()) { _timer.runAfter(_joinTask, getJoinTimeout(), TimeUnit.MILLISECONDS, Result.ignore()); } } }
public class class_name { private void onJoinComplete(Integer count, Result<Boolean> result) { if (count == null) { count = 0; // depends on control dependency: [if], data = [none] } _joinState = _joinState.onJoinComplete(count, this); updatePodsFromHeartbeat(); waitForHubHeartbeat(count, result); if (_joinLifecycle.toActive()) { _timer.runAfter(_joinTask, getJoinTimeout(), TimeUnit.MILLISECONDS, Result.ignore()); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void initResultsTable(DeferredSelector[] dg, Benchmark... benchs) { int numRows = dg.length; grid = new FlexTable(); grid.addStyleName("resultstable"); RootPanel.get("results").clear(); RootPanel.get("results").add(grid); grid.setText(0, 0, "Selector"); for (int i=0; i < benchs.length; i++) { grid.setText(0, i+1, benchs[i].getId()); } for (int i = 0; i < numRows; i++) { grid.setText(i+1, 0, dg[i].getSelector()); for (int j = 0; j < benchs.length; j++) { grid.setText(i+1, j+1, "-"); } } } }
public class class_name { private void initResultsTable(DeferredSelector[] dg, Benchmark... benchs) { int numRows = dg.length; grid = new FlexTable(); grid.addStyleName("resultstable"); RootPanel.get("results").clear(); RootPanel.get("results").add(grid); grid.setText(0, 0, "Selector"); for (int i=0; i < benchs.length; i++) { grid.setText(0, i+1, benchs[i].getId()); // depends on control dependency: [for], data = [i] } for (int i = 0; i < numRows; i++) { grid.setText(i+1, 0, dg[i].getSelector()); // depends on control dependency: [for], data = [i] for (int j = 0; j < benchs.length; j++) { grid.setText(i+1, j+1, "-"); // depends on control dependency: [for], data = [j] } } } }
public class class_name { public static boolean isTypeOf(final Class<?> lookupClass, final Class<?> targetClass) { if (targetClass == null || lookupClass == null) { return false; } return targetClass.isAssignableFrom(lookupClass); } }
public class class_name { public static boolean isTypeOf(final Class<?> lookupClass, final Class<?> targetClass) { if (targetClass == null || lookupClass == null) { return false; // depends on control dependency: [if], data = [none] } return targetClass.isAssignableFrom(lookupClass); } }
public class class_name { @SneakyThrows public void parseCompilationUnit(final Set<ConfigurationMetadataProperty> collectedProps, final Set<ConfigurationMetadataProperty> collectedGroups, final ConfigurationMetadataProperty p, final String typePath, final String typeName, final boolean indexNameWithBrackets) { try (val is = Files.newInputStream(Paths.get(typePath))) { val cu = StaticJavaParser.parse(is); new ConfigurationMetadataFieldVisitor(collectedProps, collectedGroups, indexNameWithBrackets, typeName, sourcePath).visit(cu, p); if (!cu.getTypes().isEmpty()) { val decl = ClassOrInterfaceDeclaration.class.cast(cu.getType(0)); for (var i = 0; i < decl.getExtendedTypes().size(); i++) { val parentType = decl.getExtendedTypes().get(i); val instance = ConfigurationMetadataClassSourceLocator.getInstance(); val parentClazz = instance.locatePropertiesClassForType(parentType); val parentTypePath = ConfigurationMetadataClassSourceLocator.buildTypeSourcePath(this.sourcePath, parentClazz.getName()); parseCompilationUnit(collectedProps, collectedGroups, p, parentTypePath, parentClazz.getName(), indexNameWithBrackets); } } } } }
public class class_name { @SneakyThrows public void parseCompilationUnit(final Set<ConfigurationMetadataProperty> collectedProps, final Set<ConfigurationMetadataProperty> collectedGroups, final ConfigurationMetadataProperty p, final String typePath, final String typeName, final boolean indexNameWithBrackets) { try (val is = Files.newInputStream(Paths.get(typePath))) { val cu = StaticJavaParser.parse(is); new ConfigurationMetadataFieldVisitor(collectedProps, collectedGroups, indexNameWithBrackets, typeName, sourcePath).visit(cu, p); if (!cu.getTypes().isEmpty()) { val decl = ClassOrInterfaceDeclaration.class.cast(cu.getType(0)); for (var i = 0; i < decl.getExtendedTypes().size(); i++) { val parentType = decl.getExtendedTypes().get(i); val instance = ConfigurationMetadataClassSourceLocator.getInstance(); val parentClazz = instance.locatePropertiesClassForType(parentType); val parentTypePath = ConfigurationMetadataClassSourceLocator.buildTypeSourcePath(this.sourcePath, parentClazz.getName()); parseCompilationUnit(collectedProps, collectedGroups, p, parentTypePath, parentClazz.getName(), indexNameWithBrackets); // depends on control dependency: [for], data = [none] } } } } }
public class class_name { public void marshall(HlsGroupSettings hlsGroupSettings, ProtocolMarshaller protocolMarshaller) { if (hlsGroupSettings == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(hlsGroupSettings.getAdMarkers(), ADMARKERS_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getBaseUrlContent(), BASEURLCONTENT_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getBaseUrlManifest(), BASEURLMANIFEST_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getCaptionLanguageMappings(), CAPTIONLANGUAGEMAPPINGS_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getCaptionLanguageSetting(), CAPTIONLANGUAGESETTING_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getClientCache(), CLIENTCACHE_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getCodecSpecification(), CODECSPECIFICATION_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getConstantIv(), CONSTANTIV_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getDestination(), DESTINATION_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getDirectoryStructure(), DIRECTORYSTRUCTURE_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getEncryptionType(), ENCRYPTIONTYPE_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getHlsCdnSettings(), HLSCDNSETTINGS_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getIFrameOnlyPlaylists(), IFRAMEONLYPLAYLISTS_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getIndexNSegments(), INDEXNSEGMENTS_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getInputLossAction(), INPUTLOSSACTION_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getIvInManifest(), IVINMANIFEST_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getIvSource(), IVSOURCE_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getKeepSegments(), KEEPSEGMENTS_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getKeyFormat(), KEYFORMAT_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getKeyFormatVersions(), KEYFORMATVERSIONS_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getKeyProviderSettings(), KEYPROVIDERSETTINGS_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getManifestCompression(), MANIFESTCOMPRESSION_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getManifestDurationFormat(), MANIFESTDURATIONFORMAT_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getMinSegmentLength(), MINSEGMENTLENGTH_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getMode(), MODE_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getOutputSelection(), OUTPUTSELECTION_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getProgramDateTime(), PROGRAMDATETIME_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getProgramDateTimePeriod(), PROGRAMDATETIMEPERIOD_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getRedundantManifest(), REDUNDANTMANIFEST_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getSegmentLength(), SEGMENTLENGTH_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getSegmentationMode(), SEGMENTATIONMODE_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getSegmentsPerSubdirectory(), SEGMENTSPERSUBDIRECTORY_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getStreamInfResolution(), STREAMINFRESOLUTION_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getTimedMetadataId3Frame(), TIMEDMETADATAID3FRAME_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getTimedMetadataId3Period(), TIMEDMETADATAID3PERIOD_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getTimestampDeltaMilliseconds(), TIMESTAMPDELTAMILLISECONDS_BINDING); protocolMarshaller.marshall(hlsGroupSettings.getTsFileMode(), TSFILEMODE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(HlsGroupSettings hlsGroupSettings, ProtocolMarshaller protocolMarshaller) { if (hlsGroupSettings == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(hlsGroupSettings.getAdMarkers(), ADMARKERS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getBaseUrlContent(), BASEURLCONTENT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getBaseUrlManifest(), BASEURLMANIFEST_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getCaptionLanguageMappings(), CAPTIONLANGUAGEMAPPINGS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getCaptionLanguageSetting(), CAPTIONLANGUAGESETTING_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getClientCache(), CLIENTCACHE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getCodecSpecification(), CODECSPECIFICATION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getConstantIv(), CONSTANTIV_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getDestination(), DESTINATION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getDirectoryStructure(), DIRECTORYSTRUCTURE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getEncryptionType(), ENCRYPTIONTYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getHlsCdnSettings(), HLSCDNSETTINGS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getIFrameOnlyPlaylists(), IFRAMEONLYPLAYLISTS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getIndexNSegments(), INDEXNSEGMENTS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getInputLossAction(), INPUTLOSSACTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getIvInManifest(), IVINMANIFEST_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getIvSource(), IVSOURCE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getKeepSegments(), KEEPSEGMENTS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getKeyFormat(), KEYFORMAT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getKeyFormatVersions(), KEYFORMATVERSIONS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getKeyProviderSettings(), KEYPROVIDERSETTINGS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getManifestCompression(), MANIFESTCOMPRESSION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getManifestDurationFormat(), MANIFESTDURATIONFORMAT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getMinSegmentLength(), MINSEGMENTLENGTH_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getMode(), MODE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getOutputSelection(), OUTPUTSELECTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getProgramDateTime(), PROGRAMDATETIME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getProgramDateTimePeriod(), PROGRAMDATETIMEPERIOD_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getRedundantManifest(), REDUNDANTMANIFEST_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getSegmentLength(), SEGMENTLENGTH_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getSegmentationMode(), SEGMENTATIONMODE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getSegmentsPerSubdirectory(), SEGMENTSPERSUBDIRECTORY_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getStreamInfResolution(), STREAMINFRESOLUTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getTimedMetadataId3Frame(), TIMEDMETADATAID3FRAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getTimedMetadataId3Period(), TIMEDMETADATAID3PERIOD_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getTimestampDeltaMilliseconds(), TIMESTAMPDELTAMILLISECONDS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hlsGroupSettings.getTsFileMode(), TSFILEMODE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected void checkWritePermissionsInFolder(CmsDbContext dbc, CmsResource folder) throws CmsDataAccessException { ResultSet res = null; PreparedStatement stmt = null; Connection conn = null; CmsUUID projectId = dbc.getRequestContext().getCurrentProject().getUuid(); // first read all subresources with ACEs List<CmsResource> resources = new ArrayList<CmsResource>(); try { conn = m_sqlManager.getConnection(dbc); stmt = m_sqlManager.getPreparedStatement(conn, projectId, "C_RESOURCES_READ_WITH_ACE_1"); stmt.setString(1, folder.getRootPath() + "%"); res = stmt.executeQuery(); while (res.next()) { resources.add(createResource(res, projectId)); } } catch (SQLException e) { throw new CmsDbSqlException( Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)), e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, res); } // check current user write permission for each of these resources Iterator<CmsResource> itResources = resources.iterator(); while (itResources.hasNext()) { CmsResource resource = itResources.next(); try { m_driverManager.getSecurityManager().checkPermissions( dbc.getRequestContext(), resource, CmsPermissionSet.ACCESS_WRITE, false, CmsResourceFilter.ALL); } catch (CmsException e) { throw new CmsDataAccessException(e.getMessageContainer(), e); } } // then check for possible jsp pages without permissions CmsResourceFilter filter = CmsResourceFilter.ALL; itResources = readTypesInResourceTree( dbc, projectId, folder.getRootPath(), CmsResourceTypeJsp.getJspResourceTypeIds(), filter.getState(), filter.getModifiedAfter(), filter.getModifiedBefore(), filter.getReleaseAfter(), filter.getReleaseBefore(), filter.getExpireAfter(), filter.getExpireBefore(), CmsDriverManager.READMODE_INCLUDE_TREE).iterator(); while (itResources.hasNext()) { CmsResource resource = itResources.next(); try { m_driverManager.getSecurityManager().checkPermissions( dbc.getRequestContext(), resource, CmsPermissionSet.ACCESS_WRITE, false, CmsResourceFilter.ALL); } catch (CmsException e) { throw new CmsDataAccessException(e.getMessageContainer(), e); } } } }
public class class_name { protected void checkWritePermissionsInFolder(CmsDbContext dbc, CmsResource folder) throws CmsDataAccessException { ResultSet res = null; PreparedStatement stmt = null; Connection conn = null; CmsUUID projectId = dbc.getRequestContext().getCurrentProject().getUuid(); // first read all subresources with ACEs List<CmsResource> resources = new ArrayList<CmsResource>(); try { conn = m_sqlManager.getConnection(dbc); stmt = m_sqlManager.getPreparedStatement(conn, projectId, "C_RESOURCES_READ_WITH_ACE_1"); stmt.setString(1, folder.getRootPath() + "%"); res = stmt.executeQuery(); while (res.next()) { resources.add(createResource(res, projectId)); // depends on control dependency: [while], data = [none] } } catch (SQLException e) { throw new CmsDbSqlException( Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)), e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, res); } // check current user write permission for each of these resources Iterator<CmsResource> itResources = resources.iterator(); while (itResources.hasNext()) { CmsResource resource = itResources.next(); try { m_driverManager.getSecurityManager().checkPermissions( dbc.getRequestContext(), resource, CmsPermissionSet.ACCESS_WRITE, false, CmsResourceFilter.ALL); } catch (CmsException e) { throw new CmsDataAccessException(e.getMessageContainer(), e); } } // then check for possible jsp pages without permissions CmsResourceFilter filter = CmsResourceFilter.ALL; itResources = readTypesInResourceTree( dbc, projectId, folder.getRootPath(), CmsResourceTypeJsp.getJspResourceTypeIds(), filter.getState(), filter.getModifiedAfter(), filter.getModifiedBefore(), filter.getReleaseAfter(), filter.getReleaseBefore(), filter.getExpireAfter(), filter.getExpireBefore(), CmsDriverManager.READMODE_INCLUDE_TREE).iterator(); while (itResources.hasNext()) { CmsResource resource = itResources.next(); try { m_driverManager.getSecurityManager().checkPermissions( dbc.getRequestContext(), resource, CmsPermissionSet.ACCESS_WRITE, false, CmsResourceFilter.ALL); } catch (CmsException e) { throw new CmsDataAccessException(e.getMessageContainer(), e); } } } }
public class class_name { public void marshall(GetTriggerRequest getTriggerRequest, ProtocolMarshaller protocolMarshaller) { if (getTriggerRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getTriggerRequest.getName(), NAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetTriggerRequest getTriggerRequest, ProtocolMarshaller protocolMarshaller) { if (getTriggerRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getTriggerRequest.getName(), NAME_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 static Collection<TileRef> getTiles(Map<ColorRgba, Collection<TileRef>> colors, ColorRgba color) { if (!colors.containsKey(color)) { colors.put(color, new HashSet<TileRef>()); } return colors.get(color); } }
public class class_name { private static Collection<TileRef> getTiles(Map<ColorRgba, Collection<TileRef>> colors, ColorRgba color) { if (!colors.containsKey(color)) { colors.put(color, new HashSet<TileRef>()); // depends on control dependency: [if], data = [none] } return colors.get(color); } }
public class class_name { public void dispose(){ if(logger.isDebugEnabled()){ logger.debug("Disposing of editor "+getId()); } context.register(GlobalCommandIds.SAVE, null); context.register(GlobalCommandIds.SAVE_AS, null); //descriptor.removePropertyChangeListener((PropertyChangeListener)context.getPane()); concreteDispose(); } }
public class class_name { public void dispose(){ if(logger.isDebugEnabled()){ logger.debug("Disposing of editor "+getId()); // depends on control dependency: [if], data = [none] } context.register(GlobalCommandIds.SAVE, null); context.register(GlobalCommandIds.SAVE_AS, null); //descriptor.removePropertyChangeListener((PropertyChangeListener)context.getPane()); concreteDispose(); } }
public class class_name { @Override public void taskStopping() { if (suspendTranOfExecutionThread) { Throwable exception = null; // Cleanup any unresolved transactions. UOWCurrent uowCurrent = EmbeddableTransactionManagerFactory.getUOWCurrent(); switch (uowCurrent.getUOWType()) { case UOWCurrent.UOW_GLOBAL: // Rollback global transactions. try { EmbeddableWebSphereTransactionManager tm = EmbeddableTransactionManagerFactory.getTransactionManager(); tm.rollback(); exception = new Exception("Global transaction rolled back."); } catch (Exception e) { exception = e; } break; case UOWCurrent.UOW_LOCAL: // Commit local transaction. try { LocalTransactionCurrent ltCurrent = EmbeddableTransactionManagerFactory.getLocalTransactionCurrent(); ltCurrent.end(LocalTransactionCoordinator.EndModeCommit); } catch (Exception e) { exception = e; } break; case UOWCurrent.UOW_NONE: break; default: exception = new Exception("Invalid transaction type: " + uowCurrent.getUOWType()); break; } // Resume the original transaction. try { if (suspendedUOW != null) { UOWManager uowManager = UOWManagerFactory.getUOWManager(); uowManager.resume(suspendedUOW); suspendedUOW = null; } } catch (Throwable e) { exception = e; } // Throw any pending exception. if (exception != null) { throw new IllegalStateException(exception); } } } }
public class class_name { @Override public void taskStopping() { if (suspendTranOfExecutionThread) { Throwable exception = null; // Cleanup any unresolved transactions. UOWCurrent uowCurrent = EmbeddableTransactionManagerFactory.getUOWCurrent(); switch (uowCurrent.getUOWType()) { case UOWCurrent.UOW_GLOBAL: // Rollback global transactions. try { EmbeddableWebSphereTransactionManager tm = EmbeddableTransactionManagerFactory.getTransactionManager(); tm.rollback(); // depends on control dependency: [try], data = [none] exception = new Exception("Global transaction rolled back."); // depends on control dependency: [try], data = [exception] } catch (Exception e) { exception = e; } // depends on control dependency: [catch], data = [none] break; case UOWCurrent.UOW_LOCAL: // Commit local transaction. try { LocalTransactionCurrent ltCurrent = EmbeddableTransactionManagerFactory.getLocalTransactionCurrent(); ltCurrent.end(LocalTransactionCoordinator.EndModeCommit); // depends on control dependency: [try], data = [none] } catch (Exception e) { exception = e; } // depends on control dependency: [catch], data = [none] break; case UOWCurrent.UOW_NONE: break; default: exception = new Exception("Invalid transaction type: " + uowCurrent.getUOWType()); break; } // Resume the original transaction. try { if (suspendedUOW != null) { UOWManager uowManager = UOWManagerFactory.getUOWManager(); uowManager.resume(suspendedUOW); // depends on control dependency: [if], data = [(suspendedUOW] suspendedUOW = null; // depends on control dependency: [if], data = [none] } } catch (Throwable e) { exception = e; } // depends on control dependency: [catch], data = [none] // Throw any pending exception. if (exception != null) { throw new IllegalStateException(exception); } } } }
public class class_name { public ServiceCall<Classifier> getClassifier(GetClassifierOptions getClassifierOptions) { Validator.notNull(getClassifierOptions, "getClassifierOptions cannot be null"); String[] pathSegments = { "v3/classifiers" }; String[] pathParameters = { getClassifierOptions.classifierId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters)); builder.query("version", versionDate); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("watson_vision_combined", "v3", "getClassifier"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Classifier.class)); } }
public class class_name { public ServiceCall<Classifier> getClassifier(GetClassifierOptions getClassifierOptions) { Validator.notNull(getClassifierOptions, "getClassifierOptions cannot be null"); String[] pathSegments = { "v3/classifiers" }; String[] pathParameters = { getClassifierOptions.classifierId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters)); builder.query("version", versionDate); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("watson_vision_combined", "v3", "getClassifier"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header] } builder.header("Accept", "application/json"); return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Classifier.class)); } }
public class class_name { public Map<String, String> toStringMap() { Map<String, String> map = new HashMap<>(); for (Map.Entry<String, Object> entry : entrySet()) { map.put(entry.getKey(), String.valueOf(entry.getValue())); } return map; } }
public class class_name { public Map<String, String> toStringMap() { Map<String, String> map = new HashMap<>(); for (Map.Entry<String, Object> entry : entrySet()) { map.put(entry.getKey(), String.valueOf(entry.getValue())); // depends on control dependency: [for], data = [entry] } return map; } }