code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public Variable declareVariable(Variable var, boolean isPrivate) { if (mVariables.containsKey(var)) { var = mVariables.get(var); } else { mVariables.put(var, var); } mDeclared.put(var.getName(), var); if (isPrivate) { if (mPrivateVars == null) { mPrivateVars = new HashSet<Variable>(7); } mPrivateVars.add(var); } else { if (mPrivateVars != null) { mPrivateVars.remove(var); } } return var; } }
public class class_name { public Variable declareVariable(Variable var, boolean isPrivate) { if (mVariables.containsKey(var)) { var = mVariables.get(var); // depends on control dependency: [if], data = [none] } else { mVariables.put(var, var); // depends on control dependency: [if], data = [none] } mDeclared.put(var.getName(), var); if (isPrivate) { if (mPrivateVars == null) { mPrivateVars = new HashSet<Variable>(7); // depends on control dependency: [if], data = [none] } mPrivateVars.add(var); // depends on control dependency: [if], data = [none] } else { if (mPrivateVars != null) { mPrivateVars.remove(var); // depends on control dependency: [if], data = [none] } } return var; } }
public class class_name { public static void putAllIfNotNull(Map<String, String> ret, Map<String, String> toPut) { if (toPut != null) { ret.putAll(toPut); } } }
public class class_name { public static void putAllIfNotNull(Map<String, String> ret, Map<String, String> toPut) { if (toPut != null) { ret.putAll(toPut); // depends on control dependency: [if], data = [(toPut] } } }
public class class_name { @Override public void initialize(String name, final Scheduler scheduler) throws SchedulerException { logger.info("Registering Quartz shutdown hook."); Thread t = new Thread("Quartz Shutdown-Hook") { @Override public void run() { logger.info("Shutting down Quartz..."); try { scheduler.shutdown(); } catch (SchedulerException e) { logger.info("Error shutting down Quartz: " + e.getMessage(), e); } } }; Runtime.getRuntime().addShutdownHook(t); } }
public class class_name { @Override public void initialize(String name, final Scheduler scheduler) throws SchedulerException { logger.info("Registering Quartz shutdown hook."); Thread t = new Thread("Quartz Shutdown-Hook") { @Override public void run() { logger.info("Shutting down Quartz..."); try { scheduler.shutdown(); // depends on control dependency: [try], data = [none] } catch (SchedulerException e) { logger.info("Error shutting down Quartz: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }; Runtime.getRuntime().addShutdownHook(t); } }
public class class_name { public String extractModel(XLog log) { XAttribute attribute = log.getAttributes().get(KEY_MODEL); if (attribute == null) { return null; } else { return ((XAttributeLiteral) attribute).getValue(); } } }
public class class_name { public String extractModel(XLog log) { XAttribute attribute = log.getAttributes().get(KEY_MODEL); if (attribute == null) { return null; // depends on control dependency: [if], data = [none] } else { return ((XAttributeLiteral) attribute).getValue(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Integer safeAdd(final Integer v1, final Integer v2) { Integer total = v1; if (v1 != null && v2 != null) { total = v1 + v2; } else if (v2 != null) { total = v2; } return total; } }
public class class_name { public static Integer safeAdd(final Integer v1, final Integer v2) { Integer total = v1; if (v1 != null && v2 != null) { total = v1 + v2; // depends on control dependency: [if], data = [none] } else if (v2 != null) { total = v2; // depends on control dependency: [if], data = [none] } return total; } }
public class class_name { protected int getNextAttributeIdentity(int identity) { // Assume that attributes and namespace nodes immediately follow the element while (DTM.NULL != (identity = getNextNodeIdentity(identity))) { int type = _type(identity); if (type == DTM.ATTRIBUTE_NODE) { return identity; } else if (type != DTM.NAMESPACE_NODE) { break; } } return DTM.NULL; } }
public class class_name { protected int getNextAttributeIdentity(int identity) { // Assume that attributes and namespace nodes immediately follow the element while (DTM.NULL != (identity = getNextNodeIdentity(identity))) { int type = _type(identity); if (type == DTM.ATTRIBUTE_NODE) { return identity; // depends on control dependency: [if], data = [none] } else if (type != DTM.NAMESPACE_NODE) { break; } } return DTM.NULL; } }
public class class_name { public void setInstanceFleets(java.util.Collection<InstanceFleet> instanceFleets) { if (instanceFleets == null) { this.instanceFleets = null; return; } this.instanceFleets = new com.amazonaws.internal.SdkInternalList<InstanceFleet>(instanceFleets); } }
public class class_name { public void setInstanceFleets(java.util.Collection<InstanceFleet> instanceFleets) { if (instanceFleets == null) { this.instanceFleets = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.instanceFleets = new com.amazonaws.internal.SdkInternalList<InstanceFleet>(instanceFleets); } }
public class class_name { @FFDCIgnore(value = { Throwable.class }) // Liberty Change for CXF End protected static Object createProvider(String className, Bus bus) { try { Class<?> cls = ClassLoaderUtils.loadClass(className, ProviderFactory.class); for (Constructor<?> c : cls.getConstructors()) { if (c.getParameterTypes().length == 1 && c.getParameterTypes()[0] == Bus.class) { return c.newInstance(bus); } } return cls.newInstance(); } catch (Throwable ex) { String message = "Problem with creating the default provider " + className; if (ex.getMessage() != null) { message += ": " + ex.getMessage(); } else { message += ", exception class : " + ex.getClass().getName(); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, message); } } return null; } }
public class class_name { @FFDCIgnore(value = { Throwable.class }) // Liberty Change for CXF End protected static Object createProvider(String className, Bus bus) { try { Class<?> cls = ClassLoaderUtils.loadClass(className, ProviderFactory.class); for (Constructor<?> c : cls.getConstructors()) { if (c.getParameterTypes().length == 1 && c.getParameterTypes()[0] == Bus.class) { return c.newInstance(bus); // depends on control dependency: [if], data = [none] } } return cls.newInstance(); // depends on control dependency: [try], data = [none] } catch (Throwable ex) { String message = "Problem with creating the default provider " + className; if (ex.getMessage() != null) { message += ": " + ex.getMessage(); // depends on control dependency: [if], data = [none] } else { message += ", exception class : " + ex.getClass().getName(); // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, message); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { private static Optional<String[]> getTrimmedStrings(final YarnConfiguration configuration, final String key) { final String[] result = configuration.getTrimmedStrings(key); if (null == result || result.length == 0) { return Optional.empty(); } else { return Optional.of(result); } } }
public class class_name { private static Optional<String[]> getTrimmedStrings(final YarnConfiguration configuration, final String key) { final String[] result = configuration.getTrimmedStrings(key); if (null == result || result.length == 0) { return Optional.empty(); // depends on control dependency: [if], data = [none] } else { return Optional.of(result); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void forIterator(Env env, Scope scope, Writer writer) { Ctrl ctrl = scope.getCtrl(); Object outer = scope.get("for"); ctrl.setLocalAssignment(); ForIteratorStatus forIteratorStatus = new ForIteratorStatus(outer, forCtrl.getExpr().eval(scope), location); ctrl.setWisdomAssignment(); scope.setLocal("for", forIteratorStatus); Iterator<?> it = forIteratorStatus.getIterator(); String itemName = forCtrl.getId(); while(it.hasNext()) { scope.setLocal(itemName, it.next()); stat.exec(env, scope, writer); forIteratorStatus.nextState(); if (ctrl.isJump()) { if (ctrl.isBreak()) { ctrl.setJumpNone(); break ; } else if (ctrl.isContinue()) { ctrl.setJumpNone(); continue ; } else { return ; } } } if (_else != null && forIteratorStatus.getIndex() == 0) { _else.exec(env, scope, writer); } } }
public class class_name { private void forIterator(Env env, Scope scope, Writer writer) { Ctrl ctrl = scope.getCtrl(); Object outer = scope.get("for"); ctrl.setLocalAssignment(); ForIteratorStatus forIteratorStatus = new ForIteratorStatus(outer, forCtrl.getExpr().eval(scope), location); ctrl.setWisdomAssignment(); scope.setLocal("for", forIteratorStatus); Iterator<?> it = forIteratorStatus.getIterator(); String itemName = forCtrl.getId(); while(it.hasNext()) { scope.setLocal(itemName, it.next()); // depends on control dependency: [while], data = [none] stat.exec(env, scope, writer); // depends on control dependency: [while], data = [none] forIteratorStatus.nextState(); // depends on control dependency: [while], data = [none] if (ctrl.isJump()) { if (ctrl.isBreak()) { ctrl.setJumpNone(); // depends on control dependency: [if], data = [none] break ; } else if (ctrl.isContinue()) { ctrl.setJumpNone(); // depends on control dependency: [if], data = [none] continue ; } else { return ; // depends on control dependency: [if], data = [none] } } } if (_else != null && forIteratorStatus.getIndex() == 0) { _else.exec(env, scope, writer); // depends on control dependency: [if], data = [none] } } }
public class class_name { public INDArray inferVector(@NonNull List<VocabWord> document, double learningRate, double minLearningRate, int iterations) { if (this.vocab == null || this.vocab.numWords() == 0) reassignExistingModel(); SequenceLearningAlgorithm<VocabWord> learner = sequenceLearningAlgorithm; if (learner == null) { synchronized (this) { if (sequenceLearningAlgorithm == null) { log.info("Creating new PV-DM learner..."); learner = new DM<>(); learner.configure(vocab, lookupTable, configuration); sequenceLearningAlgorithm = learner; } else { learner = sequenceLearningAlgorithm; } } } learner = sequenceLearningAlgorithm; if (document.isEmpty()) throw new ND4JIllegalStateException("Impossible to apply inference to empty list of words"); Sequence<VocabWord> sequence = new Sequence<>(); sequence.addElements(document); sequence.setSequenceLabel(new VocabWord(1.0, String.valueOf(new Random().nextInt()))); initLearners(); INDArray inf = learner.inferSequence(sequence, seed, learningRate, minLearningRate, iterations); return inf; } }
public class class_name { public INDArray inferVector(@NonNull List<VocabWord> document, double learningRate, double minLearningRate, int iterations) { if (this.vocab == null || this.vocab.numWords() == 0) reassignExistingModel(); SequenceLearningAlgorithm<VocabWord> learner = sequenceLearningAlgorithm; if (learner == null) { synchronized (this) { // depends on control dependency: [if], data = [none] if (sequenceLearningAlgorithm == null) { log.info("Creating new PV-DM learner..."); // depends on control dependency: [if], data = [none] learner = new DM<>(); // depends on control dependency: [if], data = [none] learner.configure(vocab, lookupTable, configuration); // depends on control dependency: [if], data = [none] sequenceLearningAlgorithm = learner; // depends on control dependency: [if], data = [none] } else { learner = sequenceLearningAlgorithm; // depends on control dependency: [if], data = [none] } } } learner = sequenceLearningAlgorithm; if (document.isEmpty()) throw new ND4JIllegalStateException("Impossible to apply inference to empty list of words"); Sequence<VocabWord> sequence = new Sequence<>(); sequence.addElements(document); sequence.setSequenceLabel(new VocabWord(1.0, String.valueOf(new Random().nextInt()))); initLearners(); INDArray inf = learner.inferSequence(sequence, seed, learningRate, minLearningRate, iterations); return inf; } }
public class class_name { @Override public String getIndexName() { final NoteLink noteLink = noteLinkRenderer .getGedObject(); if (!noteLink.isSet()) { return ""; } final Note note = (Note) noteLink.find(noteLink.getToString()); if (note == null) { // Prevents problems with malformed file return noteLink.getToString(); } final NoteRenderer noteRenderer = (NoteRenderer) new GedRendererFactory().create(note, noteLinkRenderer.getRenderingContext()); return noteRenderer.getIndexNameHtml(); } }
public class class_name { @Override public String getIndexName() { final NoteLink noteLink = noteLinkRenderer .getGedObject(); if (!noteLink.isSet()) { return ""; // depends on control dependency: [if], data = [none] } final Note note = (Note) noteLink.find(noteLink.getToString()); if (note == null) { // Prevents problems with malformed file return noteLink.getToString(); // depends on control dependency: [if], data = [none] } final NoteRenderer noteRenderer = (NoteRenderer) new GedRendererFactory().create(note, noteLinkRenderer.getRenderingContext()); return noteRenderer.getIndexNameHtml(); } }
public class class_name { public void confirm(final int title, final int message, final DialogInterface.OnClickListener onClickListener) { final AlertDialog.Builder builder = new AlertDialog.Builder( getContext()); builder.setTitle(title).setIcon(android.R.drawable.ic_dialog_info).setMessage(message); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { if (onClickListener != null) { onClickListener.onClick(dialog, which); } } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { if (onClickListener != null) { onClickListener.onClick(dialog, which); } } }); builder.show(); } }
public class class_name { public void confirm(final int title, final int message, final DialogInterface.OnClickListener onClickListener) { final AlertDialog.Builder builder = new AlertDialog.Builder( getContext()); builder.setTitle(title).setIcon(android.R.drawable.ic_dialog_info).setMessage(message); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { if (onClickListener != null) { onClickListener.onClick(dialog, which); // depends on control dependency: [if], data = [none] } } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { if (onClickListener != null) { onClickListener.onClick(dialog, which); // depends on control dependency: [if], data = [none] } } }); builder.show(); } }
public class class_name { private void cleanWorkArea() { File workareaDir = new File(serverOutputDir.getAbsolutePath(), "workarea"); if (workareaDir.exists()) { cleanDir(workareaDir); log(MessageFormat.format(messages.getString("info.element.cleaned"), "workarea")); } else { log(MessageFormat.format(messages.getString("info.directory.noexist"), workareaDir.getAbsolutePath())); } } }
public class class_name { private void cleanWorkArea() { File workareaDir = new File(serverOutputDir.getAbsolutePath(), "workarea"); if (workareaDir.exists()) { cleanDir(workareaDir); // depends on control dependency: [if], data = [none] log(MessageFormat.format(messages.getString("info.element.cleaned"), "workarea")); // depends on control dependency: [if], data = [none] } else { log(MessageFormat.format(messages.getString("info.directory.noexist"), workareaDir.getAbsolutePath())); // depends on control dependency: [if], data = [none] } } }
public class class_name { public EClass getIfcBuildingStorey() { if (ifcBuildingStoreyEClass == null) { ifcBuildingStoreyEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(61); } return ifcBuildingStoreyEClass; } }
public class class_name { public EClass getIfcBuildingStorey() { if (ifcBuildingStoreyEClass == null) { ifcBuildingStoreyEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(61); // depends on control dependency: [if], data = [none] } return ifcBuildingStoreyEClass; } }
public class class_name { private boolean updateMinMaxValues() { double min_x_value_new; double max_x_value_new; double max_y_value_new; if (this.measures == null) { // no values received yet -> reset axes min_x_value_new = 0; max_x_value_new = 1; max_y_value_new = 1; } else { min_x_value_new = getMinXValue(); max_x_value_new = getMaxXValue(); max_y_value_new = getMaxSelectedValue(); } // resizing needed? if (min_x_value_new != this.min_x_value || max_x_value_new != this.max_x_value || max_y_value_new != this.max_y_value) { this.min_x_value = min_x_value_new; this.max_x_value = max_x_value_new; this.max_y_value = max_y_value_new; updateMinXValue(); updateMaxXValue(); updateMaxYValue(); updateLowerXValue(); updateUpperXValue(); updateUpperYValue(); return true; } return false; } }
public class class_name { private boolean updateMinMaxValues() { double min_x_value_new; double max_x_value_new; double max_y_value_new; if (this.measures == null) { // no values received yet -> reset axes min_x_value_new = 0; // depends on control dependency: [if], data = [none] max_x_value_new = 1; // depends on control dependency: [if], data = [none] max_y_value_new = 1; // depends on control dependency: [if], data = [none] } else { min_x_value_new = getMinXValue(); // depends on control dependency: [if], data = [none] max_x_value_new = getMaxXValue(); // depends on control dependency: [if], data = [none] max_y_value_new = getMaxSelectedValue(); // depends on control dependency: [if], data = [none] } // resizing needed? if (min_x_value_new != this.min_x_value || max_x_value_new != this.max_x_value || max_y_value_new != this.max_y_value) { this.min_x_value = min_x_value_new; // depends on control dependency: [if], data = [this.min_x_value] this.max_x_value = max_x_value_new; // depends on control dependency: [if], data = [none] this.max_y_value = max_y_value_new; // depends on control dependency: [if], data = [none] updateMinXValue(); // depends on control dependency: [if], data = [none] updateMaxXValue(); // depends on control dependency: [if], data = [none] updateMaxYValue(); // depends on control dependency: [if], data = [none] updateLowerXValue(); // depends on control dependency: [if], data = [none] updateUpperXValue(); // depends on control dependency: [if], data = [none] updateUpperYValue(); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { private boolean isRecursive(HttpRequestHeader header) { try { if (header.getHostPort() == inSocket.getLocalPort()) { String targetDomain = header.getHostName(); if (API.API_DOMAIN.equals(targetDomain)) { return true; } if (isProxyAddress(InetAddress.getByName(targetDomain))) { return true; } } } catch (Exception e) { // ZAP: Log exceptions log.warn(e.getMessage(), e); } return false; } }
public class class_name { private boolean isRecursive(HttpRequestHeader header) { try { if (header.getHostPort() == inSocket.getLocalPort()) { String targetDomain = header.getHostName(); if (API.API_DOMAIN.equals(targetDomain)) { return true; // depends on control dependency: [if], data = [none] } if (isProxyAddress(InetAddress.getByName(targetDomain))) { return true; // depends on control dependency: [if], data = [none] } } } catch (Exception e) { // ZAP: Log exceptions log.warn(e.getMessage(), e); } // depends on control dependency: [catch], data = [none] return false; } }
public class class_name { public String toMinimizedJsonString() { try { final Map<String, Object> json = new LinkedHashMap<>(); json.put("alert", this.message.getAlert()); if (this.getMessage().getBadge()>0) { json.put("badge", Integer.toString(this.getMessage().getBadge())); } json.put("config", this.config); // we strip down the criteria too, as alias/category can be quite long, based on use-case final Map<String, Object> shrinkedCriteriaJSON = new LinkedHashMap<>(); shrinkedCriteriaJSON.put("variants", this.criteria.getVariants()); shrinkedCriteriaJSON.put("deviceType", this.criteria.getDeviceTypes()); json.put("criteria", shrinkedCriteriaJSON); return OBJECT_MAPPER.writeValueAsString(json); } catch (JsonProcessingException e) { return "[\"invalid json\"]"; } catch (IOException e) { return "[\"invalid json\"]"; } } }
public class class_name { public String toMinimizedJsonString() { try { final Map<String, Object> json = new LinkedHashMap<>(); json.put("alert", this.message.getAlert()); // depends on control dependency: [try], data = [none] if (this.getMessage().getBadge()>0) { json.put("badge", Integer.toString(this.getMessage().getBadge())); // depends on control dependency: [if], data = [(this.getMessage().getBadge()] } json.put("config", this.config); // depends on control dependency: [try], data = [none] // we strip down the criteria too, as alias/category can be quite long, based on use-case final Map<String, Object> shrinkedCriteriaJSON = new LinkedHashMap<>(); shrinkedCriteriaJSON.put("variants", this.criteria.getVariants()); // depends on control dependency: [try], data = [none] shrinkedCriteriaJSON.put("deviceType", this.criteria.getDeviceTypes()); // depends on control dependency: [try], data = [none] json.put("criteria", shrinkedCriteriaJSON); // depends on control dependency: [try], data = [none] return OBJECT_MAPPER.writeValueAsString(json); // depends on control dependency: [try], data = [none] } catch (JsonProcessingException e) { return "[\"invalid json\"]"; } catch (IOException e) { // depends on control dependency: [catch], data = [none] return "[\"invalid json\"]"; } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public CommerceNotificationTemplate remove(Serializable primaryKey) throws NoSuchNotificationTemplateException { Session session = null; try { session = openSession(); CommerceNotificationTemplate commerceNotificationTemplate = (CommerceNotificationTemplate)session.get(CommerceNotificationTemplateImpl.class, primaryKey); if (commerceNotificationTemplate == null) { if (_log.isDebugEnabled()) { _log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } throw new NoSuchNotificationTemplateException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } return remove(commerceNotificationTemplate); } catch (NoSuchNotificationTemplateException nsee) { throw nsee; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } }
public class class_name { @Override public CommerceNotificationTemplate remove(Serializable primaryKey) throws NoSuchNotificationTemplateException { Session session = null; try { session = openSession(); CommerceNotificationTemplate commerceNotificationTemplate = (CommerceNotificationTemplate)session.get(CommerceNotificationTemplateImpl.class, primaryKey); if (commerceNotificationTemplate == null) { if (_log.isDebugEnabled()) { _log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); // depends on control dependency: [if], data = [none] } throw new NoSuchNotificationTemplateException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } return remove(commerceNotificationTemplate); } catch (NoSuchNotificationTemplateException nsee) { throw nsee; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } }
public class class_name { private static Method getMethod(String methodName, Class<?> clazz, Class<?>... args) { Method method; try { method = clazz.getMethod(methodName, args); } catch (NoSuchMethodException e1) { method = null; } return method; } }
public class class_name { private static Method getMethod(String methodName, Class<?> clazz, Class<?>... args) { Method method; try { method = clazz.getMethod(methodName, args); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException e1) { method = null; } // depends on control dependency: [catch], data = [none] return method; } }
public class class_name { private Object convertStrToObjTree(String s) { Object contentObj = null; if (s != null) { s = s.trim(); try { if (s.startsWith("{")) { contentObj = Config.getInstance().getMapper().readValue(s, new TypeReference<HashMap<String, Object>>() { }); } else if (s.startsWith("[")) { contentObj = Config.getInstance().getMapper().readValue(s, new TypeReference<List<Object>>() { }); } else { logger.error("cannot deserialize json str: {}", s); return null; } } catch (IOException e) { logger.error(e.getMessage()); } } return contentObj; } }
public class class_name { private Object convertStrToObjTree(String s) { Object contentObj = null; if (s != null) { s = s.trim(); // depends on control dependency: [if], data = [none] try { if (s.startsWith("{")) { contentObj = Config.getInstance().getMapper().readValue(s, new TypeReference<HashMap<String, Object>>() { }); // depends on control dependency: [if], data = [none] } else if (s.startsWith("[")) { contentObj = Config.getInstance().getMapper().readValue(s, new TypeReference<List<Object>>() { }); // depends on control dependency: [if], data = [none] } else { logger.error("cannot deserialize json str: {}", s); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } } catch (IOException e) { logger.error(e.getMessage()); } // depends on control dependency: [catch], data = [none] } return contentObj; } }
public class class_name { public static Point2D_F64 transform( Affine2D_F64 se, Point2D_F64 orig, Point2D_F64 result ) { if( result == null ) { result = new Point2D_F64(); } // copy the values so that no errors happen if orig and result are the same instance double x = orig.x; double y = orig.y; result.x = se.tx + se.a11 * x + se.a12 * y; result.y = se.ty + se.a21 * x + se.a22 * y; return result; } }
public class class_name { public static Point2D_F64 transform( Affine2D_F64 se, Point2D_F64 orig, Point2D_F64 result ) { if( result == null ) { result = new Point2D_F64(); // depends on control dependency: [if], data = [none] } // copy the values so that no errors happen if orig and result are the same instance double x = orig.x; double y = orig.y; result.x = se.tx + se.a11 * x + se.a12 * y; result.y = se.ty + se.a21 * x + se.a22 * y; return result; } }
public class class_name { public static Function<DeploymentUnit, Boolean> abortUnitActiveProcessInstances(final RuntimeDataService runtimeDataService, final DeploymentService deploymentService) { return unit -> { Collection<ProcessInstanceDesc> activeProcesses = runtimeDataService.getProcessInstancesByDeploymentId(unit.getIdentifier(), activeProcessInstancessStates, new QueryContext(0, -1)); DeployedUnit deployedUnit = deploymentService.getDeployedUnit(unit.getIdentifier()); if (deployedUnit == null) { throw new IllegalStateException("Undeploy forbidden - No deployments available for " + unit.getIdentifier()); } for (ProcessInstanceDesc instanceDesc : activeProcesses) { RuntimeManager manager = deployedUnit.getRuntimeManager(); RuntimeEngine engine = manager.getRuntimeEngine(ProcessInstanceIdContext.get(instanceDesc.getId())); try { KieSession ksession = engine.getKieSession(); ksession.abortProcessInstance(instanceDesc.getId()); } catch (Exception e) { logger.error("Undeploy forbidden - Error aborting process instances for deployment unit {} due to: {}", unit.getIdentifier(), e.getMessage()); return false; } finally { manager.disposeRuntimeEngine(engine); } } return true; }; } }
public class class_name { public static Function<DeploymentUnit, Boolean> abortUnitActiveProcessInstances(final RuntimeDataService runtimeDataService, final DeploymentService deploymentService) { return unit -> { Collection<ProcessInstanceDesc> activeProcesses = runtimeDataService.getProcessInstancesByDeploymentId(unit.getIdentifier(), activeProcessInstancessStates, new QueryContext(0, -1)); DeployedUnit deployedUnit = deploymentService.getDeployedUnit(unit.getIdentifier()); if (deployedUnit == null) { throw new IllegalStateException("Undeploy forbidden - No deployments available for " + unit.getIdentifier()); } for (ProcessInstanceDesc instanceDesc : activeProcesses) { RuntimeManager manager = deployedUnit.getRuntimeManager(); RuntimeEngine engine = manager.getRuntimeEngine(ProcessInstanceIdContext.get(instanceDesc.getId())); try { KieSession ksession = engine.getKieSession(); ksession.abortProcessInstance(instanceDesc.getId()); // depends on control dependency: [try], data = [none] } catch (Exception e) { logger.error("Undeploy forbidden - Error aborting process instances for deployment unit {} due to: {}", unit.getIdentifier(), e.getMessage()); return false; } finally { // depends on control dependency: [catch], data = [none] manager.disposeRuntimeEngine(engine); } } return true; }; } }
public class class_name { @Override public Configuration getDefault() { return new Configuration() { @Override public HttpClient httpClient() { try { SchemeRegistry schemeRegistry = new SchemeRegistry(); schemeRegistry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory())); schemeRegistry.register(new Scheme("https", 443, SSLSocketFactory.getSocketFactory())); PoolingClientConnectionManager pccm = new PoolingClientConnectionManager(schemeRegistry); pccm.setMaxTotal(200); pccm.setDefaultMaxPerRoute(20); return new DefaultHttpClient(pccm); } catch(Exception e) { throw new ConfigurationFailedException(e); } } }; } }
public class class_name { @Override public Configuration getDefault() { return new Configuration() { @Override public HttpClient httpClient() { try { SchemeRegistry schemeRegistry = new SchemeRegistry(); schemeRegistry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory())); // depends on control dependency: [try], data = [none] schemeRegistry.register(new Scheme("https", 443, SSLSocketFactory.getSocketFactory())); // depends on control dependency: [try], data = [none] PoolingClientConnectionManager pccm = new PoolingClientConnectionManager(schemeRegistry); pccm.setMaxTotal(200); // depends on control dependency: [try], data = [none] pccm.setDefaultMaxPerRoute(20); // depends on control dependency: [try], data = [none] return new DefaultHttpClient(pccm); // depends on control dependency: [try], data = [none] } catch(Exception e) { throw new ConfigurationFailedException(e); } // depends on control dependency: [catch], data = [none] } }; } }
public class class_name { @Nonnull public static String encodeFromFile (@Nonnull final String filename) throws IOException { // Setup some useful variables final File file = new File (filename); // Open a stream try (final Base64InputStream bis = new Base64InputStream (FileHelper.getBufferedInputStream (file), ENCODE)) { // Need max() for math on small files (v2.2.1); // Need +1 for a few corner cases (v2.3.5) final byte [] aBuffer = new byte [Math.max ((int) (file.length () * 1.4 + 1), 40)]; int nLength = 0; int nBytes; // Read until done while ((nBytes = bis.read (aBuffer, nLength, 4096)) >= 0) { nLength += nBytes; } // Save in a variable to return return new String (aBuffer, 0, nLength, PREFERRED_ENCODING); } } }
public class class_name { @Nonnull public static String encodeFromFile (@Nonnull final String filename) throws IOException { // Setup some useful variables final File file = new File (filename); // Open a stream try (final Base64InputStream bis = new Base64InputStream (FileHelper.getBufferedInputStream (file), ENCODE)) { // Need max() for math on small files (v2.2.1); // Need +1 for a few corner cases (v2.3.5) final byte [] aBuffer = new byte [Math.max ((int) (file.length () * 1.4 + 1), 40)]; int nLength = 0; int nBytes; // Read until done while ((nBytes = bis.read (aBuffer, nLength, 4096)) >= 0) { nLength += nBytes; // depends on control dependency: [while], data = [none] } // Save in a variable to return return new String (aBuffer, 0, nLength, PREFERRED_ENCODING); } } }
public class class_name { public void marshall(MailFromAttributes mailFromAttributes, ProtocolMarshaller protocolMarshaller) { if (mailFromAttributes == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(mailFromAttributes.getMailFromDomain(), MAILFROMDOMAIN_BINDING); protocolMarshaller.marshall(mailFromAttributes.getMailFromDomainStatus(), MAILFROMDOMAINSTATUS_BINDING); protocolMarshaller.marshall(mailFromAttributes.getBehaviorOnMxFailure(), BEHAVIORONMXFAILURE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(MailFromAttributes mailFromAttributes, ProtocolMarshaller protocolMarshaller) { if (mailFromAttributes == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(mailFromAttributes.getMailFromDomain(), MAILFROMDOMAIN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(mailFromAttributes.getMailFromDomainStatus(), MAILFROMDOMAINSTATUS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(mailFromAttributes.getBehaviorOnMxFailure(), BEHAVIORONMXFAILURE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public final void mStringLiteral() throws RecognitionException { try { int _type = StringLiteral; int _channel = DEFAULT_TOKEN_CHANNEL; // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1347:5: ( '\"' ( EscapeSequence |~ ( '\\\\' | '\"' ) )* '\"' ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1347:8: '\"' ( EscapeSequence |~ ( '\\\\' | '\"' ) )* '\"' { match('\"'); // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1347:12: ( EscapeSequence |~ ( '\\\\' | '\"' ) )* loop23: while (true) { int alt23=3; int LA23_0 = input.LA(1); if ( (LA23_0=='\\') ) { alt23=1; } else if ( ((LA23_0 >= '\u0000' && LA23_0 <= '!')||(LA23_0 >= '#' && LA23_0 <= '[')||(LA23_0 >= ']' && LA23_0 <= '\uFFFF')) ) { alt23=2; } switch (alt23) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1347:14: EscapeSequence { mEscapeSequence(); } break; case 2 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1347:31: ~ ( '\\\\' | '\"' ) { if ( (input.LA(1) >= '\u0000' && input.LA(1) <= '!')||(input.LA(1) >= '#' && input.LA(1) <= '[')||(input.LA(1) >= ']' && input.LA(1) <= '\uFFFF') ) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); throw mse; } } break; default : break loop23; } } match('\"'); } state.type = _type; state.channel = _channel; } finally { // do for sure before leaving } } }
public class class_name { public final void mStringLiteral() throws RecognitionException { try { int _type = StringLiteral; int _channel = DEFAULT_TOKEN_CHANNEL; // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1347:5: ( '\"' ( EscapeSequence |~ ( '\\\\' | '\"' ) )* '\"' ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1347:8: '\"' ( EscapeSequence |~ ( '\\\\' | '\"' ) )* '\"' { match('\"'); // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1347:12: ( EscapeSequence |~ ( '\\\\' | '\"' ) )* loop23: while (true) { int alt23=3; int LA23_0 = input.LA(1); if ( (LA23_0=='\\') ) { alt23=1; // depends on control dependency: [if], data = [none] } else if ( ((LA23_0 >= '\u0000' && LA23_0 <= '!')||(LA23_0 >= '#' && LA23_0 <= '[')||(LA23_0 >= ']' && LA23_0 <= '\uFFFF')) ) { alt23=2; // depends on control dependency: [if], data = [none] } switch (alt23) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1347:14: EscapeSequence { mEscapeSequence(); } break; case 2 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1347:31: ~ ( '\\\\' | '\"' ) { if ( (input.LA(1) >= '\u0000' && input.LA(1) <= '!')||(input.LA(1) >= '#' && input.LA(1) <= '[')||(input.LA(1) >= ']' && input.LA(1) <= '\uFFFF') ) { input.consume(); // depends on control dependency: [if], data = [none] } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); // depends on control dependency: [if], data = [none] throw mse; } } break; default : break loop23; } } match('\"'); } state.type = _type; state.channel = _channel; } finally { // do for sure before leaving } } }
public class class_name { public SMethod findMethod(String methodName) { for (SService sService : servicesByName.values()) { SMethod method = sService.getSMethod(methodName); if (method != null) { return method; } } return null; } }
public class class_name { public SMethod findMethod(String methodName) { for (SService sService : servicesByName.values()) { SMethod method = sService.getSMethod(methodName); if (method != null) { return method; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { protected void init(DMatrixRMaj A ) { UBV = A; m = UBV.numRows; n = UBV.numCols; min = Math.min(m,n); int max = Math.max(m,n); if( b.length < max+1 ) { b = new double[ max+1 ]; u = new double[ max+1 ]; } if( gammasU.length < m ) { gammasU = new double[ m ]; } if( gammasV.length < n ) { gammasV = new double[ n ]; } } }
public class class_name { protected void init(DMatrixRMaj A ) { UBV = A; m = UBV.numRows; n = UBV.numCols; min = Math.min(m,n); int max = Math.max(m,n); if( b.length < max+1 ) { b = new double[ max+1 ]; // depends on control dependency: [if], data = [none] u = new double[ max+1 ]; // depends on control dependency: [if], data = [none] } if( gammasU.length < m ) { gammasU = new double[ m ]; // depends on control dependency: [if], data = [none] } if( gammasV.length < n ) { gammasV = new double[ n ]; // depends on control dependency: [if], data = [none] } } }
public class class_name { @SuppressWarnings ( value = {"fallthrough"} ) static public Map<FieldName, ?> evaluate(Map<FieldName, ?> predictions, ModelEvaluationContext context){ ModelEvaluator<?> modelEvaluator = context.getModelEvaluator(); Model model = modelEvaluator.getModel(); Output output = model.getOutput(); if(output == null || !output.hasOutputFields()){ return predictions; } OutputMap result = new OutputMap(predictions); List<OutputField> outputFields = output.getOutputFields(); Predicate<OutputField> outputFilter = modelEvaluator.ensureOutputFilter(); outputFields: for(OutputField outputField : outputFields){ FieldName targetName = outputField.getTargetField(); Object targetValue = null; ResultFeature resultFeature = outputField.getResultFeature(); String segmentId = outputField.getSegmentId(); SegmentResult segmentPredictions = null; // Load the target value of the specified segment if(segmentId != null){ if(!(model instanceof MiningModel)){ throw new InvalidAttributeException(outputField, PMMLAttributes.OUTPUTFIELD_SEGMENTID, segmentId); } MiningModelEvaluationContext miningModelContext = (MiningModelEvaluationContext)context; segmentPredictions = miningModelContext.getResult(segmentId); // "If there is no Segment matching segmentId or if the predicate of the matching Segment evaluated to false, then the result delivered by this OutputField is missing" if(segmentPredictions == null){ continue outputFields; } // End if if(targetName != null){ if(!segmentPredictions.containsKey(targetName)){ throw new MissingValueException(targetName, outputField); } targetValue = segmentPredictions.get(targetName); } else { targetValue = segmentPredictions.getTargetValue(); } } else // Load the target value { switch(resultFeature){ case ENTITY_ID: { // "Result feature entityId returns the id of the winning segment" if(model instanceof MiningModel){ targetValue = TypeUtil.cast(HasEntityId.class, predictions); break; } } // Falls through default: { if(targetName == null){ targetName = modelEvaluator.getTargetName(); } // End if if(!predictions.containsKey(targetName)){ throw new MissingValueException(targetName, outputField); } targetValue = predictions.get(targetName); } break; } } // "If the target value is missing, then the result delivered by this OutputField is missing" if(targetValue == null){ continue outputFields; } Object value; // Perform the requested computation on the target value switch(resultFeature){ case PREDICTED_VALUE: { value = getPredictedValue(targetValue); } break; case PREDICTED_DISPLAY_VALUE: { if(segmentId != null){ throw new UnsupportedElementException(outputField); } TargetField targetField = modelEvaluator.findTargetField(targetName); if(targetField == null){ throw new MissingFieldException(targetName, outputField); } value = getPredictedDisplayValue(targetValue, targetField); } break; case TRANSFORMED_VALUE: case DECISION: { if(segmentId != null){ Object name = outputField.getValue(); if(name == null){ throw new MissingAttributeException(outputField, PMMLAttributes.OUTPUTFIELD_VALUE); } name = TypeUtil.format(name); Expression expression = outputField.getExpression(); if(expression != null){ throw new MisplacedElementException(expression); } value = segmentPredictions.get(FieldName.create((String)name)); break; } value = FieldValueUtil.getValue(ExpressionUtil.evaluateExpressionContainer(outputField, context)); } break; case PROBABILITY: { value = getProbability(targetValue, outputField); } break; case CONFIDENCE: { if(targetValue instanceof HasRuleValues){ value = getRuleValue(targetValue, outputField, OutputField.RuleFeature.CONFIDENCE); break; } value = getConfidence(targetValue, outputField); } break; case RESIDUAL: { if(segmentId != null){ throw new UnsupportedElementException(outputField); } FieldValue expectedTargetValue = context.evaluate(targetName); if(FieldValueUtil.isMissing(expectedTargetValue)){ throw new MissingValueException(targetName, outputField); } TargetField targetField = modelEvaluator.findTargetField(targetName); if(targetField == null){ throw new MissingFieldException(targetName, outputField); } OpType opType = targetField.getOpType(); switch(opType){ case CONTINUOUS: value = getContinuousResidual(targetValue, expectedTargetValue); break; case CATEGORICAL: case ORDINAL: value = getDiscreteResidual(targetValue, expectedTargetValue); break; default: throw new InvalidElementException(outputField); } } break; case CLUSTER_ID: { value = getClusterId(targetValue); } break; case ENTITY_ID: { if(targetValue instanceof HasRuleValues){ value = getRuleValue(targetValue, outputField, OutputField.RuleFeature.RULE_ID); break; } value = getEntityId(targetValue, outputField); } break; case AFFINITY: { value = getAffinity(targetValue, outputField); } break; case CLUSTER_AFFINITY: case ENTITY_AFFINITY: { Object entityId = outputField.getValue(); // Select the specified entity instead of the winning entity if(entityId != null){ value = getAffinity(targetValue, outputField); break; } value = getEntityAffinity(targetValue); } break; case REASON_CODE: { value = getReasonCode(targetValue, outputField); } break; case RULE_VALUE: { value = getRuleValue(targetValue, outputField); } break; case ANTECEDENT: { value = getRuleValue(targetValue, outputField, OutputField.RuleFeature.ANTECEDENT); } break; case CONSEQUENT: { value = getRuleValue(targetValue, outputField, OutputField.RuleFeature.CONSEQUENT); } break; case RULE: { value = getRuleValue(targetValue, outputField, OutputField.RuleFeature.RULE); } break; case RULE_ID: { value = getRuleValue(targetValue, outputField, OutputField.RuleFeature.RULE_ID); } break; case SUPPORT: { value = getRuleValue(targetValue, outputField, OutputField.RuleFeature.SUPPORT); } break; case LIFT: { value = getRuleValue(targetValue, outputField, OutputField.RuleFeature.LIFT); } break; case LEVERAGE: { value = getRuleValue(targetValue, outputField, OutputField.RuleFeature.LEVERAGE); } break; case REPORT: { FieldName reportName = outputField.getReportField(); if(reportName == null){ throw new MissingAttributeException(outputField, PMMLAttributes.OUTPUTFIELD_REPORTFIELD); } OutputField reportOutputField = modelEvaluator.getOutputField(reportName); if(reportOutputField == null){ throw new MissingFieldException(reportName); } value = getReport(targetValue, reportOutputField); } break; case WARNING: { value = context.getWarnings(); } break; default: throw new UnsupportedAttributeException(outputField, resultFeature); } FieldName outputName = outputField.getName(); if(outputName == null){ throw new MissingAttributeException(outputField, PMMLAttributes.OUTPUTFIELD_NAME); } TypeInfo typeInfo = new TypeInfo(){ @Override public DataType getDataType(){ DataType dataType = outputField.getDataType(); if(dataType == null){ if(value instanceof Collection){ Collection<?> values = (Collection<?>)value; dataType = TypeUtil.getDataType(values); } else { dataType = TypeUtil.getDataType(value); } } return dataType; } @Override public OpType getOpType(){ OpType opType = outputField.getOpType(); if(opType == null){ DataType dataType = getDataType(); opType = TypeUtil.getOpType(dataType); } return opType; } @Override public List<?> getOrdering(){ List<?> ordering = FieldUtil.getValidValues(outputField); return ordering; } }; FieldValue outputValue = FieldValueUtil.create(typeInfo, value); // The result of one output field becomes available to other output fields context.declare(outputName, outputValue); if(outputFilter.test(outputField)){ result.putPublic(outputName, FieldValueUtil.getValue(outputValue)); } else { result.putPrivate(outputName, FieldValueUtil.getValue(outputValue)); } } return result; } }
public class class_name { @SuppressWarnings ( value = {"fallthrough"} ) static public Map<FieldName, ?> evaluate(Map<FieldName, ?> predictions, ModelEvaluationContext context){ ModelEvaluator<?> modelEvaluator = context.getModelEvaluator(); Model model = modelEvaluator.getModel(); Output output = model.getOutput(); if(output == null || !output.hasOutputFields()){ return predictions; // depends on control dependency: [if], data = [none] } OutputMap result = new OutputMap(predictions); List<OutputField> outputFields = output.getOutputFields(); Predicate<OutputField> outputFilter = modelEvaluator.ensureOutputFilter(); outputFields: for(OutputField outputField : outputFields){ FieldName targetName = outputField.getTargetField(); Object targetValue = null; ResultFeature resultFeature = outputField.getResultFeature(); String segmentId = outputField.getSegmentId(); SegmentResult segmentPredictions = null; // Load the target value of the specified segment if(segmentId != null){ if(!(model instanceof MiningModel)){ throw new InvalidAttributeException(outputField, PMMLAttributes.OUTPUTFIELD_SEGMENTID, segmentId); } MiningModelEvaluationContext miningModelContext = (MiningModelEvaluationContext)context; segmentPredictions = miningModelContext.getResult(segmentId); // depends on control dependency: [if], data = [(segmentId] // "If there is no Segment matching segmentId or if the predicate of the matching Segment evaluated to false, then the result delivered by this OutputField is missing" if(segmentPredictions == null){ continue outputFields; } // End if if(targetName != null){ if(!segmentPredictions.containsKey(targetName)){ throw new MissingValueException(targetName, outputField); } targetValue = segmentPredictions.get(targetName); // depends on control dependency: [if], data = [(targetName] } else { targetValue = segmentPredictions.getTargetValue(); // depends on control dependency: [if], data = [none] } } else // Load the target value { switch(resultFeature){ case ENTITY_ID: { // "Result feature entityId returns the id of the winning segment" if(model instanceof MiningModel){ targetValue = TypeUtil.cast(HasEntityId.class, predictions); // depends on control dependency: [if], data = [none] break; } } // Falls through default: { if(targetName == null){ targetName = modelEvaluator.getTargetName(); // depends on control dependency: [if], data = [none] } // End if if(!predictions.containsKey(targetName)){ throw new MissingValueException(targetName, outputField); } targetValue = predictions.get(targetName); } break; } } // "If the target value is missing, then the result delivered by this OutputField is missing" if(targetValue == null){ continue outputFields; } Object value; // Perform the requested computation on the target value switch(resultFeature){ case PREDICTED_VALUE: { value = getPredictedValue(targetValue); } break; case PREDICTED_DISPLAY_VALUE: { if(segmentId != null){ throw new UnsupportedElementException(outputField); } TargetField targetField = modelEvaluator.findTargetField(targetName); if(targetField == null){ throw new MissingFieldException(targetName, outputField); } value = getPredictedDisplayValue(targetValue, targetField); } break; case TRANSFORMED_VALUE: case DECISION: { if(segmentId != null){ Object name = outputField.getValue(); if(name == null){ throw new MissingAttributeException(outputField, PMMLAttributes.OUTPUTFIELD_VALUE); } name = TypeUtil.format(name); Expression expression = outputField.getExpression(); if(expression != null){ throw new MisplacedElementException(expression); } value = segmentPredictions.get(FieldName.create((String)name)); break; } value = FieldValueUtil.getValue(ExpressionUtil.evaluateExpressionContainer(outputField, context)); } break; case PROBABILITY: { value = getProbability(targetValue, outputField); } break; case CONFIDENCE: { if(targetValue instanceof HasRuleValues){ value = getRuleValue(targetValue, outputField, OutputField.RuleFeature.CONFIDENCE); break; } value = getConfidence(targetValue, outputField); } break; case RESIDUAL: { if(segmentId != null){ throw new UnsupportedElementException(outputField); } FieldValue expectedTargetValue = context.evaluate(targetName); if(FieldValueUtil.isMissing(expectedTargetValue)){ throw new MissingValueException(targetName, outputField); } TargetField targetField = modelEvaluator.findTargetField(targetName); if(targetField == null){ throw new MissingFieldException(targetName, outputField); } OpType opType = targetField.getOpType(); switch(opType){ case CONTINUOUS: value = getContinuousResidual(targetValue, expectedTargetValue); break; case CATEGORICAL: case ORDINAL: value = getDiscreteResidual(targetValue, expectedTargetValue); break; default: throw new InvalidElementException(outputField); } } break; case CLUSTER_ID: { value = getClusterId(targetValue); } break; case ENTITY_ID: { if(targetValue instanceof HasRuleValues){ value = getRuleValue(targetValue, outputField, OutputField.RuleFeature.RULE_ID); break; } value = getEntityId(targetValue, outputField); } break; case AFFINITY: { value = getAffinity(targetValue, outputField); } break; case CLUSTER_AFFINITY: case ENTITY_AFFINITY: { Object entityId = outputField.getValue(); // Select the specified entity instead of the winning entity if(entityId != null){ value = getAffinity(targetValue, outputField); break; } value = getEntityAffinity(targetValue); } break; case REASON_CODE: { value = getReasonCode(targetValue, outputField); } break; case RULE_VALUE: { value = getRuleValue(targetValue, outputField); } break; case ANTECEDENT: { value = getRuleValue(targetValue, outputField, OutputField.RuleFeature.ANTECEDENT); } break; case CONSEQUENT: { value = getRuleValue(targetValue, outputField, OutputField.RuleFeature.CONSEQUENT); } break; case RULE: { value = getRuleValue(targetValue, outputField, OutputField.RuleFeature.RULE); } break; case RULE_ID: { value = getRuleValue(targetValue, outputField, OutputField.RuleFeature.RULE_ID); } break; case SUPPORT: { value = getRuleValue(targetValue, outputField, OutputField.RuleFeature.SUPPORT); } break; case LIFT: { value = getRuleValue(targetValue, outputField, OutputField.RuleFeature.LIFT); } break; case LEVERAGE: { value = getRuleValue(targetValue, outputField, OutputField.RuleFeature.LEVERAGE); } break; case REPORT: { FieldName reportName = outputField.getReportField(); if(reportName == null){ throw new MissingAttributeException(outputField, PMMLAttributes.OUTPUTFIELD_REPORTFIELD); } OutputField reportOutputField = modelEvaluator.getOutputField(reportName); if(reportOutputField == null){ throw new MissingFieldException(reportName); } value = getReport(targetValue, reportOutputField); } break; case WARNING: { value = context.getWarnings(); } break; default: throw new UnsupportedAttributeException(outputField, resultFeature); } FieldName outputName = outputField.getName(); if(outputName == null){ throw new MissingAttributeException(outputField, PMMLAttributes.OUTPUTFIELD_NAME); } TypeInfo typeInfo = new TypeInfo(){ @Override public DataType getDataType(){ DataType dataType = outputField.getDataType(); if(dataType == null){ if(value instanceof Collection){ Collection<?> values = (Collection<?>)value; dataType = TypeUtil.getDataType(values); } else { dataType = TypeUtil.getDataType(value); } } return dataType; } @Override public OpType getOpType(){ OpType opType = outputField.getOpType(); if(opType == null){ DataType dataType = getDataType(); opType = TypeUtil.getOpType(dataType); } return opType; } @Override public List<?> getOrdering(){ List<?> ordering = FieldUtil.getValidValues(outputField); return ordering; } }; FieldValue outputValue = FieldValueUtil.create(typeInfo, value); // The result of one output field becomes available to other output fields context.declare(outputName, outputValue); if(outputFilter.test(outputField)){ result.putPublic(outputName, FieldValueUtil.getValue(outputValue)); } else { result.putPrivate(outputName, FieldValueUtil.getValue(outputValue)); } } return result; } }
public class class_name { public synchronized void updateStorageInfo() { Map<String, Long> tierCapacities = mBlockWorker.getStoreMeta().getCapacityBytesOnTiers(); long lastTierReservedBytes = 0; for (int ordinal = 0; ordinal < mStorageTierAssoc.size(); ordinal++) { String tierAlias = mStorageTierAssoc.getAlias(ordinal); long tierCapacity = tierCapacities.get(tierAlias); long reservedSpace; PropertyKey tierReservedSpaceProp = PropertyKey.Template.WORKER_TIERED_STORE_LEVEL_RESERVED_RATIO.format(ordinal); if (ServerConfiguration.isSet(tierReservedSpaceProp)) { LOG.warn("The property reserved.ratio is deprecated, use high/low watermark instead."); reservedSpace = (long) (tierCapacity * ServerConfiguration .getDouble(tierReservedSpaceProp)); } else { // High watermark defines when to start the space reserving process PropertyKey tierHighWatermarkProp = PropertyKey.Template.WORKER_TIERED_STORE_LEVEL_HIGH_WATERMARK_RATIO.format(ordinal); double tierHighWatermarkConf = ServerConfiguration.getDouble(tierHighWatermarkProp); Preconditions.checkArgument(tierHighWatermarkConf > 0, "The high watermark of tier %s should be positive, but is %s", Integer.toString(ordinal), tierHighWatermarkConf); Preconditions.checkArgument(tierHighWatermarkConf < 1, "The high watermark of tier %s should be less than 1.0, but is %s", Integer.toString(ordinal), tierHighWatermarkConf); long highWatermark = (long) (tierCapacity * ServerConfiguration .getDouble(tierHighWatermarkProp)); mHighWatermarks.put(tierAlias, highWatermark); // Low watermark defines when to stop the space reserving process if started PropertyKey tierLowWatermarkProp = PropertyKey.Template.WORKER_TIERED_STORE_LEVEL_LOW_WATERMARK_RATIO.format(ordinal); double tierLowWatermarkConf = ServerConfiguration.getDouble(tierLowWatermarkProp); Preconditions.checkArgument(tierLowWatermarkConf >= 0, "The low watermark of tier %s should not be negative, but is %s", Integer.toString(ordinal), tierLowWatermarkConf); Preconditions.checkArgument(tierLowWatermarkConf < tierHighWatermarkConf, "The low watermark (%s) of tier %d should not be smaller than the high watermark (%s)", tierLowWatermarkConf, ordinal, tierHighWatermarkConf); reservedSpace = (long) (tierCapacity - tierCapacity * ServerConfiguration .getDouble(tierLowWatermarkProp)); } lastTierReservedBytes += reservedSpace; // On each tier, we reserve no more than its capacity lastTierReservedBytes = (lastTierReservedBytes <= tierCapacity) ? lastTierReservedBytes : tierCapacity; mReservedSpaces.put(tierAlias, lastTierReservedBytes); } } }
public class class_name { public synchronized void updateStorageInfo() { Map<String, Long> tierCapacities = mBlockWorker.getStoreMeta().getCapacityBytesOnTiers(); long lastTierReservedBytes = 0; for (int ordinal = 0; ordinal < mStorageTierAssoc.size(); ordinal++) { String tierAlias = mStorageTierAssoc.getAlias(ordinal); long tierCapacity = tierCapacities.get(tierAlias); long reservedSpace; PropertyKey tierReservedSpaceProp = PropertyKey.Template.WORKER_TIERED_STORE_LEVEL_RESERVED_RATIO.format(ordinal); if (ServerConfiguration.isSet(tierReservedSpaceProp)) { LOG.warn("The property reserved.ratio is deprecated, use high/low watermark instead."); // depends on control dependency: [if], data = [none] reservedSpace = (long) (tierCapacity * ServerConfiguration .getDouble(tierReservedSpaceProp)); // depends on control dependency: [if], data = [none] } else { // High watermark defines when to start the space reserving process PropertyKey tierHighWatermarkProp = PropertyKey.Template.WORKER_TIERED_STORE_LEVEL_HIGH_WATERMARK_RATIO.format(ordinal); double tierHighWatermarkConf = ServerConfiguration.getDouble(tierHighWatermarkProp); Preconditions.checkArgument(tierHighWatermarkConf > 0, "The high watermark of tier %s should be positive, but is %s", Integer.toString(ordinal), tierHighWatermarkConf); // depends on control dependency: [if], data = [none] Preconditions.checkArgument(tierHighWatermarkConf < 1, "The high watermark of tier %s should be less than 1.0, but is %s", Integer.toString(ordinal), tierHighWatermarkConf); // depends on control dependency: [if], data = [none] long highWatermark = (long) (tierCapacity * ServerConfiguration .getDouble(tierHighWatermarkProp)); mHighWatermarks.put(tierAlias, highWatermark); // depends on control dependency: [if], data = [none] // Low watermark defines when to stop the space reserving process if started PropertyKey tierLowWatermarkProp = PropertyKey.Template.WORKER_TIERED_STORE_LEVEL_LOW_WATERMARK_RATIO.format(ordinal); double tierLowWatermarkConf = ServerConfiguration.getDouble(tierLowWatermarkProp); Preconditions.checkArgument(tierLowWatermarkConf >= 0, "The low watermark of tier %s should not be negative, but is %s", Integer.toString(ordinal), tierLowWatermarkConf); // depends on control dependency: [if], data = [none] Preconditions.checkArgument(tierLowWatermarkConf < tierHighWatermarkConf, "The low watermark (%s) of tier %d should not be smaller than the high watermark (%s)", tierLowWatermarkConf, ordinal, tierHighWatermarkConf); // depends on control dependency: [if], data = [none] reservedSpace = (long) (tierCapacity - tierCapacity * ServerConfiguration .getDouble(tierLowWatermarkProp)); // depends on control dependency: [if], data = [none] } lastTierReservedBytes += reservedSpace; // depends on control dependency: [for], data = [none] // On each tier, we reserve no more than its capacity lastTierReservedBytes = (lastTierReservedBytes <= tierCapacity) ? lastTierReservedBytes : tierCapacity; // depends on control dependency: [for], data = [none] mReservedSpaces.put(tierAlias, lastTierReservedBytes); // depends on control dependency: [for], data = [none] } } }
public class class_name { private boolean startsWithCustomRoot(String path) { for (Enumeration<String> it = customRoots.elements(); it != null && it.hasMoreElements();) { if (path.startsWith(it.nextElement())) { return true; } } return false; } }
public class class_name { private boolean startsWithCustomRoot(String path) { for (Enumeration<String> it = customRoots.elements(); it != null && it.hasMoreElements();) { if (path.startsWith(it.nextElement())) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { private boolean isCurrentStageCompleted() { if (this.indexToCurrentExecutionStage >= this.stages.size()) { return true; } final ExecutionGraphIterator it = new ExecutionGraphIterator(this, this.indexToCurrentExecutionStage, true, true); while (it.hasNext()) { final ExecutionVertex vertex = it.next(); if (vertex.getExecutionState() != ExecutionState.FINISHED) { return false; } } return true; } }
public class class_name { private boolean isCurrentStageCompleted() { if (this.indexToCurrentExecutionStage >= this.stages.size()) { return true; // depends on control dependency: [if], data = [none] } final ExecutionGraphIterator it = new ExecutionGraphIterator(this, this.indexToCurrentExecutionStage, true, true); while (it.hasNext()) { final ExecutionVertex vertex = it.next(); if (vertex.getExecutionState() != ExecutionState.FINISHED) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { public BreakIterator getBreakIterator(int type) { if (type < BI_CHARACTER || type >= BI_LIMIT) { throw new IllegalArgumentException("Illegal break iterator type"); } if (breakIterators == null || breakIterators[type] == null) { return guessBreakIterator(type); } return (BreakIterator) breakIterators[type].clone(); // clone for safety } }
public class class_name { public BreakIterator getBreakIterator(int type) { if (type < BI_CHARACTER || type >= BI_LIMIT) { throw new IllegalArgumentException("Illegal break iterator type"); } if (breakIterators == null || breakIterators[type] == null) { return guessBreakIterator(type); // depends on control dependency: [if], data = [none] } return (BreakIterator) breakIterators[type].clone(); // clone for safety } }
public class class_name { private void handleException(final Throwable e) { if (e instanceof ServiceException) { final ServiceException se = (ServiceException) e; // Only log with warn level to let the application continue its workflow even in developer mode LOGGER.log(SERVICE_TASK_EXCEPTION, se, se.getExplanation(), getServiceHandlerName()); } else { // In developer mode it will stop the application throwing another exception LOGGER.log(SERVICE_TASK_ERROR, e, getServiceHandlerName()); } this.wave.status(Status.Failed); final Class<? extends Throwable> managedException = e instanceof ServiceException ? e.getCause().getClass() : e.getClass(); // Get the exact exception type final Wave exceptionHandlerWave = this.wave.waveType().waveExceptionHandler().get(managedException); if (exceptionHandlerWave != null) { // Fill the wave with useful data exceptionHandlerWave.fromClass(this.service.getClass()) .add(JRebirthItems.exceptionItem, e) .add(JRebirthItems.waveItem, this.wave) .relatedWave(this.wave); LOGGER.log(SERVICE_TASK_HANDLE_EXCEPTION, e, e.getClass().getSimpleName(), getServiceHandlerName()); // Send the exception wave to interested components this.service.sendWave(exceptionHandlerWave); } else { LOGGER.log(SERVICE_TASK_NOT_MANAGED_EXCEPTION, e, e.getClass().getSimpleName(), getServiceHandlerName()); } } }
public class class_name { private void handleException(final Throwable e) { if (e instanceof ServiceException) { final ServiceException se = (ServiceException) e; // Only log with warn level to let the application continue its workflow even in developer mode LOGGER.log(SERVICE_TASK_EXCEPTION, se, se.getExplanation(), getServiceHandlerName()); // depends on control dependency: [if], data = [none] } else { // In developer mode it will stop the application throwing another exception LOGGER.log(SERVICE_TASK_ERROR, e, getServiceHandlerName()); // depends on control dependency: [if], data = [none] } this.wave.status(Status.Failed); final Class<? extends Throwable> managedException = e instanceof ServiceException ? e.getCause().getClass() : e.getClass(); // Get the exact exception type final Wave exceptionHandlerWave = this.wave.waveType().waveExceptionHandler().get(managedException); if (exceptionHandlerWave != null) { // Fill the wave with useful data exceptionHandlerWave.fromClass(this.service.getClass()) .add(JRebirthItems.exceptionItem, e) .add(JRebirthItems.waveItem, this.wave) .relatedWave(this.wave); // depends on control dependency: [if], data = [none] LOGGER.log(SERVICE_TASK_HANDLE_EXCEPTION, e, e.getClass().getSimpleName(), getServiceHandlerName()); // depends on control dependency: [if], data = [none] // Send the exception wave to interested components this.service.sendWave(exceptionHandlerWave); // depends on control dependency: [if], data = [(exceptionHandlerWave] } else { LOGGER.log(SERVICE_TASK_NOT_MANAGED_EXCEPTION, e, e.getClass().getSimpleName(), getServiceHandlerName()); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public double getPercentageOfIdentity(boolean countGaps) { double seqid = getNumIdenticals(); double length = getLength(); if (!countGaps) { length = length - getAlignedSequence(1).getNumGapPositions() - getAlignedSequence(2).getNumGapPositions(); } return seqid / length; } }
public class class_name { @Override public double getPercentageOfIdentity(boolean countGaps) { double seqid = getNumIdenticals(); double length = getLength(); if (!countGaps) { length = length - getAlignedSequence(1).getNumGapPositions() - getAlignedSequence(2).getNumGapPositions(); // depends on control dependency: [if], data = [none] } return seqid / length; } }
public class class_name { @SuppressWarnings("WeakerAccess") public static Object parse(final ChainedHttpConfig config, final FromServer fromServer) { try { final ObjectMapper mapper = (ObjectMapper) config.actualContext(fromServer.getContentType(), OBJECT_MAPPER_ID); return mapper.readValue(fromServer.getReader(), config.getChainedResponse().getType()); } catch (IOException e) { throw new TransportingException(e); } } }
public class class_name { @SuppressWarnings("WeakerAccess") public static Object parse(final ChainedHttpConfig config, final FromServer fromServer) { try { final ObjectMapper mapper = (ObjectMapper) config.actualContext(fromServer.getContentType(), OBJECT_MAPPER_ID); return mapper.readValue(fromServer.getReader(), config.getChainedResponse().getType()); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new TransportingException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(CreateVpcPeeringAuthorizationRequest createVpcPeeringAuthorizationRequest, ProtocolMarshaller protocolMarshaller) { if (createVpcPeeringAuthorizationRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createVpcPeeringAuthorizationRequest.getGameLiftAwsAccountId(), GAMELIFTAWSACCOUNTID_BINDING); protocolMarshaller.marshall(createVpcPeeringAuthorizationRequest.getPeerVpcId(), PEERVPCID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(CreateVpcPeeringAuthorizationRequest createVpcPeeringAuthorizationRequest, ProtocolMarshaller protocolMarshaller) { if (createVpcPeeringAuthorizationRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createVpcPeeringAuthorizationRequest.getGameLiftAwsAccountId(), GAMELIFTAWSACCOUNTID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createVpcPeeringAuthorizationRequest.getPeerVpcId(), PEERVPCID_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 EClass getIfcFontVariant() { if (ifcFontVariantEClass == null) { ifcFontVariantEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(677); } return ifcFontVariantEClass; } }
public class class_name { public EClass getIfcFontVariant() { if (ifcFontVariantEClass == null) { ifcFontVariantEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(677); // depends on control dependency: [if], data = [none] } return ifcFontVariantEClass; } }
public class class_name { @SafeVarargs public static <T> T coalesceNonEmpty( final T ... things ) { if( things == null || things.length == 0 ) { return null; } for( T thing : things ) { if( thing instanceof CharSequence ) { if( ! StringUtils.isBlank( (CharSequence) thing ) ) { return thing; } } else if( thing != null ) { return thing; } } return null; } }
public class class_name { @SafeVarargs public static <T> T coalesceNonEmpty( final T ... things ) { if( things == null || things.length == 0 ) { return null; // depends on control dependency: [if], data = [none] } for( T thing : things ) { if( thing instanceof CharSequence ) { if( ! StringUtils.isBlank( (CharSequence) thing ) ) { return thing; // depends on control dependency: [if], data = [none] } } else if( thing != null ) { return thing; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public void setItemTouchable(boolean enabled) { if (enabled != mItemTouchable) { mItemTouchable = enabled; Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "mItemTouchable(%s): item touch enabled: %b", getName(), enabled); for (Widget view: getAllViews()) { view.setTouchable(enabled); } } } }
public class class_name { public void setItemTouchable(boolean enabled) { if (enabled != mItemTouchable) { mItemTouchable = enabled; // depends on control dependency: [if], data = [none] Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "mItemTouchable(%s): item touch enabled: %b", getName(), enabled); // depends on control dependency: [if], data = [none] for (Widget view: getAllViews()) { view.setTouchable(enabled); // depends on control dependency: [for], data = [view] } } } }
public class class_name { public void authenticateConnection (Invoker invoker, final AuthingConnection conn, final ResultListener<AuthingConnection> onComplete) { final AuthRequest req = conn.getAuthRequest(); final AuthResponseData rdata = createResponseData(); final AuthResponse rsp = new AuthResponse(rdata); invoker.postUnit(new Invoker.Unit("authenticateConnection") { @Override public boolean invoke () { try { processAuthentication(conn, rsp); if (AuthResponseData.SUCCESS.equals(rdata.code) && conn.getAuthName() == null) { // fail early, fail (less) often throw new IllegalStateException("Authenticator failed to provide authname"); } } catch (AuthException e) { rdata.code = e.getMessage(); } catch (Exception e) { log.warning("Error authenticating user", "areq", req, e); rdata.code = AuthCodes.SERVER_ERROR; } return true; } @Override public void handleResult () { // stuff a reference to the auth response into the connection so that we have // access to it later in the authentication process conn.setAuthResponse(rsp); // send the response back to the client conn.postMessage(rsp); // if the authentication request was granted, let the connection manager know that // we just authed if (AuthResponseData.SUCCESS.equals(rdata.code)) { onComplete.requestCompleted(conn); } } }); } }
public class class_name { public void authenticateConnection (Invoker invoker, final AuthingConnection conn, final ResultListener<AuthingConnection> onComplete) { final AuthRequest req = conn.getAuthRequest(); final AuthResponseData rdata = createResponseData(); final AuthResponse rsp = new AuthResponse(rdata); invoker.postUnit(new Invoker.Unit("authenticateConnection") { @Override public boolean invoke () { try { processAuthentication(conn, rsp); // depends on control dependency: [try], data = [none] if (AuthResponseData.SUCCESS.equals(rdata.code) && conn.getAuthName() == null) { // fail early, fail (less) often throw new IllegalStateException("Authenticator failed to provide authname"); } } catch (AuthException e) { rdata.code = e.getMessage(); } catch (Exception e) { // depends on control dependency: [catch], data = [none] log.warning("Error authenticating user", "areq", req, e); rdata.code = AuthCodes.SERVER_ERROR; } // depends on control dependency: [catch], data = [none] return true; } @Override public void handleResult () { // stuff a reference to the auth response into the connection so that we have // access to it later in the authentication process conn.setAuthResponse(rsp); // send the response back to the client conn.postMessage(rsp); // if the authentication request was granted, let the connection manager know that // we just authed if (AuthResponseData.SUCCESS.equals(rdata.code)) { onComplete.requestCompleted(conn); // depends on control dependency: [if], data = [none] } } }); } }
public class class_name { public void put(String identifier, ActiveConnectionRecord record) { synchronized (records) { // Get set of active connection records, creating if necessary Set<ActiveConnectionRecord> connections = records.get(identifier); if (connections == null) { connections = Collections.synchronizedSet(Collections.newSetFromMap(new LinkedHashMap<ActiveConnectionRecord, Boolean>())); records.put(identifier, connections); } // Add active connection connections.add(record); } } }
public class class_name { public void put(String identifier, ActiveConnectionRecord record) { synchronized (records) { // Get set of active connection records, creating if necessary Set<ActiveConnectionRecord> connections = records.get(identifier); if (connections == null) { connections = Collections.synchronizedSet(Collections.newSetFromMap(new LinkedHashMap<ActiveConnectionRecord, Boolean>())); // depends on control dependency: [if], data = [none] records.put(identifier, connections); // depends on control dependency: [if], data = [none] } // Add active connection connections.add(record); } } }
public class class_name { private Map<URI, Set<URI>> addMapFilePrefix(final Map<URI, Set<URI>> map) { final Map<URI, Set<URI>> res = new HashMap<>(); for (final Map.Entry<URI, Set<URI>> e: map.entrySet()) { final URI key = e.getKey(); final Set<URI> newSet = new HashSet<>(e.getValue().size()); for (final URI file: e.getValue()) { newSet.add(tempFileNameScheme.generateTempFileName(file)); } res.put(key.equals(ROOT_URI) ? key : tempFileNameScheme.generateTempFileName(key), newSet); } return res; } }
public class class_name { private Map<URI, Set<URI>> addMapFilePrefix(final Map<URI, Set<URI>> map) { final Map<URI, Set<URI>> res = new HashMap<>(); for (final Map.Entry<URI, Set<URI>> e: map.entrySet()) { final URI key = e.getKey(); final Set<URI> newSet = new HashSet<>(e.getValue().size()); for (final URI file: e.getValue()) { newSet.add(tempFileNameScheme.generateTempFileName(file)); // depends on control dependency: [for], data = [file] } res.put(key.equals(ROOT_URI) ? key : tempFileNameScheme.generateTempFileName(key), newSet); // depends on control dependency: [for], data = [e] } return res; } }
public class class_name { private String createListFilter(FilterableAttribute attribute, Collection<String> values) { /* * This is more complicated than you'd think... Some attribute values caused incompatible changes to the JSON data model so are actually stored in a different object in the * JSON. Therefore the filter that we are constructing maybe pointing to one or two attributes in the JSON. We create a filter for both possible attributes and then only * add the ones that we used. */ boolean firstFilter1Value = true; boolean firstFilter2Value = true; StringBuilder filter1 = new StringBuilder(attribute.getAttributeName()).append("="); StringBuilder filter2 = new StringBuilder(); Collection<String> filter2Values = attribute.getValuesInSecondaryAttributeName() == null ? Collections.<String> emptySet() : attribute.getValuesInSecondaryAttributeName(); if (attribute.getSecondaryAttributeName() != null) { filter2 = filter2.append(attribute.getSecondaryAttributeName()).append("="); } for (String value : values) { if (filter2Values.contains(value)) { try { value = URLEncoder.encode(value, "UTF-8"); } catch (UnsupportedEncodingException e) { // If UTF-8 encoding isn't supported we'll just have to try the unencoded string } if (firstFilter2Value) { firstFilter2Value = false; } else { // OR all types so we get them all filter2.append(ENCODED_BAR); } filter2.append(value); } else { try { value = URLEncoder.encode(value, "UTF-8"); } catch (UnsupportedEncodingException e) { // If UTF-8 encoding isn't supported we'll just have to try the unencoded string } if (firstFilter1Value) { firstFilter1Value = false; } else { // OR all types so we get them all filter1.append(ENCODED_BAR); } filter1.append(value); } } if (!firstFilter1Value && !firstFilter2Value) { throw new IllegalArgumentException("Unable to filter values that come from two different JSON objects, attempted to filter " + attribute + " using values " + values); } if (!firstFilter1Value) { return filter1.toString(); } if (!firstFilter2Value) { return filter2.toString(); } return null; } }
public class class_name { private String createListFilter(FilterableAttribute attribute, Collection<String> values) { /* * This is more complicated than you'd think... Some attribute values caused incompatible changes to the JSON data model so are actually stored in a different object in the * JSON. Therefore the filter that we are constructing maybe pointing to one or two attributes in the JSON. We create a filter for both possible attributes and then only * add the ones that we used. */ boolean firstFilter1Value = true; boolean firstFilter2Value = true; StringBuilder filter1 = new StringBuilder(attribute.getAttributeName()).append("="); StringBuilder filter2 = new StringBuilder(); Collection<String> filter2Values = attribute.getValuesInSecondaryAttributeName() == null ? Collections.<String> emptySet() : attribute.getValuesInSecondaryAttributeName(); if (attribute.getSecondaryAttributeName() != null) { filter2 = filter2.append(attribute.getSecondaryAttributeName()).append("="); // depends on control dependency: [if], data = [(attribute.getSecondaryAttributeName()] } for (String value : values) { if (filter2Values.contains(value)) { try { value = URLEncoder.encode(value, "UTF-8"); // depends on control dependency: [try], data = [none] } catch (UnsupportedEncodingException e) { // If UTF-8 encoding isn't supported we'll just have to try the unencoded string } // depends on control dependency: [catch], data = [none] if (firstFilter2Value) { firstFilter2Value = false; // depends on control dependency: [if], data = [none] } else { // OR all types so we get them all filter2.append(ENCODED_BAR); // depends on control dependency: [if], data = [none] } filter2.append(value); // depends on control dependency: [if], data = [none] } else { try { value = URLEncoder.encode(value, "UTF-8"); // depends on control dependency: [try], data = [none] } catch (UnsupportedEncodingException e) { // If UTF-8 encoding isn't supported we'll just have to try the unencoded string } // depends on control dependency: [catch], data = [none] if (firstFilter1Value) { firstFilter1Value = false; // depends on control dependency: [if], data = [none] } else { // OR all types so we get them all filter1.append(ENCODED_BAR); // depends on control dependency: [if], data = [none] } filter1.append(value); // depends on control dependency: [if], data = [none] } } if (!firstFilter1Value && !firstFilter2Value) { throw new IllegalArgumentException("Unable to filter values that come from two different JSON objects, attempted to filter " + attribute + " using values " + values); } if (!firstFilter1Value) { return filter1.toString(); // depends on control dependency: [if], data = [none] } if (!firstFilter2Value) { return filter2.toString(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { @Override public List<Token> tokenize(String s) { List<Token> result = new ArrayList<Token>(); result.add(new UndefinedToken(s)); for (PredefinedTokenDefinition predefinedTokenDefinition : _predefinedTokenDefitions) { Set<Pattern> patterns = predefinedTokenDefinition.getTokenRegexPatterns(); for (Pattern pattern : patterns) { for (ListIterator<Token> it = result.listIterator(); it.hasNext();) { Token token = it.next(); if (token instanceof UndefinedToken) { List<Token> replacementTokens = tokenizeInternal(token.getString(), predefinedTokenDefinition, pattern); if (replacementTokens.size() > 1) { it.remove(); for (Token newToken : replacementTokens) { it.add(newToken); } } } } } } return result; } }
public class class_name { @Override public List<Token> tokenize(String s) { List<Token> result = new ArrayList<Token>(); result.add(new UndefinedToken(s)); for (PredefinedTokenDefinition predefinedTokenDefinition : _predefinedTokenDefitions) { Set<Pattern> patterns = predefinedTokenDefinition.getTokenRegexPatterns(); for (Pattern pattern : patterns) { for (ListIterator<Token> it = result.listIterator(); it.hasNext();) { Token token = it.next(); if (token instanceof UndefinedToken) { List<Token> replacementTokens = tokenizeInternal(token.getString(), predefinedTokenDefinition, pattern); if (replacementTokens.size() > 1) { it.remove(); // depends on control dependency: [if], data = [none] for (Token newToken : replacementTokens) { it.add(newToken); // depends on control dependency: [for], data = [newToken] } } } } } } return result; } }
public class class_name { public synchronized static String getSetupJavaScript(String cdnPrefix, String urlPrefix) { if (requireConfigJavaScriptCdn == null) { List<String> prefixes = new ArrayList<>(); prefixes.add(cdnPrefix); prefixes.add(urlPrefix); requireConfigJavaScriptCdn = generateSetupJavaScript(prefixes); } return requireConfigJavaScriptCdn; } }
public class class_name { public synchronized static String getSetupJavaScript(String cdnPrefix, String urlPrefix) { if (requireConfigJavaScriptCdn == null) { List<String> prefixes = new ArrayList<>(); prefixes.add(cdnPrefix); // depends on control dependency: [if], data = [none] prefixes.add(urlPrefix); // depends on control dependency: [if], data = [none] requireConfigJavaScriptCdn = generateSetupJavaScript(prefixes); // depends on control dependency: [if], data = [none] } return requireConfigJavaScriptCdn; } }
public class class_name { public void fireEvent(String locator, String eventName) { WebElement element = getElement(locator); JavascriptLibrary javascript = new JavascriptLibrary(); if (runningInIE()) { String script = String.format("$('#%s').trigger('%s');", locator, eventName); javascript.executeScript(getWebDriver(), script); } else { javascript.callEmbeddedSelenium(getWebDriver(), "triggerEvent", element, eventName); } } }
public class class_name { public void fireEvent(String locator, String eventName) { WebElement element = getElement(locator); JavascriptLibrary javascript = new JavascriptLibrary(); if (runningInIE()) { String script = String.format("$('#%s').trigger('%s');", locator, eventName); javascript.executeScript(getWebDriver(), script); // depends on control dependency: [if], data = [none] } else { javascript.callEmbeddedSelenium(getWebDriver(), "triggerEvent", element, eventName); // depends on control dependency: [if], data = [none] } } }
public class class_name { private <T> Collection<Integer> transformSelect(SelectTransformation<T> select) { StreamTransformation<T> input = select.getInput(); Collection<Integer> resultIds = transform(input); // the recursive transform might have already transformed this if (alreadyTransformed.containsKey(select)) { return alreadyTransformed.get(select); } List<Integer> virtualResultIds = new ArrayList<>(); for (int inputId : resultIds) { int virtualId = StreamTransformation.getNewNodeId(); streamGraph.addVirtualSelectNode(inputId, virtualId, select.getSelectedNames()); virtualResultIds.add(virtualId); } return virtualResultIds; } }
public class class_name { private <T> Collection<Integer> transformSelect(SelectTransformation<T> select) { StreamTransformation<T> input = select.getInput(); Collection<Integer> resultIds = transform(input); // the recursive transform might have already transformed this if (alreadyTransformed.containsKey(select)) { return alreadyTransformed.get(select); // depends on control dependency: [if], data = [none] } List<Integer> virtualResultIds = new ArrayList<>(); for (int inputId : resultIds) { int virtualId = StreamTransformation.getNewNodeId(); streamGraph.addVirtualSelectNode(inputId, virtualId, select.getSelectedNames()); // depends on control dependency: [for], data = [inputId] virtualResultIds.add(virtualId); // depends on control dependency: [for], data = [none] } return virtualResultIds; } }
public class class_name { @Override public void copyFrom(final CopyFrom obj) { final GeoRSSModule geoRSSModule = (GeoRSSModule) obj; geometry = geoRSSModule.getGeometry(); try { geometry = (AbstractGeometry) geometry.clone(); } catch (final CloneNotSupportedException ex) { LOG.error("Error", ex); } } }
public class class_name { @Override public void copyFrom(final CopyFrom obj) { final GeoRSSModule geoRSSModule = (GeoRSSModule) obj; geometry = geoRSSModule.getGeometry(); try { geometry = (AbstractGeometry) geometry.clone(); // depends on control dependency: [try], data = [none] } catch (final CloneNotSupportedException ex) { LOG.error("Error", ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static <T> CompletableFuture<T> asyncFuture(CompletableFuture<T> future, Executor executor) { CompletableFuture<T> newFuture = new AtomixFuture<>(); future.whenComplete((result, error) -> { executor.execute(() -> { if (error == null) { newFuture.complete(result); } else { newFuture.completeExceptionally(error); } }); }); return newFuture; } }
public class class_name { public static <T> CompletableFuture<T> asyncFuture(CompletableFuture<T> future, Executor executor) { CompletableFuture<T> newFuture = new AtomixFuture<>(); future.whenComplete((result, error) -> { executor.execute(() -> { if (error == null) { newFuture.complete(result); // depends on control dependency: [if], data = [none] } else { newFuture.completeExceptionally(error); // depends on control dependency: [if], data = [(error] } }); }); return newFuture; } }
public class class_name { public DescribeEventAggregatesResult withEventAggregates(EventAggregate... eventAggregates) { if (this.eventAggregates == null) { setEventAggregates(new java.util.ArrayList<EventAggregate>(eventAggregates.length)); } for (EventAggregate ele : eventAggregates) { this.eventAggregates.add(ele); } return this; } }
public class class_name { public DescribeEventAggregatesResult withEventAggregates(EventAggregate... eventAggregates) { if (this.eventAggregates == null) { setEventAggregates(new java.util.ArrayList<EventAggregate>(eventAggregates.length)); // depends on control dependency: [if], data = [none] } for (EventAggregate ele : eventAggregates) { this.eventAggregates.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private void buildUI() { // Create the layout: VLayout layout = new VLayout(); layout.setWidth100(); layout.setHeight100(); logicalOperatorRadio = new RadioGroupItem("logicalOperator"); logicalOperatorRadio.setValueMap(I18nProvider.getSearch().radioOperatorOr(), I18nProvider.getSearch() .radioOperatorAnd()); logicalOperatorRadio.setVertical(false); logicalOperatorRadio.setRequired(true); logicalOperatorRadio.setAlign(Alignment.LEFT); logicalOperatorRadio.setWidth(250); logicalOperatorRadio.setShowTitle(false); HLayout optionLayout = new HLayout(); optionLayout.setHeight(50); optionLayout.setWidth100(); VLayout leftLayout = new VLayout(); leftLayout.setAlign(Alignment.LEFT); HLayout layerLayout = new HLayout(); layerLayout.setWidth(420); DynamicForm layerForm = new DynamicForm(); layerForm.setHeight(30); if (manualLayerSelection) { layerSelect = new SelectItem(); layerSelect.setTitle(I18nProvider.getSearch().labelLayerSelected()); layerSelect.setWidth(250); layerSelect.setHint(I18nProvider.getSearch().labelNoLayerSelected()); ((SelectItem) layerSelect).setShowHintInField(true); layerSelect.addChangedHandler(new ChangedHandler() { public void onChanged(ChangedEvent event) { String layerLabel = (String) event.getValue(); for (Layer<?> vLayer : mapModel.getLayers()) { if (vLayer.getLabel().equals(layerLabel)) { setLayer((VectorLayer) vLayer); } } } }); mapModel.addMapModelChangedHandler(new MapModelChangedHandler() { public void onMapModelChanged(MapModelChangedEvent event) { fillLayerSelect(); } }); // needed if map is already loaded ! fillLayerSelect(); } else { mapModel.addLayerSelectionHandler(new LayerSelectionHandler() { public void onDeselectLayer(LayerDeselectedEvent event) { empty(); updateLabelTitle(I18nProvider.getSearch().labelNoLayerSelected()); } public void onSelectLayer(LayerSelectedEvent event) { if (event.getLayer() instanceof VectorLayer) { setLayer((VectorLayer) event.getLayer()); if (event.getLayer() != null) { updateLabelTitle(event.getLayer().getLabel()); } } } }); layerSelect = new BlurbItem(); layerSelect.setShowTitle(true); layerSelect.setTitle(I18nProvider.getSearch().labelLayerSelected()); layerSelect.setWidth(250); layerSelect.setValue("<b>" + I18nProvider.getSearch().labelNoLayerSelected() + "</b>"); } layerForm.setFields(layerSelect); layerLayout.addMember(layerForm); leftLayout.addMember(layerLayout); DynamicForm logicalForm = new DynamicForm(); logicalForm.setAutoWidth(); logicalForm.setLayoutAlign(Alignment.CENTER); logicalForm.setFields(logicalOperatorRadio); leftLayout.setWidth(420); leftLayout.addMember(logicalForm); VLayout rightLayout = new VLayout(); rightLayout.setLayoutAlign(VerticalAlignment.TOP); rightLayout.setMargin(5); rightLayout.setMembersMargin(5); rightLayout.setWidth(100); searchButton = new IButton(I18nProvider.getSearch().btnSearch()); searchButton.setIcon(WidgetLayout.iconFind); searchButton.setWidth(100); searchButton.setDisabled(true); searchButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { search(); } }); resetButton = new IButton(I18nProvider.getSearch().btnReset()); resetButton.setIcon(WidgetLayout.iconUndo); resetButton.setWidth(100); resetButton.setDisabled(true); resetButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { empty(); } }); rightLayout.addMember(searchButton); rightLayout.addMember(resetButton); optionLayout.addMember(leftLayout); optionLayout.addMember(new LayoutSpacer()); optionLayout.addMember(rightLayout); // Create a header for the criterionStack: HLayout headerLayout = new HLayout(); headerLayout.setHeight(26); headerLayout.setStyleName(STYLE_HEADER_BAR); HTMLPane attrHeader = new HTMLPane(); attrHeader.setStyleName(STYLE_SEARCH_HEADER); attrHeader.setContents("Attribute"); attrHeader.setWidth(140); HTMLPane operatorHeader = new HTMLPane(); operatorHeader.setContents("Operator"); operatorHeader.setWidth(140); operatorHeader.setStyleName(STYLE_SEARCH_HEADER); HTMLPane valueHeader = new HTMLPane(); valueHeader.setContents("Value"); valueHeader.setStyleName(STYLE_SEARCH_HEADER); criterionStack = new VStack(); criterionStack.setAlign(VerticalAlignment.TOP); headerLayout.addMember(attrHeader); headerLayout.addMember(operatorHeader); headerLayout.addMember(valueHeader); criterionStack.addMember(headerLayout); buttonStack = new VStack(); buttonStack.setWidth(70); buttonStack.setAlign(VerticalAlignment.TOP); HTMLPane btnHeader = new HTMLPane(); btnHeader.setStyleName(STYLE_HEADER_BAR); btnHeader.setWidth(70); btnHeader.setHeight(26); buttonStack.addMember(btnHeader); HLayout searchGrid = new HLayout(); searchGrid.addMember(criterionStack); searchGrid.addMember(buttonStack); searchGrid.setBorder("1px solid lightgrey"); layout.addMember(optionLayout); layout.addMember(searchGrid); addChild(layout); } }
public class class_name { private void buildUI() { // Create the layout: VLayout layout = new VLayout(); layout.setWidth100(); layout.setHeight100(); logicalOperatorRadio = new RadioGroupItem("logicalOperator"); logicalOperatorRadio.setValueMap(I18nProvider.getSearch().radioOperatorOr(), I18nProvider.getSearch() .radioOperatorAnd()); logicalOperatorRadio.setVertical(false); logicalOperatorRadio.setRequired(true); logicalOperatorRadio.setAlign(Alignment.LEFT); logicalOperatorRadio.setWidth(250); logicalOperatorRadio.setShowTitle(false); HLayout optionLayout = new HLayout(); optionLayout.setHeight(50); optionLayout.setWidth100(); VLayout leftLayout = new VLayout(); leftLayout.setAlign(Alignment.LEFT); HLayout layerLayout = new HLayout(); layerLayout.setWidth(420); DynamicForm layerForm = new DynamicForm(); layerForm.setHeight(30); if (manualLayerSelection) { layerSelect = new SelectItem(); // depends on control dependency: [if], data = [none] layerSelect.setTitle(I18nProvider.getSearch().labelLayerSelected()); // depends on control dependency: [if], data = [none] layerSelect.setWidth(250); // depends on control dependency: [if], data = [none] layerSelect.setHint(I18nProvider.getSearch().labelNoLayerSelected()); // depends on control dependency: [if], data = [none] ((SelectItem) layerSelect).setShowHintInField(true); // depends on control dependency: [if], data = [none] layerSelect.addChangedHandler(new ChangedHandler() { public void onChanged(ChangedEvent event) { String layerLabel = (String) event.getValue(); for (Layer<?> vLayer : mapModel.getLayers()) { if (vLayer.getLabel().equals(layerLabel)) { setLayer((VectorLayer) vLayer); // depends on control dependency: [if], data = [none] } } } }); // depends on control dependency: [if], data = [none] mapModel.addMapModelChangedHandler(new MapModelChangedHandler() { public void onMapModelChanged(MapModelChangedEvent event) { fillLayerSelect(); } }); // depends on control dependency: [if], data = [none] // needed if map is already loaded ! fillLayerSelect(); // depends on control dependency: [if], data = [none] } else { mapModel.addLayerSelectionHandler(new LayerSelectionHandler() { public void onDeselectLayer(LayerDeselectedEvent event) { empty(); updateLabelTitle(I18nProvider.getSearch().labelNoLayerSelected()); } public void onSelectLayer(LayerSelectedEvent event) { if (event.getLayer() instanceof VectorLayer) { setLayer((VectorLayer) event.getLayer()); // depends on control dependency: [if], data = [none] if (event.getLayer() != null) { updateLabelTitle(event.getLayer().getLabel()); // depends on control dependency: [if], data = [(event.getLayer()] } } } }); // depends on control dependency: [if], data = [none] layerSelect = new BlurbItem(); // depends on control dependency: [if], data = [none] layerSelect.setShowTitle(true); // depends on control dependency: [if], data = [none] layerSelect.setTitle(I18nProvider.getSearch().labelLayerSelected()); // depends on control dependency: [if], data = [none] layerSelect.setWidth(250); // depends on control dependency: [if], data = [none] layerSelect.setValue("<b>" + I18nProvider.getSearch().labelNoLayerSelected() + "</b>"); // depends on control dependency: [if], data = [none] } layerForm.setFields(layerSelect); layerLayout.addMember(layerForm); leftLayout.addMember(layerLayout); DynamicForm logicalForm = new DynamicForm(); logicalForm.setAutoWidth(); logicalForm.setLayoutAlign(Alignment.CENTER); logicalForm.setFields(logicalOperatorRadio); leftLayout.setWidth(420); leftLayout.addMember(logicalForm); VLayout rightLayout = new VLayout(); rightLayout.setLayoutAlign(VerticalAlignment.TOP); rightLayout.setMargin(5); rightLayout.setMembersMargin(5); rightLayout.setWidth(100); searchButton = new IButton(I18nProvider.getSearch().btnSearch()); searchButton.setIcon(WidgetLayout.iconFind); searchButton.setWidth(100); searchButton.setDisabled(true); searchButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { search(); } }); resetButton = new IButton(I18nProvider.getSearch().btnReset()); resetButton.setIcon(WidgetLayout.iconUndo); resetButton.setWidth(100); resetButton.setDisabled(true); resetButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { empty(); } }); rightLayout.addMember(searchButton); rightLayout.addMember(resetButton); optionLayout.addMember(leftLayout); optionLayout.addMember(new LayoutSpacer()); optionLayout.addMember(rightLayout); // Create a header for the criterionStack: HLayout headerLayout = new HLayout(); headerLayout.setHeight(26); headerLayout.setStyleName(STYLE_HEADER_BAR); HTMLPane attrHeader = new HTMLPane(); attrHeader.setStyleName(STYLE_SEARCH_HEADER); attrHeader.setContents("Attribute"); attrHeader.setWidth(140); HTMLPane operatorHeader = new HTMLPane(); operatorHeader.setContents("Operator"); operatorHeader.setWidth(140); operatorHeader.setStyleName(STYLE_SEARCH_HEADER); HTMLPane valueHeader = new HTMLPane(); valueHeader.setContents("Value"); valueHeader.setStyleName(STYLE_SEARCH_HEADER); criterionStack = new VStack(); criterionStack.setAlign(VerticalAlignment.TOP); headerLayout.addMember(attrHeader); headerLayout.addMember(operatorHeader); headerLayout.addMember(valueHeader); criterionStack.addMember(headerLayout); buttonStack = new VStack(); buttonStack.setWidth(70); buttonStack.setAlign(VerticalAlignment.TOP); HTMLPane btnHeader = new HTMLPane(); btnHeader.setStyleName(STYLE_HEADER_BAR); btnHeader.setWidth(70); btnHeader.setHeight(26); buttonStack.addMember(btnHeader); HLayout searchGrid = new HLayout(); searchGrid.addMember(criterionStack); searchGrid.addMember(buttonStack); searchGrid.setBorder("1px solid lightgrey"); layout.addMember(optionLayout); layout.addMember(searchGrid); addChild(layout); } }
public class class_name { protected Object executeCQLQuery(String cqlQuery, boolean isCql3Enabled) { Cassandra.Client conn = null; Object pooledConnection = null; pooledConnection = getConnection(); conn = (org.apache.cassandra.thrift.Cassandra.Client) getConnection(pooledConnection); try { if (isCql3Enabled || isCql3Enabled()) { return execute(cqlQuery, conn); } KunderaCoreUtils.printQuery(cqlQuery, showQuery); if (log.isDebugEnabled()) { log.debug("Executing cql query {}.", cqlQuery); } return conn.execute_cql_query(ByteBufferUtil.bytes(cqlQuery), org.apache.cassandra.thrift.Compression.NONE); } catch (Exception ex) { if (log.isErrorEnabled()) { log.error("Error during executing query {}, Caused by: {} .", cqlQuery, ex); } throw new PersistenceException(ex); } finally { releaseConnection(pooledConnection); } } }
public class class_name { protected Object executeCQLQuery(String cqlQuery, boolean isCql3Enabled) { Cassandra.Client conn = null; Object pooledConnection = null; pooledConnection = getConnection(); conn = (org.apache.cassandra.thrift.Cassandra.Client) getConnection(pooledConnection); try { if (isCql3Enabled || isCql3Enabled()) { return execute(cqlQuery, conn); // depends on control dependency: [if], data = [none] } KunderaCoreUtils.printQuery(cqlQuery, showQuery); // depends on control dependency: [try], data = [none] if (log.isDebugEnabled()) { log.debug("Executing cql query {}.", cqlQuery); // depends on control dependency: [if], data = [none] } return conn.execute_cql_query(ByteBufferUtil.bytes(cqlQuery), org.apache.cassandra.thrift.Compression.NONE); // depends on control dependency: [try], data = [none] } catch (Exception ex) { if (log.isErrorEnabled()) { log.error("Error during executing query {}, Caused by: {} .", cqlQuery, ex); // depends on control dependency: [if], data = [none] } throw new PersistenceException(ex); } finally { // depends on control dependency: [catch], data = [none] releaseConnection(pooledConnection); } } }
public class class_name { public Map<String, Collection<String>> headers() { Map<String, Collection<String>> headerMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); this.headers.forEach((key, headerTemplate) -> { List<String> values = new ArrayList<>(headerTemplate.getValues()); /* add the expanded collection, but only if it has values */ if (!values.isEmpty()) { headerMap.put(key, Collections.unmodifiableList(values)); } }); return Collections.unmodifiableMap(headerMap); } }
public class class_name { public Map<String, Collection<String>> headers() { Map<String, Collection<String>> headerMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); this.headers.forEach((key, headerTemplate) -> { List<String> values = new ArrayList<>(headerTemplate.getValues()); /* add the expanded collection, but only if it has values */ if (!values.isEmpty()) { headerMap.put(key, Collections.unmodifiableList(values)); // depends on control dependency: [if], data = [none] } }); return Collections.unmodifiableMap(headerMap); } }
public class class_name { public long getKeyMemoryUsageBytes() { long total = 0; for (int i = 0; i < maps_.length; i++) { if (maps_[i] != null) { total += (long) (maps_[i].getActiveEntries()) * keySizeBytes_; } } return total; } }
public class class_name { public long getKeyMemoryUsageBytes() { long total = 0; for (int i = 0; i < maps_.length; i++) { if (maps_[i] != null) { total += (long) (maps_[i].getActiveEntries()) * keySizeBytes_; // depends on control dependency: [if], data = [(maps_[i]] } } return total; } }
public class class_name { private static String resolveCompositeKey(String key, Properties props) { String value = null; // Look for the comma int comma = key.indexOf(','); if (comma > -1) { // If we have a first part, try resolve it if (comma > 0) { // Check the first part String key1 = key.substring(0, comma); value = getReplacementString(key1, props); } // Check the second part, if there is one and first lookup failed if (value == null && comma < key.length() - 1) { String key2 = key.substring(comma + 1); value = getReplacementString(key2, props); } } // Return whatever we've found or null return value; } }
public class class_name { private static String resolveCompositeKey(String key, Properties props) { String value = null; // Look for the comma int comma = key.indexOf(','); if (comma > -1) { // If we have a first part, try resolve it if (comma > 0) { // Check the first part String key1 = key.substring(0, comma); value = getReplacementString(key1, props); // depends on control dependency: [if], data = [none] } // Check the second part, if there is one and first lookup failed if (value == null && comma < key.length() - 1) { String key2 = key.substring(comma + 1); value = getReplacementString(key2, props); // depends on control dependency: [if], data = [none] } } // Return whatever we've found or null return value; } }
public class class_name { public List getMulti(String attribute) { NameOpValue nv = rslTree.getParam(attribute); if (nv == null || nv.getOperator() != NameOpValue.EQ) return null; List values = nv.getValues(); List list = new LinkedList(); Iterator iter = values.iterator(); Object obj; while( iter.hasNext() ) { obj = iter.next(); if (obj instanceof Value) { list.add( ((Value)obj).getCompleteValue() ); } } return list; } }
public class class_name { public List getMulti(String attribute) { NameOpValue nv = rslTree.getParam(attribute); if (nv == null || nv.getOperator() != NameOpValue.EQ) return null; List values = nv.getValues(); List list = new LinkedList(); Iterator iter = values.iterator(); Object obj; while( iter.hasNext() ) { obj = iter.next(); // depends on control dependency: [while], data = [none] if (obj instanceof Value) { list.add( ((Value)obj).getCompleteValue() ); // depends on control dependency: [if], data = [none] } } return list; } }
public class class_name { private double getMinStringSize(String[] tTokens, String[] uTokens) { double tSize = 0, uSize = 0; for (int i = 0; i < tTokens.length; i++) { tSize += tTokens[i].length(); } for (int i = 0; i < uTokens.length; i++) { uSize += uTokens[i].length(); } return Math.min(tSize, uSize); } }
public class class_name { private double getMinStringSize(String[] tTokens, String[] uTokens) { double tSize = 0, uSize = 0; for (int i = 0; i < tTokens.length; i++) { tSize += tTokens[i].length(); // depends on control dependency: [for], data = [i] } for (int i = 0; i < uTokens.length; i++) { uSize += uTokens[i].length(); // depends on control dependency: [for], data = [i] } return Math.min(tSize, uSize); } }
public class class_name { protected void processSipContextParameters(JBossConvergedSipMetaData metaData) { if (metaData.getSipContextParams() != null) { for (ParamValueMetaData param : metaData.getSipContextParams()) { context.addParameter(param.getParamName(), param.getParamValue()); } } } }
public class class_name { protected void processSipContextParameters(JBossConvergedSipMetaData metaData) { if (metaData.getSipContextParams() != null) { for (ParamValueMetaData param : metaData.getSipContextParams()) { context.addParameter(param.getParamName(), param.getParamValue()); // depends on control dependency: [for], data = [param] } } } }
public class class_name { public static String chopNewline(String str) { int lastIdx = str.length() - 1; if (lastIdx <= 0) { return EMPTY; } char last = str.charAt(lastIdx); if (last == '\n') { if (str.charAt(lastIdx - 1) == '\r') { lastIdx--; } } else { lastIdx++; } return str.substring(0, lastIdx); } }
public class class_name { public static String chopNewline(String str) { int lastIdx = str.length() - 1; if (lastIdx <= 0) { return EMPTY; // depends on control dependency: [if], data = [none] } char last = str.charAt(lastIdx); if (last == '\n') { if (str.charAt(lastIdx - 1) == '\r') { lastIdx--; // depends on control dependency: [if], data = [none] } } else { lastIdx++; // depends on control dependency: [if], data = [none] } return str.substring(0, lastIdx); } }
public class class_name { private void addXMLAttributes(Map<String, String> attrMap) { if (m_children != null) { for (UNode childNode : m_children) { // A child node must not contain a tag name to be considered an attribute. if (childNode.m_type == NodeType.VALUE && childNode.m_bAttribute && Utils.isEmpty(childNode.m_tagName)) { assert m_name != null && m_name.length() > 0; attrMap.put(childNode.m_name, childNode.m_value); } } } } }
public class class_name { private void addXMLAttributes(Map<String, String> attrMap) { if (m_children != null) { for (UNode childNode : m_children) { // A child node must not contain a tag name to be considered an attribute. if (childNode.m_type == NodeType.VALUE && childNode.m_bAttribute && Utils.isEmpty(childNode.m_tagName)) { assert m_name != null && m_name.length() > 0; // depends on control dependency: [if], data = [none] attrMap.put(childNode.m_name, childNode.m_value); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { protected void invokeMethod(Method method, D bean, R value) { assert bean != null; try { method.invoke(domain.cast(bean), value); } catch (ClassCastException e) { String message = "Failed to set property: " + property; if (!domain.isAssignableFrom(bean.getClass())) { message += " Invalid domain bean: " + domain.getSimpleName() + " is not assignable from " + bean.getClass(); } if (!range.isAssignableFrom(value.getClass())) { message += " Invalid range value: " + range + " is not assignable from " + value.getClass(); } throw new IllegalBioPAXArgumentException(message, e); } catch (Exception e) //java.lang.reflect.InvocationTargetException { String valInfo = (value == null) ? null : value.getClass().getSimpleName() + ", " + value; String message = "Failed to set " + property + " with " + method.getName() + " on " + domain.getSimpleName() + " (" + bean.getClass().getSimpleName() + ", " + bean + ")" + " with range: " + range.getSimpleName() + " (" + valInfo + ")"; throw new IllegalBioPAXArgumentException(message, e); } } }
public class class_name { protected void invokeMethod(Method method, D bean, R value) { assert bean != null; try { method.invoke(domain.cast(bean), value); // depends on control dependency: [try], data = [none] } catch (ClassCastException e) { String message = "Failed to set property: " + property; if (!domain.isAssignableFrom(bean.getClass())) { message += " Invalid domain bean: " + domain.getSimpleName() + " is not assignable from " + // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] bean.getClass(); // depends on control dependency: [if], data = [none] } if (!range.isAssignableFrom(value.getClass())) { message += " Invalid range value: " + range + " is not assignable from " + value.getClass(); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] } throw new IllegalBioPAXArgumentException(message, e); } // depends on control dependency: [catch], data = [none] catch (Exception e) //java.lang.reflect.InvocationTargetException { String valInfo = (value == null) ? null : value.getClass().getSimpleName() + ", " + value; String message = "Failed to set " + property + " with " + method.getName() + " on " + domain.getSimpleName() + " (" + bean.getClass().getSimpleName() + ", " + bean + ")" + " with range: " + range.getSimpleName() + " (" + valInfo + ")"; throw new IllegalBioPAXArgumentException(message, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Bundle saveInstanceState(Bundle savedInstanceState) { if (savedInstanceState != null) { if (!mDrawerBuilder.mAppended) { savedInstanceState = mDrawerBuilder.mAdapter.saveInstanceState(savedInstanceState, BUNDLE_SELECTION); savedInstanceState.putInt(BUNDLE_STICKY_FOOTER_SELECTION, mDrawerBuilder.mCurrentStickyFooterSelection); savedInstanceState.putBoolean(BUNDLE_DRAWER_CONTENT_SWITCHED, switchedDrawerContent()); } else { savedInstanceState = mDrawerBuilder.mAdapter.saveInstanceState(savedInstanceState, BUNDLE_SELECTION_APPENDED); savedInstanceState.putInt(BUNDLE_STICKY_FOOTER_SELECTION_APPENDED, mDrawerBuilder.mCurrentStickyFooterSelection); savedInstanceState.putBoolean(BUNDLE_DRAWER_CONTENT_SWITCHED_APPENDED, switchedDrawerContent()); } } return savedInstanceState; } }
public class class_name { public Bundle saveInstanceState(Bundle savedInstanceState) { if (savedInstanceState != null) { if (!mDrawerBuilder.mAppended) { savedInstanceState = mDrawerBuilder.mAdapter.saveInstanceState(savedInstanceState, BUNDLE_SELECTION); // depends on control dependency: [if], data = [none] savedInstanceState.putInt(BUNDLE_STICKY_FOOTER_SELECTION, mDrawerBuilder.mCurrentStickyFooterSelection); // depends on control dependency: [if], data = [none] savedInstanceState.putBoolean(BUNDLE_DRAWER_CONTENT_SWITCHED, switchedDrawerContent()); // depends on control dependency: [if], data = [none] } else { savedInstanceState = mDrawerBuilder.mAdapter.saveInstanceState(savedInstanceState, BUNDLE_SELECTION_APPENDED); // depends on control dependency: [if], data = [none] savedInstanceState.putInt(BUNDLE_STICKY_FOOTER_SELECTION_APPENDED, mDrawerBuilder.mCurrentStickyFooterSelection); // depends on control dependency: [if], data = [none] savedInstanceState.putBoolean(BUNDLE_DRAWER_CONTENT_SWITCHED_APPENDED, switchedDrawerContent()); // depends on control dependency: [if], data = [none] } } return savedInstanceState; } }
public class class_name { public static AceObjectFlags parseValue(final int value) { final AceObjectFlags res = new AceObjectFlags(); res.others = value; for (AceObjectFlags.Flag type : AceObjectFlags.Flag.values()) { if ((value & type.getValue()) == type.getValue()) { res.flags.add(type); res.others ^= type.getValue(); } } return res; } }
public class class_name { public static AceObjectFlags parseValue(final int value) { final AceObjectFlags res = new AceObjectFlags(); res.others = value; for (AceObjectFlags.Flag type : AceObjectFlags.Flag.values()) { if ((value & type.getValue()) == type.getValue()) { res.flags.add(type); // depends on control dependency: [if], data = [none] res.others ^= type.getValue(); // depends on control dependency: [if], data = [none] } } return res; } }
public class class_name { public void endInterval(int lastIndex) { if (isOpen) { currentDetail.setLast(lastIndex); pathDetails.add(currentDetail); } isOpen = false; } }
public class class_name { public void endInterval(int lastIndex) { if (isOpen) { currentDetail.setLast(lastIndex); // depends on control dependency: [if], data = [none] pathDetails.add(currentDetail); // depends on control dependency: [if], data = [none] } isOpen = false; } }
public class class_name { public void setEndTimes(java.util.Collection<DateTimeRange> endTimes) { if (endTimes == null) { this.endTimes = null; return; } this.endTimes = new java.util.ArrayList<DateTimeRange>(endTimes); } }
public class class_name { public void setEndTimes(java.util.Collection<DateTimeRange> endTimes) { if (endTimes == null) { this.endTimes = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.endTimes = new java.util.ArrayList<DateTimeRange>(endTimes); } }
public class class_name { public ElementCollection<EmbeddableAttributes<T>> getOrCreateElementCollection() { List<Node> nodeList = childNode.get("element-collection"); if (nodeList != null && nodeList.size() > 0) { return new ElementCollectionImpl<EmbeddableAttributes<T>>(this, "element-collection", childNode, nodeList.get(0)); } return createElementCollection(); } }
public class class_name { public ElementCollection<EmbeddableAttributes<T>> getOrCreateElementCollection() { List<Node> nodeList = childNode.get("element-collection"); if (nodeList != null && nodeList.size() > 0) { return new ElementCollectionImpl<EmbeddableAttributes<T>>(this, "element-collection", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none] } return createElementCollection(); } }
public class class_name { public static float bound( float ang ) { ang %= GrlConstants.F_PI2; if( ang > GrlConstants.F_PI ) { return ang - GrlConstants.F_PI2; } else if( ang < -GrlConstants.F_PI ) { return ang + GrlConstants.F_PI2; } return ang; } }
public class class_name { public static float bound( float ang ) { ang %= GrlConstants.F_PI2; if( ang > GrlConstants.F_PI ) { return ang - GrlConstants.F_PI2; // depends on control dependency: [if], data = [none] } else if( ang < -GrlConstants.F_PI ) { return ang + GrlConstants.F_PI2; // depends on control dependency: [if], data = [none] } return ang; } }
public class class_name { public boolean printData(PrintWriter out, int iHtmlAttributes) { boolean bFieldsFound = false; String strXmlFilename = this.getProperty(DBParams.XML); // Html page if (strXmlFilename == null) strXmlFilename = this.getProperty(DBParams.TEMPLATE); if (DBConstants.BLANK.equals(strXmlFilename)) strXmlFilename = DBConstants.DEFAULT_HELP_FILE; if (strXmlFilename != null) { if ((strXmlFilename.indexOf(':') == -1) && (strXmlFilename.charAt(0) != '/')) { if (strXmlFilename.indexOf('/') == -1) strXmlFilename = DBConstants.DEFAULT_HELP_FILE.substring(0, DBConstants.DEFAULT_HELP_FILE.lastIndexOf('/') + 1) + strXmlFilename; String strLanguage = ((BaseApplication)this.getTask().getApplication()).getLanguage(false); if ((strLanguage == null) || (strLanguage.equalsIgnoreCase("en"))) strLanguage = Constants.BLANK; if (strLanguage.length() > 0) strLanguage += "/"; strXmlFilename = strLanguage + strXmlFilename; // DBConstants.kxxx; } boolean bHTML = false; if ((strXmlFilename.endsWith(".html")) || (strXmlFilename.endsWith(".htm"))) bHTML = true; if (bHTML) out.println(Utility.startTag(XMLTags.HTML)); InputStream streamIn = this.getTask().getInputStream(strXmlFilename); if (streamIn != null) Utility.transferURLStream(null, null, new InputStreamReader(streamIn), out); else out.println("File not found: " + strXmlFilename + "<br/>"); if (bHTML) out.println(Utility.endTag(XMLTags.HTML)); } else return super.printData(out, HtmlConstants.HTML_DISPLAY); // DO print screen return bFieldsFound; } }
public class class_name { public boolean printData(PrintWriter out, int iHtmlAttributes) { boolean bFieldsFound = false; String strXmlFilename = this.getProperty(DBParams.XML); // Html page if (strXmlFilename == null) strXmlFilename = this.getProperty(DBParams.TEMPLATE); if (DBConstants.BLANK.equals(strXmlFilename)) strXmlFilename = DBConstants.DEFAULT_HELP_FILE; if (strXmlFilename != null) { if ((strXmlFilename.indexOf(':') == -1) && (strXmlFilename.charAt(0) != '/')) { if (strXmlFilename.indexOf('/') == -1) strXmlFilename = DBConstants.DEFAULT_HELP_FILE.substring(0, DBConstants.DEFAULT_HELP_FILE.lastIndexOf('/') + 1) + strXmlFilename; String strLanguage = ((BaseApplication)this.getTask().getApplication()).getLanguage(false); if ((strLanguage == null) || (strLanguage.equalsIgnoreCase("en"))) strLanguage = Constants.BLANK; if (strLanguage.length() > 0) strLanguage += "/"; strXmlFilename = strLanguage + strXmlFilename; // DBConstants.kxxx; // depends on control dependency: [if], data = [none] } boolean bHTML = false; if ((strXmlFilename.endsWith(".html")) || (strXmlFilename.endsWith(".htm"))) bHTML = true; if (bHTML) out.println(Utility.startTag(XMLTags.HTML)); InputStream streamIn = this.getTask().getInputStream(strXmlFilename); if (streamIn != null) Utility.transferURLStream(null, null, new InputStreamReader(streamIn), out); else out.println("File not found: " + strXmlFilename + "<br/>"); if (bHTML) out.println(Utility.endTag(XMLTags.HTML)); } else return super.printData(out, HtmlConstants.HTML_DISPLAY); // DO print screen return bFieldsFound; } }
public class class_name { @Override public String getColumnName(int column) { try { java.util.List<String> signature = results.getSignature(); if (signature != null && column < signature.size()) { return results.getSignature().get(column); } else { return ""; } } catch (Exception e) { e.printStackTrace(); return "ERROR"; } } }
public class class_name { @Override public String getColumnName(int column) { try { java.util.List<String> signature = results.getSignature(); if (signature != null && column < signature.size()) { return results.getSignature().get(column); // depends on control dependency: [if], data = [none] } else { return ""; // depends on control dependency: [if], data = [none] } } catch (Exception e) { e.printStackTrace(); return "ERROR"; } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected Map<String, String> getElementAttributes() { // Preserve order of attributes Map<String, String> attrs = new HashMap<>(); if (this.getParticipantidentity() != null) { attrs.put("participantidentity", this.getParticipantidentity()); } return attrs; } }
public class class_name { protected Map<String, String> getElementAttributes() { // Preserve order of attributes Map<String, String> attrs = new HashMap<>(); if (this.getParticipantidentity() != null) { attrs.put("participantidentity", this.getParticipantidentity()); // depends on control dependency: [if], data = [none] } return attrs; } }
public class class_name { boolean undoChanges() { final State state = stateUpdater.getAndSet(this, State.ROLLBACK_ONLY); if (state == State.COMPLETED || state == State.ROLLBACK_ONLY) { // Was actually completed already return false; } PatchingTaskContext.Mode currentMode = this.mode; mode = PatchingTaskContext.Mode.UNDO; final PatchContentLoader loader = PatchContentLoader.create(miscBackup, null, null); // Undo changes for the identity undoChanges(identityEntry, loader); // TODO maybe check if we need to do something for the layers too !? if (state == State.INVALIDATE || currentMode == PatchingTaskContext.Mode.ROLLBACK) { // For apply the state needs to be invalidate // For rollback the files are invalidated as part of the tasks final PatchingTaskContext.Mode mode = currentMode == PatchingTaskContext.Mode.APPLY ? PatchingTaskContext.Mode.ROLLBACK : PatchingTaskContext.Mode.APPLY; for (final File file : moduleInvalidations) { try { PatchModuleInvalidationUtils.processFile(this, file, mode); } catch (Exception e) { PatchLogger.ROOT_LOGGER.debugf(e, "failed to restore state for %s", file); } } if(!modulesToReenable.isEmpty()) { for (final File file : modulesToReenable) { try { PatchModuleInvalidationUtils.processFile(this, file, PatchingTaskContext.Mode.APPLY); } catch (Exception e) { PatchLogger.ROOT_LOGGER.debugf(e, "failed to restore state for %s", file); } } } if(!modulesToDisable.isEmpty()) { for (final File file : modulesToDisable) { try { PatchModuleInvalidationUtils.processFile(this, file, PatchingTaskContext.Mode.ROLLBACK); } catch (Exception e) { PatchLogger.ROOT_LOGGER.debugf(e, "failed to restore state for %s", file); } } } } return true; } }
public class class_name { boolean undoChanges() { final State state = stateUpdater.getAndSet(this, State.ROLLBACK_ONLY); if (state == State.COMPLETED || state == State.ROLLBACK_ONLY) { // Was actually completed already return false; // depends on control dependency: [if], data = [none] } PatchingTaskContext.Mode currentMode = this.mode; mode = PatchingTaskContext.Mode.UNDO; final PatchContentLoader loader = PatchContentLoader.create(miscBackup, null, null); // Undo changes for the identity undoChanges(identityEntry, loader); // TODO maybe check if we need to do something for the layers too !? if (state == State.INVALIDATE || currentMode == PatchingTaskContext.Mode.ROLLBACK) { // For apply the state needs to be invalidate // For rollback the files are invalidated as part of the tasks final PatchingTaskContext.Mode mode = currentMode == PatchingTaskContext.Mode.APPLY ? PatchingTaskContext.Mode.ROLLBACK : PatchingTaskContext.Mode.APPLY; for (final File file : moduleInvalidations) { try { PatchModuleInvalidationUtils.processFile(this, file, mode); // depends on control dependency: [try], data = [none] } catch (Exception e) { PatchLogger.ROOT_LOGGER.debugf(e, "failed to restore state for %s", file); } // depends on control dependency: [catch], data = [none] } if(!modulesToReenable.isEmpty()) { for (final File file : modulesToReenable) { try { PatchModuleInvalidationUtils.processFile(this, file, PatchingTaskContext.Mode.APPLY); // depends on control dependency: [try], data = [none] } catch (Exception e) { PatchLogger.ROOT_LOGGER.debugf(e, "failed to restore state for %s", file); } // depends on control dependency: [catch], data = [none] } } if(!modulesToDisable.isEmpty()) { for (final File file : modulesToDisable) { try { PatchModuleInvalidationUtils.processFile(this, file, PatchingTaskContext.Mode.ROLLBACK); // depends on control dependency: [try], data = [none] } catch (Exception e) { PatchLogger.ROOT_LOGGER.debugf(e, "failed to restore state for %s", file); } // depends on control dependency: [catch], data = [none] } } } return true; } }
public class class_name { @Override public void setStatusCode(int code) { StatusCodes val = null; try { val = StatusCodes.getByOrdinal(code); } catch (IndexOutOfBoundsException e) { // no FFDC required // nothing to do, just make the undefined value below } // this could be null because the ordinal lookup returned an empty // status code, or because it was out of bounds if (null == val) { val = StatusCodes.makeUndefinedValue(code); } setStatusCode(val); } }
public class class_name { @Override public void setStatusCode(int code) { StatusCodes val = null; try { val = StatusCodes.getByOrdinal(code); // depends on control dependency: [try], data = [none] } catch (IndexOutOfBoundsException e) { // no FFDC required // nothing to do, just make the undefined value below } // depends on control dependency: [catch], data = [none] // this could be null because the ordinal lookup returned an empty // status code, or because it was out of bounds if (null == val) { val = StatusCodes.makeUndefinedValue(code); // depends on control dependency: [if], data = [none] } setStatusCode(val); } }
public class class_name { public void addModifier(String modifier) { if (!Strings.isEmpty(modifier)) { this.sarlBehavior.getModifiers().add(modifier); } } }
public class class_name { public void addModifier(String modifier) { if (!Strings.isEmpty(modifier)) { this.sarlBehavior.getModifiers().add(modifier); // depends on control dependency: [if], data = [none] } } }
public class class_name { public EventQueueDefinition getQueueForClass(Class<? extends Event> clazz) { for (EventQueueDefinition d : definitions) { if (d.getEventType() == clazz) { return d; } } return null; } }
public class class_name { public EventQueueDefinition getQueueForClass(Class<? extends Event> clazz) { for (EventQueueDefinition d : definitions) { if (d.getEventType() == clazz) { return d; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public boolean recordExpose() { if (!currentInfo.isExpose()) { currentInfo.setExpose(true); populated = true; return true; } else { return false; } } }
public class class_name { public boolean recordExpose() { if (!currentInfo.isExpose()) { currentInfo.setExpose(true); // depends on control dependency: [if], data = [none] populated = true; // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public String stem(String token) { if (token != null && token.length() > 3 && token.endsWith("s")) { return token.substring(0, token.length() - 1); } return token; } }
public class class_name { @Override public String stem(String token) { if (token != null && token.length() > 3 && token.endsWith("s")) { return token.substring(0, token.length() - 1); // depends on control dependency: [if], data = [none] } return token; } }
public class class_name { @Override public void setDefinition(PluginDefinition definition) { super.setDefinition(definition); if (definition != null) { container.addClass("cwf-plugin-" + definition.getId()); shell.registerPlugin(this); } } }
public class class_name { @Override public void setDefinition(PluginDefinition definition) { super.setDefinition(definition); if (definition != null) { container.addClass("cwf-plugin-" + definition.getId()); // depends on control dependency: [if], data = [none] shell.registerPlugin(this); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(Logging logging, ProtocolMarshaller protocolMarshaller) { if (logging == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(logging.getClusterLogging(), CLUSTERLOGGING_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(Logging logging, ProtocolMarshaller protocolMarshaller) { if (logging == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(logging.getClusterLogging(), CLUSTERLOGGING_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 { @Override public synchronized void start() { if (monitorActive) { return; } lastTime.set(milliSecondFromNano()); long localCheckInterval = checkInterval.get(); if (localCheckInterval > 0) { monitorActive = true; monitor = new MixedTrafficMonitoringTask((GlobalChannelTrafficShapingHandler) trafficShapingHandler, this); scheduledFuture = executor.schedule(monitor, localCheckInterval, TimeUnit.MILLISECONDS); } } }
public class class_name { @Override public synchronized void start() { if (monitorActive) { return; // depends on control dependency: [if], data = [none] } lastTime.set(milliSecondFromNano()); long localCheckInterval = checkInterval.get(); if (localCheckInterval > 0) { monitorActive = true; // depends on control dependency: [if], data = [none] monitor = new MixedTrafficMonitoringTask((GlobalChannelTrafficShapingHandler) trafficShapingHandler, this); // depends on control dependency: [if], data = [none] scheduledFuture = executor.schedule(monitor, localCheckInterval, TimeUnit.MILLISECONDS); // depends on control dependency: [if], data = [none] } } }
public class class_name { private boolean addHisoricalRecord(HistoricalRecord historicalRecord) { final boolean added = mHistoricalRecords.add(historicalRecord); if (added) { mHistoricalRecordsChanged = true; pruneExcessiveHistoricalRecordsIfNeeded(); persistHistoricalDataIfNeeded(); sortActivitiesIfNeeded(); notifyChanged(); } return added; } }
public class class_name { private boolean addHisoricalRecord(HistoricalRecord historicalRecord) { final boolean added = mHistoricalRecords.add(historicalRecord); if (added) { mHistoricalRecordsChanged = true; // depends on control dependency: [if], data = [none] pruneExcessiveHistoricalRecordsIfNeeded(); // depends on control dependency: [if], data = [none] persistHistoricalDataIfNeeded(); // depends on control dependency: [if], data = [none] sortActivitiesIfNeeded(); // depends on control dependency: [if], data = [none] notifyChanged(); // depends on control dependency: [if], data = [none] } return added; } }
public class class_name { private static String extractArguments( final ProfileOption[] profiles ) { final StringBuilder argument = new StringBuilder(); if( profiles != null && profiles.length > 0 ) { for( ProfileOption profile : profiles ) { if( profile != null && profile.getProfile() != null && profile.getProfile().length() > 0 ) { if( argument.length() == 0 ) { argument.append( "--profiles=" ); } else { argument.append( "," ); } argument.append( profile.getProfile() ); } } } return argument.toString(); } }
public class class_name { private static String extractArguments( final ProfileOption[] profiles ) { final StringBuilder argument = new StringBuilder(); if( profiles != null && profiles.length > 0 ) { for( ProfileOption profile : profiles ) { if( profile != null && profile.getProfile() != null && profile.getProfile().length() > 0 ) { if( argument.length() == 0 ) { argument.append( "--profiles=" ); // depends on control dependency: [if], data = [none] } else { argument.append( "," ); // depends on control dependency: [if], data = [none] } argument.append( profile.getProfile() ); // depends on control dependency: [if], data = [( profile] } } } return argument.toString(); } }
public class class_name { private boolean isTryRecoverSucceeded(ConcurrentMap<Integer, Long> brokenSequences) { int numberOfBrokenSequences = brokenSequences.size(); InvokerWrapper invokerWrapper = context.getInvokerWrapper(); SubscriberContext subscriberContext = context.getSubscriberContext(); SubscriberContextSupport subscriberContextSupport = subscriberContext.getSubscriberContextSupport(); List<Future<Object>> futures = new ArrayList<>(numberOfBrokenSequences); for (Map.Entry<Integer, Long> entry : brokenSequences.entrySet()) { Integer partitionId = entry.getKey(); Long sequence = entry.getValue(); Object recoveryOperation = subscriberContextSupport.createRecoveryOperation(mapName, cacheId, sequence, partitionId); Future<Object> future = (Future<Object>) invokerWrapper.invokeOnPartitionOwner(recoveryOperation, partitionId); futures.add(future); } Collection<Object> results = FutureUtil.returnWithDeadline(futures, 1, MINUTES); int successCount = 0; for (Object object : results) { Boolean resolvedResponse = subscriberContextSupport.resolveResponseForRecoveryOperation(object); if (TRUE.equals(resolvedResponse)) { successCount++; } } return successCount == numberOfBrokenSequences; } }
public class class_name { private boolean isTryRecoverSucceeded(ConcurrentMap<Integer, Long> brokenSequences) { int numberOfBrokenSequences = brokenSequences.size(); InvokerWrapper invokerWrapper = context.getInvokerWrapper(); SubscriberContext subscriberContext = context.getSubscriberContext(); SubscriberContextSupport subscriberContextSupport = subscriberContext.getSubscriberContextSupport(); List<Future<Object>> futures = new ArrayList<>(numberOfBrokenSequences); for (Map.Entry<Integer, Long> entry : brokenSequences.entrySet()) { Integer partitionId = entry.getKey(); Long sequence = entry.getValue(); Object recoveryOperation = subscriberContextSupport.createRecoveryOperation(mapName, cacheId, sequence, partitionId); Future<Object> future = (Future<Object>) invokerWrapper.invokeOnPartitionOwner(recoveryOperation, partitionId); futures.add(future); // depends on control dependency: [for], data = [none] } Collection<Object> results = FutureUtil.returnWithDeadline(futures, 1, MINUTES); int successCount = 0; for (Object object : results) { Boolean resolvedResponse = subscriberContextSupport.resolveResponseForRecoveryOperation(object); if (TRUE.equals(resolvedResponse)) { successCount++; // depends on control dependency: [if], data = [none] } } return successCount == numberOfBrokenSequences; } }
public class class_name { public static void fire(final HasRefreshedHandlers source) { if (TYPE != null) { RefreshedEvent event = new RefreshedEvent(); source.fireEvent(event); } } }
public class class_name { public static void fire(final HasRefreshedHandlers source) { if (TYPE != null) { RefreshedEvent event = new RefreshedEvent(); source.fireEvent(event); // depends on control dependency: [if], data = [none] } } }
public class class_name { public EClass getIfcConstraintClassificationRelationship() { if (ifcConstraintClassificationRelationshipEClass == null) { ifcConstraintClassificationRelationshipEClass = (EClass) EPackage.Registry.INSTANCE .getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(109); } return ifcConstraintClassificationRelationshipEClass; } }
public class class_name { public EClass getIfcConstraintClassificationRelationship() { if (ifcConstraintClassificationRelationshipEClass == null) { ifcConstraintClassificationRelationshipEClass = (EClass) EPackage.Registry.INSTANCE .getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(109); // depends on control dependency: [if], data = [none] } return ifcConstraintClassificationRelationshipEClass; } }
public class class_name { private void boundaryAreaInteriorPoint_(int cluster, int id_a, int id_b) { if (m_matrix[MatrixPredicate.BoundaryInterior] == 0) return; int clusterParentage = m_topo_graph.getClusterParentage(cluster); if ((clusterParentage & id_a) != 0 && (clusterParentage & id_b) != 0) { m_matrix[MatrixPredicate.BoundaryInterior] = 0; } } }
public class class_name { private void boundaryAreaInteriorPoint_(int cluster, int id_a, int id_b) { if (m_matrix[MatrixPredicate.BoundaryInterior] == 0) return; int clusterParentage = m_topo_graph.getClusterParentage(cluster); if ((clusterParentage & id_a) != 0 && (clusterParentage & id_b) != 0) { m_matrix[MatrixPredicate.BoundaryInterior] = 0; // depends on control dependency: [if], data = [none] } } }
public class class_name { private static void addUniqueIdAndGroupsForUser(String securityName, Hashtable<String, Object> credData, String appRealm) // 675924 throws WSSecurityException, RemoteException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "addUniqueIdAndGroupsForUser", securityName); } GetRegistry action = new GetRegistry(appRealm); UserRegistry registry = null; try { registry = AccessController.doPrivileged(action); } catch (PrivilegedActionException pae) { Exception ex = pae.getException(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "addUniqueIdAndGroupsForUser"); } if (ex instanceof WSSecurityException) { throw (WSSecurityException) ex; } else { // This means an unexpected runtime exception is wrapped in the PrivilegedActionException throw new WSSecurityException(ex); } } if (registry.isValidUser(securityName)) { String uniqueId = registry.getUniqueUserId(securityName); String uidGrp = stripRealm(uniqueId, appRealm); // 669627 // 673415 List<?> groups = null; try { groups = registry.getUniqueGroupIds(uidGrp); // 673415 } catch (EntryNotFoundException ex) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Exception is ", ex); Tr.warning(tc, "NO_GROUPS_FOR_UNIQUEID_J2CA0679", uidGrp); // 673415 } updateCustomHashtable(credData, appRealm, uniqueId, securityName, groups); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Added uniqueId: " + uniqueId + " and uniqueGroups: " + groups); } else { String message = getNLS() .getFormattedMessage("INVALID_USER_NAME_IN_PRINCIPAL_J2CA0670", new Object[] { securityName }, "J2CA0670E: The WorkManager was unable to establish the security context for the Work instance, " + "because the resource adapter provided a caller identity " + securityName + ", which does not belong to the security " + "domain associated with the application."); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "addUniqueIdAndGroupsForUser"); } throw new WSSecurityException(message); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "addUniqueIdAndGroupsForUser"); } } }
public class class_name { private static void addUniqueIdAndGroupsForUser(String securityName, Hashtable<String, Object> credData, String appRealm) // 675924 throws WSSecurityException, RemoteException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "addUniqueIdAndGroupsForUser", securityName); } GetRegistry action = new GetRegistry(appRealm); UserRegistry registry = null; try { registry = AccessController.doPrivileged(action); } catch (PrivilegedActionException pae) { Exception ex = pae.getException(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "addUniqueIdAndGroupsForUser"); // depends on control dependency: [if], data = [none] } if (ex instanceof WSSecurityException) { throw (WSSecurityException) ex; } else { // This means an unexpected runtime exception is wrapped in the PrivilegedActionException throw new WSSecurityException(ex); } } if (registry.isValidUser(securityName)) { String uniqueId = registry.getUniqueUserId(securityName); String uidGrp = stripRealm(uniqueId, appRealm); // 669627 // 673415 List<?> groups = null; try { groups = registry.getUniqueGroupIds(uidGrp); // 673415 // depends on control dependency: [try], data = [none] } catch (EntryNotFoundException ex) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Exception is ", ex); Tr.warning(tc, "NO_GROUPS_FOR_UNIQUEID_J2CA0679", uidGrp); // 673415 } // depends on control dependency: [catch], data = [none] updateCustomHashtable(credData, appRealm, uniqueId, securityName, groups); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Added uniqueId: " + uniqueId + " and uniqueGroups: " + groups); } else { String message = getNLS() .getFormattedMessage("INVALID_USER_NAME_IN_PRINCIPAL_J2CA0670", new Object[] { securityName }, "J2CA0670E: The WorkManager was unable to establish the security context for the Work instance, " + "because the resource adapter provided a caller identity " + securityName + ", which does not belong to the security " + "domain associated with the application."); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "addUniqueIdAndGroupsForUser"); // depends on control dependency: [if], data = [none] } throw new WSSecurityException(message); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "addUniqueIdAndGroupsForUser"); } } }
public class class_name { public void redirectToApplicationPath(String path) { if ("".equals(applicationPath)) { // application path is the root redirect(path); } else { redirect(applicationPath + StringUtils.addStart(path, "/")); } } }
public class class_name { public void redirectToApplicationPath(String path) { if ("".equals(applicationPath)) { // application path is the root redirect(path); // depends on control dependency: [if], data = [none] } else { redirect(applicationPath + StringUtils.addStart(path, "/")); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String loadFileFromFTPServer(String hostName, Integer port, String userName, String password, String filePath, int numberOfLines) { String result = null; FTPClient ftpClient = new FTPClient(); InputStream inputStream = null; String errorMessage = "Unable to connect and download file '%s' from FTP server '%s'."; try { connectAndLoginOnFTPServer(ftpClient, hostName, port, userName, password); // load file into string ftpClient.enterLocalPassiveMode(); inputStream = ftpClient.retrieveFileStream(filePath); validatResponse(ftpClient); result = FileUtil.streamToString(inputStream, filePath, numberOfLines); ftpClient.completePendingCommand(); } catch (IOException ex) { throw new RuntimeException(String.format(errorMessage, filePath, hostName), ex); } finally { closeInputStream(inputStream); disconnectAndLogoutFromFTPServer(ftpClient, hostName); } return result; } }
public class class_name { public static String loadFileFromFTPServer(String hostName, Integer port, String userName, String password, String filePath, int numberOfLines) { String result = null; FTPClient ftpClient = new FTPClient(); InputStream inputStream = null; String errorMessage = "Unable to connect and download file '%s' from FTP server '%s'."; try { connectAndLoginOnFTPServer(ftpClient, hostName, port, userName, password); // depends on control dependency: [try], data = [none] // load file into string ftpClient.enterLocalPassiveMode(); // depends on control dependency: [try], data = [none] inputStream = ftpClient.retrieveFileStream(filePath); // depends on control dependency: [try], data = [none] validatResponse(ftpClient); // depends on control dependency: [try], data = [none] result = FileUtil.streamToString(inputStream, filePath, numberOfLines); // depends on control dependency: [try], data = [none] ftpClient.completePendingCommand(); // depends on control dependency: [try], data = [none] } catch (IOException ex) { throw new RuntimeException(String.format(errorMessage, filePath, hostName), ex); } finally { // depends on control dependency: [catch], data = [none] closeInputStream(inputStream); disconnectAndLogoutFromFTPServer(ftpClient, hostName); } return result; } }
public class class_name { public void marshall(DescribeFileSystemsRequest describeFileSystemsRequest, ProtocolMarshaller protocolMarshaller) { if (describeFileSystemsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeFileSystemsRequest.getFileSystemIds(), FILESYSTEMIDS_BINDING); protocolMarshaller.marshall(describeFileSystemsRequest.getMaxResults(), MAXRESULTS_BINDING); protocolMarshaller.marshall(describeFileSystemsRequest.getNextToken(), NEXTTOKEN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DescribeFileSystemsRequest describeFileSystemsRequest, ProtocolMarshaller protocolMarshaller) { if (describeFileSystemsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeFileSystemsRequest.getFileSystemIds(), FILESYSTEMIDS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeFileSystemsRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeFileSystemsRequest.getNextToken(), NEXTTOKEN_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 { @VisibleForTesting static String makeTargetStringForDirectAddress(SocketAddress address) { try { return new URI(DIRECT_ADDRESS_SCHEME, "", "/" + address, null).toString(); } catch (URISyntaxException e) { // It should not happen. throw new RuntimeException(e); } } }
public class class_name { @VisibleForTesting static String makeTargetStringForDirectAddress(SocketAddress address) { try { return new URI(DIRECT_ADDRESS_SCHEME, "", "/" + address, null).toString(); // depends on control dependency: [try], data = [none] } catch (URISyntaxException e) { // It should not happen. throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void apply(Mutation mutation, boolean writeCommitLog, boolean updateIndexes) { try (OpOrder.Group opGroup = writeOrder.start()) { // write the mutation to the commitlog and memtables ReplayPosition replayPosition = null; if (writeCommitLog) { Tracing.trace("Appending to commitlog"); replayPosition = CommitLog.instance.add(mutation); } DecoratedKey key = StorageService.getPartitioner().decorateKey(mutation.key()); for (ColumnFamily cf : mutation.getColumnFamilies()) { ColumnFamilyStore cfs = columnFamilyStores.get(cf.id()); if (cfs == null) { logger.error("Attempting to mutate non-existant column family {}", cf.id()); continue; } Tracing.trace("Adding to {} memtable", cf.metadata().cfName); SecondaryIndexManager.Updater updater = updateIndexes ? cfs.indexManager.updaterFor(key, cf, opGroup) : SecondaryIndexManager.nullUpdater; cfs.apply(key, cf, updater, opGroup, replayPosition); } } } }
public class class_name { public void apply(Mutation mutation, boolean writeCommitLog, boolean updateIndexes) { try (OpOrder.Group opGroup = writeOrder.start()) { // write the mutation to the commitlog and memtables ReplayPosition replayPosition = null; if (writeCommitLog) { Tracing.trace("Appending to commitlog"); // depends on control dependency: [if], data = [none] replayPosition = CommitLog.instance.add(mutation); // depends on control dependency: [if], data = [none] } DecoratedKey key = StorageService.getPartitioner().decorateKey(mutation.key()); for (ColumnFamily cf : mutation.getColumnFamilies()) { ColumnFamilyStore cfs = columnFamilyStores.get(cf.id()); if (cfs == null) { logger.error("Attempting to mutate non-existant column family {}", cf.id()); // depends on control dependency: [if], data = [none] continue; } Tracing.trace("Adding to {} memtable", cf.metadata().cfName); // depends on control dependency: [for], data = [cf] SecondaryIndexManager.Updater updater = updateIndexes ? cfs.indexManager.updaterFor(key, cf, opGroup) : SecondaryIndexManager.nullUpdater; cfs.apply(key, cf, updater, opGroup, replayPosition); // depends on control dependency: [for], data = [cf] } } } }
public class class_name { public static IAuditManager getInstance() { IAuditManager result = auditManager; if(result == null) { synchronized (AuditManager.class) { result = auditManager; if(result == null) { Context.init(); auditManager = result = new AuditManager(); } } } return result; } }
public class class_name { public static IAuditManager getInstance() { IAuditManager result = auditManager; if(result == null) { synchronized (AuditManager.class) { // depends on control dependency: [if], data = [none] result = auditManager; if(result == null) { Context.init(); // depends on control dependency: [if], data = [none] auditManager = result = new AuditManager(); // depends on control dependency: [if], data = [none] } } } return result; } }
public class class_name { protected void incrementRequestCount(ResourceType type, int delta) { Context c = getContext(type); int newRequestCount = c.requestCount + delta; c.requestCount = newRequestCount; if (newRequestCount > c.maxConcurrentRequestCount) { c.maxConcurrentRequestCount = newRequestCount; } } }
public class class_name { protected void incrementRequestCount(ResourceType type, int delta) { Context c = getContext(type); int newRequestCount = c.requestCount + delta; c.requestCount = newRequestCount; if (newRequestCount > c.maxConcurrentRequestCount) { c.maxConcurrentRequestCount = newRequestCount; // depends on control dependency: [if], data = [none] } } }
public class class_name { public List<JAXBElement<? extends AbstractCurveType>> get_Curve() { if (_Curve == null) { _Curve = new ArrayList<JAXBElement<? extends AbstractCurveType>>(); } return this._Curve; } }
public class class_name { public List<JAXBElement<? extends AbstractCurveType>> get_Curve() { if (_Curve == null) { _Curve = new ArrayList<JAXBElement<? extends AbstractCurveType>>(); // depends on control dependency: [if], data = [none] } return this._Curve; } }
public class class_name { protected final List<ExtensionFunction> initExtensions(final WebSocketHttpExchange exchange) { String extHeader = exchange.getResponseHeaders().get(Headers.SEC_WEB_SOCKET_EXTENSIONS_STRING) != null ? exchange.getResponseHeaders().get(Headers.SEC_WEB_SOCKET_EXTENSIONS_STRING).get(0) : null; List<ExtensionFunction> negotiated = new ArrayList<>(); if (extHeader != null) { List<WebSocketExtension> extensions = WebSocketExtension.parse(extHeader); if (extensions != null && !extensions.isEmpty()) { for (WebSocketExtension ext : extensions) { for (ExtensionHandshake extHandshake : availableExtensions) { if (extHandshake.getName().equals(ext.getName())) { negotiated.add(extHandshake.create()); } } } } } return negotiated; } }
public class class_name { protected final List<ExtensionFunction> initExtensions(final WebSocketHttpExchange exchange) { String extHeader = exchange.getResponseHeaders().get(Headers.SEC_WEB_SOCKET_EXTENSIONS_STRING) != null ? exchange.getResponseHeaders().get(Headers.SEC_WEB_SOCKET_EXTENSIONS_STRING).get(0) : null; List<ExtensionFunction> negotiated = new ArrayList<>(); if (extHeader != null) { List<WebSocketExtension> extensions = WebSocketExtension.parse(extHeader); if (extensions != null && !extensions.isEmpty()) { for (WebSocketExtension ext : extensions) { for (ExtensionHandshake extHandshake : availableExtensions) { if (extHandshake.getName().equals(ext.getName())) { negotiated.add(extHandshake.create()); // depends on control dependency: [if], data = [none] } } } } } return negotiated; } }
public class class_name { public void marshall(ContextDataType contextDataType, ProtocolMarshaller protocolMarshaller) { if (contextDataType == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(contextDataType.getIpAddress(), IPADDRESS_BINDING); protocolMarshaller.marshall(contextDataType.getServerName(), SERVERNAME_BINDING); protocolMarshaller.marshall(contextDataType.getServerPath(), SERVERPATH_BINDING); protocolMarshaller.marshall(contextDataType.getHttpHeaders(), HTTPHEADERS_BINDING); protocolMarshaller.marshall(contextDataType.getEncodedData(), ENCODEDDATA_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ContextDataType contextDataType, ProtocolMarshaller protocolMarshaller) { if (contextDataType == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(contextDataType.getIpAddress(), IPADDRESS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(contextDataType.getServerName(), SERVERNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(contextDataType.getServerPath(), SERVERPATH_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(contextDataType.getHttpHeaders(), HTTPHEADERS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(contextDataType.getEncodedData(), ENCODEDDATA_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 Boolean castBoolean(Object o) { if (o == null) { return null; } if (o instanceof Boolean) { return (Boolean) o; } else if (o instanceof String) { try { return Boolean.parseBoolean((String) o); } catch (IllegalArgumentException e) { return null; } } return null; } }
public class class_name { public static Boolean castBoolean(Object o) { if (o == null) { return null; // depends on control dependency: [if], data = [none] } if (o instanceof Boolean) { return (Boolean) o; // depends on control dependency: [if], data = [none] } else if (o instanceof String) { try { return Boolean.parseBoolean((String) o); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException e) { return null; } // depends on control dependency: [catch], data = [none] } return null; } }
public class class_name { public static Bitmap cropBitmap(Bitmap sourceBitmap, Rect bounds) { if ((bounds == null) || bounds.isEmpty()) { return null; } return cropBitmap(sourceBitmap, bounds.left, bounds.top, bounds.width(), bounds.height()); } }
public class class_name { public static Bitmap cropBitmap(Bitmap sourceBitmap, Rect bounds) { if ((bounds == null) || bounds.isEmpty()) { return null; // depends on control dependency: [if], data = [none] } return cropBitmap(sourceBitmap, bounds.left, bounds.top, bounds.width(), bounds.height()); } }