code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public static long eatInputStream(InputStream is) { try { long eaten = 0; try { Thread.sleep(STREAM_SLEEP_TIME); } catch (InterruptedException e) { // ignore } int avail = Math.min(is.available(), CHUNKSIZE); byte[] eatingArray = new byte[CHUNKSIZE]; while (avail > 0) { is.read(eatingArray, 0, avail); eaten += avail; if (avail < CHUNKSIZE) { // If the buffer wasn't full, wait a short amount of time to let it fill up if (STREAM_SLEEP_TIME != 0) try { Thread.sleep(STREAM_SLEEP_TIME); } catch (InterruptedException e) { // ignore } } avail = Math.min(is.available(), CHUNKSIZE); } return eaten; } catch (IOException e) { log.error(e.getMessage(), e); return -1; } } }
public class class_name { public static long eatInputStream(InputStream is) { try { long eaten = 0; try { Thread.sleep(STREAM_SLEEP_TIME); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { // ignore } // depends on control dependency: [catch], data = [none] int avail = Math.min(is.available(), CHUNKSIZE); byte[] eatingArray = new byte[CHUNKSIZE]; while (avail > 0) { is.read(eatingArray, 0, avail); // depends on control dependency: [while], data = [none] eaten += avail; // depends on control dependency: [while], data = [none] if (avail < CHUNKSIZE) { // If the buffer wasn't full, wait a short amount of time to let it fill up if (STREAM_SLEEP_TIME != 0) try { Thread.sleep(STREAM_SLEEP_TIME); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { // ignore } // depends on control dependency: [catch], data = [none] } avail = Math.min(is.available(), CHUNKSIZE); // depends on control dependency: [while], data = [none] } return eaten; // depends on control dependency: [try], data = [none] } catch (IOException e) { log.error(e.getMessage(), e); return -1; } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected InputSource resolvePublicID(String publicId, boolean trace) { if( publicId == null ) return null; if (trace) log.trace("resolvePublicID, publicId=" + publicId); InputSource inputSource = null; String filename = null; if( localEntities != null ) filename = (String) localEntities.get(publicId); if( filename == null ) filename = (String) entities.get(publicId); if( filename != null ) { if (trace) log.trace("Found entity from publicId=" + publicId + " fileName=" + filename); InputStream ins = loadClasspathResource(filename, trace); if( ins != null ) { inputSource = new InputSource(ins); inputSource.setPublicId(publicId); } else { log.trace("Cannot load publicId from classpath resource: " + filename); // Try the file name as a URI inputSource = resolveSystemIDasURL(filename, trace); if (inputSource == null) log.warn("Cannot load publicId from resource: " + filename); } } return inputSource; } }
public class class_name { protected InputSource resolvePublicID(String publicId, boolean trace) { if( publicId == null ) return null; if (trace) log.trace("resolvePublicID, publicId=" + publicId); InputSource inputSource = null; String filename = null; if( localEntities != null ) filename = (String) localEntities.get(publicId); if( filename == null ) filename = (String) entities.get(publicId); if( filename != null ) { if (trace) log.trace("Found entity from publicId=" + publicId + " fileName=" + filename); InputStream ins = loadClasspathResource(filename, trace); if( ins != null ) { inputSource = new InputSource(ins); // depends on control dependency: [if], data = [none] inputSource.setPublicId(publicId); // depends on control dependency: [if], data = [none] } else { log.trace("Cannot load publicId from classpath resource: " + filename); // depends on control dependency: [if], data = [none] // Try the file name as a URI inputSource = resolveSystemIDasURL(filename, trace); // depends on control dependency: [if], data = [none] if (inputSource == null) log.warn("Cannot load publicId from resource: " + filename); } } return inputSource; } }
public class class_name { private void annotateOptions(Properties properties) throws IOException { String ruleBasedOption = properties.getProperty("ruleBasedOption"); String dictOption = properties.getProperty("dictTag"); String dictPath = properties.getProperty("dictPath"); if (!dictOption.equals(Flags.DEFAULT_DICT_OPTION)) { if (dictPath.equals(Flags.DEFAULT_DICT_PATH)) { Flags.dictionaryException(); } if (!ruleBasedOption.equals(Flags.DEFAULT_LEXER)) { lexerTagger = true; } if (!dictPath.equals(Flags.DEFAULT_DICT_PATH)) { if (dictionaries == null) { dictionaries = new Dictionaries(dictPath); nerTaggerDict = new DictionariesNERTagger(dictionaries); } if (dictOption.equalsIgnoreCase("tag")) { dictTag = true; postProcess = false; statistical = false; } else if (dictOption.equalsIgnoreCase("post")) { nerTagger = new StatisticalSequenceLabeler(properties); statistical = true; postProcess = true; dictTag = false; } else { nerTagger = new StatisticalSequenceLabeler(properties); statistical = true; dictTag = false; postProcess = false; } } } else if (!ruleBasedOption.equals(Flags.DEFAULT_LEXER)) { lexerTagger = true; statistical = true; dictTag = false; postProcess = false; nerTagger = new StatisticalSequenceLabeler(properties); } else { lexerTagger = false; statistical = true; dictTag = false; postProcess = false; nerTagger = new StatisticalSequenceLabeler(properties); } } }
public class class_name { private void annotateOptions(Properties properties) throws IOException { String ruleBasedOption = properties.getProperty("ruleBasedOption"); String dictOption = properties.getProperty("dictTag"); String dictPath = properties.getProperty("dictPath"); if (!dictOption.equals(Flags.DEFAULT_DICT_OPTION)) { if (dictPath.equals(Flags.DEFAULT_DICT_PATH)) { Flags.dictionaryException(); // depends on control dependency: [if], data = [none] } if (!ruleBasedOption.equals(Flags.DEFAULT_LEXER)) { lexerTagger = true; // depends on control dependency: [if], data = [none] } if (!dictPath.equals(Flags.DEFAULT_DICT_PATH)) { if (dictionaries == null) { dictionaries = new Dictionaries(dictPath); // depends on control dependency: [if], data = [none] nerTaggerDict = new DictionariesNERTagger(dictionaries); // depends on control dependency: [if], data = [(dictionaries] } if (dictOption.equalsIgnoreCase("tag")) { dictTag = true; // depends on control dependency: [if], data = [none] postProcess = false; // depends on control dependency: [if], data = [none] statistical = false; // depends on control dependency: [if], data = [none] } else if (dictOption.equalsIgnoreCase("post")) { nerTagger = new StatisticalSequenceLabeler(properties); // depends on control dependency: [if], data = [none] statistical = true; // depends on control dependency: [if], data = [none] postProcess = true; // depends on control dependency: [if], data = [none] dictTag = false; // depends on control dependency: [if], data = [none] } else { nerTagger = new StatisticalSequenceLabeler(properties); // depends on control dependency: [if], data = [none] statistical = true; // depends on control dependency: [if], data = [none] dictTag = false; // depends on control dependency: [if], data = [none] postProcess = false; // depends on control dependency: [if], data = [none] } } } else if (!ruleBasedOption.equals(Flags.DEFAULT_LEXER)) { lexerTagger = true; statistical = true; dictTag = false; postProcess = false; nerTagger = new StatisticalSequenceLabeler(properties); } else { lexerTagger = false; statistical = true; dictTag = false; postProcess = false; nerTagger = new StatisticalSequenceLabeler(properties); } } }
public class class_name { public void convertToMultipart() { this.method = "POST"; String boundary = UUID.randomUUID().toString().replaceAll("-", ""); setHeader("Content-Type", "multipart/form-data; boundary=----" + boundary); //add parameters, if available StringBuilder bodyBuilder = new StringBuilder(); for (Parameter param : parameters) { bodyBuilder.append("------").append(boundary).append(CRLF); bodyBuilder.append("Content-Disposition: form-data; name=\"").append(param.getName()).append("\""); if (param.getType() == IParameter.PARAM_MULTIPART_ATTR) { bodyBuilder.append("; filename=\"").append(param.getFilename()).append("\"").append(CRLF); bodyBuilder.append("Content-Type: ").append(param.getContentType()); } bodyBuilder.append(CRLF).append(CRLF); bodyBuilder.append(param.getValue()); bodyBuilder.append(CRLF); } bodyBuilder.append("------").append(boundary).append("--").append(CRLF); this.body = bodyBuilder.toString(); this.parameters = new ArrayList<>(); this.sortedParams = null; } }
public class class_name { public void convertToMultipart() { this.method = "POST"; String boundary = UUID.randomUUID().toString().replaceAll("-", ""); setHeader("Content-Type", "multipart/form-data; boundary=----" + boundary); //add parameters, if available StringBuilder bodyBuilder = new StringBuilder(); for (Parameter param : parameters) { bodyBuilder.append("------").append(boundary).append(CRLF); // depends on control dependency: [for], data = [none] bodyBuilder.append("Content-Disposition: form-data; name=\"").append(param.getName()).append("\""); // depends on control dependency: [for], data = [none] // depends on control dependency: [for], data = [param] if (param.getType() == IParameter.PARAM_MULTIPART_ATTR) { bodyBuilder.append("; filename=\"").append(param.getFilename()).append("\"").append(CRLF); // depends on control dependency: [if], data = [none] bodyBuilder.append("Content-Type: ").append(param.getContentType()); // depends on control dependency: [if], data = [none] } bodyBuilder.append(CRLF).append(CRLF); // depends on control dependency: [for], data = [none] bodyBuilder.append(param.getValue()); // depends on control dependency: [for], data = [param] bodyBuilder.append(CRLF); // depends on control dependency: [for], data = [none] } bodyBuilder.append("------").append(boundary).append("--").append(CRLF); this.body = bodyBuilder.toString(); this.parameters = new ArrayList<>(); this.sortedParams = null; } }
public class class_name { @SuppressWarnings("unchecked") public void call(Serializer ser, InputStream is, OutputStream os) throws IOException { Object obj = null; try { obj = ser.readMapOrList(is); } catch (Exception e) { String msg = "Unable to deserialize request: " + e.getMessage(); ser.write(new RpcResponse(null, RpcException.Error.PARSE.exc(msg)).marshal(), os); return; } if (obj instanceof List) { List list = (List)obj; List respList = new ArrayList(); for (Object o : list) { RpcRequest rpcReq = new RpcRequest((Map)o); respList.add(call(rpcReq).marshal()); } ser.write(respList, os); } else if (obj instanceof Map) { RpcRequest rpcReq = new RpcRequest((Map)obj); ser.write(call(rpcReq).marshal(), os); } else { ser.write(new RpcResponse(null, RpcException.Error.INVALID_REQ.exc("Invalid Request")).marshal(), os); } } }
public class class_name { @SuppressWarnings("unchecked") public void call(Serializer ser, InputStream is, OutputStream os) throws IOException { Object obj = null; try { obj = ser.readMapOrList(is); } catch (Exception e) { String msg = "Unable to deserialize request: " + e.getMessage(); ser.write(new RpcResponse(null, RpcException.Error.PARSE.exc(msg)).marshal(), os); return; } if (obj instanceof List) { List list = (List)obj; List respList = new ArrayList(); for (Object o : list) { RpcRequest rpcReq = new RpcRequest((Map)o); respList.add(call(rpcReq).marshal()); // depends on control dependency: [for], data = [none] } ser.write(respList, os); } else if (obj instanceof Map) { RpcRequest rpcReq = new RpcRequest((Map)obj); ser.write(call(rpcReq).marshal(), os); } else { ser.write(new RpcResponse(null, RpcException.Error.INVALID_REQ.exc("Invalid Request")).marshal(), os); } } }
public class class_name { @Override public void remove(final int x) { final short hb = BufferUtil.highbits(x); final int i = highLowContainer.getIndex(hb); if (i < 0) { return; } getMappeableRoaringArray().setContainerAtIndex(i, highLowContainer.getContainerAtIndex(i).remove(BufferUtil.lowbits(x))); if (highLowContainer.getContainerAtIndex(i).isEmpty()) { getMappeableRoaringArray().removeAtIndex(i); } } }
public class class_name { @Override public void remove(final int x) { final short hb = BufferUtil.highbits(x); final int i = highLowContainer.getIndex(hb); if (i < 0) { return; // depends on control dependency: [if], data = [none] } getMappeableRoaringArray().setContainerAtIndex(i, highLowContainer.getContainerAtIndex(i).remove(BufferUtil.lowbits(x))); if (highLowContainer.getContainerAtIndex(i).isEmpty()) { getMappeableRoaringArray().removeAtIndex(i); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public final Object invoke(final String actionName, final Object[] params, final String[] signature) throws MBeanException, ReflectionException { // Get the JmxCommand JmxCommand curCmd = null; for (JmxCommand cmd : this.cmds) { if (cmd.getType().equals(actionName)) { curCmd = cmd; break; } } final boolean isSync = actionName.startsWith("sync"); try { // initialize arguments for lunching (using Quartz) final Map<String, Object> jobDataMap = buildJobDataMap(curCmd, params); final Launch<?> launch = Launcher.getLauncher() .newLaunch((Class<?>) remoteProgram.getAdapterClass()).addParameters(jobDataMap); if (isSync) { // Launch and wait until terminated launch.synchLaunch(); return LaunchingMessageKind.ILAUNCH0003.getFormatedMessage( remoteProgram.getAdapterClass().getCanonicalName(), launch.getLaunchId(), launch.getLaunchResult().getStatusCode(), launch.getLaunchResult().getReturnCode()); } else { // Launch and continue launch.aSynchLaunch(); return LaunchingMessageKind.ILAUNCH0002.getFormatedMessage( remoteProgram.getAdapterClass().getCanonicalName(), launch.getLaunchId()); } } catch (LaunchException e) { LaunchingMessageKind.ELAUNCH0003.format(actionName, e); } return null; } }
public class class_name { @Override public final Object invoke(final String actionName, final Object[] params, final String[] signature) throws MBeanException, ReflectionException { // Get the JmxCommand JmxCommand curCmd = null; for (JmxCommand cmd : this.cmds) { if (cmd.getType().equals(actionName)) { curCmd = cmd; // depends on control dependency: [if], data = [none] break; } } final boolean isSync = actionName.startsWith("sync"); try { // initialize arguments for lunching (using Quartz) final Map<String, Object> jobDataMap = buildJobDataMap(curCmd, params); final Launch<?> launch = Launcher.getLauncher() .newLaunch((Class<?>) remoteProgram.getAdapterClass()).addParameters(jobDataMap); if (isSync) { // Launch and wait until terminated launch.synchLaunch(); // depends on control dependency: [if], data = [none] return LaunchingMessageKind.ILAUNCH0003.getFormatedMessage( remoteProgram.getAdapterClass().getCanonicalName(), launch.getLaunchId(), launch.getLaunchResult().getStatusCode(), launch.getLaunchResult().getReturnCode()); // depends on control dependency: [if], data = [none] } else { // Launch and continue launch.aSynchLaunch(); // depends on control dependency: [if], data = [none] return LaunchingMessageKind.ILAUNCH0002.getFormatedMessage( remoteProgram.getAdapterClass().getCanonicalName(), launch.getLaunchId()); // depends on control dependency: [if], data = [none] } } catch (LaunchException e) { LaunchingMessageKind.ELAUNCH0003.format(actionName, e); } return null; } }
public class class_name { @Override public long skip (final long nSkip) throws IOException { ValueEnforcer.isGE0 (nSkip, "SkipValue"); _ensureOpen (); if (nSkip == 0) return 0L; long nRealSkip = nSkip; final int nBufAvail = m_aBuf.length - m_nBufPos; if (nBufAvail > 0) { if (nRealSkip <= nBufAvail) { m_nBufPos += nRealSkip; return nRealSkip; } m_nBufPos = m_aBuf.length; nRealSkip -= nBufAvail; } return nBufAvail + super.skip (nRealSkip); } }
public class class_name { @Override public long skip (final long nSkip) throws IOException { ValueEnforcer.isGE0 (nSkip, "SkipValue"); _ensureOpen (); if (nSkip == 0) return 0L; long nRealSkip = nSkip; final int nBufAvail = m_aBuf.length - m_nBufPos; if (nBufAvail > 0) { if (nRealSkip <= nBufAvail) { m_nBufPos += nRealSkip; // depends on control dependency: [if], data = [none] return nRealSkip; // depends on control dependency: [if], data = [none] } m_nBufPos = m_aBuf.length; nRealSkip -= nBufAvail; } return nBufAvail + super.skip (nRealSkip); } }
public class class_name { public List<Task> getActiveTasks() { InputStream response = null; URI uri = new URIBase(getBaseUri()).path("_active_tasks").build(); try { response = couchDbClient.get(uri); return getResponseList(response, couchDbClient.getGson(), DeserializationTypes.TASKS); } finally { close(response); } } }
public class class_name { public List<Task> getActiveTasks() { InputStream response = null; URI uri = new URIBase(getBaseUri()).path("_active_tasks").build(); try { response = couchDbClient.get(uri); // depends on control dependency: [try], data = [none] return getResponseList(response, couchDbClient.getGson(), DeserializationTypes.TASKS); // depends on control dependency: [try], data = [none] } finally { close(response); } } }
public class class_name { public int getAnalysisBits() { int bits = 0; if (null != m_firstWalker) { AxesWalker walker = m_firstWalker; while (null != walker) { int bit = walker.getAnalysisBits(); bits |= bit; walker = walker.getNextWalker(); } } return bits; } }
public class class_name { public int getAnalysisBits() { int bits = 0; if (null != m_firstWalker) { AxesWalker walker = m_firstWalker; while (null != walker) { int bit = walker.getAnalysisBits(); bits |= bit; // depends on control dependency: [while], data = [none] walker = walker.getNextWalker(); // depends on control dependency: [while], data = [none] } } return bits; } }
public class class_name { protected void acceptMadvocComponentClass(final Class componentClass) { if (componentClass == null) { return; } if (!checkClass(componentClass)) { return; } madvocComponents.add(() -> madvocContainer.registerComponent(componentClass)); } }
public class class_name { protected void acceptMadvocComponentClass(final Class componentClass) { if (componentClass == null) { return; // depends on control dependency: [if], data = [none] } if (!checkClass(componentClass)) { return; // depends on control dependency: [if], data = [none] } madvocComponents.add(() -> madvocContainer.registerComponent(componentClass)); } }
public class class_name { public LdapQuery filter(String filterFormat, Object... params) { Object[] encodedParams = new String[params.length]; for (int i=0; i < params.length; i++) { encodedParams[i] = LdapEncoder.filterEncode(params[i].toString()); } return filter(MessageFormat.format(filterFormat, encodedParams)); } }
public class class_name { public LdapQuery filter(String filterFormat, Object... params) { Object[] encodedParams = new String[params.length]; for (int i=0; i < params.length; i++) { encodedParams[i] = LdapEncoder.filterEncode(params[i].toString()); // depends on control dependency: [for], data = [i] } return filter(MessageFormat.format(filterFormat, encodedParams)); } }
public class class_name { private boolean hasPublisherWithMerkleTreeSync(Config config, String wanReplicationRefName) { WanReplicationConfig replicationConfig = config.getWanReplicationConfig(wanReplicationRefName); if (replicationConfig != null) { for (WanPublisherConfig publisherConfig : replicationConfig.getWanPublisherConfigs()) { if (publisherConfig.getWanSyncConfig() != null && ConsistencyCheckStrategy.MERKLE_TREES.equals(publisherConfig.getWanSyncConfig() .getConsistencyCheckStrategy())) { return true; } } } return false; } }
public class class_name { private boolean hasPublisherWithMerkleTreeSync(Config config, String wanReplicationRefName) { WanReplicationConfig replicationConfig = config.getWanReplicationConfig(wanReplicationRefName); if (replicationConfig != null) { for (WanPublisherConfig publisherConfig : replicationConfig.getWanPublisherConfigs()) { if (publisherConfig.getWanSyncConfig() != null && ConsistencyCheckStrategy.MERKLE_TREES.equals(publisherConfig.getWanSyncConfig() .getConsistencyCheckStrategy())) { return true; // depends on control dependency: [if], data = [none] } } } return false; } }
public class class_name { public static byte asByte(Object value, byte nullValue) { value=convert(Byte.class,value); if (value!=null) { return ((Byte)value).byteValue(); } else { return nullValue; } } }
public class class_name { public static byte asByte(Object value, byte nullValue) { value=convert(Byte.class,value); if (value!=null) { return ((Byte)value).byteValue(); // depends on control dependency: [if], data = [none] } else { return nullValue; // depends on control dependency: [if], data = [none] } } }
public class class_name { void sendTaskListToChannels(List<TaskRec> tasks) { // group by type // Map<String, List<TaskRec>> grouped = new HashMap<String, List<TaskRec>>(); for (TaskRec taskRec : tasks) { List<TaskRec> tlist = grouped.get(taskRec.name); if (tlist == null) { tlist = new ArrayList<TaskRec>(); grouped.put(taskRec.name, tlist); } tlist.add(taskRec); } // execute // for (String taskName : grouped.keySet()) { final List<TaskRec> taskList = grouped.get(taskName); TaskRec trec1 = taskList.get(0); Channel channel = context.registry.getChannel(trec1.channel); if (channel == null) { // should never happen logger.warn("Task channel '{}' not exists. Use channel MAIN (task={} taskId={})", trec1.channel, trec1.name, trec1.taskId); channel = context.registry.getChannel(Model.CHANNEL_MAIN); } TaskConfig taskConfig = context.registry.getTaskConfig(trec1.name); if (taskConfig == null) { handleUnknownTasks(taskList); continue; } for (final TaskRec taskRec : taskList) { logger.debug("got task: " + taskRec); context.stats.metrics.loadTask(taskRec.taskId, taskRec.name, taskRec.channel); channel.workers.execute(new TedRunnable(taskRec) { @Override public void run() { processTask(taskRec); } }); } } } }
public class class_name { void sendTaskListToChannels(List<TaskRec> tasks) { // group by type // Map<String, List<TaskRec>> grouped = new HashMap<String, List<TaskRec>>(); for (TaskRec taskRec : tasks) { List<TaskRec> tlist = grouped.get(taskRec.name); if (tlist == null) { tlist = new ArrayList<TaskRec>(); // depends on control dependency: [if], data = [none] grouped.put(taskRec.name, tlist); // depends on control dependency: [if], data = [none] } tlist.add(taskRec); // depends on control dependency: [for], data = [taskRec] } // execute // for (String taskName : grouped.keySet()) { final List<TaskRec> taskList = grouped.get(taskName); TaskRec trec1 = taskList.get(0); Channel channel = context.registry.getChannel(trec1.channel); if (channel == null) { // should never happen logger.warn("Task channel '{}' not exists. Use channel MAIN (task={} taskId={})", trec1.channel, trec1.name, trec1.taskId); channel = context.registry.getChannel(Model.CHANNEL_MAIN); // depends on control dependency: [if], data = [none] } TaskConfig taskConfig = context.registry.getTaskConfig(trec1.name); if (taskConfig == null) { handleUnknownTasks(taskList); // depends on control dependency: [if], data = [none] continue; } for (final TaskRec taskRec : taskList) { logger.debug("got task: " + taskRec); // depends on control dependency: [for], data = [taskRec] context.stats.metrics.loadTask(taskRec.taskId, taskRec.name, taskRec.channel); // depends on control dependency: [for], data = [taskRec] channel.workers.execute(new TedRunnable(taskRec) { @Override public void run() { processTask(taskRec); } }); // depends on control dependency: [for], data = [none] } } } }
public class class_name { public void setNamespaces(java.util.Collection<NamespaceSummary> namespaces) { if (namespaces == null) { this.namespaces = null; return; } this.namespaces = new java.util.ArrayList<NamespaceSummary>(namespaces); } }
public class class_name { public void setNamespaces(java.util.Collection<NamespaceSummary> namespaces) { if (namespaces == null) { this.namespaces = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.namespaces = new java.util.ArrayList<NamespaceSummary>(namespaces); } }
public class class_name { public void setCustomFontEnabled(final boolean ENABLED) { if (null == customFontEnabled) { _customFontEnabled = ENABLED; fireTileEvent(RESIZE_EVENT); } else { customFontEnabled.set(ENABLED); } } }
public class class_name { public void setCustomFontEnabled(final boolean ENABLED) { if (null == customFontEnabled) { _customFontEnabled = ENABLED; // depends on control dependency: [if], data = [none] fireTileEvent(RESIZE_EVENT); // depends on control dependency: [if], data = [none] } else { customFontEnabled.set(ENABLED); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Optional<Object> tryValue(ReadableRepresentation representation, String name) { try { return Optional.fromNullable(representation.getValue(name)); } catch (RepresentationException e) { return Optional.absent(); } } }
public class class_name { public static Optional<Object> tryValue(ReadableRepresentation representation, String name) { try { return Optional.fromNullable(representation.getValue(name)); // depends on control dependency: [try], data = [none] } catch (RepresentationException e) { return Optional.absent(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { void moveToDone(final JobID id, boolean sync, final JobID renameJobId) { // If restarting is disabled use original implementation if (conf.getInt(CoronaJobTracker.MAX_JT_FAILURES_CONF, CoronaJobTracker.MAX_JT_FAILURES_DEFAULT) == 0) { moveToDone(id, sync); return; } // Otherwise use corona-specific implementation final List<Path> paths = new ArrayList<Path>(); final Path historyFile = getHistoryFile(id); if (historyFile == null) { LOG.info("No file for job-history with " + id + " found in cache!"); } else { paths.add(historyFile); } final Path confPath = getConfFileWriters(id); if (confPath == null) { LOG.info("No file for jobconf with " + id + " found in cache!"); } else { paths.add(confPath); } Runnable r = new Runnable() { public void run() { // move the files to doneDir folder try { List<PrintWriter> writers = getWriters(id); synchronized (writers) { if (writers.size() > 0) { // try to wait writers for 10 minutes writers.wait(600000L); } if (writers.size() > 0) { LOG.warn("Failed to wait for writers to finish in 10 minutes."); } } URI srcURI = logFs.getUri(); URI doneURI = doneFs.getUri(); boolean useRename = (srcURI.compareTo(doneURI) == 0); for (Path path : paths) { // check if path exists, in case of retries it may not exist if (logFs.exists(path)) { LOG.info("Moving " + path.toString() + " to " + doneDir.toString()); Path dstPath; if (renameJobId != null) { if (JobHistory.CONF_FILTER.accept(path)) { dstPath = new Path(doneDir, getConfFilename(renameJobId)); } else { dstPath = new Path(doneDir, getHistoryFilename(renameJobId)); } } else { dstPath = new Path(doneDir, path.getName()); } if (useRename) { // In the job tracker failover case, the previous job tracker may have // generated the history file, remove it if existed if (doneFs.exists(dstPath)) { LOG.info("Delete the previous job tracker generaged job history file in " + dstPath); doneFs.delete(dstPath, true); } doneFs.rename(path, dstPath); } else { FileUtil.copy(logFs, path, doneFs, dstPath, true, true, conf); } doneFs.setPermission(dstPath, new FsPermission( CoronaJobHistory.HISTORY_FILE_PERMISSION)); } } } catch (Throwable e) { LOG.error("Unable to move history file to DONE folder:\n" + StringUtils.stringifyException(e)); } String historyFileDonePath = null; if (historyFile != null) { historyFileDonePath = new Path(doneDir, historyFile.getName()) .toString(); } JobHistory.jobHistoryFileMap.put(id, new MovedFileInfo( historyFileDonePath, System.currentTimeMillis())); jobTracker.historyFileCopied(id, historyFileDonePath); // purge the job from the cache purgeJob(id); } }; if (sync) { r.run(); } else { executor.execute(r); } } }
public class class_name { void moveToDone(final JobID id, boolean sync, final JobID renameJobId) { // If restarting is disabled use original implementation if (conf.getInt(CoronaJobTracker.MAX_JT_FAILURES_CONF, CoronaJobTracker.MAX_JT_FAILURES_DEFAULT) == 0) { moveToDone(id, sync); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // Otherwise use corona-specific implementation final List<Path> paths = new ArrayList<Path>(); final Path historyFile = getHistoryFile(id); if (historyFile == null) { LOG.info("No file for job-history with " + id + " found in cache!"); // depends on control dependency: [if], data = [none] } else { paths.add(historyFile); // depends on control dependency: [if], data = [(historyFile] } final Path confPath = getConfFileWriters(id); if (confPath == null) { LOG.info("No file for jobconf with " + id + " found in cache!"); // depends on control dependency: [if], data = [none] } else { paths.add(confPath); // depends on control dependency: [if], data = [(confPath] } Runnable r = new Runnable() { public void run() { // move the files to doneDir folder try { List<PrintWriter> writers = getWriters(id); synchronized (writers) { // depends on control dependency: [try], data = [none] if (writers.size() > 0) { // try to wait writers for 10 minutes writers.wait(600000L); // depends on control dependency: [if], data = [none] } if (writers.size() > 0) { LOG.warn("Failed to wait for writers to finish in 10 minutes."); // depends on control dependency: [if], data = [none] } } URI srcURI = logFs.getUri(); URI doneURI = doneFs.getUri(); boolean useRename = (srcURI.compareTo(doneURI) == 0); for (Path path : paths) { // check if path exists, in case of retries it may not exist if (logFs.exists(path)) { LOG.info("Moving " + path.toString() + " to " + doneDir.toString()); // depends on control dependency: [if], data = [none] Path dstPath; if (renameJobId != null) { if (JobHistory.CONF_FILTER.accept(path)) { dstPath = new Path(doneDir, getConfFilename(renameJobId)); // depends on control dependency: [if], data = [none] } else { dstPath = new Path(doneDir, getHistoryFilename(renameJobId)); // depends on control dependency: [if], data = [none] } } else { dstPath = new Path(doneDir, path.getName()); // depends on control dependency: [if], data = [none] } if (useRename) { // In the job tracker failover case, the previous job tracker may have // generated the history file, remove it if existed if (doneFs.exists(dstPath)) { LOG.info("Delete the previous job tracker generaged job history file in " + dstPath); // depends on control dependency: [if], data = [none] doneFs.delete(dstPath, true); // depends on control dependency: [if], data = [none] } doneFs.rename(path, dstPath); // depends on control dependency: [if], data = [none] } else { FileUtil.copy(logFs, path, doneFs, dstPath, true, true, conf); // depends on control dependency: [if], data = [none] } doneFs.setPermission(dstPath, new FsPermission( CoronaJobHistory.HISTORY_FILE_PERMISSION)); // depends on control dependency: [if], data = [none] } } } catch (Throwable e) { LOG.error("Unable to move history file to DONE folder:\n" + StringUtils.stringifyException(e)); } // depends on control dependency: [catch], data = [none] String historyFileDonePath = null; if (historyFile != null) { historyFileDonePath = new Path(doneDir, historyFile.getName()) .toString(); // depends on control dependency: [if], data = [none] } JobHistory.jobHistoryFileMap.put(id, new MovedFileInfo( historyFileDonePath, System.currentTimeMillis())); jobTracker.historyFileCopied(id, historyFileDonePath); // purge the job from the cache purgeJob(id); } }; if (sync) { r.run(); // depends on control dependency: [if], data = [none] } else { executor.execute(r); // depends on control dependency: [if], data = [none] } } }
public class class_name { private boolean refine(int row) { int marking = -(row + 1); boolean changed; do { changed = false; // for every feasible mapping verify if it is still valid for (int n = row + 1; n < matrix.nRows; n++) { for (int m = 0; m < matrix.mCols; m++) { if (matrix.get(n, m) && !verify(n, m)) { // remove the now invalid mapping matrix.mark(n, m, marking); changed = true; // no more mappings for n in the feasibility matrix if (!hasCandidate(n)) return false; } } } } while (changed); return true; } }
public class class_name { private boolean refine(int row) { int marking = -(row + 1); boolean changed; do { changed = false; // for every feasible mapping verify if it is still valid for (int n = row + 1; n < matrix.nRows; n++) { for (int m = 0; m < matrix.mCols; m++) { if (matrix.get(n, m) && !verify(n, m)) { // remove the now invalid mapping matrix.mark(n, m, marking); // depends on control dependency: [if], data = [none] changed = true; // depends on control dependency: [if], data = [none] // no more mappings for n in the feasibility matrix if (!hasCandidate(n)) return false; } } } } while (changed); return true; } }
public class class_name { public void skipUntil(final TokenType... tokenTypes) { Set<TokenType> tokenTypeSet = Sets.newHashSet(tokenTypes); tokenTypeSet.add(Assist.END); while (!tokenTypeSet.contains(lexer.getCurrentToken().getType())) { lexer.nextToken(); } } }
public class class_name { public void skipUntil(final TokenType... tokenTypes) { Set<TokenType> tokenTypeSet = Sets.newHashSet(tokenTypes); tokenTypeSet.add(Assist.END); while (!tokenTypeSet.contains(lexer.getCurrentToken().getType())) { lexer.nextToken(); // depends on control dependency: [while], data = [none] } } }
public class class_name { private void updateIncrementalSimonsIncrease(long inc, long now) { for (Simon simon : incrementalSimons.values()) { ((CounterImpl) simon).increasePrivate(inc, now); } } }
public class class_name { private void updateIncrementalSimonsIncrease(long inc, long now) { for (Simon simon : incrementalSimons.values()) { ((CounterImpl) simon).increasePrivate(inc, now); // depends on control dependency: [for], data = [simon] } } }
public class class_name { public TagFileType<WebJsptaglibraryDescriptor> getOrCreateTagFile() { List<Node> nodeList = model.get("tag-file"); if (nodeList != null && nodeList.size() > 0) { return new TagFileTypeImpl<WebJsptaglibraryDescriptor>(this, "tag-file", model, nodeList.get(0)); } return createTagFile(); } }
public class class_name { public TagFileType<WebJsptaglibraryDescriptor> getOrCreateTagFile() { List<Node> nodeList = model.get("tag-file"); if (nodeList != null && nodeList.size() > 0) { return new TagFileTypeImpl<WebJsptaglibraryDescriptor>(this, "tag-file", model, nodeList.get(0)); // depends on control dependency: [if], data = [none] } return createTagFile(); } }
public class class_name { public int setSFieldValue(String strParamValue, boolean bDisplayOption, int iMoveMode) { String strButtonDesc = this.getButtonDesc(); String strButtonCommand = this.getButtonCommand(); if (strButtonCommand != null) if (strButtonDesc != null) if (strButtonDesc.equals(strParamValue)) { // Button was pressed, do command this.handleCommand(strButtonCommand, this, ScreenConstants.USE_NEW_WINDOW); return DBConstants.NORMAL_RETURN; } // Often this is called in a report needing a value set, so set it: return super.setSFieldValue(strParamValue, bDisplayOption, iMoveMode); } }
public class class_name { public int setSFieldValue(String strParamValue, boolean bDisplayOption, int iMoveMode) { String strButtonDesc = this.getButtonDesc(); String strButtonCommand = this.getButtonCommand(); if (strButtonCommand != null) if (strButtonDesc != null) if (strButtonDesc.equals(strParamValue)) { // Button was pressed, do command this.handleCommand(strButtonCommand, this, ScreenConstants.USE_NEW_WINDOW); // depends on control dependency: [if], data = [none] return DBConstants.NORMAL_RETURN; // depends on control dependency: [if], data = [none] } // Often this is called in a report needing a value set, so set it: return super.setSFieldValue(strParamValue, bDisplayOption, iMoveMode); } }
public class class_name { public boolean addAll(CharacterArray items) { ensureCapacity(size + items.size); for (int i = 0; i < items.size; i++) { elements[size++] = items.elements[i]; } return items.size > 0; } }
public class class_name { public boolean addAll(CharacterArray items) { ensureCapacity(size + items.size); for (int i = 0; i < items.size; i++) { elements[size++] = items.elements[i]; // depends on control dependency: [for], data = [i] } return items.size > 0; } }
public class class_name { public CloudWatchDestination withDimensionConfigurations(CloudWatchDimensionConfiguration... dimensionConfigurations) { if (this.dimensionConfigurations == null) { setDimensionConfigurations(new java.util.ArrayList<CloudWatchDimensionConfiguration>(dimensionConfigurations.length)); } for (CloudWatchDimensionConfiguration ele : dimensionConfigurations) { this.dimensionConfigurations.add(ele); } return this; } }
public class class_name { public CloudWatchDestination withDimensionConfigurations(CloudWatchDimensionConfiguration... dimensionConfigurations) { if (this.dimensionConfigurations == null) { setDimensionConfigurations(new java.util.ArrayList<CloudWatchDimensionConfiguration>(dimensionConfigurations.length)); // depends on control dependency: [if], data = [none] } for (CloudWatchDimensionConfiguration ele : dimensionConfigurations) { this.dimensionConfigurations.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static double meanDoublematrixColumn( double[][] matrix, int column ) { double mean; mean = 0; int length = matrix.length; for( int i = 0; i < length; i++ ) { mean += matrix[i][column]; } return mean / length; } }
public class class_name { public static double meanDoublematrixColumn( double[][] matrix, int column ) { double mean; mean = 0; int length = matrix.length; for( int i = 0; i < length; i++ ) { mean += matrix[i][column]; // depends on control dependency: [for], data = [i] } return mean / length; } }
public class class_name { public RocMetric addIn(RocMetric other) { // Sum tpr, fpr for each threshold int i = 0; // start from 1, 0-index is for threshold value int j = 1; while (i < this.pred.length) { if (this.pred[i] != null) { if (other.pred[i] != null) { j = 1; // P = P + P // N = N + N while (j < this.pred[i].length) { this.pred[i][j] = this.pred[i][j] + other.pred[i][j]; j++; } } } else { if (other.pred[i] != null) { j = 0; // P = P + P // N = N + N // this.pred[i] is currently null so need to cretae new instance this.pred[i] = new double[3]; while (j < other.pred[i].length) { this.pred[i][j] = other.pred[i][j]; j = j + 1; } } } i = i + 1; } return (this); } }
public class class_name { public RocMetric addIn(RocMetric other) { // Sum tpr, fpr for each threshold int i = 0; // start from 1, 0-index is for threshold value int j = 1; while (i < this.pred.length) { if (this.pred[i] != null) { if (other.pred[i] != null) { j = 1; // depends on control dependency: [if], data = [none] // P = P + P // N = N + N while (j < this.pred[i].length) { this.pred[i][j] = this.pred[i][j] + other.pred[i][j]; // depends on control dependency: [while], data = [none] j++; // depends on control dependency: [while], data = [none] } } } else { if (other.pred[i] != null) { j = 0; // depends on control dependency: [if], data = [none] // P = P + P // N = N + N // this.pred[i] is currently null so need to cretae new instance this.pred[i] = new double[3]; // depends on control dependency: [if], data = [none] while (j < other.pred[i].length) { this.pred[i][j] = other.pred[i][j]; // depends on control dependency: [while], data = [none] j = j + 1; // depends on control dependency: [while], data = [none] } } } i = i + 1; // depends on control dependency: [while], data = [none] } return (this); } }
public class class_name { protected boolean removeLayer(Layer layer) { int index = getLayerIndex(layer); if (index >= 0) { //contentPanel.remove(index); view.removeWidget(index); return true; } return false; } }
public class class_name { protected boolean removeLayer(Layer layer) { int index = getLayerIndex(layer); if (index >= 0) { //contentPanel.remove(index); view.removeWidget(index); // depends on control dependency: [if], data = [(index] return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public void startReturnHandlerProcessor() { final SendQueue<Response<Object>> webResponseSendQueue = webResponseQueue.sendQueue(); responseQueue.startListener(new ReceiveQueueListener<Response<Object>>() { @Override public void receive(Response<Object> response) { final Request<Object> originatingRequest = response.request().originatingRequest(); if (originatingRequest == null) { callbackManager.handleResponse(response); } else if (originatingRequest instanceof HttpRequest || originatingRequest instanceof WebSocketMessage) { webResponseSendQueue.send(response); } else { callbackManager.handleResponse(response); } } @Override public void empty() { webResponseSendQueue.flushSends(); } @Override public void limit() { webResponseSendQueue.flushSends(); } @Override public void shutdown() { } @Override public void idle() { webResponseSendQueue.flushSends(); } @Override public void startBatch() { } }); } }
public class class_name { public void startReturnHandlerProcessor() { final SendQueue<Response<Object>> webResponseSendQueue = webResponseQueue.sendQueue(); responseQueue.startListener(new ReceiveQueueListener<Response<Object>>() { @Override public void receive(Response<Object> response) { final Request<Object> originatingRequest = response.request().originatingRequest(); if (originatingRequest == null) { callbackManager.handleResponse(response); // depends on control dependency: [if], data = [none] } else if (originatingRequest instanceof HttpRequest || originatingRequest instanceof WebSocketMessage) { webResponseSendQueue.send(response); // depends on control dependency: [if], data = [none] } else { callbackManager.handleResponse(response); // depends on control dependency: [if], data = [none] } } @Override public void empty() { webResponseSendQueue.flushSends(); } @Override public void limit() { webResponseSendQueue.flushSends(); } @Override public void shutdown() { } @Override public void idle() { webResponseSendQueue.flushSends(); } @Override public void startBatch() { } }); } }
public class class_name { public void marshall(DescribeJobsRequest describeJobsRequest, ProtocolMarshaller protocolMarshaller) { if (describeJobsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeJobsRequest.getJobs(), JOBS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DescribeJobsRequest describeJobsRequest, ProtocolMarshaller protocolMarshaller) { if (describeJobsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeJobsRequest.getJobs(), JOBS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static List<String> parseName(String sourceName, char separator) { List<String> result = new ArrayList<String>(); if (sourceName != null) { StringBuilder currentWord = new StringBuilder(); boolean lastIsLower = false; for (int index = 0, length = sourceName.length(); index < length; ++index) { char curChar = sourceName.charAt(index); if (Character.isUpperCase(curChar) || (!lastIsLower && Character.isDigit(curChar)) || curChar == separator) { if (lastIsLower && currentWord.length() > 1 || curChar == separator && currentWord.length() > 0) { result.add(currentWord.toString()); currentWord = new StringBuilder(); } lastIsLower = false; } else { if (!lastIsLower) { int currentWordLength = currentWord.length(); if (currentWordLength > 1) { char lastChar = currentWord.charAt(--currentWordLength); currentWord.setLength(currentWordLength); result.add(currentWord.toString()); currentWord = new StringBuilder(); currentWord.append(lastChar); } } lastIsLower = true; } if (curChar != separator) { currentWord.append(curChar); } } result.add(currentWord.toString()); } return result; } }
public class class_name { public static List<String> parseName(String sourceName, char separator) { List<String> result = new ArrayList<String>(); if (sourceName != null) { StringBuilder currentWord = new StringBuilder(); boolean lastIsLower = false; for (int index = 0, length = sourceName.length(); index < length; ++index) { char curChar = sourceName.charAt(index); if (Character.isUpperCase(curChar) || (!lastIsLower && Character.isDigit(curChar)) || curChar == separator) { if (lastIsLower && currentWord.length() > 1 || curChar == separator && currentWord.length() > 0) { result.add(currentWord.toString()); // depends on control dependency: [if], data = [none] currentWord = new StringBuilder(); // depends on control dependency: [if], data = [none] } lastIsLower = false; // depends on control dependency: [if], data = [none] } else { if (!lastIsLower) { int currentWordLength = currentWord.length(); if (currentWordLength > 1) { char lastChar = currentWord.charAt(--currentWordLength); currentWord.setLength(currentWordLength); // depends on control dependency: [if], data = [(currentWordLength] result.add(currentWord.toString()); // depends on control dependency: [if], data = [none] currentWord = new StringBuilder(); // depends on control dependency: [if], data = [none] currentWord.append(lastChar); // depends on control dependency: [if], data = [none] } } lastIsLower = true; // depends on control dependency: [if], data = [none] } if (curChar != separator) { currentWord.append(curChar); // depends on control dependency: [if], data = [(curChar] } } result.add(currentWord.toString()); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { private void deleteVersion(final Future<Void> aFuture) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(MessageCodes.PT_DEBUG_006, myPath); } myFileSystem.delete(getVersionFilePath(), result -> { if (result.succeeded()) { if (hasPrefix()) { deletePrefix(aFuture); } else { aFuture.complete(); } } else { aFuture.fail(result.cause()); } }); } }
public class class_name { private void deleteVersion(final Future<Void> aFuture) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(MessageCodes.PT_DEBUG_006, myPath); // depends on control dependency: [if], data = [none] } myFileSystem.delete(getVersionFilePath(), result -> { if (result.succeeded()) { if (hasPrefix()) { deletePrefix(aFuture); } else { aFuture.complete(); } } else { aFuture.fail(result.cause()); } }); } }
public class class_name { public EClass getIfcCsgSelect() { if (ifcCsgSelectEClass == null) { ifcCsgSelectEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(945); } return ifcCsgSelectEClass; } }
public class class_name { public EClass getIfcCsgSelect() { if (ifcCsgSelectEClass == null) { ifcCsgSelectEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(945); // depends on control dependency: [if], data = [none] } return ifcCsgSelectEClass; } }
public class class_name { private final V remove_semi_leaf(BinTreeNode<K,V> node, BinTreeNode<K,V> prev, int son, BinTreeNode<K,V> m) { if(prev == null) { root = m; } else { if(son == 0) prev.left = m; else prev.right = m; } return node.value; } }
public class class_name { private final V remove_semi_leaf(BinTreeNode<K,V> node, BinTreeNode<K,V> prev, int son, BinTreeNode<K,V> m) { if(prev == null) { root = m; // depends on control dependency: [if], data = [none] } else { if(son == 0) prev.left = m; else prev.right = m; } return node.value; } }
public class class_name { public static ExtensibleConfigurationPersister createHostXmlConfigurationPersister(final ConfigurationFile file, final HostControllerEnvironment environment, final ExecutorService executorService, final ExtensionRegistry hostExtensionRegistry, final LocalHostControllerInfo localHostControllerInfo) { String defaultHostname = localHostControllerInfo.getLocalHostName(); if (environment.getRunningModeControl().isReloaded()) { if (environment.getRunningModeControl().getReloadHostName() != null) { defaultHostname = environment.getRunningModeControl().getReloadHostName(); } } HostXml hostXml = new HostXml(defaultHostname, environment.getRunningModeControl().getRunningMode(), environment.isUseCachedDc(), Module.getBootModuleLoader(), executorService, hostExtensionRegistry); BackupXmlConfigurationPersister persister = new BackupXmlConfigurationPersister(file, new QName(Namespace.CURRENT.getUriString(), "host"), hostXml, hostXml, false); for (Namespace namespace : Namespace.domainValues()) { if (!namespace.equals(Namespace.CURRENT)) { persister.registerAdditionalRootElement(new QName(namespace.getUriString(), "host"), hostXml); } } hostExtensionRegistry.setWriterRegistry(persister); return persister; } }
public class class_name { public static ExtensibleConfigurationPersister createHostXmlConfigurationPersister(final ConfigurationFile file, final HostControllerEnvironment environment, final ExecutorService executorService, final ExtensionRegistry hostExtensionRegistry, final LocalHostControllerInfo localHostControllerInfo) { String defaultHostname = localHostControllerInfo.getLocalHostName(); if (environment.getRunningModeControl().isReloaded()) { if (environment.getRunningModeControl().getReloadHostName() != null) { defaultHostname = environment.getRunningModeControl().getReloadHostName(); // depends on control dependency: [if], data = [none] } } HostXml hostXml = new HostXml(defaultHostname, environment.getRunningModeControl().getRunningMode(), environment.isUseCachedDc(), Module.getBootModuleLoader(), executorService, hostExtensionRegistry); BackupXmlConfigurationPersister persister = new BackupXmlConfigurationPersister(file, new QName(Namespace.CURRENT.getUriString(), "host"), hostXml, hostXml, false); for (Namespace namespace : Namespace.domainValues()) { if (!namespace.equals(Namespace.CURRENT)) { persister.registerAdditionalRootElement(new QName(namespace.getUriString(), "host"), hostXml); // depends on control dependency: [if], data = [none] } } hostExtensionRegistry.setWriterRegistry(persister); return persister; } }
public class class_name { private boolean check(File fingerprintFile, TaskListener listener) { try { Fingerprint fp = loadFingerprint(fingerprintFile); if (fp == null || !fp.isAlive()) { listener.getLogger().println("deleting obsolete " + fingerprintFile); fingerprintFile.delete(); return true; } else { // get the fingerprint in the official map so have the changes visible to Jenkins // otherwise the mutation made in FingerprintMap can override our trimming. fp = getFingerprint(fp); return fp.trim(); } } catch (IOException e) { Functions.printStackTrace(e, listener.error("Failed to process " + fingerprintFile)); return false; } } }
public class class_name { private boolean check(File fingerprintFile, TaskListener listener) { try { Fingerprint fp = loadFingerprint(fingerprintFile); if (fp == null || !fp.isAlive()) { listener.getLogger().println("deleting obsolete " + fingerprintFile); // depends on control dependency: [if], data = [none] fingerprintFile.delete(); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } else { // get the fingerprint in the official map so have the changes visible to Jenkins // otherwise the mutation made in FingerprintMap can override our trimming. fp = getFingerprint(fp); // depends on control dependency: [if], data = [(fp] return fp.trim(); // depends on control dependency: [if], data = [none] } } catch (IOException e) { Functions.printStackTrace(e, listener.error("Failed to process " + fingerprintFile)); return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public Object get(int ix) throws NamingException { Iterator<Object> iterator = values.iterator(); try { Object value = iterator.next(); for(int i = 0; i < ix; i++) { value = iterator.next(); } return value; } catch (NoSuchElementException e) { throw new IndexOutOfBoundsException("No value at index i"); } } }
public class class_name { @Override public Object get(int ix) throws NamingException { Iterator<Object> iterator = values.iterator(); try { Object value = iterator.next(); for(int i = 0; i < ix; i++) { value = iterator.next(); // depends on control dependency: [for], data = [none] } return value; } catch (NoSuchElementException e) { throw new IndexOutOfBoundsException("No value at index i"); } } }
public class class_name { public void consumeEvents(Listener listener) { while (!isEmpty()) { Event event = remove(); event.eventType.fireEvent(listener, event.eventParameters); } } }
public class class_name { public void consumeEvents(Listener listener) { while (!isEmpty()) { Event event = remove(); event.eventType.fireEvent(listener, event.eventParameters); // depends on control dependency: [while], data = [none] } } }
public class class_name { private void setUserAgentsRegEx(List<String> agents) { if ((agents == null) || (agents.size() == 0)) { setValidConfiguration(false); LOG.error(Messages.get().getBundle().key(Messages.LOG_NO_USER_AGENTS_0)); } m_userAgentsRegEx = agents; } }
public class class_name { private void setUserAgentsRegEx(List<String> agents) { if ((agents == null) || (agents.size() == 0)) { setValidConfiguration(false); // depends on control dependency: [if], data = [none] LOG.error(Messages.get().getBundle().key(Messages.LOG_NO_USER_AGENTS_0)); // depends on control dependency: [if], data = [none] } m_userAgentsRegEx = agents; } }
public class class_name { public static double approximateUpperBoundOnP(final long n, final long k, final double numStdDevs) { checkInputs(n, k); if (n == 0) { return 1.0; } // the coin was never flipped, so we know nothing else if (k == n) { return 1.0; } else if (k == (n - 1)) { return (exactUpperBoundOnPForKequalsNminusOne(n, deltaOfNumStdevs(numStdDevs))); } else if (k == 0) { return (exactUpperBoundOnPForKequalsZero(n, deltaOfNumStdevs(numStdDevs))); } else { final double x = abramowitzStegunFormula26p5p22(n - k, k + 1, numStdDevs); return (1.0 - x); // which is p } } }
public class class_name { public static double approximateUpperBoundOnP(final long n, final long k, final double numStdDevs) { checkInputs(n, k); if (n == 0) { return 1.0; } // the coin was never flipped, so we know nothing // depends on control dependency: [if], data = [none] else if (k == n) { return 1.0; } // depends on control dependency: [if], data = [none] else if (k == (n - 1)) { return (exactUpperBoundOnPForKequalsNminusOne(n, deltaOfNumStdevs(numStdDevs))); // depends on control dependency: [if], data = [none] } else if (k == 0) { return (exactUpperBoundOnPForKequalsZero(n, deltaOfNumStdevs(numStdDevs))); // depends on control dependency: [if], data = [none] } else { final double x = abramowitzStegunFormula26p5p22(n - k, k + 1, numStdDevs); return (1.0 - x); // which is p // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean next() { if (sketchAccessor_ == null) { // initial setup sketchAccessor_ = DoublesSketchAccessor.wrap(sketch_); } else { // advance index within the current level i_++; } if (i_ < sketchAccessor_.numItems()) { return true; } // go to the next non-empty level do { level_++; if (level_ > 0) { bits_ >>>= 1; } if (bits_ == 0L) { return false; // run out of levels } weight_ *= 2; } while ((bits_ & 1L) == 0L); i_ = 0; sketchAccessor_.setLevel(level_); return true; } }
public class class_name { public boolean next() { if (sketchAccessor_ == null) { // initial setup sketchAccessor_ = DoublesSketchAccessor.wrap(sketch_); // depends on control dependency: [if], data = [none] } else { // advance index within the current level i_++; // depends on control dependency: [if], data = [none] } if (i_ < sketchAccessor_.numItems()) { return true; // depends on control dependency: [if], data = [none] } // go to the next non-empty level do { level_++; if (level_ > 0) { bits_ >>>= 1; // depends on control dependency: [if], data = [none] } if (bits_ == 0L) { return false; // run out of levels // depends on control dependency: [if], data = [none] } weight_ *= 2; } while ((bits_ & 1L) == 0L); i_ = 0; sketchAccessor_.setLevel(level_); return true; } }
public class class_name { public static Long toNumericDate(Date value) { if (value == null) { return null; } return DateUtils.clearMs(value).getTime() / 1000; } }
public class class_name { public static Long toNumericDate(Date value) { if (value == null) { return null; // depends on control dependency: [if], data = [none] } return DateUtils.clearMs(value).getTime() / 1000; } }
public class class_name { private String getPartialLocationName(String tzID, String mzID, boolean isLong, String mzDisplayName) { String letter = isLong ? "L" : "S"; String key = tzID + "&" + mzID + "#" + letter; String name = _genericPartialLocationNamesMap.get(key); if (name != null) { return name; } String location = null; String countryCode = ZoneMeta.getCanonicalCountry(tzID); if (countryCode != null) { // Is this the golden zone for the region? String regionalGolden = _tznames.getReferenceZoneID(mzID, countryCode); if (tzID.equals(regionalGolden)) { // Use country name location = getLocaleDisplayNames().regionDisplayName(countryCode); } else { // Otherwise, use exemplar city name location = _tznames.getExemplarLocationName(tzID); } } else { location = _tznames.getExemplarLocationName(tzID); if (location == null) { // This could happen when the time zone is not associated with a country, // and its ID is not hierarchical, for example, CST6CDT. // We use the canonical ID itself as the location for this case. location = tzID; } } name = formatPattern(Pattern.FALLBACK_FORMAT, location, mzDisplayName); synchronized (this) { // we have to sync the name map and the trie String tmp = _genericPartialLocationNamesMap.putIfAbsent(key.intern(), name.intern()); if (tmp == null) { NameInfo info = new NameInfo(tzID.intern(), isLong ? GenericNameType.LONG : GenericNameType.SHORT); _gnamesTrie.put(name, info); } else { name = tmp; } } return name; } }
public class class_name { private String getPartialLocationName(String tzID, String mzID, boolean isLong, String mzDisplayName) { String letter = isLong ? "L" : "S"; String key = tzID + "&" + mzID + "#" + letter; String name = _genericPartialLocationNamesMap.get(key); if (name != null) { return name; // depends on control dependency: [if], data = [none] } String location = null; String countryCode = ZoneMeta.getCanonicalCountry(tzID); if (countryCode != null) { // Is this the golden zone for the region? String regionalGolden = _tznames.getReferenceZoneID(mzID, countryCode); if (tzID.equals(regionalGolden)) { // Use country name location = getLocaleDisplayNames().regionDisplayName(countryCode); // depends on control dependency: [if], data = [none] } else { // Otherwise, use exemplar city name location = _tznames.getExemplarLocationName(tzID); // depends on control dependency: [if], data = [none] } } else { location = _tznames.getExemplarLocationName(tzID); // depends on control dependency: [if], data = [none] if (location == null) { // This could happen when the time zone is not associated with a country, // and its ID is not hierarchical, for example, CST6CDT. // We use the canonical ID itself as the location for this case. location = tzID; // depends on control dependency: [if], data = [none] } } name = formatPattern(Pattern.FALLBACK_FORMAT, location, mzDisplayName); synchronized (this) { // we have to sync the name map and the trie String tmp = _genericPartialLocationNamesMap.putIfAbsent(key.intern(), name.intern()); if (tmp == null) { NameInfo info = new NameInfo(tzID.intern(), isLong ? GenericNameType.LONG : GenericNameType.SHORT); _gnamesTrie.put(name, info); // depends on control dependency: [if], data = [none] } else { name = tmp; // depends on control dependency: [if], data = [none] } } return name; } }
public class class_name { void unlink(Node<E> x) { // assert lock.isHeldByCurrentThread(); Node<E> p = x.prev; Node<E> n = x.next; if (p == null) { unlinkFirst(); } else if (n == null) { unlinkLast(); } else { p.next = n; n.prev = p; x.item = null; // Don't mess with x's links. They may still be in use by // an iterator. --count; notFull.signal(); } } }
public class class_name { void unlink(Node<E> x) { // assert lock.isHeldByCurrentThread(); Node<E> p = x.prev; Node<E> n = x.next; if (p == null) { unlinkFirst(); // depends on control dependency: [if], data = [none] } else if (n == null) { unlinkLast(); // depends on control dependency: [if], data = [none] } else { p.next = n; // depends on control dependency: [if], data = [none] n.prev = p; // depends on control dependency: [if], data = [none] x.item = null; // depends on control dependency: [if], data = [none] // Don't mess with x's links. They may still be in use by // an iterator. --count; // depends on control dependency: [if], data = [none] notFull.signal(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public DescribeCustomKeyStoresResult withCustomKeyStores(CustomKeyStoresListEntry... customKeyStores) { if (this.customKeyStores == null) { setCustomKeyStores(new com.amazonaws.internal.SdkInternalList<CustomKeyStoresListEntry>(customKeyStores.length)); } for (CustomKeyStoresListEntry ele : customKeyStores) { this.customKeyStores.add(ele); } return this; } }
public class class_name { public DescribeCustomKeyStoresResult withCustomKeyStores(CustomKeyStoresListEntry... customKeyStores) { if (this.customKeyStores == null) { setCustomKeyStores(new com.amazonaws.internal.SdkInternalList<CustomKeyStoresListEntry>(customKeyStores.length)); // depends on control dependency: [if], data = [none] } for (CustomKeyStoresListEntry ele : customKeyStores) { this.customKeyStores.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static BufferedImage createTracedImage ( BufferedImage src, BufferedImage dest, Color tcolor, int thickness, float startAlpha, float endAlpha) { // prepare various bits of working data int wid = src.getWidth(), hei = src.getHeight(); int spixel = (tcolor.getRGB() & RGB_MASK); int salpha = (int)(startAlpha * 255); int tpixel = (spixel | (salpha << 24)); boolean[] traced = new boolean[wid * hei]; int stepAlpha = (thickness <= 1) ? 0 : (int)(((startAlpha - endAlpha) * 255) / (thickness - 1)); // TODO: this could be made more efficient, e.g., if we made four passes through the image // in a vertical scan, horizontal scan, and opposing diagonal scans, making sure each // non-transparent pixel found during each scan is traced on both sides of the respective // scan direction. For now, we just naively check all eight pixels surrounding each pixel // in the image and fill the center pixel with the tracing color if it's transparent but // has a non-transparent pixel around it. for (int tt = 0; tt < thickness; tt++) { if (tt > 0) { // clear out the array of pixels traced this go-around Arrays.fill(traced, false); // use the destination image as our new source src = dest; // decrement the trace pixel alpha-level salpha -= Math.max(0, stepAlpha); tpixel = (spixel | (salpha << 24)); } for (int yy = 0; yy < hei; yy++) { for (int xx = 0; xx < wid; xx++) { // get the pixel we're checking int argb = src.getRGB(xx, yy); if ((argb & TRANS_MASK) != 0) { // copy any pixel that isn't transparent dest.setRGB(xx, yy, argb); } else if (bordersNonTransparentPixel(src, wid, hei, traced, xx, yy)) { dest.setRGB(xx, yy, tpixel); // note that we traced this pixel this pass so // that it doesn't impact other-pixel borderedness traced[(yy*wid)+xx] = true; } } } } return dest; } }
public class class_name { public static BufferedImage createTracedImage ( BufferedImage src, BufferedImage dest, Color tcolor, int thickness, float startAlpha, float endAlpha) { // prepare various bits of working data int wid = src.getWidth(), hei = src.getHeight(); int spixel = (tcolor.getRGB() & RGB_MASK); int salpha = (int)(startAlpha * 255); int tpixel = (spixel | (salpha << 24)); boolean[] traced = new boolean[wid * hei]; int stepAlpha = (thickness <= 1) ? 0 : (int)(((startAlpha - endAlpha) * 255) / (thickness - 1)); // TODO: this could be made more efficient, e.g., if we made four passes through the image // in a vertical scan, horizontal scan, and opposing diagonal scans, making sure each // non-transparent pixel found during each scan is traced on both sides of the respective // scan direction. For now, we just naively check all eight pixels surrounding each pixel // in the image and fill the center pixel with the tracing color if it's transparent but // has a non-transparent pixel around it. for (int tt = 0; tt < thickness; tt++) { if (tt > 0) { // clear out the array of pixels traced this go-around Arrays.fill(traced, false); // depends on control dependency: [if], data = [none] // use the destination image as our new source src = dest; // depends on control dependency: [if], data = [none] // decrement the trace pixel alpha-level salpha -= Math.max(0, stepAlpha); // depends on control dependency: [if], data = [none] tpixel = (spixel | (salpha << 24)); // depends on control dependency: [if], data = [none] } for (int yy = 0; yy < hei; yy++) { for (int xx = 0; xx < wid; xx++) { // get the pixel we're checking int argb = src.getRGB(xx, yy); if ((argb & TRANS_MASK) != 0) { // copy any pixel that isn't transparent dest.setRGB(xx, yy, argb); // depends on control dependency: [if], data = [none] } else if (bordersNonTransparentPixel(src, wid, hei, traced, xx, yy)) { dest.setRGB(xx, yy, tpixel); // depends on control dependency: [if], data = [none] // note that we traced this pixel this pass so // that it doesn't impact other-pixel borderedness traced[(yy*wid)+xx] = true; // depends on control dependency: [if], data = [none] } } } } return dest; } }
public class class_name { private boolean selectionsEqual(final Set<?> set1, final Set<?> set2) { // Empty or null lists if ((set1 == null || set1.isEmpty()) && (set2 == null || set2.isEmpty())) { return true; } // Same size and contain same entries return set1 != null && set2 != null && set1.size() == set2.size() && set1. containsAll(set2); } }
public class class_name { private boolean selectionsEqual(final Set<?> set1, final Set<?> set2) { // Empty or null lists if ((set1 == null || set1.isEmpty()) && (set2 == null || set2.isEmpty())) { return true; // depends on control dependency: [if], data = [none] } // Same size and contain same entries return set1 != null && set2 != null && set1.size() == set2.size() && set1. containsAll(set2); } }
public class class_name { public void fixSampleLoops(int modType) { if (sample==null || length==0) return; if (repeatStop>length) { repeatStop = length; repeatLength = repeatStop - repeatStart; } if (repeatStart+2>repeatStop) { repeatStop = repeatStart = 0; repeatLength = repeatStop - repeatStart; loopType = 0; } sample[length+4] = sample[length+3] = sample[length+2] = sample[length+1] = sample[length] = sample[length-1]; if (loopType==1 && (repeatStop+4>repeatLength || modType==Helpers.MODTYPE_MOD || modType==Helpers.MODTYPE_S3M)) { sample[repeatStop ] = sample[repeatStart ]; sample[repeatStop+1] = sample[repeatStart+1]; sample[repeatStop+2] = sample[repeatStart+2]; sample[repeatStop+3] = sample[repeatStart+3]; sample[repeatStop+4] = sample[repeatStart+4]; } } }
public class class_name { public void fixSampleLoops(int modType) { if (sample==null || length==0) return; if (repeatStop>length) { repeatStop = length; // depends on control dependency: [if], data = [none] repeatLength = repeatStop - repeatStart; // depends on control dependency: [if], data = [none] } if (repeatStart+2>repeatStop) { repeatStop = repeatStart = 0; // depends on control dependency: [if], data = [none] repeatLength = repeatStop - repeatStart; // depends on control dependency: [if], data = [none] loopType = 0; // depends on control dependency: [if], data = [none] } sample[length+4] = sample[length+3] = sample[length+2] = sample[length+1] = sample[length] = sample[length-1]; if (loopType==1 && (repeatStop+4>repeatLength || modType==Helpers.MODTYPE_MOD || modType==Helpers.MODTYPE_S3M)) { sample[repeatStop ] = sample[repeatStart ]; // depends on control dependency: [if], data = [none] sample[repeatStop+1] = sample[repeatStart+1]; // depends on control dependency: [if], data = [none] sample[repeatStop+2] = sample[repeatStart+2]; // depends on control dependency: [if], data = [none] sample[repeatStop+3] = sample[repeatStart+3]; // depends on control dependency: [if], data = [none] sample[repeatStop+4] = sample[repeatStart+4]; // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void handleCellSpanning() { RtfCell deletedCell = new RtfCell(true); for(int i = 0; i < this.cells.size(); i++) { RtfCell rtfCell = (RtfCell) this.cells.get(i); if(rtfCell.getColspan() > 1) { int cSpan = rtfCell.getColspan(); for(int j = i + 1; j < i + cSpan; j++) { if(j < this.cells.size()) { RtfCell rtfCellMerge = (RtfCell) this.cells.get(j); rtfCell.setCellRight(rtfCell.getCellRight() + rtfCellMerge.getCellWidth()); rtfCell.setCellWidth(rtfCell.getCellWidth() + rtfCellMerge.getCellWidth()); this.cells.set(j, deletedCell); } } } if(rtfCell.getRowspan() > 1) { ArrayList rows = this.parentTable.getRows(); for(int j = 1; j < rtfCell.getRowspan(); j++) { RtfRow mergeRow = (RtfRow) rows.get(this.rowNumber + j); if(this.rowNumber + j < rows.size()) { RtfCell rtfCellMerge = (RtfCell) mergeRow.getCells().get(i); rtfCellMerge.setCellMergeChild(rtfCell); } if(rtfCell.getColspan() > 1) { int cSpan = rtfCell.getColspan(); for(int k = i + 1; k < i + cSpan; k++) { if(k < mergeRow.getCells().size()) { mergeRow.getCells().set(k, deletedCell); } } } } } } } }
public class class_name { protected void handleCellSpanning() { RtfCell deletedCell = new RtfCell(true); for(int i = 0; i < this.cells.size(); i++) { RtfCell rtfCell = (RtfCell) this.cells.get(i); if(rtfCell.getColspan() > 1) { int cSpan = rtfCell.getColspan(); for(int j = i + 1; j < i + cSpan; j++) { if(j < this.cells.size()) { RtfCell rtfCellMerge = (RtfCell) this.cells.get(j); rtfCell.setCellRight(rtfCell.getCellRight() + rtfCellMerge.getCellWidth()); // depends on control dependency: [if], data = [none] rtfCell.setCellWidth(rtfCell.getCellWidth() + rtfCellMerge.getCellWidth()); // depends on control dependency: [if], data = [none] this.cells.set(j, deletedCell); // depends on control dependency: [if], data = [(j] } } } if(rtfCell.getRowspan() > 1) { ArrayList rows = this.parentTable.getRows(); for(int j = 1; j < rtfCell.getRowspan(); j++) { RtfRow mergeRow = (RtfRow) rows.get(this.rowNumber + j); if(this.rowNumber + j < rows.size()) { RtfCell rtfCellMerge = (RtfCell) mergeRow.getCells().get(i); rtfCellMerge.setCellMergeChild(rtfCell); // depends on control dependency: [if], data = [none] } if(rtfCell.getColspan() > 1) { int cSpan = rtfCell.getColspan(); for(int k = i + 1; k < i + cSpan; k++) { if(k < mergeRow.getCells().size()) { mergeRow.getCells().set(k, deletedCell); // depends on control dependency: [if], data = [(k] } } } } } } } }
public class class_name { static Annotation[] findAndSortAnnotations(Annotation annotation) { final Annotation[] metaAnnotations = annotation.annotationType().getAnnotations(); Arrays.sort(metaAnnotations, new Comparator<Annotation>() { @Override public int compare(Annotation o1, Annotation o2) { if (o1 instanceof ChameleonTarget) { return -1; } if (o2 instanceof ChameleonTarget) { return 1; } return 0; } }); return metaAnnotations; } }
public class class_name { static Annotation[] findAndSortAnnotations(Annotation annotation) { final Annotation[] metaAnnotations = annotation.annotationType().getAnnotations(); Arrays.sort(metaAnnotations, new Comparator<Annotation>() { @Override public int compare(Annotation o1, Annotation o2) { if (o1 instanceof ChameleonTarget) { return -1; // depends on control dependency: [if], data = [none] } if (o2 instanceof ChameleonTarget) { return 1; // depends on control dependency: [if], data = [none] } return 0; } }); return metaAnnotations; } }
public class class_name { @Override public synchronized void write(final int b) { BufferPool.Buffer buff = getBuffer(count, false); if (buff == null) { buff = newBuffer(); } if (!buff.putByte(b)) { buff = newBuffer(); if (!buff.putByte(b)) { throw new RuntimeException("Logic error in write(b)"); } } count++; } }
public class class_name { @Override public synchronized void write(final int b) { BufferPool.Buffer buff = getBuffer(count, false); if (buff == null) { buff = newBuffer(); // depends on control dependency: [if], data = [none] } if (!buff.putByte(b)) { buff = newBuffer(); // depends on control dependency: [if], data = [none] if (!buff.putByte(b)) { throw new RuntimeException("Logic error in write(b)"); } } count++; } }
public class class_name { public T textColor(int color) { if (view instanceof TextView) { TextView tv = (TextView) view; tv.setTextColor(color); } return self(); } }
public class class_name { public T textColor(int color) { if (view instanceof TextView) { TextView tv = (TextView) view; tv.setTextColor(color); // depends on control dependency: [if], data = [none] } return self(); } }
public class class_name { public static <A> double[] alphaBetaPWM(A data, NumberArrayAdapter<?, A> adapter, final int nmom) { final int n = adapter.size(data); final double[] xmom = new double[nmom << 1]; double aweight = 1. / n, bweight = aweight; for(int i = 0; i < n; i++) { final double val = adapter.getDouble(data, i); xmom[0] += aweight * val; xmom[1] += bweight * val; for(int j = 1, k = 2; j < nmom; j++, k += 2) { aweight *= (n - i - j + 1) / (n - j + 1); bweight *= (i - j + 1) / (n - j + 1); xmom[k + 1] += aweight * val; xmom[k + 1] += bweight * val; } } return xmom; } }
public class class_name { public static <A> double[] alphaBetaPWM(A data, NumberArrayAdapter<?, A> adapter, final int nmom) { final int n = adapter.size(data); final double[] xmom = new double[nmom << 1]; double aweight = 1. / n, bweight = aweight; for(int i = 0; i < n; i++) { final double val = adapter.getDouble(data, i); xmom[0] += aweight * val; // depends on control dependency: [for], data = [none] xmom[1] += bweight * val; // depends on control dependency: [for], data = [none] for(int j = 1, k = 2; j < nmom; j++, k += 2) { aweight *= (n - i - j + 1) / (n - j + 1); // depends on control dependency: [for], data = [j] bweight *= (i - j + 1) / (n - j + 1); // depends on control dependency: [for], data = [j] xmom[k + 1] += aweight * val; // depends on control dependency: [for], data = [none] xmom[k + 1] += bweight * val; // depends on control dependency: [for], data = [none] } } return xmom; } }
public class class_name { protected BigDecimal valueOrNull(final Double source) { if (source != null) { return BigDecimal.valueOf(source); } return null; } }
public class class_name { protected BigDecimal valueOrNull(final Double source) { if (source != null) { return BigDecimal.valueOf(source); // depends on control dependency: [if], data = [(source] } return null; } }
public class class_name { private void closeConfig(Config config) { if (config instanceof WebSphereConfig) { try { ((WebSphereConfig) config).close(); } catch (IOException e) { throw new ConfigException(Tr.formatMessage(tc, "could.not.close.CWMCG0004E", e)); } } } }
public class class_name { private void closeConfig(Config config) { if (config instanceof WebSphereConfig) { try { ((WebSphereConfig) config).close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new ConfigException(Tr.formatMessage(tc, "could.not.close.CWMCG0004E", e)); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public SoyExpression coerceToString() { if (soyRuntimeType.isKnownString() && !isBoxed()) { return this; } if (BytecodeUtils.isPrimitive(resultType())) { if (resultType().equals(Type.BOOLEAN_TYPE)) { return forString(MethodRef.BOOLEAN_TO_STRING.invoke(delegate)); } else if (resultType().equals(Type.DOUBLE_TYPE)) { return forString(MethodRef.DOUBLE_TO_STRING.invoke(delegate)); } else if (resultType().equals(Type.LONG_TYPE)) { return forString(MethodRef.LONG_TO_STRING.invoke(delegate)); } else { throw new AssertionError( "resultType(): " + resultType() + " is not a valid type for a SoyExpression"); } } if (!isBoxed()) { // this is for unboxed reference types (strings, lists, protos) String.valueOf handles null // implicitly return forString(MethodRef.STRING_VALUE_OF.invoke(delegate)); } return forString(MethodRef.RUNTIME_COERCE_TO_STRING.invoke(delegate)); } }
public class class_name { public SoyExpression coerceToString() { if (soyRuntimeType.isKnownString() && !isBoxed()) { return this; // depends on control dependency: [if], data = [none] } if (BytecodeUtils.isPrimitive(resultType())) { if (resultType().equals(Type.BOOLEAN_TYPE)) { return forString(MethodRef.BOOLEAN_TO_STRING.invoke(delegate)); // depends on control dependency: [if], data = [none] } else if (resultType().equals(Type.DOUBLE_TYPE)) { return forString(MethodRef.DOUBLE_TO_STRING.invoke(delegate)); // depends on control dependency: [if], data = [none] } else if (resultType().equals(Type.LONG_TYPE)) { return forString(MethodRef.LONG_TO_STRING.invoke(delegate)); // depends on control dependency: [if], data = [none] } else { throw new AssertionError( "resultType(): " + resultType() + " is not a valid type for a SoyExpression"); } } if (!isBoxed()) { // this is for unboxed reference types (strings, lists, protos) String.valueOf handles null // implicitly return forString(MethodRef.STRING_VALUE_OF.invoke(delegate)); // depends on control dependency: [if], data = [none] } return forString(MethodRef.RUNTIME_COERCE_TO_STRING.invoke(delegate)); } }
public class class_name { @Override protected DocWriter createWriter(final MBasicTable table, final Document document, final OutputStream out) { final RtfWriter2 writer = RtfWriter2.getInstance(document, out); // title final String title = buildTitle(table); if (title != null) { final HeaderFooter header = new RtfHeaderFooter(new Paragraph(title)); header.setAlignment(Element.ALIGN_LEFT); header.setBorder(Rectangle.NO_BORDER); document.setHeader(header); document.addTitle(title); } // advanced page numbers : x/y final Paragraph footerParagraph = new Paragraph(); final Font font = FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL); footerParagraph.add(new RtfPageNumber(font)); footerParagraph.add(new Phrase(" / ", font)); footerParagraph.add(new RtfTotalPageNumber(font)); footerParagraph.setAlignment(Element.ALIGN_CENTER); final HeaderFooter footer = new RtfHeaderFooter(footerParagraph); footer.setBorder(Rectangle.TOP); document.setFooter(footer); return writer; } }
public class class_name { @Override protected DocWriter createWriter(final MBasicTable table, final Document document, final OutputStream out) { final RtfWriter2 writer = RtfWriter2.getInstance(document, out); // title final String title = buildTitle(table); if (title != null) { final HeaderFooter header = new RtfHeaderFooter(new Paragraph(title)); header.setAlignment(Element.ALIGN_LEFT); // depends on control dependency: [if], data = [none] header.setBorder(Rectangle.NO_BORDER); // depends on control dependency: [if], data = [none] document.setHeader(header); // depends on control dependency: [if], data = [none] document.addTitle(title); // depends on control dependency: [if], data = [(title] } // advanced page numbers : x/y final Paragraph footerParagraph = new Paragraph(); final Font font = FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL); footerParagraph.add(new RtfPageNumber(font)); footerParagraph.add(new Phrase(" / ", font)); footerParagraph.add(new RtfTotalPageNumber(font)); footerParagraph.setAlignment(Element.ALIGN_CENTER); final HeaderFooter footer = new RtfHeaderFooter(footerParagraph); footer.setBorder(Rectangle.TOP); document.setFooter(footer); return writer; } }
public class class_name { private void cache(Process entity) { Cache<String, String> nameCache = ensureAvailableNameCache(); Cache<String, Process> entityCache = ensureAvailableEntityCache(); if(entity.getModel() == null && entity.getDBContent() != null) { entity.setModel(ModelParser.parse(entity.getDBContent())); } String processName = entity.getName() + DEFAULT_SEPARATOR + entity.getVersion(); if(nameCache != null && entityCache != null) { if(log.isDebugEnabled()) { log.debug("cache process id is[{}],name is[{}]", entity.getId(), processName); } entityCache.put(processName, entity); nameCache.put(entity.getId(), processName); } else { if(log.isDebugEnabled()) { log.debug("no cache implementation class"); } } } }
public class class_name { private void cache(Process entity) { Cache<String, String> nameCache = ensureAvailableNameCache(); Cache<String, Process> entityCache = ensureAvailableEntityCache(); if(entity.getModel() == null && entity.getDBContent() != null) { entity.setModel(ModelParser.parse(entity.getDBContent())); // depends on control dependency: [if], data = [none] } String processName = entity.getName() + DEFAULT_SEPARATOR + entity.getVersion(); if(nameCache != null && entityCache != null) { if(log.isDebugEnabled()) { log.debug("cache process id is[{}],name is[{}]", entity.getId(), processName); // depends on control dependency: [if], data = [none] } entityCache.put(processName, entity); // depends on control dependency: [if], data = [none] nameCache.put(entity.getId(), processName); // depends on control dependency: [if], data = [none] } else { if(log.isDebugEnabled()) { log.debug("no cache implementation class"); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static int visitFile(File f, FileVisitor fv, FileFilter filter) { int re = 0; if (f.isFile()) { fv.visit(f); re++; } else if (f.isDirectory()) { File[] fs = null == filter ? f.listFiles() : f.listFiles(filter); if (fs != null) for (File theFile : fs) re += visitFile(theFile, fv, filter); } return re; } }
public class class_name { public static int visitFile(File f, FileVisitor fv, FileFilter filter) { int re = 0; if (f.isFile()) { fv.visit(f); // depends on control dependency: [if], data = [none] re++; // depends on control dependency: [if], data = [none] } else if (f.isDirectory()) { File[] fs = null == filter ? f.listFiles() : f.listFiles(filter); if (fs != null) for (File theFile : fs) re += visitFile(theFile, fv, filter); } return re; } }
public class class_name { @Override public EEnum getIfcWindowTypeEnum() { if (ifcWindowTypeEnumEEnum == null) { ifcWindowTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(1106); } return ifcWindowTypeEnumEEnum; } }
public class class_name { @Override public EEnum getIfcWindowTypeEnum() { if (ifcWindowTypeEnumEEnum == null) { ifcWindowTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(1106); // depends on control dependency: [if], data = [none] } return ifcWindowTypeEnumEEnum; } }
public class class_name { @Pure public boolean isStartingBusHalt() { final BusItinerary itinerary = getContainer(); if (itinerary != null && itinerary.isValidPrimitive()) { try { return itinerary.getBusHaltAt(0) == this; } catch (IndexOutOfBoundsException exception) { // invalid halt } } return false; } }
public class class_name { @Pure public boolean isStartingBusHalt() { final BusItinerary itinerary = getContainer(); if (itinerary != null && itinerary.isValidPrimitive()) { try { return itinerary.getBusHaltAt(0) == this; // depends on control dependency: [try], data = [none] } catch (IndexOutOfBoundsException exception) { // invalid halt } // depends on control dependency: [catch], data = [none] } return false; } }
public class class_name { private int countEvents(TouchState newState) { int count = state.getPointCount(); for (int i = 0; i < newState.getPointCount(); i++) { TouchState.Point newPoint = newState.getPoint(i); TouchState.Point oldPoint = state.getPointForID(newPoint.id); if (oldPoint == null) { count ++; } } return count; } }
public class class_name { private int countEvents(TouchState newState) { int count = state.getPointCount(); for (int i = 0; i < newState.getPointCount(); i++) { TouchState.Point newPoint = newState.getPoint(i); TouchState.Point oldPoint = state.getPointForID(newPoint.id); if (oldPoint == null) { count ++; // depends on control dependency: [if], data = [none] } } return count; } }
public class class_name { public int checkSecurity() { int iLevel = Constants.LOGIN_USER; try { iLevel = Integer.parseInt(this.getProperty(Params.SECURITY_LEVEL)); } catch (NumberFormatException ex) { } int iAccessAllowed = DBConstants.NORMAL_RETURN; if (iLevel == Constants.LOGIN_USER) if (!DBConstants.ANON_USER_ID.equalsIgnoreCase(this.getProperty(DBParams.USER_ID))) { if (this.getProperty(DBParams.USER_NAME) != null) iAccessAllowed = DBConstants.AUTHENTICATION_REQUIRED; // If you have an account, you need to sign into it. } return iAccessAllowed; } }
public class class_name { public int checkSecurity() { int iLevel = Constants.LOGIN_USER; try { iLevel = Integer.parseInt(this.getProperty(Params.SECURITY_LEVEL)); // depends on control dependency: [try], data = [none] } catch (NumberFormatException ex) { } // depends on control dependency: [catch], data = [none] int iAccessAllowed = DBConstants.NORMAL_RETURN; if (iLevel == Constants.LOGIN_USER) if (!DBConstants.ANON_USER_ID.equalsIgnoreCase(this.getProperty(DBParams.USER_ID))) { if (this.getProperty(DBParams.USER_NAME) != null) iAccessAllowed = DBConstants.AUTHENTICATION_REQUIRED; // If you have an account, you need to sign into it. } return iAccessAllowed; } }
public class class_name { public static boolean startsWith(byte[] bs, byte[] head) { if (bs.length < head.length) { return false; } for (int i = 0; i < head.length; i++) { if (head[i] != bs[i]) { return false; } } return true; } }
public class class_name { public static boolean startsWith(byte[] bs, byte[] head) { if (bs.length < head.length) { return false; // depends on control dependency: [if], data = [none] } for (int i = 0; i < head.length; i++) { if (head[i] != bs[i]) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { @Override public Set<String> getContextLabels() { final Set<String> labels = new HashSet<>(); for (final Pair<String, Object> pair : contextValues) { labels.add(pair.getKey()); } return labels; } }
public class class_name { @Override public Set<String> getContextLabels() { final Set<String> labels = new HashSet<>(); for (final Pair<String, Object> pair : contextValues) { labels.add(pair.getKey()); // depends on control dependency: [for], data = [pair] } return labels; } }
public class class_name { public static <S extends Sequence<C>, C extends Compound> List<PairwiseSequenceScorer<S, C>> getAllPairsScorers( List<S> sequences, PairwiseSequenceScorerType type, GapPenalty gapPenalty, SubstitutionMatrix<C> subMatrix) { List<PairwiseSequenceScorer<S, C>> allPairs = new ArrayList<PairwiseSequenceScorer<S, C>>(); for (int i = 0; i < sequences.size(); i++) { for (int j = i+1; j < sequences.size(); j++) { allPairs.add(getPairwiseScorer(sequences.get(i), sequences.get(j), type, gapPenalty, subMatrix)); } } return allPairs; } }
public class class_name { public static <S extends Sequence<C>, C extends Compound> List<PairwiseSequenceScorer<S, C>> getAllPairsScorers( List<S> sequences, PairwiseSequenceScorerType type, GapPenalty gapPenalty, SubstitutionMatrix<C> subMatrix) { List<PairwiseSequenceScorer<S, C>> allPairs = new ArrayList<PairwiseSequenceScorer<S, C>>(); for (int i = 0; i < sequences.size(); i++) { for (int j = i+1; j < sequences.size(); j++) { allPairs.add(getPairwiseScorer(sequences.get(i), sequences.get(j), type, gapPenalty, subMatrix)); // depends on control dependency: [for], data = [j] } } return allPairs; } }
public class class_name { @TargetApi(Build.VERSION_CODES.FROYO) public String getBase64EncodedTelemetry(Beacon beacon) { byte[] bytes = getTelemetryBytes(beacon); if (bytes != null) { String base64EncodedTelemetry = Base64.encodeToString(bytes, Base64.DEFAULT); // 12-21 00:17:18.844 20180-20180/? D/EddystoneTLMAccessor: Rehydrated telemetry bytes are :20 00 00 00 88 29 18 4d 00 00 18 4d 00 00 // 12-21 00:17:18.844 20180-20180/? D/EddystoneTLMAccessor: Base64 telemetry bytes are :IAAAAIgpGE0AABhNAAA= Log.d(TAG, "Base64 telemetry bytes are :"+base64EncodedTelemetry); return base64EncodedTelemetry; } else { return null; } } }
public class class_name { @TargetApi(Build.VERSION_CODES.FROYO) public String getBase64EncodedTelemetry(Beacon beacon) { byte[] bytes = getTelemetryBytes(beacon); if (bytes != null) { String base64EncodedTelemetry = Base64.encodeToString(bytes, Base64.DEFAULT); // 12-21 00:17:18.844 20180-20180/? D/EddystoneTLMAccessor: Rehydrated telemetry bytes are :20 00 00 00 88 29 18 4d 00 00 18 4d 00 00 // 12-21 00:17:18.844 20180-20180/? D/EddystoneTLMAccessor: Base64 telemetry bytes are :IAAAAIgpGE0AABhNAAA= Log.d(TAG, "Base64 telemetry bytes are :"+base64EncodedTelemetry); // depends on control dependency: [if], data = [none] return base64EncodedTelemetry; // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public ValueSet readTemplate(String template, boolean delete) { Result result = htod.readTemplate(template, delete); if (result.returnCode == HTODDynacache.DISK_EXCEPTION) { stopOnError(result.diskException); this.htod.returnToResultPool(result); return HTODDynacache.EMPTY_VS; } ValueSet valueSet = (ValueSet) result.data; if (valueSet == null) { valueSet = HTODDynacache.EMPTY_VS; } this.htod.returnToResultPool(result); return valueSet; } }
public class class_name { public ValueSet readTemplate(String template, boolean delete) { Result result = htod.readTemplate(template, delete); if (result.returnCode == HTODDynacache.DISK_EXCEPTION) { stopOnError(result.diskException); // depends on control dependency: [if], data = [none] this.htod.returnToResultPool(result); // depends on control dependency: [if], data = [none] return HTODDynacache.EMPTY_VS; // depends on control dependency: [if], data = [none] } ValueSet valueSet = (ValueSet) result.data; if (valueSet == null) { valueSet = HTODDynacache.EMPTY_VS; // depends on control dependency: [if], data = [none] } this.htod.returnToResultPool(result); return valueSet; } }
public class class_name { public static boolean isAnActionFitInterpreter(SystemUnderDevelopment sud, String name) { try { Object target = sud.getFixture(name).getTarget(); if (target.getClass().equals(ActionFixture.class)) return false; if (target instanceof ActionFixture) return true; } catch (Throwable t) { } return false; } }
public class class_name { public static boolean isAnActionFitInterpreter(SystemUnderDevelopment sud, String name) { try { Object target = sud.getFixture(name).getTarget(); if (target.getClass().equals(ActionFixture.class)) return false; if (target instanceof ActionFixture) return true; } catch (Throwable t) { } // depends on control dependency: [catch], data = [none] return false; } }
public class class_name { public static int[] toArray(final Collection<Integer> collection) { Objects.requireNonNull(collection); final int size = collection.size(); final int[] array = new int[size]; int i=0; for(Integer value : collection) { array[i] = value; i++; } return array; } }
public class class_name { public static int[] toArray(final Collection<Integer> collection) { Objects.requireNonNull(collection); final int size = collection.size(); final int[] array = new int[size]; int i=0; for(Integer value : collection) { array[i] = value; // depends on control dependency: [for], data = [value] i++; // depends on control dependency: [for], data = [none] } return array; } }
public class class_name { public static Frame buildOutput(int[] gbCols, int noutCols, Frame fr, String[] fcnames, int ngrps, MRTask mrfill) { // Build the output! // the names of columns final int nCols = gbCols.length + noutCols; String[] names = new String[nCols]; String[][] domains = new String[nCols][]; byte[] types = new byte[nCols]; for (int i = 0; i < gbCols.length; i++) { names[i] = fr.name(gbCols[i]); domains[i] = fr.domains()[gbCols[i]]; types[i] = fr.vec(names[i]).get_type(); } for (int i = 0; i < fcnames.length; i++) { names[i + gbCols.length] = fcnames[i]; types[i + gbCols.length] = Vec.T_NUM; } Vec v = Vec.makeZero(ngrps); // dummy layout vec // Convert the output arrays into a Frame, also doing the post-pass work Frame f = mrfill.doAll(types, new Frame(v)).outputFrame(names, domains); v.remove(); return f; } }
public class class_name { public static Frame buildOutput(int[] gbCols, int noutCols, Frame fr, String[] fcnames, int ngrps, MRTask mrfill) { // Build the output! // the names of columns final int nCols = gbCols.length + noutCols; String[] names = new String[nCols]; String[][] domains = new String[nCols][]; byte[] types = new byte[nCols]; for (int i = 0; i < gbCols.length; i++) { names[i] = fr.name(gbCols[i]); // depends on control dependency: [for], data = [i] domains[i] = fr.domains()[gbCols[i]]; // depends on control dependency: [for], data = [i] types[i] = fr.vec(names[i]).get_type(); // depends on control dependency: [for], data = [i] } for (int i = 0; i < fcnames.length; i++) { names[i + gbCols.length] = fcnames[i]; // depends on control dependency: [for], data = [i] types[i + gbCols.length] = Vec.T_NUM; // depends on control dependency: [for], data = [i] } Vec v = Vec.makeZero(ngrps); // dummy layout vec // Convert the output arrays into a Frame, also doing the post-pass work Frame f = mrfill.doAll(types, new Frame(v)).outputFrame(names, domains); v.remove(); return f; } }
public class class_name { private void simulate(final Instruction instruction) { switch (instruction.getType()) { case PUSH: final PushInstruction pushInstruction = (PushInstruction) instruction; runtimeStack.push(new Element(pushInstruction.getValueType(), pushInstruction.getValue())); break; case METHOD_HANDLE: simulateMethodHandle((InvokeDynamicInstruction) instruction); break; case INVOKE: simulateInvoke((InvokeInstruction) instruction); break; case GET_FIELD: runtimeStack.pop(); runtimeStack.push(new Element(((GetFieldInstruction) instruction).getPropertyType())); break; case GET_STATIC: final GetStaticInstruction getStaticInstruction = (GetStaticInstruction) instruction; final Object value = getStaticInstruction.getValue(); if (value != null) runtimeStack.push(new Element(getStaticInstruction.getPropertyType(), value)); else runtimeStack.push(new Element(getStaticInstruction.getPropertyType())); break; case LOAD: final LoadInstruction loadInstruction = (LoadInstruction) instruction; runtimeStack.push(localVariables.getOrDefault(loadInstruction.getNumber(), new Element(loadInstruction.getVariableType()))); runtimeStack.peek().getTypes().add(loadInstruction.getVariableType()); variableInvalidation.add(loadInstruction.getValidUntil(), loadInstruction.getNumber()); break; case STORE: simulateStore((StoreInstruction) instruction); break; case SIZE_CHANGE: simulateSizeChange((SizeChangingInstruction) instruction); break; case NEW: final NewInstruction newInstruction = (NewInstruction) instruction; runtimeStack.push(new Element(toType(newInstruction.getClassName()))); break; case DUP: runtimeStack.push(runtimeStack.peek()); break; case OTHER: // do nothing break; case RETURN: mergeReturnElement(runtimeStack.pop()); case THROW: mergePossibleResponse(); // stack has to be empty for further analysis runtimeStack.clear(); break; default: throw new IllegalArgumentException("Instruction without type!"); } if (instruction.getLabel() != active && variableInvalidation.containsKey(active)) { variableInvalidation.get(active).forEach(localVariables::remove); } active = instruction.getLabel(); } }
public class class_name { private void simulate(final Instruction instruction) { switch (instruction.getType()) { case PUSH: final PushInstruction pushInstruction = (PushInstruction) instruction; runtimeStack.push(new Element(pushInstruction.getValueType(), pushInstruction.getValue())); break; case METHOD_HANDLE: simulateMethodHandle((InvokeDynamicInstruction) instruction); break; case INVOKE: simulateInvoke((InvokeInstruction) instruction); break; case GET_FIELD: runtimeStack.pop(); runtimeStack.push(new Element(((GetFieldInstruction) instruction).getPropertyType())); break; case GET_STATIC: final GetStaticInstruction getStaticInstruction = (GetStaticInstruction) instruction; final Object value = getStaticInstruction.getValue(); if (value != null) runtimeStack.push(new Element(getStaticInstruction.getPropertyType(), value)); else runtimeStack.push(new Element(getStaticInstruction.getPropertyType())); break; case LOAD: final LoadInstruction loadInstruction = (LoadInstruction) instruction; runtimeStack.push(localVariables.getOrDefault(loadInstruction.getNumber(), new Element(loadInstruction.getVariableType()))); runtimeStack.peek().getTypes().add(loadInstruction.getVariableType()); variableInvalidation.add(loadInstruction.getValidUntil(), loadInstruction.getNumber()); break; case STORE: simulateStore((StoreInstruction) instruction); break; case SIZE_CHANGE: simulateSizeChange((SizeChangingInstruction) instruction); break; case NEW: final NewInstruction newInstruction = (NewInstruction) instruction; runtimeStack.push(new Element(toType(newInstruction.getClassName()))); break; case DUP: runtimeStack.push(runtimeStack.peek()); break; case OTHER: // do nothing break; case RETURN: mergeReturnElement(runtimeStack.pop()); case THROW: mergePossibleResponse(); // stack has to be empty for further analysis runtimeStack.clear(); break; default: throw new IllegalArgumentException("Instruction without type!"); } if (instruction.getLabel() != active && variableInvalidation.containsKey(active)) { variableInvalidation.get(active).forEach(localVariables::remove); // depends on control dependency: [if], data = [none] } active = instruction.getLabel(); } }
public class class_name { @SuppressWarnings("unchecked") public static <T> T getBean(BeanManager bm, Class<T> clazz, Annotation... annotations) { Bean<?> bean; if (annotations != null) { bean = bm.getBeans(clazz, annotations).iterator().next(); } else { bean = bm.getBeans(clazz, new DefaultLiteral()).iterator().next(); } CreationalContext<?> ctx = bm.createCreationalContext(bean); return (T) bm.getReference(bean, clazz, ctx); } }
public class class_name { @SuppressWarnings("unchecked") public static <T> T getBean(BeanManager bm, Class<T> clazz, Annotation... annotations) { Bean<?> bean; if (annotations != null) { bean = bm.getBeans(clazz, annotations).iterator().next(); // depends on control dependency: [if], data = [none] } else { bean = bm.getBeans(clazz, new DefaultLiteral()).iterator().next(); // depends on control dependency: [if], data = [none] } CreationalContext<?> ctx = bm.createCreationalContext(bean); return (T) bm.getReference(bean, clazz, ctx); } }
public class class_name { @Override public Optional<Identification> getIdentification(Identifiable identifiable) { if(!registered.containsKey(identifiable.getID())) { return Optional.empty(); } AddOnModel registered = addOnInformationManager.getAddonModel(this.registered.get(identifiable.getID())); AddOnModel requested = addOnInformationManager.getAddonModel(identifiable); if (!(registered == requested)) { return Optional.empty(); } return Optional.of(IdentificationImpl.createIdentification(identifiable, true)); } }
public class class_name { @Override public Optional<Identification> getIdentification(Identifiable identifiable) { if(!registered.containsKey(identifiable.getID())) { return Optional.empty(); // depends on control dependency: [if], data = [none] } AddOnModel registered = addOnInformationManager.getAddonModel(this.registered.get(identifiable.getID())); AddOnModel requested = addOnInformationManager.getAddonModel(identifiable); if (!(registered == requested)) { return Optional.empty(); // depends on control dependency: [if], data = [none] } return Optional.of(IdentificationImpl.createIdentification(identifiable, true)); } }
public class class_name { public Feature nextFeature() { Feature f = null; if (hasNextSFeature()) { f = nextSFeature(); } else if (hasNextEFeature()) { f = nextEFeature(); } else { // do nothing } return f; } }
public class class_name { public Feature nextFeature() { Feature f = null; if (hasNextSFeature()) { f = nextSFeature(); // depends on control dependency: [if], data = [none] } else if (hasNextEFeature()) { f = nextEFeature(); // depends on control dependency: [if], data = [none] } else { // do nothing } return f; } }
public class class_name { public ListPullRequestsResult withPullRequestIds(String... pullRequestIds) { if (this.pullRequestIds == null) { setPullRequestIds(new java.util.ArrayList<String>(pullRequestIds.length)); } for (String ele : pullRequestIds) { this.pullRequestIds.add(ele); } return this; } }
public class class_name { public ListPullRequestsResult withPullRequestIds(String... pullRequestIds) { if (this.pullRequestIds == null) { setPullRequestIds(new java.util.ArrayList<String>(pullRequestIds.length)); // depends on control dependency: [if], data = [none] } for (String ele : pullRequestIds) { this.pullRequestIds.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { ContactServiceInterface contactService = adManagerServices.get(session, ContactServiceInterface.class); // Create a statement to select contacts. StatementBuilder statementBuilder = new StatementBuilder() .where("status = :status") .orderBy("id ASC") .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT) .withBindVariableValue("status", ContactStatus.UNINVITED.toString()); // Retrieve a small amount of contacts at a time, paging through // until all contacts have been retrieved. int totalResultSetSize = 0; do { ContactPage page = contactService.getContactsByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { // Print out some information for each contact. totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (Contact contact : page.getResults()) { System.out.printf( "%d) Contact with ID %d and name '%s' was found.%n", i++, contact.getId(), contact.getName() ); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); } }
public class class_name { public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { ContactServiceInterface contactService = adManagerServices.get(session, ContactServiceInterface.class); // Create a statement to select contacts. StatementBuilder statementBuilder = new StatementBuilder() .where("status = :status") .orderBy("id ASC") .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT) .withBindVariableValue("status", ContactStatus.UNINVITED.toString()); // Retrieve a small amount of contacts at a time, paging through // until all contacts have been retrieved. int totalResultSetSize = 0; do { ContactPage page = contactService.getContactsByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { // Print out some information for each contact. totalResultSetSize = page.getTotalResultSetSize(); // depends on control dependency: [if], data = [none] int i = page.getStartIndex(); for (Contact contact : page.getResults()) { System.out.printf( "%d) Contact with ID %d and name '%s' was found.%n", // depends on control dependency: [for], data = [none] i++, contact.getId(), contact.getName() ); // depends on control dependency: [for], data = [none] } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); } }
public class class_name { public static String getName(String x) { String ret = null; if (x.equals("280")) { ret = "DE"; } else if (x.equals("040")) { ret = "AT"; } else if (x.equals("250")) { ret = "FR"; } else if (x.equals("056")) { ret = "BE"; } else if (x.equals("100")) { ret = "BG"; } else if (x.equals("208")) { ret = "DK"; } else if (x.equals("246")) { ret = "FI"; } else if (x.equals("300")) { ret = "GR"; } else if (x.equals("826")) { ret = "GB"; } else if (x.equals("372")) { ret = "IE"; } else if (x.equals("352")) { ret = "IS"; } else if (x.equals("380")) { ret = "IT"; } else if (x.equals("392")) { ret = "JP"; } else if (x.equals("124")) { ret = "CA"; } else if (x.equals("191")) { ret = "HR"; } else if (x.equals("438")) { ret = "LI"; } else if (x.equals("442")) { ret = "LU"; } else if (x.equals("528")) { ret = "NL"; } else if (x.equals("578")) { ret = "NO"; } else if (x.equals("616")) { ret = "PL"; } else if (x.equals("620")) { ret = "PT"; } else if (x.equals("642")) { ret = "RO"; } else if (x.equals("643")) { ret = "RU"; } else if (x.equals("752")) { ret = "SE"; } else if (x.equals("756")) { ret = "CH"; } else if (x.equals("703")) { ret = "SK"; } else if (x.equals("705")) { ret = "SI"; } else if (x.equals("724")) { ret = "ES"; } else if (x.equals("203")) { ret = "CZ"; } else if (x.equals("792")) { ret = "TR"; } else if (x.equals("348")) { ret = "HU"; } else if (x.equals("840")) { ret = "US"; } else if (x.equals("978")) { ret = "EU"; } else { throw new InvalidArgumentException(HBCIUtils.getLocMsg("EXC_DT_UNNKOWN_CTR", x)); } return ret; } }
public class class_name { public static String getName(String x) { String ret = null; if (x.equals("280")) { ret = "DE"; // depends on control dependency: [if], data = [none] } else if (x.equals("040")) { ret = "AT"; // depends on control dependency: [if], data = [none] } else if (x.equals("250")) { ret = "FR"; // depends on control dependency: [if], data = [none] } else if (x.equals("056")) { ret = "BE"; // depends on control dependency: [if], data = [none] } else if (x.equals("100")) { ret = "BG"; // depends on control dependency: [if], data = [none] } else if (x.equals("208")) { ret = "DK"; // depends on control dependency: [if], data = [none] } else if (x.equals("246")) { ret = "FI"; // depends on control dependency: [if], data = [none] } else if (x.equals("300")) { ret = "GR"; // depends on control dependency: [if], data = [none] } else if (x.equals("826")) { ret = "GB"; // depends on control dependency: [if], data = [none] } else if (x.equals("372")) { ret = "IE"; // depends on control dependency: [if], data = [none] } else if (x.equals("352")) { ret = "IS"; // depends on control dependency: [if], data = [none] } else if (x.equals("380")) { ret = "IT"; // depends on control dependency: [if], data = [none] } else if (x.equals("392")) { ret = "JP"; // depends on control dependency: [if], data = [none] } else if (x.equals("124")) { ret = "CA"; // depends on control dependency: [if], data = [none] } else if (x.equals("191")) { ret = "HR"; // depends on control dependency: [if], data = [none] } else if (x.equals("438")) { ret = "LI"; // depends on control dependency: [if], data = [none] } else if (x.equals("442")) { ret = "LU"; // depends on control dependency: [if], data = [none] } else if (x.equals("528")) { ret = "NL"; // depends on control dependency: [if], data = [none] } else if (x.equals("578")) { ret = "NO"; // depends on control dependency: [if], data = [none] } else if (x.equals("616")) { ret = "PL"; // depends on control dependency: [if], data = [none] } else if (x.equals("620")) { ret = "PT"; // depends on control dependency: [if], data = [none] } else if (x.equals("642")) { ret = "RO"; // depends on control dependency: [if], data = [none] } else if (x.equals("643")) { ret = "RU"; // depends on control dependency: [if], data = [none] } else if (x.equals("752")) { ret = "SE"; // depends on control dependency: [if], data = [none] } else if (x.equals("756")) { ret = "CH"; // depends on control dependency: [if], data = [none] } else if (x.equals("703")) { ret = "SK"; // depends on control dependency: [if], data = [none] } else if (x.equals("705")) { ret = "SI"; // depends on control dependency: [if], data = [none] } else if (x.equals("724")) { ret = "ES"; // depends on control dependency: [if], data = [none] } else if (x.equals("203")) { ret = "CZ"; // depends on control dependency: [if], data = [none] } else if (x.equals("792")) { ret = "TR"; // depends on control dependency: [if], data = [none] } else if (x.equals("348")) { ret = "HU"; // depends on control dependency: [if], data = [none] } else if (x.equals("840")) { ret = "US"; // depends on control dependency: [if], data = [none] } else if (x.equals("978")) { ret = "EU"; // depends on control dependency: [if], data = [none] } else { throw new InvalidArgumentException(HBCIUtils.getLocMsg("EXC_DT_UNNKOWN_CTR", x)); } return ret; } }
public class class_name { public static MutableDoubleTuple min( Collection<? extends DoubleTuple> tuples, MutableDoubleTuple result) { if (tuples.isEmpty()) { return null; } int size = getSize(result, tuples); DoubleTuple identity = DoubleTuples.constant(size, Double.POSITIVE_INFINITY); MutableDoubleTuple localResult = tuples.parallelStream().collect( () -> DoubleTuples.copy(identity), (r,t) -> DoubleTuples.min(r, t, r), (r0,r1) -> DoubleTuples.min(r0, r1, r0)); if (result == null) { return localResult; } result.set(localResult); return result; } }
public class class_name { public static MutableDoubleTuple min( Collection<? extends DoubleTuple> tuples, MutableDoubleTuple result) { if (tuples.isEmpty()) { return null; // depends on control dependency: [if], data = [none] } int size = getSize(result, tuples); DoubleTuple identity = DoubleTuples.constant(size, Double.POSITIVE_INFINITY); MutableDoubleTuple localResult = tuples.parallelStream().collect( () -> DoubleTuples.copy(identity), (r,t) -> DoubleTuples.min(r, t, r), (r0,r1) -> DoubleTuples.min(r0, r1, r0)); if (result == null) { return localResult; // depends on control dependency: [if], data = [none] } result.set(localResult); return result; } }
public class class_name { int getTotalCount() { int ret = 0; for (RaidMissingBlocksPerCodec queue : queues.values()) { ret += queue.getTotalCount(); } return ret; } }
public class class_name { int getTotalCount() { int ret = 0; for (RaidMissingBlocksPerCodec queue : queues.values()) { ret += queue.getTotalCount(); // depends on control dependency: [for], data = [queue] } return ret; } }
public class class_name { @Override public AppSession getNewSession(String sessionId, Class<? extends AppSession> aClass, ApplicationId applicationId, Object[] args) { AppSession appSession = null; if (aClass == ClientCxDxSession.class) { if (sessionId == null) { if (args != null && args.length > 0 && args[0] instanceof Request) { Request request = (Request) args[0]; sessionId = request.getSessionId(); } else { sessionId = this.sessionFactory.getSessionId(); } } IClientCxDxSessionData sessionData = (IClientCxDxSessionData) this.sessionDataFactory.getAppSessionData(ClientCxDxSession.class, sessionId); sessionData.setApplicationId(applicationId); CxDxClientSessionImpl clientSession = new CxDxClientSessionImpl(sessionData, this.getMessageFactory(), this.sessionFactory, this .getClientSessionListener()); iss.addSession(clientSession); clientSession.getSessions().get(0).setRequestListener(clientSession); appSession = clientSession; } else if (aClass == ServerCxDxSession.class) { if (sessionId == null) { if (args != null && args.length > 0 && args[0] instanceof Request) { Request request = (Request) args[0]; sessionId = request.getSessionId(); } else { sessionId = this.sessionFactory.getSessionId(); } } IServerCxDxSessionData sessionData = (IServerCxDxSessionData) this.sessionDataFactory.getAppSessionData(ServerCxDxSession.class, sessionId); sessionData.setApplicationId(applicationId); CxDxServerSessionImpl serverSession = new CxDxServerSessionImpl(sessionData, getMessageFactory(), sessionFactory, this.getServerSessionListener()); iss.addSession(serverSession); serverSession.getSessions().get(0).setRequestListener(serverSession); appSession = serverSession; } else { throw new IllegalArgumentException("Wrong session class: " + aClass + ". Supported[" + ServerCxDxSession.class + "," + ClientCxDxSession.class + "]"); } return appSession; } }
public class class_name { @Override public AppSession getNewSession(String sessionId, Class<? extends AppSession> aClass, ApplicationId applicationId, Object[] args) { AppSession appSession = null; if (aClass == ClientCxDxSession.class) { if (sessionId == null) { if (args != null && args.length > 0 && args[0] instanceof Request) { Request request = (Request) args[0]; sessionId = request.getSessionId(); // depends on control dependency: [if], data = [none] } else { sessionId = this.sessionFactory.getSessionId(); // depends on control dependency: [if], data = [none] } } IClientCxDxSessionData sessionData = (IClientCxDxSessionData) this.sessionDataFactory.getAppSessionData(ClientCxDxSession.class, sessionId); sessionData.setApplicationId(applicationId); // depends on control dependency: [if], data = [none] CxDxClientSessionImpl clientSession = new CxDxClientSessionImpl(sessionData, this.getMessageFactory(), this.sessionFactory, this .getClientSessionListener()); iss.addSession(clientSession); // depends on control dependency: [if], data = [none] clientSession.getSessions().get(0).setRequestListener(clientSession); // depends on control dependency: [if], data = [none] appSession = clientSession; // depends on control dependency: [if], data = [none] } else if (aClass == ServerCxDxSession.class) { if (sessionId == null) { if (args != null && args.length > 0 && args[0] instanceof Request) { Request request = (Request) args[0]; sessionId = request.getSessionId(); // depends on control dependency: [if], data = [none] } else { sessionId = this.sessionFactory.getSessionId(); // depends on control dependency: [if], data = [none] } } IServerCxDxSessionData sessionData = (IServerCxDxSessionData) this.sessionDataFactory.getAppSessionData(ServerCxDxSession.class, sessionId); sessionData.setApplicationId(applicationId); // depends on control dependency: [if], data = [none] CxDxServerSessionImpl serverSession = new CxDxServerSessionImpl(sessionData, getMessageFactory(), sessionFactory, this.getServerSessionListener()); iss.addSession(serverSession); // depends on control dependency: [if], data = [none] serverSession.getSessions().get(0).setRequestListener(serverSession); // depends on control dependency: [if], data = [none] appSession = serverSession; // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Wrong session class: " + aClass + ". Supported[" + ServerCxDxSession.class + "," + ClientCxDxSession.class + "]"); } return appSession; } }
public class class_name { public static Node.OfLong flattenLong(Node.OfLong node) { if (node.getChildCount() > 0) { long size = node.count(); if (size >= MAX_ARRAY_SIZE) throw new IllegalArgumentException(BAD_SIZE); long[] array = new long[(int) size]; new ToArrayTask.OfLong(node, array, 0).invoke(); return node(array); } else { return node; } } }
public class class_name { public static Node.OfLong flattenLong(Node.OfLong node) { if (node.getChildCount() > 0) { long size = node.count(); if (size >= MAX_ARRAY_SIZE) throw new IllegalArgumentException(BAD_SIZE); long[] array = new long[(int) size]; new ToArrayTask.OfLong(node, array, 0).invoke(); // depends on control dependency: [if], data = [0)] return node(array); // depends on control dependency: [if], data = [none] } else { return node; // depends on control dependency: [if], data = [none] } } }
public class class_name { public MethodInfo[] getConstructors() { int size = mMethods.size(); List<MethodInfo> ctorsOnly = new ArrayList<MethodInfo>(size); for (int i=0; i<size; i++) { MethodInfo method = mMethods.get(i); if ("<init>".equals(method.getName())) { ctorsOnly.add(method); } } MethodInfo[] ctorsArray = new MethodInfo[ctorsOnly.size()]; return ctorsOnly.toArray(ctorsArray); } }
public class class_name { public MethodInfo[] getConstructors() { int size = mMethods.size(); List<MethodInfo> ctorsOnly = new ArrayList<MethodInfo>(size); for (int i=0; i<size; i++) { MethodInfo method = mMethods.get(i); if ("<init>".equals(method.getName())) { ctorsOnly.add(method); // depends on control dependency: [if], data = [none] } } MethodInfo[] ctorsArray = new MethodInfo[ctorsOnly.size()]; return ctorsOnly.toArray(ctorsArray); } }
public class class_name { private RegionMetadata loadFromSystemProperty() { final String overrideFilePath = System.getProperty (REGIONS_FILE_OVERRIDE); if (overrideFilePath != null) { try { return LegacyRegionXmlLoadUtils.load(new File (overrideFilePath)); } catch (IOException exception) { throw new SdkClientException( "Error parsing region metadata from " + overrideFilePath, exception); } } return null; } }
public class class_name { private RegionMetadata loadFromSystemProperty() { final String overrideFilePath = System.getProperty (REGIONS_FILE_OVERRIDE); if (overrideFilePath != null) { try { return LegacyRegionXmlLoadUtils.load(new File (overrideFilePath)); // depends on control dependency: [try], data = [none] } catch (IOException exception) { throw new SdkClientException( "Error parsing region metadata from " + overrideFilePath, exception); } // depends on control dependency: [catch], data = [none] } return null; } }
public class class_name { public static boolean isServiceRunning(Class<? extends Service> service) { ActivityManager manager = (ActivityManager) QuickUtils.getContext().getSystemService(Context.ACTIVITY_SERVICE); for (ActivityManager.RunningServiceInfo runningServiceInfo : manager.getRunningServices(Integer.MAX_VALUE)) { if (service.getName().equals(runningServiceInfo.service.getClassName())) { return true; } } return false; } }
public class class_name { public static boolean isServiceRunning(Class<? extends Service> service) { ActivityManager manager = (ActivityManager) QuickUtils.getContext().getSystemService(Context.ACTIVITY_SERVICE); for (ActivityManager.RunningServiceInfo runningServiceInfo : manager.getRunningServices(Integer.MAX_VALUE)) { if (service.getName().equals(runningServiceInfo.service.getClassName())) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public void initialize(PropertyProvider propertyProvider) { host = propertyProvider.getProperty(PropertyProvider.PROPERTY_HOST); if (host == null) { host = propertyProvider.getProperty(PropertyProvider.PROPERTY_GRAYLOG_HOST); } String port = propertyProvider.getProperty(PropertyProvider.PROPERTY_PORT); if (port == null) { port = propertyProvider.getProperty(PropertyProvider.PROPERTY_GRAYLOG_PORT); } if (port != null && !"".equals(port)) { this.port = Integer.parseInt(port); } originHost = propertyProvider.getProperty(PropertyProvider.PROPERTY_ORIGIN_HOST); setExtractStackTrace(propertyProvider.getProperty(PropertyProvider.PROPERTY_EXTRACT_STACKTRACE)); setFilterStackTrace("true".equalsIgnoreCase(propertyProvider.getProperty(PropertyProvider.PROPERTY_FILTER_STACK_TRACE))); String includeLogMessageParameters = propertyProvider .getProperty(PropertyProvider.PROPERTY_INCLUDE_LOG_MESSAGE_PARAMETERS); if (includeLogMessageParameters != null && !includeLogMessageParameters.trim().equals("")) { setIncludeLogMessageParameters("true".equalsIgnoreCase(includeLogMessageParameters)); } setupStaticFields(propertyProvider); setupAdditionalFieldTypes(propertyProvider); facility = propertyProvider.getProperty(PropertyProvider.PROPERTY_FACILITY); String version = propertyProvider.getProperty(PropertyProvider.PROPERTY_VERSION); if (version != null && !"".equals(version)) { this.version = version; } String messageSize = propertyProvider.getProperty(PropertyProvider.PROPERTY_MAX_MESSAGE_SIZE); if (messageSize != null) { maximumMessageSize = Integer.parseInt(messageSize); } String timestampPattern = propertyProvider.getProperty(PropertyProvider.PROPERTY_TIMESTAMP_PATTERN); if (timestampPattern != null && !"".equals(timestampPattern)) { this.timestampPattern = timestampPattern; } } }
public class class_name { public void initialize(PropertyProvider propertyProvider) { host = propertyProvider.getProperty(PropertyProvider.PROPERTY_HOST); if (host == null) { host = propertyProvider.getProperty(PropertyProvider.PROPERTY_GRAYLOG_HOST); // depends on control dependency: [if], data = [none] } String port = propertyProvider.getProperty(PropertyProvider.PROPERTY_PORT); if (port == null) { port = propertyProvider.getProperty(PropertyProvider.PROPERTY_GRAYLOG_PORT); // depends on control dependency: [if], data = [none] } if (port != null && !"".equals(port)) { this.port = Integer.parseInt(port); // depends on control dependency: [if], data = [(port] } originHost = propertyProvider.getProperty(PropertyProvider.PROPERTY_ORIGIN_HOST); setExtractStackTrace(propertyProvider.getProperty(PropertyProvider.PROPERTY_EXTRACT_STACKTRACE)); setFilterStackTrace("true".equalsIgnoreCase(propertyProvider.getProperty(PropertyProvider.PROPERTY_FILTER_STACK_TRACE))); String includeLogMessageParameters = propertyProvider .getProperty(PropertyProvider.PROPERTY_INCLUDE_LOG_MESSAGE_PARAMETERS); if (includeLogMessageParameters != null && !includeLogMessageParameters.trim().equals("")) { setIncludeLogMessageParameters("true".equalsIgnoreCase(includeLogMessageParameters)); // depends on control dependency: [if], data = [(includeLogMessageParameters] } setupStaticFields(propertyProvider); setupAdditionalFieldTypes(propertyProvider); facility = propertyProvider.getProperty(PropertyProvider.PROPERTY_FACILITY); String version = propertyProvider.getProperty(PropertyProvider.PROPERTY_VERSION); if (version != null && !"".equals(version)) { this.version = version; // depends on control dependency: [if], data = [none] } String messageSize = propertyProvider.getProperty(PropertyProvider.PROPERTY_MAX_MESSAGE_SIZE); if (messageSize != null) { maximumMessageSize = Integer.parseInt(messageSize); // depends on control dependency: [if], data = [(messageSize] } String timestampPattern = propertyProvider.getProperty(PropertyProvider.PROPERTY_TIMESTAMP_PATTERN); if (timestampPattern != null && !"".equals(timestampPattern)) { this.timestampPattern = timestampPattern; // depends on control dependency: [if], data = [none] } } }
public class class_name { @SuppressWarnings("unchecked") private Map<String, Object> readCachedETags() { File cachedETagsFile = getCachedETagsFile(); Map<String, Object> cachedETags; if (cachedETagsFile.exists()) { JsonSlurper slurper = new JsonSlurper(); cachedETags = (Map<String, Object>)slurper.parse(cachedETagsFile, "UTF-8"); } else { cachedETags = new LinkedHashMap<String, Object>(); } return cachedETags; } }
public class class_name { @SuppressWarnings("unchecked") private Map<String, Object> readCachedETags() { File cachedETagsFile = getCachedETagsFile(); Map<String, Object> cachedETags; if (cachedETagsFile.exists()) { JsonSlurper slurper = new JsonSlurper(); cachedETags = (Map<String, Object>)slurper.parse(cachedETagsFile, "UTF-8"); // depends on control dependency: [if], data = [none] } else { cachedETags = new LinkedHashMap<String, Object>(); // depends on control dependency: [if], data = [none] } return cachedETags; } }
public class class_name { public void setSuggesterNames(java.util.Collection<String> suggesterNames) { if (suggesterNames == null) { this.suggesterNames = null; return; } this.suggesterNames = new com.amazonaws.internal.SdkInternalList<String>(suggesterNames); } }
public class class_name { public void setSuggesterNames(java.util.Collection<String> suggesterNames) { if (suggesterNames == null) { this.suggesterNames = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.suggesterNames = new com.amazonaws.internal.SdkInternalList<String>(suggesterNames); } }
public class class_name { void putAll(ParsedValues other) { if (this.keys == null) { int v = other.len; if (v != Integer.MIN_VALUE) { if ((this.len == Integer.MIN_VALUE) || this.duplicateKeysAllowed || (this.len == v)) { this.len = v; } else { throw new AmbivalentValueException(PlainTime.DIGITAL_HOUR_OF_DAY); } } v = other.mask; if (v != Integer.MIN_VALUE) { if ((this.mask == Integer.MIN_VALUE) || this.duplicateKeysAllowed || (this.mask == v)) { this.mask = v; } else { throw new AmbivalentValueException(PlainTime.MINUTE_OF_HOUR); } } v = other.threshold; if (v != Integer.MIN_VALUE) { if ((this.threshold == Integer.MIN_VALUE) || this.duplicateKeysAllowed || (this.threshold == v)) { this.threshold = v; } else { throw new AmbivalentValueException(PlainTime.SECOND_OF_MINUTE); } } v = other.count; if (v != Integer.MIN_VALUE) { if ((this.count == Integer.MIN_VALUE) || this.duplicateKeysAllowed || (this.count == v)) { this.count = v; } else { throw new AmbivalentValueException(PlainTime.NANO_OF_SECOND); } } for (int i = 0; i < 3; i++) { v = other.ints[i]; if (v != Integer.MIN_VALUE) { if ((this.ints[i] == Integer.MIN_VALUE) || this.duplicateKeysAllowed || (this.ints[i] == v)) { this.ints[i] = v; } else { throw new AmbivalentValueException(getIndexedElement(i)); } } } Map<ChronoElement<?>, Object> m = other.map; if (m != null) { for (ChronoElement<?> e : m.keySet()) { this.put(e, m.get(e)); } } return; } Object[] elements = other.keys; Object current; for (int i = 0; i < elements.length; i++) { if ((current = elements[i]) != null) { ChronoElement<?> element = ChronoElement.class.cast(current); if (element.getType() == Integer.class) { this.put(element, other.ints[i]); } else { this.put(element, other.values[i]); } } } } }
public class class_name { void putAll(ParsedValues other) { if (this.keys == null) { int v = other.len; if (v != Integer.MIN_VALUE) { if ((this.len == Integer.MIN_VALUE) || this.duplicateKeysAllowed || (this.len == v)) { this.len = v; // depends on control dependency: [if], data = [none] } else { throw new AmbivalentValueException(PlainTime.DIGITAL_HOUR_OF_DAY); } } v = other.mask; // depends on control dependency: [if], data = [none] if (v != Integer.MIN_VALUE) { if ((this.mask == Integer.MIN_VALUE) || this.duplicateKeysAllowed || (this.mask == v)) { this.mask = v; // depends on control dependency: [if], data = [none] } else { throw new AmbivalentValueException(PlainTime.MINUTE_OF_HOUR); } } v = other.threshold; // depends on control dependency: [if], data = [none] if (v != Integer.MIN_VALUE) { if ((this.threshold == Integer.MIN_VALUE) || this.duplicateKeysAllowed || (this.threshold == v)) { this.threshold = v; // depends on control dependency: [if], data = [none] } else { throw new AmbivalentValueException(PlainTime.SECOND_OF_MINUTE); } } v = other.count; // depends on control dependency: [if], data = [none] if (v != Integer.MIN_VALUE) { if ((this.count == Integer.MIN_VALUE) || this.duplicateKeysAllowed || (this.count == v)) { this.count = v; // depends on control dependency: [if], data = [none] } else { throw new AmbivalentValueException(PlainTime.NANO_OF_SECOND); } } for (int i = 0; i < 3; i++) { v = other.ints[i]; // depends on control dependency: [for], data = [i] if (v != Integer.MIN_VALUE) { if ((this.ints[i] == Integer.MIN_VALUE) || this.duplicateKeysAllowed || (this.ints[i] == v)) { this.ints[i] = v; // depends on control dependency: [if], data = [none] } else { throw new AmbivalentValueException(getIndexedElement(i)); } } } Map<ChronoElement<?>, Object> m = other.map; if (m != null) { for (ChronoElement<?> e : m.keySet()) { this.put(e, m.get(e)); // depends on control dependency: [for], data = [e] } } return; // depends on control dependency: [if], data = [none] } Object[] elements = other.keys; Object current; for (int i = 0; i < elements.length; i++) { if ((current = elements[i]) != null) { ChronoElement<?> element = ChronoElement.class.cast(current); if (element.getType() == Integer.class) { this.put(element, other.ints[i]); // depends on control dependency: [if], data = [none] } else { this.put(element, other.values[i]); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { @SuppressWarnings("unchecked") protected void bcsPreDeserializationHook(ObjectInputStream ois) throws IOException, ClassNotFoundException { super.bcsPreDeserializationHook(ois); // deserialize services synchronized (services) { serializable = ois.readInt(); for (int i = 0; i < serializable; i++) { Object serviceClass = ois.readObject(); Object bcssProvider = ois.readObject(); services.put((Class) serviceClass, (BCSSServiceProvider) bcssProvider); } } } }
public class class_name { @SuppressWarnings("unchecked") protected void bcsPreDeserializationHook(ObjectInputStream ois) throws IOException, ClassNotFoundException { super.bcsPreDeserializationHook(ois); // deserialize services synchronized (services) { serializable = ois.readInt(); for (int i = 0; i < serializable; i++) { Object serviceClass = ois.readObject(); Object bcssProvider = ois.readObject(); services.put((Class) serviceClass, (BCSSServiceProvider) bcssProvider); // depends on control dependency: [for], data = [none] } } } }
public class class_name { private static CookieUser userForCookie(String uuid, HttpServletRequest request) { if (StringUtils.isBlank(uuid)) { return null; } String ck = decrypt(uuid); final String[] items = StringUtils.split(ck, '|'); if (items.length == 5) { String ua = request.getHeader("user-agent"); int ua_code = (ua == null) ? 0 : ua.hashCode(); int old_ua_code = Integer.parseInt(items[3]); if (ua_code == old_ua_code) { return new CookieUser(NumberUtils.toLong(items[0], -1L), items[1], false); } } return null; } }
public class class_name { private static CookieUser userForCookie(String uuid, HttpServletRequest request) { if (StringUtils.isBlank(uuid)) { return null; // depends on control dependency: [if], data = [none] } String ck = decrypt(uuid); final String[] items = StringUtils.split(ck, '|'); if (items.length == 5) { String ua = request.getHeader("user-agent"); int ua_code = (ua == null) ? 0 : ua.hashCode(); int old_ua_code = Integer.parseInt(items[3]); if (ua_code == old_ua_code) { return new CookieUser(NumberUtils.toLong(items[0], -1L), items[1], false); // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public void marshall(AdminUpdateAuthEventFeedbackRequest adminUpdateAuthEventFeedbackRequest, ProtocolMarshaller protocolMarshaller) { if (adminUpdateAuthEventFeedbackRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(adminUpdateAuthEventFeedbackRequest.getUserPoolId(), USERPOOLID_BINDING); protocolMarshaller.marshall(adminUpdateAuthEventFeedbackRequest.getUsername(), USERNAME_BINDING); protocolMarshaller.marshall(adminUpdateAuthEventFeedbackRequest.getEventId(), EVENTID_BINDING); protocolMarshaller.marshall(adminUpdateAuthEventFeedbackRequest.getFeedbackValue(), FEEDBACKVALUE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(AdminUpdateAuthEventFeedbackRequest adminUpdateAuthEventFeedbackRequest, ProtocolMarshaller protocolMarshaller) { if (adminUpdateAuthEventFeedbackRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(adminUpdateAuthEventFeedbackRequest.getUserPoolId(), USERPOOLID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(adminUpdateAuthEventFeedbackRequest.getUsername(), USERNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(adminUpdateAuthEventFeedbackRequest.getEventId(), EVENTID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(adminUpdateAuthEventFeedbackRequest.getFeedbackValue(), FEEDBACKVALUE_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 char decodeChar(char c, int offset) { int position = (table.indexOf(c) - offset) % 52; if (position < 0) { position += 52; } return table.charAt(position); } }
public class class_name { private static char decodeChar(char c, int offset) { int position = (table.indexOf(c) - offset) % 52; if (position < 0) { position += 52; // depends on control dependency: [if], data = [none] } return table.charAt(position); } }
public class class_name { public DockerContainerObjectBuilder<T> withContainerObjectClass(Class<T> containerObjectClass) { if (containerObjectClass == null) { throw new IllegalArgumentException("container object class cannot be null"); } this.containerObjectClass = containerObjectClass; //First we check if this ContainerObject is defining a @CubeDockerFile in static method final List<Method> methodsWithCubeDockerFile = ReflectionUtil.getMethodsWithAnnotation(containerObjectClass, CubeDockerFile.class); if (methodsWithCubeDockerFile.size() > 1) { throw new IllegalArgumentException( String.format( "More than one %s annotation found and only one was expected. Methods where annotation was found are: %s", CubeDockerFile.class.getSimpleName(), methodsWithCubeDockerFile)); } classHasMethodWithCubeDockerFile = !methodsWithCubeDockerFile.isEmpty(); classDefinesCubeDockerFile = containerObjectClass.isAnnotationPresent(CubeDockerFile.class); classDefinesImage = containerObjectClass.isAnnotationPresent(Image.class); if (classHasMethodWithCubeDockerFile) { methodWithCubeDockerFile = methodsWithCubeDockerFile.get(0); boolean isMethodStatic = Modifier.isStatic(methodWithCubeDockerFile.getModifiers()); boolean methodHasNoArguments = methodWithCubeDockerFile.getParameterCount() == 0; boolean methodReturnsAnArchive = Archive.class.isAssignableFrom(methodWithCubeDockerFile.getReturnType()); if (!isMethodStatic || !methodHasNoArguments || !methodReturnsAnArchive) { throw new IllegalArgumentException( String.format("Method %s annotated with %s is expected to be static, no args and return %s.", methodWithCubeDockerFile, CubeDockerFile.class.getSimpleName(), Archive.class.getSimpleName())); } } // User has defined @CubeDockerfile on the class and a method if (classHasMethodWithCubeDockerFile && classDefinesCubeDockerFile) { throw new IllegalArgumentException( String.format( "More than one %s annotation found and only one was expected. Both class and method %s has the annotation.", CubeDockerFile.class.getSimpleName(), methodWithCubeDockerFile)); } // User has defined @CubeDockerfile and @Image if ((classHasMethodWithCubeDockerFile || classDefinesCubeDockerFile) && classDefinesImage) { throw new IllegalArgumentException( String.format("Container Object %s has defined %s annotation and %s annotation together.", containerObjectClass.getSimpleName(), Image.class.getSimpleName(), CubeDockerFile.class.getSimpleName())); } // User has not defined either @CubeDockerfile or @Image if (!classDefinesCubeDockerFile && !classDefinesImage && !classHasMethodWithCubeDockerFile) { throw new IllegalArgumentException( String.format("Container Object %s is not annotated with either %s or %s annotations.", containerObjectClass.getName(), CubeDockerFile.class.getSimpleName(), Image.class.getSimpleName())); } return this; } }
public class class_name { public DockerContainerObjectBuilder<T> withContainerObjectClass(Class<T> containerObjectClass) { if (containerObjectClass == null) { throw new IllegalArgumentException("container object class cannot be null"); } this.containerObjectClass = containerObjectClass; //First we check if this ContainerObject is defining a @CubeDockerFile in static method final List<Method> methodsWithCubeDockerFile = ReflectionUtil.getMethodsWithAnnotation(containerObjectClass, CubeDockerFile.class); if (methodsWithCubeDockerFile.size() > 1) { throw new IllegalArgumentException( String.format( "More than one %s annotation found and only one was expected. Methods where annotation was found are: %s", CubeDockerFile.class.getSimpleName(), methodsWithCubeDockerFile)); } classHasMethodWithCubeDockerFile = !methodsWithCubeDockerFile.isEmpty(); classDefinesCubeDockerFile = containerObjectClass.isAnnotationPresent(CubeDockerFile.class); classDefinesImage = containerObjectClass.isAnnotationPresent(Image.class); if (classHasMethodWithCubeDockerFile) { methodWithCubeDockerFile = methodsWithCubeDockerFile.get(0); // depends on control dependency: [if], data = [none] boolean isMethodStatic = Modifier.isStatic(methodWithCubeDockerFile.getModifiers()); boolean methodHasNoArguments = methodWithCubeDockerFile.getParameterCount() == 0; boolean methodReturnsAnArchive = Archive.class.isAssignableFrom(methodWithCubeDockerFile.getReturnType()); if (!isMethodStatic || !methodHasNoArguments || !methodReturnsAnArchive) { throw new IllegalArgumentException( String.format("Method %s annotated with %s is expected to be static, no args and return %s.", methodWithCubeDockerFile, CubeDockerFile.class.getSimpleName(), Archive.class.getSimpleName())); } } // User has defined @CubeDockerfile on the class and a method if (classHasMethodWithCubeDockerFile && classDefinesCubeDockerFile) { throw new IllegalArgumentException( String.format( "More than one %s annotation found and only one was expected. Both class and method %s has the annotation.", CubeDockerFile.class.getSimpleName(), methodWithCubeDockerFile)); } // User has defined @CubeDockerfile and @Image if ((classHasMethodWithCubeDockerFile || classDefinesCubeDockerFile) && classDefinesImage) { throw new IllegalArgumentException( String.format("Container Object %s has defined %s annotation and %s annotation together.", containerObjectClass.getSimpleName(), Image.class.getSimpleName(), CubeDockerFile.class.getSimpleName())); } // User has not defined either @CubeDockerfile or @Image if (!classDefinesCubeDockerFile && !classDefinesImage && !classHasMethodWithCubeDockerFile) { throw new IllegalArgumentException( String.format("Container Object %s is not annotated with either %s or %s annotations.", containerObjectClass.getName(), CubeDockerFile.class.getSimpleName(), Image.class.getSimpleName())); } return this; } }
public class class_name { private void parsePrimaryHeader(WsByteBuffer contextBuffer) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "parsePrimaryHeader", contextBuffer); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, contextBuffer, "contextBuffer"); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, unparsedPrimaryHeader, "unparsedPrimaryHeader"); int initialPrimaryHeaderPosition = unparsedPrimaryHeader.position(); WsByteBuffer parseHeaderBuffer = readData(contextBuffer, unparsedPrimaryHeader); if (parseHeaderBuffer != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "parse header buffer not null"); short eyecatcher = parseHeaderBuffer.getShort(); if (eyecatcher != (short)0xBEEF) { // bad eyecatcher state = STATE_ERROR; throwable = new SIConnectionLostException(nls.getFormattedMessage("TRANSPARSER_PROTOCOLERROR_SICJ0053", new Object[] {connection.remoteHostAddress, connection.chainName}, "TRANSPARSER_PROTOCOLERROR_SICJ0053")); // D226223 // This FFDC was generated because our peer sent us an invalid eyecatcher. FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSEPRIMHDR_01, getFormattedBytes(contextBuffer)); // D267629 if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "bad eyecatcer (as short): "+eyecatcher); } else { primaryHeaderFields.segmentLength = parseHeaderBuffer.getInt(); if (primaryHeaderFields.segmentLength < 0) primaryHeaderFields.segmentLength += 4294967296L; // Reject lengths greater than our maximum transmission length. if (primaryHeaderFields.segmentLength > connection.getMaxTransmissionSize()) { state = STATE_ERROR; throwable = new SIConnectionLostException(nls.getFormattedMessage("TRANSPARSER_PROTOCOLERROR_SICJ0053", new Object[] {connection.remoteHostAddress, connection.chainName}, "TRANSPARSER_PROTOCOLERROR_SICJ0053")); // D226223 // This FFDC was generated because our peer has exceeded the maximum segment size // that was agreed at handshake time. FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSEPRIMHDR_02, getFormattedBytes(contextBuffer)); // D267629 if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "max transmission size exceeded"); } else { transmissionPayloadRemaining = primaryHeaderFields.segmentLength - JFapChannelConstants.SIZEOF_PRIMARY_HEADER; short flags = parseHeaderBuffer.getShort(); primaryHeaderFields.priority = flags & 0x000F; primaryHeaderFields.isPooled = (flags & 0x1000) == 0x1000; primaryHeaderFields.isExchange = (flags & 0x4000) == 0x4000; // D190023 if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "flags: "+flags); primaryHeaderFields.packetNumber = parseHeaderBuffer.get(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "packet number: "+primaryHeaderFields.packetNumber+" expected: "+expectedPacketNumber); if (primaryHeaderFields.packetNumber != expectedPacketNumber) { state = STATE_ERROR; throwable = new SIConnectionLostException(nls.getFormattedMessage("TRANSPARSER_PROTOCOLERROR_SICJ0053", new Object[] {connection.remoteHostAddress, connection.chainName}, "TRANSPARSER_PROTOCOLERROR_SICJ0053")); // D226223 // This FFDC was generated because our peer sent us a transmission containing // a sequence number that did not match the one we expected. final Object[] ffdcData = new Object[] { "expected packet number="+expectedPacketNumber, "received packet number="+primaryHeaderFields.packetNumber, getFormattedBytes(contextBuffer) }; FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSEPRIMHDR_03, ffdcData); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "sequence number mis-match - expected:"+expectedPacketNumber+" got:"+primaryHeaderFields.packetNumber); } else { ++expectedPacketNumber; primaryHeaderFields.segmentType = parseHeaderBuffer.get(); if (primaryHeaderFields.segmentType < 0) primaryHeaderFields.segmentType += 256; transmissionLayout = JFapChannelConstants.segmentToLayout(primaryHeaderFields.segmentType); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "layout = "+transmissionLayout); if (transmissionLayout == JFapChannelConstants.XMIT_PRIMARY_ONLY) { transmissionPayloadDataLength = primaryHeaderFields.segmentLength - JFapChannelConstants.SIZEOF_PRIMARY_HEADER; state = STATE_PARSING_PRIMARY_ONLY_PAYLOAD; } else if ( (transmissionLayout == JFapChannelConstants.XMIT_CONVERSATION) || (transmissionLayout == JFapChannelConstants.XMIT_SEGMENT_START) || (transmissionLayout == JFapChannelConstants.XMIT_SEGMENT_MIDDLE) || (transmissionLayout == JFapChannelConstants.XMIT_SEGMENT_END)) { state = STATE_PARSING_CONVERSATION_HEADER; } else if (transmissionLayout == JFapChannelConstants.XMIT_LAYOUT_UNKNOWN) { throwable = new SIErrorException(nls.getFormattedMessage("TRANSPARSER_INTERNAL_SICJ0054", null, "TRANSPARSER_INTERNAL_SICJ0054")); // D226223 // This FFDC was generated because the segment type of the transmission doesn't match any of // the segment types that we know the layout for. FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSEPRIMHDR_04, getFormattedBytes(contextBuffer)); // D267629 state = STATE_ERROR; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "invalid layout"); } else { throwable = new SIErrorException(nls.getFormattedMessage("TRANSPARSER_INTERNAL_SICJ0054", null, "TRANSPARSER_INTERNAL_SICJ0054")); // D226223 // This FFDC was generated because the JFapChannelConstants.segmentToLayout method // returned a transmission layout we didn't expect. FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSEPRIMHDR_05, getFormattedBytes(contextBuffer)); // D267629 state = STATE_ERROR; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "JFapChannelConstants.segmentToLayout method returned unknown enumeration value"); } } } } } else { // Optimisation for early rejection of bad eyecatcher if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, unparsedPrimaryHeader, "unparsedPrimaryHEader"); int unparsedPrimaryHeaderPosition = unparsedPrimaryHeader.position(); if ((initialPrimaryHeaderPosition < JFapChannelConstants.SIZEOF_EYECATCHER) && (unparsedPrimaryHeaderPosition > initialPrimaryHeaderPosition)) { int eyecatcherPresent = unparsedPrimaryHeaderPosition - initialPrimaryHeaderPosition; if (eyecatcherPresent > JFapChannelConstants.SIZEOF_EYECATCHER) eyecatcherPresent = JFapChannelConstants.SIZEOF_EYECATCHER; int eyecatcherOffset = initialPrimaryHeaderPosition; unparsedPrimaryHeader.position(eyecatcherOffset); boolean reject = false; for (int i=eyecatcherOffset; (i < eyecatcherPresent) && (!reject); ++i) { reject = unparsedPrimaryHeader.get() != JFapChannelConstants.EYECATCHER_AS_BYTES[i]; } if (reject) { throwable = new SIConnectionLostException(nls.getFormattedMessage("TRANSPARSER_PROTOCOLERROR_SICJ0053", new Object[] {connection.remoteHostAddress, connection.chainName}, "TRANSPARSER_PROTOCOLERROR_SICJ0053")); // D226223 // This FFDC was generated because our peer sent us bad eyecathcer data. FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSEPRIMHDR_06, getFormattedBytes(contextBuffer)); // D267629 state = STATE_ERROR; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "invalid eyecatcher"); } else { unparsedPrimaryHeader.position(unparsedPrimaryHeaderPosition); } } if (state != STATE_ERROR) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "need more data"); needMoreData = true; } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "parsePrimaryHeader"); } }
public class class_name { private void parsePrimaryHeader(WsByteBuffer contextBuffer) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "parsePrimaryHeader", contextBuffer); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, contextBuffer, "contextBuffer"); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, unparsedPrimaryHeader, "unparsedPrimaryHeader"); int initialPrimaryHeaderPosition = unparsedPrimaryHeader.position(); WsByteBuffer parseHeaderBuffer = readData(contextBuffer, unparsedPrimaryHeader); if (parseHeaderBuffer != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "parse header buffer not null"); short eyecatcher = parseHeaderBuffer.getShort(); if (eyecatcher != (short)0xBEEF) { // bad eyecatcher state = STATE_ERROR; // depends on control dependency: [if], data = [none] throwable = new SIConnectionLostException(nls.getFormattedMessage("TRANSPARSER_PROTOCOLERROR_SICJ0053", new Object[] {connection.remoteHostAddress, connection.chainName}, "TRANSPARSER_PROTOCOLERROR_SICJ0053")); // D226223 // depends on control dependency: [if], data = [none] // This FFDC was generated because our peer sent us an invalid eyecatcher. FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSEPRIMHDR_01, getFormattedBytes(contextBuffer)); // D267629 // depends on control dependency: [if], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "bad eyecatcer (as short): "+eyecatcher); } else { primaryHeaderFields.segmentLength = parseHeaderBuffer.getInt(); // depends on control dependency: [if], data = [none] if (primaryHeaderFields.segmentLength < 0) primaryHeaderFields.segmentLength += 4294967296L; // Reject lengths greater than our maximum transmission length. if (primaryHeaderFields.segmentLength > connection.getMaxTransmissionSize()) { state = STATE_ERROR; // depends on control dependency: [if], data = [none] throwable = new SIConnectionLostException(nls.getFormattedMessage("TRANSPARSER_PROTOCOLERROR_SICJ0053", new Object[] {connection.remoteHostAddress, connection.chainName}, "TRANSPARSER_PROTOCOLERROR_SICJ0053")); // D226223 // depends on control dependency: [if], data = [none] // This FFDC was generated because our peer has exceeded the maximum segment size // that was agreed at handshake time. FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSEPRIMHDR_02, getFormattedBytes(contextBuffer)); // D267629 // depends on control dependency: [if], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "max transmission size exceeded"); } else { transmissionPayloadRemaining = primaryHeaderFields.segmentLength - JFapChannelConstants.SIZEOF_PRIMARY_HEADER; // depends on control dependency: [if], data = [none] short flags = parseHeaderBuffer.getShort(); primaryHeaderFields.priority = flags & 0x000F; // depends on control dependency: [if], data = [none] primaryHeaderFields.isPooled = (flags & 0x1000) == 0x1000; // depends on control dependency: [if], data = [none] primaryHeaderFields.isExchange = (flags & 0x4000) == 0x4000; // D190023 // depends on control dependency: [if], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "flags: "+flags); primaryHeaderFields.packetNumber = parseHeaderBuffer.get(); // depends on control dependency: [if], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "packet number: "+primaryHeaderFields.packetNumber+" expected: "+expectedPacketNumber); if (primaryHeaderFields.packetNumber != expectedPacketNumber) { state = STATE_ERROR; // depends on control dependency: [if], data = [none] throwable = new SIConnectionLostException(nls.getFormattedMessage("TRANSPARSER_PROTOCOLERROR_SICJ0053", new Object[] {connection.remoteHostAddress, connection.chainName}, "TRANSPARSER_PROTOCOLERROR_SICJ0053")); // D226223 // depends on control dependency: [if], data = [none] // This FFDC was generated because our peer sent us a transmission containing // a sequence number that did not match the one we expected. final Object[] ffdcData = new Object[] { "expected packet number="+expectedPacketNumber, "received packet number="+primaryHeaderFields.packetNumber, getFormattedBytes(contextBuffer) }; FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSEPRIMHDR_03, ffdcData); // depends on control dependency: [if], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "sequence number mis-match - expected:"+expectedPacketNumber+" got:"+primaryHeaderFields.packetNumber); } else { ++expectedPacketNumber; // depends on control dependency: [if], data = [none] primaryHeaderFields.segmentType = parseHeaderBuffer.get(); // depends on control dependency: [if], data = [none] if (primaryHeaderFields.segmentType < 0) primaryHeaderFields.segmentType += 256; transmissionLayout = JFapChannelConstants.segmentToLayout(primaryHeaderFields.segmentType); // depends on control dependency: [if], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "layout = "+transmissionLayout); if (transmissionLayout == JFapChannelConstants.XMIT_PRIMARY_ONLY) { transmissionPayloadDataLength = primaryHeaderFields.segmentLength - JFapChannelConstants.SIZEOF_PRIMARY_HEADER; // depends on control dependency: [if], data = [none] state = STATE_PARSING_PRIMARY_ONLY_PAYLOAD; // depends on control dependency: [if], data = [none] } else if ( (transmissionLayout == JFapChannelConstants.XMIT_CONVERSATION) || (transmissionLayout == JFapChannelConstants.XMIT_SEGMENT_START) || (transmissionLayout == JFapChannelConstants.XMIT_SEGMENT_MIDDLE) || (transmissionLayout == JFapChannelConstants.XMIT_SEGMENT_END)) { state = STATE_PARSING_CONVERSATION_HEADER; // depends on control dependency: [if], data = [none] } else if (transmissionLayout == JFapChannelConstants.XMIT_LAYOUT_UNKNOWN) { throwable = new SIErrorException(nls.getFormattedMessage("TRANSPARSER_INTERNAL_SICJ0054", null, "TRANSPARSER_INTERNAL_SICJ0054")); // D226223 // depends on control dependency: [if], data = [none] // This FFDC was generated because the segment type of the transmission doesn't match any of // the segment types that we know the layout for. FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSEPRIMHDR_04, getFormattedBytes(contextBuffer)); // D267629 // depends on control dependency: [if], data = [none] state = STATE_ERROR; // depends on control dependency: [if], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "invalid layout"); } else { throwable = new SIErrorException(nls.getFormattedMessage("TRANSPARSER_INTERNAL_SICJ0054", null, "TRANSPARSER_INTERNAL_SICJ0054")); // D226223 // depends on control dependency: [if], data = [none] // This FFDC was generated because the JFapChannelConstants.segmentToLayout method // returned a transmission layout we didn't expect. FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSEPRIMHDR_05, getFormattedBytes(contextBuffer)); // D267629 // depends on control dependency: [if], data = [none] state = STATE_ERROR; // depends on control dependency: [if], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "JFapChannelConstants.segmentToLayout method returned unknown enumeration value"); } } } } } else { // Optimisation for early rejection of bad eyecatcher if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, unparsedPrimaryHeader, "unparsedPrimaryHEader"); int unparsedPrimaryHeaderPosition = unparsedPrimaryHeader.position(); if ((initialPrimaryHeaderPosition < JFapChannelConstants.SIZEOF_EYECATCHER) && (unparsedPrimaryHeaderPosition > initialPrimaryHeaderPosition)) { int eyecatcherPresent = unparsedPrimaryHeaderPosition - initialPrimaryHeaderPosition; if (eyecatcherPresent > JFapChannelConstants.SIZEOF_EYECATCHER) eyecatcherPresent = JFapChannelConstants.SIZEOF_EYECATCHER; int eyecatcherOffset = initialPrimaryHeaderPosition; unparsedPrimaryHeader.position(eyecatcherOffset); // depends on control dependency: [if], data = [none] boolean reject = false; for (int i=eyecatcherOffset; (i < eyecatcherPresent) && (!reject); ++i) { reject = unparsedPrimaryHeader.get() != JFapChannelConstants.EYECATCHER_AS_BYTES[i]; // depends on control dependency: [for], data = [i] } if (reject) { throwable = new SIConnectionLostException(nls.getFormattedMessage("TRANSPARSER_PROTOCOLERROR_SICJ0053", new Object[] {connection.remoteHostAddress, connection.chainName}, "TRANSPARSER_PROTOCOLERROR_SICJ0053")); // D226223 // depends on control dependency: [if], data = [none] // This FFDC was generated because our peer sent us bad eyecathcer data. FFDCFilter.processException(throwable, "com.ibm.ws.sib.jfapchannel.impl.InboundTransmissionParser", JFapChannelConstants.INBOUNDXMITPARSER_PARSEPRIMHDR_06, getFormattedBytes(contextBuffer)); // D267629 // depends on control dependency: [if], data = [none] state = STATE_ERROR; // depends on control dependency: [if], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "invalid eyecatcher"); } else { unparsedPrimaryHeader.position(unparsedPrimaryHeaderPosition); // depends on control dependency: [if], data = [none] } } if (state != STATE_ERROR) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "need more data"); needMoreData = true; // depends on control dependency: [if], data = [none] } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "parsePrimaryHeader"); } }
public class class_name { public void marshall(DeleteAssessmentTemplateRequest deleteAssessmentTemplateRequest, ProtocolMarshaller protocolMarshaller) { if (deleteAssessmentTemplateRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteAssessmentTemplateRequest.getAssessmentTemplateArn(), ASSESSMENTTEMPLATEARN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteAssessmentTemplateRequest deleteAssessmentTemplateRequest, ProtocolMarshaller protocolMarshaller) { if (deleteAssessmentTemplateRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteAssessmentTemplateRequest.getAssessmentTemplateArn(), ASSESSMENTTEMPLATEARN_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static String getKeyQuery(String queryString, String name) { Matcher m = FROM_PATTERN.matcher(queryString); if (m.find()) { StringBuilder sb = new StringBuilder("SELECT "); sb.append(getAlias(queryString)); sb.append("."); sb.append(name); sb.append(" "); sb.append(m.group()); return sb.toString(); } return null; } }
public class class_name { public static String getKeyQuery(String queryString, String name) { Matcher m = FROM_PATTERN.matcher(queryString); if (m.find()) { StringBuilder sb = new StringBuilder("SELECT "); sb.append(getAlias(queryString)); // depends on control dependency: [if], data = [none] sb.append("."); // depends on control dependency: [if], data = [none] sb.append(name); // depends on control dependency: [if], data = [none] sb.append(" "); // depends on control dependency: [if], data = [none] sb.append(m.group()); // depends on control dependency: [if], data = [none] return sb.toString(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public final EObject ruleXListLiteral() throws RecognitionException { EObject current = null; Token otherlv_1=null; Token otherlv_2=null; Token otherlv_4=null; Token otherlv_6=null; EObject lv_elements_3_0 = null; EObject lv_elements_5_0 = null; enterRule(); try { // InternalSARL.g:13869:2: ( ( () otherlv_1= '#' otherlv_2= '[' ( ( (lv_elements_3_0= ruleXExpression ) ) (otherlv_4= ',' ( (lv_elements_5_0= ruleXExpression ) ) )* )? otherlv_6= ']' ) ) // InternalSARL.g:13870:2: ( () otherlv_1= '#' otherlv_2= '[' ( ( (lv_elements_3_0= ruleXExpression ) ) (otherlv_4= ',' ( (lv_elements_5_0= ruleXExpression ) ) )* )? otherlv_6= ']' ) { // InternalSARL.g:13870:2: ( () otherlv_1= '#' otherlv_2= '[' ( ( (lv_elements_3_0= ruleXExpression ) ) (otherlv_4= ',' ( (lv_elements_5_0= ruleXExpression ) ) )* )? otherlv_6= ']' ) // InternalSARL.g:13871:3: () otherlv_1= '#' otherlv_2= '[' ( ( (lv_elements_3_0= ruleXExpression ) ) (otherlv_4= ',' ( (lv_elements_5_0= ruleXExpression ) ) )* )? otherlv_6= ']' { // InternalSARL.g:13871:3: () // InternalSARL.g:13872:4: { if ( state.backtracking==0 ) { current = forceCreateModelElement( grammarAccess.getXListLiteralAccess().getXListLiteralAction_0(), current); } } otherlv_1=(Token)match(input,106,FOLLOW_90); if (state.failed) return current; if ( state.backtracking==0 ) { newLeafNode(otherlv_1, grammarAccess.getXListLiteralAccess().getNumberSignKeyword_1()); } otherlv_2=(Token)match(input,55,FOLLOW_132); if (state.failed) return current; if ( state.backtracking==0 ) { newLeafNode(otherlv_2, grammarAccess.getXListLiteralAccess().getLeftSquareBracketKeyword_2()); } // InternalSARL.g:13886:3: ( ( (lv_elements_3_0= ruleXExpression ) ) (otherlv_4= ',' ( (lv_elements_5_0= ruleXExpression ) ) )* )? int alt330=2; int LA330_0 = input.LA(1); if ( ((LA330_0>=RULE_STRING && LA330_0<=RULE_RICH_TEXT_START)||(LA330_0>=RULE_HEX && LA330_0<=RULE_DECIMAL)||LA330_0==25||(LA330_0>=28 && LA330_0<=29)||LA330_0==36||(LA330_0>=39 && LA330_0<=40)||(LA330_0>=42 && LA330_0<=45)||(LA330_0>=48 && LA330_0<=49)||LA330_0==51||LA330_0==55||(LA330_0>=60 && LA330_0<=63)||(LA330_0>=67 && LA330_0<=68)||(LA330_0>=73 && LA330_0<=75)||(LA330_0>=78 && LA330_0<=96)||LA330_0==106||LA330_0==129||(LA330_0>=131 && LA330_0<=140)) ) { alt330=1; } switch (alt330) { case 1 : // InternalSARL.g:13887:4: ( (lv_elements_3_0= ruleXExpression ) ) (otherlv_4= ',' ( (lv_elements_5_0= ruleXExpression ) ) )* { // InternalSARL.g:13887:4: ( (lv_elements_3_0= ruleXExpression ) ) // InternalSARL.g:13888:5: (lv_elements_3_0= ruleXExpression ) { // InternalSARL.g:13888:5: (lv_elements_3_0= ruleXExpression ) // InternalSARL.g:13889:6: lv_elements_3_0= ruleXExpression { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getXListLiteralAccess().getElementsXExpressionParserRuleCall_3_0_0()); } pushFollow(FOLLOW_111); lv_elements_3_0=ruleXExpression(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { if (current==null) { current = createModelElementForParent(grammarAccess.getXListLiteralRule()); } add( current, "elements", lv_elements_3_0, "org.eclipse.xtext.xbase.Xbase.XExpression"); afterParserOrEnumRuleCall(); } } } // InternalSARL.g:13906:4: (otherlv_4= ',' ( (lv_elements_5_0= ruleXExpression ) ) )* loop329: do { int alt329=2; int LA329_0 = input.LA(1); if ( (LA329_0==32) ) { alt329=1; } switch (alt329) { case 1 : // InternalSARL.g:13907:5: otherlv_4= ',' ( (lv_elements_5_0= ruleXExpression ) ) { otherlv_4=(Token)match(input,32,FOLLOW_45); if (state.failed) return current; if ( state.backtracking==0 ) { newLeafNode(otherlv_4, grammarAccess.getXListLiteralAccess().getCommaKeyword_3_1_0()); } // InternalSARL.g:13911:5: ( (lv_elements_5_0= ruleXExpression ) ) // InternalSARL.g:13912:6: (lv_elements_5_0= ruleXExpression ) { // InternalSARL.g:13912:6: (lv_elements_5_0= ruleXExpression ) // InternalSARL.g:13913:7: lv_elements_5_0= ruleXExpression { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getXListLiteralAccess().getElementsXExpressionParserRuleCall_3_1_1_0()); } pushFollow(FOLLOW_111); lv_elements_5_0=ruleXExpression(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { if (current==null) { current = createModelElementForParent(grammarAccess.getXListLiteralRule()); } add( current, "elements", lv_elements_5_0, "org.eclipse.xtext.xbase.Xbase.XExpression"); afterParserOrEnumRuleCall(); } } } } break; default : break loop329; } } while (true); } break; } otherlv_6=(Token)match(input,56,FOLLOW_2); if (state.failed) return current; if ( state.backtracking==0 ) { newLeafNode(otherlv_6, grammarAccess.getXListLiteralAccess().getRightSquareBracketKeyword_4()); } } } if ( state.backtracking==0 ) { leaveRule(); } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; } }
public class class_name { public final EObject ruleXListLiteral() throws RecognitionException { EObject current = null; Token otherlv_1=null; Token otherlv_2=null; Token otherlv_4=null; Token otherlv_6=null; EObject lv_elements_3_0 = null; EObject lv_elements_5_0 = null; enterRule(); try { // InternalSARL.g:13869:2: ( ( () otherlv_1= '#' otherlv_2= '[' ( ( (lv_elements_3_0= ruleXExpression ) ) (otherlv_4= ',' ( (lv_elements_5_0= ruleXExpression ) ) )* )? otherlv_6= ']' ) ) // InternalSARL.g:13870:2: ( () otherlv_1= '#' otherlv_2= '[' ( ( (lv_elements_3_0= ruleXExpression ) ) (otherlv_4= ',' ( (lv_elements_5_0= ruleXExpression ) ) )* )? otherlv_6= ']' ) { // InternalSARL.g:13870:2: ( () otherlv_1= '#' otherlv_2= '[' ( ( (lv_elements_3_0= ruleXExpression ) ) (otherlv_4= ',' ( (lv_elements_5_0= ruleXExpression ) ) )* )? otherlv_6= ']' ) // InternalSARL.g:13871:3: () otherlv_1= '#' otherlv_2= '[' ( ( (lv_elements_3_0= ruleXExpression ) ) (otherlv_4= ',' ( (lv_elements_5_0= ruleXExpression ) ) )* )? otherlv_6= ']' { // InternalSARL.g:13871:3: () // InternalSARL.g:13872:4: { if ( state.backtracking==0 ) { current = forceCreateModelElement( grammarAccess.getXListLiteralAccess().getXListLiteralAction_0(), current); // depends on control dependency: [if], data = [none] } } otherlv_1=(Token)match(input,106,FOLLOW_90); if (state.failed) return current; if ( state.backtracking==0 ) { newLeafNode(otherlv_1, grammarAccess.getXListLiteralAccess().getNumberSignKeyword_1()); // depends on control dependency: [if], data = [none] } otherlv_2=(Token)match(input,55,FOLLOW_132); if (state.failed) return current; if ( state.backtracking==0 ) { newLeafNode(otherlv_2, grammarAccess.getXListLiteralAccess().getLeftSquareBracketKeyword_2()); // depends on control dependency: [if], data = [none] } // InternalSARL.g:13886:3: ( ( (lv_elements_3_0= ruleXExpression ) ) (otherlv_4= ',' ( (lv_elements_5_0= ruleXExpression ) ) )* )? int alt330=2; int LA330_0 = input.LA(1); if ( ((LA330_0>=RULE_STRING && LA330_0<=RULE_RICH_TEXT_START)||(LA330_0>=RULE_HEX && LA330_0<=RULE_DECIMAL)||LA330_0==25||(LA330_0>=28 && LA330_0<=29)||LA330_0==36||(LA330_0>=39 && LA330_0<=40)||(LA330_0>=42 && LA330_0<=45)||(LA330_0>=48 && LA330_0<=49)||LA330_0==51||LA330_0==55||(LA330_0>=60 && LA330_0<=63)||(LA330_0>=67 && LA330_0<=68)||(LA330_0>=73 && LA330_0<=75)||(LA330_0>=78 && LA330_0<=96)||LA330_0==106||LA330_0==129||(LA330_0>=131 && LA330_0<=140)) ) { alt330=1; // depends on control dependency: [if], data = [none] } switch (alt330) { case 1 : // InternalSARL.g:13887:4: ( (lv_elements_3_0= ruleXExpression ) ) (otherlv_4= ',' ( (lv_elements_5_0= ruleXExpression ) ) )* { // InternalSARL.g:13887:4: ( (lv_elements_3_0= ruleXExpression ) ) // InternalSARL.g:13888:5: (lv_elements_3_0= ruleXExpression ) { // InternalSARL.g:13888:5: (lv_elements_3_0= ruleXExpression ) // InternalSARL.g:13889:6: lv_elements_3_0= ruleXExpression { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getXListLiteralAccess().getElementsXExpressionParserRuleCall_3_0_0()); // depends on control dependency: [if], data = [none] } pushFollow(FOLLOW_111); lv_elements_3_0=ruleXExpression(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { if (current==null) { current = createModelElementForParent(grammarAccess.getXListLiteralRule()); // depends on control dependency: [if], data = [none] } add( current, "elements", lv_elements_3_0, "org.eclipse.xtext.xbase.Xbase.XExpression"); // depends on control dependency: [if], data = [none] afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none] } } } // InternalSARL.g:13906:4: (otherlv_4= ',' ( (lv_elements_5_0= ruleXExpression ) ) )* loop329: do { int alt329=2; int LA329_0 = input.LA(1); if ( (LA329_0==32) ) { alt329=1; // depends on control dependency: [if], data = [none] } switch (alt329) { case 1 : // InternalSARL.g:13907:5: otherlv_4= ',' ( (lv_elements_5_0= ruleXExpression ) ) { otherlv_4=(Token)match(input,32,FOLLOW_45); if (state.failed) return current; if ( state.backtracking==0 ) { newLeafNode(otherlv_4, grammarAccess.getXListLiteralAccess().getCommaKeyword_3_1_0()); // depends on control dependency: [if], data = [none] } // InternalSARL.g:13911:5: ( (lv_elements_5_0= ruleXExpression ) ) // InternalSARL.g:13912:6: (lv_elements_5_0= ruleXExpression ) { // InternalSARL.g:13912:6: (lv_elements_5_0= ruleXExpression ) // InternalSARL.g:13913:7: lv_elements_5_0= ruleXExpression { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getXListLiteralAccess().getElementsXExpressionParserRuleCall_3_1_1_0()); // depends on control dependency: [if], data = [none] } pushFollow(FOLLOW_111); lv_elements_5_0=ruleXExpression(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { if (current==null) { current = createModelElementForParent(grammarAccess.getXListLiteralRule()); // depends on control dependency: [if], data = [none] } add( current, "elements", lv_elements_5_0, "org.eclipse.xtext.xbase.Xbase.XExpression"); // depends on control dependency: [if], data = [none] afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none] } } } } break; default : break loop329; } } while (true); } break; } otherlv_6=(Token)match(input,56,FOLLOW_2); if (state.failed) return current; if ( state.backtracking==0 ) { newLeafNode(otherlv_6, grammarAccess.getXListLiteralAccess().getRightSquareBracketKeyword_4()); // depends on control dependency: [if], data = [none] } } } if ( state.backtracking==0 ) { leaveRule(); // depends on control dependency: [if], data = [none] } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; } }
public class class_name { private void processElement(final DeclarationScopeResolver resolver, final Stack<RuleConditionElement> contextStack, final RuleConditionElement element) { if ( element instanceof Pattern ) { Pattern pattern = (Pattern) element; for ( RuleConditionElement ruleConditionElement : pattern.getNestedElements() ) { processElement( resolver, contextStack, ruleConditionElement ); } for (Constraint constraint : pattern.getConstraints()) { if (constraint instanceof Declaration) { continue; } replaceDeclarations( resolver, pattern, constraint ); } } else if ( element instanceof EvalCondition ) { processEvalCondition(resolver, (EvalCondition) element); } else if ( element instanceof Accumulate ) { for ( RuleConditionElement rce : element.getNestedElements() ) { processElement( resolver, contextStack, rce ); } Accumulate accumulate = (Accumulate)element; replaceDeclarations( resolver, accumulate ); } else if ( element instanceof From ) { DataProvider provider = ((From) element).getDataProvider(); Declaration[] decl = provider.getRequiredDeclarations(); for (Declaration aDecl : decl) { Declaration resolved = resolver.getDeclaration(aDecl.getIdentifier()); if (resolved != null && resolved != aDecl) { provider.replaceDeclaration(aDecl, resolved); } else if (resolved == null) { // it is probably an implicit declaration, so find the corresponding pattern Pattern old = aDecl.getPattern(); Pattern current = resolver.findPatternByIndex(old.getIndex()); if (current != null && old != current) { resolved = new Declaration(aDecl.getIdentifier(), aDecl.getExtractor(), current); provider.replaceDeclaration(aDecl, resolved); } } } } else if ( element instanceof QueryElement ) { QueryElement qe = ( QueryElement ) element; Pattern pattern = qe.getResultPattern(); for ( Entry<String, Declaration> entry : pattern.getInnerDeclarations().entrySet() ) { Declaration resolved = resolver.getDeclaration( entry.getValue().getIdentifier() ); if ( resolved != null && resolved != entry.getValue() && resolved.getPattern() != pattern ) { entry.setValue( resolved ); } } List<Integer> varIndexes = asList( qe.getVariableIndexes() ); for (int i = 0; i < qe.getArguments().length; i++) { if (!(qe.getArguments()[i] instanceof QueryArgument.Declr)) { continue; } Declaration declr = ((QueryArgument.Declr) qe.getArguments()[i]).getDeclaration(); Declaration resolved = resolver.getDeclaration( declr.getIdentifier() ); if ( resolved != declr && resolved.getPattern() != pattern ) { qe.getArguments()[i] = new QueryArgument.Declr(resolved); } if( ClassObjectType.DroolsQuery_ObjectType.isAssignableFrom( resolved.getPattern().getObjectType() ) ) { // if the resolved still points to DroolsQuery, we know this is the first unification pattern, so redeclare it as the visible Declaration declr = pattern.addDeclaration( declr.getIdentifier() ); // this bit is different, notice its the ArrayElementReader that we wire up to, not the declaration. ArrayElementReader reader = new ArrayElementReader( new SelfReferenceClassFieldReader(Object[].class), i, resolved.getDeclarationClass() ); declr.setReadAccessor( reader ); varIndexes.add( i ); } } qe.setVariableIndexes( toIntArray( varIndexes ) ); } else if ( element instanceof ConditionalBranch ) { processBranch( resolver, (ConditionalBranch) element ); } else { contextStack.push( element ); for (RuleConditionElement ruleConditionElement : element.getNestedElements()) { processElement(resolver, contextStack, ruleConditionElement); } contextStack.pop(); } } }
public class class_name { private void processElement(final DeclarationScopeResolver resolver, final Stack<RuleConditionElement> contextStack, final RuleConditionElement element) { if ( element instanceof Pattern ) { Pattern pattern = (Pattern) element; for ( RuleConditionElement ruleConditionElement : pattern.getNestedElements() ) { processElement( resolver, contextStack, ruleConditionElement ); // depends on control dependency: [for], data = [none] } for (Constraint constraint : pattern.getConstraints()) { if (constraint instanceof Declaration) { continue; } replaceDeclarations( resolver, pattern, constraint ); // depends on control dependency: [for], data = [constraint] } } else if ( element instanceof EvalCondition ) { processEvalCondition(resolver, (EvalCondition) element); // depends on control dependency: [if], data = [none] } else if ( element instanceof Accumulate ) { for ( RuleConditionElement rce : element.getNestedElements() ) { processElement( resolver, contextStack, rce ); // depends on control dependency: [for], data = [rce] } Accumulate accumulate = (Accumulate)element; replaceDeclarations( resolver, accumulate ); // depends on control dependency: [if], data = [none] } else if ( element instanceof From ) { DataProvider provider = ((From) element).getDataProvider(); Declaration[] decl = provider.getRequiredDeclarations(); for (Declaration aDecl : decl) { Declaration resolved = resolver.getDeclaration(aDecl.getIdentifier()); if (resolved != null && resolved != aDecl) { provider.replaceDeclaration(aDecl, resolved); // depends on control dependency: [if], data = [none] } else if (resolved == null) { // it is probably an implicit declaration, so find the corresponding pattern Pattern old = aDecl.getPattern(); Pattern current = resolver.findPatternByIndex(old.getIndex()); if (current != null && old != current) { resolved = new Declaration(aDecl.getIdentifier(), aDecl.getExtractor(), current); // depends on control dependency: [if], data = [none] provider.replaceDeclaration(aDecl, resolved); // depends on control dependency: [if], data = [none] } } } } else if ( element instanceof QueryElement ) { QueryElement qe = ( QueryElement ) element; Pattern pattern = qe.getResultPattern(); for ( Entry<String, Declaration> entry : pattern.getInnerDeclarations().entrySet() ) { Declaration resolved = resolver.getDeclaration( entry.getValue().getIdentifier() ); if ( resolved != null && resolved != entry.getValue() && resolved.getPattern() != pattern ) { entry.setValue( resolved ); // depends on control dependency: [if], data = [( resolved] } } List<Integer> varIndexes = asList( qe.getVariableIndexes() ); for (int i = 0; i < qe.getArguments().length; i++) { if (!(qe.getArguments()[i] instanceof QueryArgument.Declr)) { continue; } Declaration declr = ((QueryArgument.Declr) qe.getArguments()[i]).getDeclaration(); Declaration resolved = resolver.getDeclaration( declr.getIdentifier() ); if ( resolved != declr && resolved.getPattern() != pattern ) { qe.getArguments()[i] = new QueryArgument.Declr(resolved); // depends on control dependency: [if], data = [none] } if( ClassObjectType.DroolsQuery_ObjectType.isAssignableFrom( resolved.getPattern().getObjectType() ) ) { // if the resolved still points to DroolsQuery, we know this is the first unification pattern, so redeclare it as the visible Declaration declr = pattern.addDeclaration( declr.getIdentifier() ); // depends on control dependency: [if], data = [none] // this bit is different, notice its the ArrayElementReader that we wire up to, not the declaration. ArrayElementReader reader = new ArrayElementReader( new SelfReferenceClassFieldReader(Object[].class), i, resolved.getDeclarationClass() ); declr.setReadAccessor( reader ); // depends on control dependency: [if], data = [none] varIndexes.add( i ); // depends on control dependency: [if], data = [none] } } qe.setVariableIndexes( toIntArray( varIndexes ) ); // depends on control dependency: [if], data = [none] } else if ( element instanceof ConditionalBranch ) { processBranch( resolver, (ConditionalBranch) element ); // depends on control dependency: [if], data = [none] } else { contextStack.push( element ); // depends on control dependency: [if], data = [none] for (RuleConditionElement ruleConditionElement : element.getNestedElements()) { processElement(resolver, contextStack, ruleConditionElement); // depends on control dependency: [for], data = [none] } contextStack.pop(); // depends on control dependency: [if], data = [none] } } }