code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public DateTimeFormatterBuilder appendSignedDecimal( DateTimeFieldType fieldType, int minDigits, int maxDigits) { if (fieldType == null) { throw new IllegalArgumentException("Field type must not be null"); } if (maxDigits < minDigits) { maxDigits = minDigits; } if (minDigits < 0 || maxDigits <= 0) { throw new IllegalArgumentException(); } if (minDigits <= 1) { return append0(new UnpaddedNumber(fieldType, maxDigits, true)); } else { return append0(new PaddedNumber(fieldType, maxDigits, true, minDigits)); } } }
public class class_name { public DateTimeFormatterBuilder appendSignedDecimal( DateTimeFieldType fieldType, int minDigits, int maxDigits) { if (fieldType == null) { throw new IllegalArgumentException("Field type must not be null"); } if (maxDigits < minDigits) { maxDigits = minDigits; // depends on control dependency: [if], data = [none] } if (minDigits < 0 || maxDigits <= 0) { throw new IllegalArgumentException(); } if (minDigits <= 1) { return append0(new UnpaddedNumber(fieldType, maxDigits, true)); // depends on control dependency: [if], data = [none] } else { return append0(new PaddedNumber(fieldType, maxDigits, true, minDigits)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static double dirichletPdf(double[] pi, double a) { double probability=1.0; int piLength=pi.length; for(int i=0;i<piLength;++i) { probability*=Math.pow(pi[i], a-1); } double sumAi=piLength*a; double productGammaAi=Math.pow(gamma(a), piLength); probability*=gamma(sumAi)/productGammaAi; return probability; } }
public class class_name { public static double dirichletPdf(double[] pi, double a) { double probability=1.0; int piLength=pi.length; for(int i=0;i<piLength;++i) { probability*=Math.pow(pi[i], a-1); // depends on control dependency: [for], data = [i] } double sumAi=piLength*a; double productGammaAi=Math.pow(gamma(a), piLength); probability*=gamma(sumAi)/productGammaAi; return probability; } }
public class class_name { public void marshall(AutoScalingPolicyDescription autoScalingPolicyDescription, ProtocolMarshaller protocolMarshaller) { if (autoScalingPolicyDescription == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(autoScalingPolicyDescription.getPolicyName(), POLICYNAME_BINDING); protocolMarshaller.marshall(autoScalingPolicyDescription.getTargetTrackingScalingPolicyConfiguration(), TARGETTRACKINGSCALINGPOLICYCONFIGURATION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(AutoScalingPolicyDescription autoScalingPolicyDescription, ProtocolMarshaller protocolMarshaller) { if (autoScalingPolicyDescription == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(autoScalingPolicyDescription.getPolicyName(), POLICYNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(autoScalingPolicyDescription.getTargetTrackingScalingPolicyConfiguration(), TARGETTRACKINGSCALINGPOLICYCONFIGURATION_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 List<Triangle> findTriangleNeighborhood(Triangle firstTriangle, Vector3 point) { List<Triangle> triangles = new ArrayList<Triangle>(30); triangles.add(firstTriangle); Triangle prevTriangle = null; Triangle currentTriangle = firstTriangle; Triangle nextTriangle = currentTriangle.nextNeighbor(point, prevTriangle); while (!nextTriangle.equals(firstTriangle)) { //the point is on the perimeter if(nextTriangle.isHalfplane()) { return null; } triangles.add(nextTriangle); prevTriangle = currentTriangle; currentTriangle = nextTriangle; nextTriangle = currentTriangle.nextNeighbor(point, prevTriangle); } return triangles; } }
public class class_name { public List<Triangle> findTriangleNeighborhood(Triangle firstTriangle, Vector3 point) { List<Triangle> triangles = new ArrayList<Triangle>(30); triangles.add(firstTriangle); Triangle prevTriangle = null; Triangle currentTriangle = firstTriangle; Triangle nextTriangle = currentTriangle.nextNeighbor(point, prevTriangle); while (!nextTriangle.equals(firstTriangle)) { //the point is on the perimeter if(nextTriangle.isHalfplane()) { return null; // depends on control dependency: [if], data = [none] } triangles.add(nextTriangle); // depends on control dependency: [while], data = [none] prevTriangle = currentTriangle; // depends on control dependency: [while], data = [none] currentTriangle = nextTriangle; // depends on control dependency: [while], data = [none] nextTriangle = currentTriangle.nextNeighbor(point, prevTriangle); // depends on control dependency: [while], data = [none] } return triangles; } }
public class class_name { protected void configure(final T builder, final String name) { configureKeepAlive(builder, name); configureSecurity(builder, name); configureLimits(builder, name); configureCompression(builder, name); for (final GrpcChannelConfigurer channelConfigurer : this.channelConfigurers) { channelConfigurer.accept(builder, name); } } }
public class class_name { protected void configure(final T builder, final String name) { configureKeepAlive(builder, name); configureSecurity(builder, name); configureLimits(builder, name); configureCompression(builder, name); for (final GrpcChannelConfigurer channelConfigurer : this.channelConfigurers) { channelConfigurer.accept(builder, name); // depends on control dependency: [for], data = [channelConfigurer] } } }
public class class_name { public ActiveTrustedSigners withItems(Signer... items) { if (this.items == null) { setItems(new com.amazonaws.internal.SdkInternalList<Signer>(items.length)); } for (Signer ele : items) { this.items.add(ele); } return this; } }
public class class_name { public ActiveTrustedSigners withItems(Signer... items) { if (this.items == null) { setItems(new com.amazonaws.internal.SdkInternalList<Signer>(items.length)); // depends on control dependency: [if], data = [none] } for (Signer ele : items) { this.items.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private void shutdownGracefully(final Iterator<EventExecutorGroup> iterator) { if (iterator.hasNext()) { EventExecutorGroup group = iterator.next(); if (!group.isShuttingDown()) { group.shutdownGracefully().addListener(future -> { if (!future.isSuccess()) { //log.debug("shutdown of {} resulted in exception", group, future.cause()); } shutdownGracefully(iterator); }); } } } }
public class class_name { private void shutdownGracefully(final Iterator<EventExecutorGroup> iterator) { if (iterator.hasNext()) { EventExecutorGroup group = iterator.next(); if (!group.isShuttingDown()) { group.shutdownGracefully().addListener(future -> { if (!future.isSuccess()) { //log.debug("shutdown of {} resulted in exception", group, future.cause()); } shutdownGracefully(iterator); // depends on control dependency: [if], data = [none] }); } } } }
public class class_name { public void onNotify(Notify ntfy, SubscriptionClientChildSbbLocalObject subscriptionChild) { // compile diff if (ntfy.getStatus().equals(SubscriptionStatus.terminated)) { try { final String notifier = ntfy.getNotifier(); subscriptionChild.remove(); getParent() .subscriptionTerminated( (XDMClientChildSbbLocalObject) this.sbbContext .getSbbLocalObject(), notifier, ntfy.getTerminationReason()); } catch (Exception e) { tracer.severe("Unexpected exception on callback!", e); } } else { // cast is safe, cause we expect diff and check MIME XcapDiff diff = null; if (ntfy != null) { try { diff = (XcapDiff) xcapDiffJaxbContext.createUnmarshaller() .unmarshal(new StringReader(ntfy.getContent())); } catch (Exception e) { tracer.severe("Failed to parse diff!", e); } } getParent().subscriptionNotification(diff, ntfy.getStatus()); } } }
public class class_name { public void onNotify(Notify ntfy, SubscriptionClientChildSbbLocalObject subscriptionChild) { // compile diff if (ntfy.getStatus().equals(SubscriptionStatus.terminated)) { try { final String notifier = ntfy.getNotifier(); subscriptionChild.remove(); // depends on control dependency: [try], data = [none] getParent() .subscriptionTerminated( (XDMClientChildSbbLocalObject) this.sbbContext .getSbbLocalObject(), notifier, ntfy.getTerminationReason()); // depends on control dependency: [try], data = [none] } catch (Exception e) { tracer.severe("Unexpected exception on callback!", e); } // depends on control dependency: [catch], data = [none] } else { // cast is safe, cause we expect diff and check MIME XcapDiff diff = null; if (ntfy != null) { try { diff = (XcapDiff) xcapDiffJaxbContext.createUnmarshaller() .unmarshal(new StringReader(ntfy.getContent())); // depends on control dependency: [try], data = [none] } catch (Exception e) { tracer.severe("Failed to parse diff!", e); } // depends on control dependency: [catch], data = [none] } getParent().subscriptionNotification(diff, ntfy.getStatus()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(SimulationJobSummary simulationJobSummary, ProtocolMarshaller protocolMarshaller) { if (simulationJobSummary == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(simulationJobSummary.getArn(), ARN_BINDING); protocolMarshaller.marshall(simulationJobSummary.getLastUpdatedAt(), LASTUPDATEDAT_BINDING); protocolMarshaller.marshall(simulationJobSummary.getName(), NAME_BINDING); protocolMarshaller.marshall(simulationJobSummary.getStatus(), STATUS_BINDING); protocolMarshaller.marshall(simulationJobSummary.getSimulationApplicationNames(), SIMULATIONAPPLICATIONNAMES_BINDING); protocolMarshaller.marshall(simulationJobSummary.getRobotApplicationNames(), ROBOTAPPLICATIONNAMES_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(SimulationJobSummary simulationJobSummary, ProtocolMarshaller protocolMarshaller) { if (simulationJobSummary == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(simulationJobSummary.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(simulationJobSummary.getLastUpdatedAt(), LASTUPDATEDAT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(simulationJobSummary.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(simulationJobSummary.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(simulationJobSummary.getSimulationApplicationNames(), SIMULATIONAPPLICATIONNAMES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(simulationJobSummary.getRobotApplicationNames(), ROBOTAPPLICATIONNAMES_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected synchronized void firstScan(List<String> scanPackageList) { // 该函数不能调用两次 if (isFirstInit) { LOGGER.info("DisConfMgr has been init, ignore........"); return; } // // // try { // 导入配置 ConfigMgr.init(); LOGGER.info("******************************* DISCONF START FIRST SCAN *******************************"); // registry Registry registry = RegistryFactory.getSpringRegistry(applicationContext); // 扫描器 scanMgr = ScanFactory.getScanMgr(registry); // 第一次扫描并入库 scanMgr.firstScan(scanPackageList); // 获取数据/注入/Watch disconfCoreMgr = DisconfCoreFactory.getDisconfCoreMgr(registry); disconfCoreMgr.process(); // isFirstInit = true; LOGGER.info("******************************* DISCONF END FIRST SCAN *******************************"); } catch (Exception e) { LOGGER.error(e.toString(), e); } } }
public class class_name { protected synchronized void firstScan(List<String> scanPackageList) { // 该函数不能调用两次 if (isFirstInit) { LOGGER.info("DisConfMgr has been init, ignore........"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // // // try { // 导入配置 ConfigMgr.init(); // depends on control dependency: [try], data = [none] LOGGER.info("******************************* DISCONF START FIRST SCAN *******************************"); // depends on control dependency: [try], data = [none] // depends on control dependency: [try], data = [none] // registry Registry registry = RegistryFactory.getSpringRegistry(applicationContext); // 扫描器 scanMgr = ScanFactory.getScanMgr(registry); // depends on control dependency: [try], data = [none] // 第一次扫描并入库 scanMgr.firstScan(scanPackageList); // depends on control dependency: [try], data = [none] // 获取数据/注入/Watch disconfCoreMgr = DisconfCoreFactory.getDisconfCoreMgr(registry); // depends on control dependency: [try], data = [none] disconfCoreMgr.process(); // depends on control dependency: [try], data = [none] // isFirstInit = true; // depends on control dependency: [try], data = [none] LOGGER.info("******************************* DISCONF END FIRST SCAN *******************************"); // depends on control dependency: [try], data = [none] // depends on control dependency: [try], data = [none] } catch (Exception e) { LOGGER.error(e.toString(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private JCheckBox getChkShowPassword() { if (chkShowPassword == null) { chkShowPassword = new JCheckBox(); chkShowPassword.setText(Constant.messages.getString("conn.options.proxy.auth.showpass")); chkShowPassword.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent e) { if (chkShowPassword.isSelected()) { txtProxyChainPassword.setEchoChar((char) 0); } else { txtProxyChainPassword.setEchoChar('*'); } } }); } return chkShowPassword; } }
public class class_name { private JCheckBox getChkShowPassword() { if (chkShowPassword == null) { chkShowPassword = new JCheckBox(); chkShowPassword.setText(Constant.messages.getString("conn.options.proxy.auth.showpass")); chkShowPassword.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent e) { if (chkShowPassword.isSelected()) { txtProxyChainPassword.setEchoChar((char) 0); // depends on control dependency: [if], data = [none] } else { txtProxyChainPassword.setEchoChar('*'); // depends on control dependency: [if], data = [none] } } }); } return chkShowPassword; } }
public class class_name { public static String squeeze(final String str, final String... set) { if (StringUtils.isEmpty(str) || deepEmpty(set)) { return str; } final CharSet chars = CharSet.getInstance(set); final StringBuilder buffer = new StringBuilder(str.length()); final char[] chrs = str.toCharArray(); final int sz = chrs.length; char lastChar = chrs[0]; char ch = ' '; Character inChars = null; Character notInChars = null; buffer.append(lastChar); for (int i = 1; i < sz; i++) { ch = chrs[i]; if (ch == lastChar) { if (inChars != null && ch == inChars) { continue; } if (notInChars == null || ch != notInChars) { if (chars.contains(ch)) { inChars = ch; continue; } notInChars = ch; } } buffer.append(ch); lastChar = ch; } return buffer.toString(); } }
public class class_name { public static String squeeze(final String str, final String... set) { if (StringUtils.isEmpty(str) || deepEmpty(set)) { return str; // depends on control dependency: [if], data = [none] } final CharSet chars = CharSet.getInstance(set); final StringBuilder buffer = new StringBuilder(str.length()); final char[] chrs = str.toCharArray(); final int sz = chrs.length; char lastChar = chrs[0]; char ch = ' '; Character inChars = null; Character notInChars = null; buffer.append(lastChar); for (int i = 1; i < sz; i++) { ch = chrs[i]; // depends on control dependency: [for], data = [i] if (ch == lastChar) { if (inChars != null && ch == inChars) { continue; } if (notInChars == null || ch != notInChars) { if (chars.contains(ch)) { inChars = ch; // depends on control dependency: [if], data = [none] continue; } notInChars = ch; // depends on control dependency: [if], data = [none] } } buffer.append(ch); // depends on control dependency: [for], data = [none] lastChar = ch; // depends on control dependency: [for], data = [none] } return buffer.toString(); } }
public class class_name { public Map<String, String> getLayoutMappings() { String mappingsValues = environment.getProperty("mustache.layoutMappings", MustacheSettings.LAYOUT_MAPPINGS).trim(); if (mappingsValues.isEmpty()) { return emptyMap(); } Map<String, String> mappings = new HashMap<String, String>(); String[] values = mappingsValues.split(";"); if (values.length > 0) { for (String value : values) { String val = value == null ? "" : value.trim(); if (val.isEmpty()) { continue; } String[] mapping = val.split(":"); if (mapping.length != 2) { throw new IllegalArgumentException("Mapping must use [viewName]:[layout] format!"); } mappings.put(mapping[0].trim(), mapping[1].trim()); } } return unmodifiableMap(mappings); } }
public class class_name { public Map<String, String> getLayoutMappings() { String mappingsValues = environment.getProperty("mustache.layoutMappings", MustacheSettings.LAYOUT_MAPPINGS).trim(); if (mappingsValues.isEmpty()) { return emptyMap(); // depends on control dependency: [if], data = [none] } Map<String, String> mappings = new HashMap<String, String>(); String[] values = mappingsValues.split(";"); if (values.length > 0) { for (String value : values) { String val = value == null ? "" : value.trim(); if (val.isEmpty()) { continue; } String[] mapping = val.split(":"); if (mapping.length != 2) { throw new IllegalArgumentException("Mapping must use [viewName]:[layout] format!"); } mappings.put(mapping[0].trim(), mapping[1].trim()); // depends on control dependency: [for], data = [none] } } return unmodifiableMap(mappings); } }
public class class_name { @Override public boolean sqlMapDocumentGenerated(Document document, IntrospectedTable introspectedTable) { // 1. batchInsert XmlElement batchInsertEle = new XmlElement("insert"); batchInsertEle.addAttribute(new Attribute("id", METHOD_BATCH_INSERT)); // 参数类型 batchInsertEle.addAttribute(new Attribute("parameterType", "map")); // 添加注释(!!!必须添加注释,overwrite覆盖生成时,@see XmlFileMergerJaxp.isGeneratedNode会去判断注释中是否存在OLD_ELEMENT_TAGS中的一点,例子:@mbg.generated) commentGenerator.addComment(batchInsertEle); // 使用JDBC的getGenereatedKeys方法获取主键并赋值到keyProperty设置的领域模型属性中。所以只支持MYSQL和SQLServer XmlElementGeneratorTools.useGeneratedKeys(batchInsertEle, introspectedTable); batchInsertEle.addElement(new TextElement("insert into " + introspectedTable.getFullyQualifiedTableNameAtRuntime())); for (Element element : XmlElementGeneratorTools.generateKeys(ListUtilities.removeIdentityAndGeneratedAlwaysColumns(introspectedTable.getAllColumns()), true)) { batchInsertEle.addElement(element); } // 添加foreach节点 XmlElement foreachElement = new XmlElement("foreach"); foreachElement.addAttribute(new Attribute("collection", "list")); foreachElement.addAttribute(new Attribute("item", "item")); foreachElement.addAttribute(new Attribute("separator", ",")); for (Element element : XmlElementGeneratorTools.generateValues(ListUtilities.removeIdentityAndGeneratedAlwaysColumns(introspectedTable.getAllColumns()), "item.")) { foreachElement.addElement(element); } // values 构建 batchInsertEle.addElement(new TextElement("values")); batchInsertEle.addElement(foreachElement); document.getRootElement().addElement(batchInsertEle); logger.debug("itfsw(批量插入插件):" + introspectedTable.getMyBatis3XmlMapperFileName() + "增加batchInsert实现方法。"); // 2. batchInsertSelective XmlElement batchInsertSelectiveEle = new XmlElement("insert"); // 添加注释(!!!必须添加注释,overwrite覆盖生成时,@see XmlFileMergerJaxp.isGeneratedNode会去判断注释中是否存在OLD_ELEMENT_TAGS中的一点,例子:@mbg.generated) commentGenerator.addComment(batchInsertSelectiveEle); batchInsertSelectiveEle.addAttribute(new Attribute("id", METHOD_BATCH_INSERT_SELECTIVE)); // 参数类型 batchInsertSelectiveEle.addAttribute(new Attribute("parameterType", "map")); // 使用JDBC的getGenereatedKeys方法获取主键并赋值到keyProperty设置的领域模型属性中。所以只支持MYSQL和SQLServer // issues#70 mybatis 版本升级到3.5.0之后,useGeneratedKeys在配置keyProperty时需要指定前缀 XmlElementGeneratorTools.useGeneratedKeys(batchInsertSelectiveEle, introspectedTable, PluginTools.compareVersion(mybatisVersion, "3.5.0") >= 0 ? "list." : null); // 支持原生字段非空判断 if (this.allowMultiQueries) { XmlElement chooseEle = new XmlElement("choose"); // selective 增强 XmlElement selectiveEnhancedEle = new XmlElement("when"); selectiveEnhancedEle.addAttribute(new Attribute("test", "selective != null and selective.length > 0")); chooseEle.addElement(selectiveEnhancedEle); selectiveEnhancedEle.getElements().addAll(this.generateSelectiveEnhancedEles(introspectedTable)); // 原生非空判断语句 XmlElement selectiveNormalEle = new XmlElement("otherwise"); chooseEle.addElement(selectiveNormalEle); XmlElement foreachEle = new XmlElement("foreach"); selectiveNormalEle.addElement(foreachEle); foreachEle.addAttribute(new Attribute("collection", "list")); foreachEle.addAttribute(new Attribute("item", "item")); foreachEle.addAttribute(new Attribute("separator", ";")); foreachEle.addElement(new TextElement("insert into " + introspectedTable.getFullyQualifiedTableNameAtRuntime())); XmlElement insertTrimElement = new XmlElement("trim"); foreachEle.addElement(insertTrimElement); insertTrimElement.addElement(XmlElementGeneratorTools.generateKeysSelective(ListUtilities.removeIdentityAndGeneratedAlwaysColumns(introspectedTable.getAllColumns()), "item.")); foreachEle.addElement(new TextElement("values")); XmlElement valuesTrimElement = new XmlElement("trim"); foreachEle.addElement(valuesTrimElement); valuesTrimElement.addElement(XmlElementGeneratorTools.generateValuesSelective(ListUtilities.removeIdentityAndGeneratedAlwaysColumns(introspectedTable.getAllColumns()), "item.")); batchInsertSelectiveEle.addElement(chooseEle); } else { batchInsertSelectiveEle.getElements().addAll(this.generateSelectiveEnhancedEles(introspectedTable)); } document.getRootElement().addElement(batchInsertSelectiveEle); logger.debug("itfsw(批量插入插件):" + introspectedTable.getMyBatis3XmlMapperFileName() + "增加batchInsertSelective实现方法。"); return true; } }
public class class_name { @Override public boolean sqlMapDocumentGenerated(Document document, IntrospectedTable introspectedTable) { // 1. batchInsert XmlElement batchInsertEle = new XmlElement("insert"); batchInsertEle.addAttribute(new Attribute("id", METHOD_BATCH_INSERT)); // 参数类型 batchInsertEle.addAttribute(new Attribute("parameterType", "map")); // 添加注释(!!!必须添加注释,overwrite覆盖生成时,@see XmlFileMergerJaxp.isGeneratedNode会去判断注释中是否存在OLD_ELEMENT_TAGS中的一点,例子:@mbg.generated) commentGenerator.addComment(batchInsertEle); // 使用JDBC的getGenereatedKeys方法获取主键并赋值到keyProperty设置的领域模型属性中。所以只支持MYSQL和SQLServer XmlElementGeneratorTools.useGeneratedKeys(batchInsertEle, introspectedTable); batchInsertEle.addElement(new TextElement("insert into " + introspectedTable.getFullyQualifiedTableNameAtRuntime())); for (Element element : XmlElementGeneratorTools.generateKeys(ListUtilities.removeIdentityAndGeneratedAlwaysColumns(introspectedTable.getAllColumns()), true)) { batchInsertEle.addElement(element); // depends on control dependency: [for], data = [element] } // 添加foreach节点 XmlElement foreachElement = new XmlElement("foreach"); foreachElement.addAttribute(new Attribute("collection", "list")); foreachElement.addAttribute(new Attribute("item", "item")); foreachElement.addAttribute(new Attribute("separator", ",")); for (Element element : XmlElementGeneratorTools.generateValues(ListUtilities.removeIdentityAndGeneratedAlwaysColumns(introspectedTable.getAllColumns()), "item.")) { foreachElement.addElement(element); // depends on control dependency: [for], data = [element] } // values 构建 batchInsertEle.addElement(new TextElement("values")); batchInsertEle.addElement(foreachElement); document.getRootElement().addElement(batchInsertEle); logger.debug("itfsw(批量插入插件):" + introspectedTable.getMyBatis3XmlMapperFileName() + "增加batchInsert实现方法。"); // 2. batchInsertSelective XmlElement batchInsertSelectiveEle = new XmlElement("insert"); // 添加注释(!!!必须添加注释,overwrite覆盖生成时,@see XmlFileMergerJaxp.isGeneratedNode会去判断注释中是否存在OLD_ELEMENT_TAGS中的一点,例子:@mbg.generated) commentGenerator.addComment(batchInsertSelectiveEle); batchInsertSelectiveEle.addAttribute(new Attribute("id", METHOD_BATCH_INSERT_SELECTIVE)); // 参数类型 batchInsertSelectiveEle.addAttribute(new Attribute("parameterType", "map")); // 使用JDBC的getGenereatedKeys方法获取主键并赋值到keyProperty设置的领域模型属性中。所以只支持MYSQL和SQLServer // issues#70 mybatis 版本升级到3.5.0之后,useGeneratedKeys在配置keyProperty时需要指定前缀 XmlElementGeneratorTools.useGeneratedKeys(batchInsertSelectiveEle, introspectedTable, PluginTools.compareVersion(mybatisVersion, "3.5.0") >= 0 ? "list." : null); // 支持原生字段非空判断 if (this.allowMultiQueries) { XmlElement chooseEle = new XmlElement("choose"); // selective 增强 XmlElement selectiveEnhancedEle = new XmlElement("when"); selectiveEnhancedEle.addAttribute(new Attribute("test", "selective != null and selective.length > 0")); // depends on control dependency: [if], data = [none] chooseEle.addElement(selectiveEnhancedEle); // depends on control dependency: [if], data = [none] selectiveEnhancedEle.getElements().addAll(this.generateSelectiveEnhancedEles(introspectedTable)); // depends on control dependency: [if], data = [none] // 原生非空判断语句 XmlElement selectiveNormalEle = new XmlElement("otherwise"); chooseEle.addElement(selectiveNormalEle); // depends on control dependency: [if], data = [none] XmlElement foreachEle = new XmlElement("foreach"); selectiveNormalEle.addElement(foreachEle); // depends on control dependency: [if], data = [none] foreachEle.addAttribute(new Attribute("collection", "list")); // depends on control dependency: [if], data = [none] foreachEle.addAttribute(new Attribute("item", "item")); // depends on control dependency: [if], data = [none] foreachEle.addAttribute(new Attribute("separator", ";")); // depends on control dependency: [if], data = [none] foreachEle.addElement(new TextElement("insert into " + introspectedTable.getFullyQualifiedTableNameAtRuntime())); // depends on control dependency: [if], data = [none] XmlElement insertTrimElement = new XmlElement("trim"); foreachEle.addElement(insertTrimElement); // depends on control dependency: [if], data = [none] insertTrimElement.addElement(XmlElementGeneratorTools.generateKeysSelective(ListUtilities.removeIdentityAndGeneratedAlwaysColumns(introspectedTable.getAllColumns()), "item.")); // depends on control dependency: [if], data = [none] foreachEle.addElement(new TextElement("values")); // depends on control dependency: [if], data = [none] XmlElement valuesTrimElement = new XmlElement("trim"); foreachEle.addElement(valuesTrimElement); // depends on control dependency: [if], data = [none] valuesTrimElement.addElement(XmlElementGeneratorTools.generateValuesSelective(ListUtilities.removeIdentityAndGeneratedAlwaysColumns(introspectedTable.getAllColumns()), "item.")); // depends on control dependency: [if], data = [none] batchInsertSelectiveEle.addElement(chooseEle); // depends on control dependency: [if], data = [none] } else { batchInsertSelectiveEle.getElements().addAll(this.generateSelectiveEnhancedEles(introspectedTable)); // depends on control dependency: [if], data = [none] } document.getRootElement().addElement(batchInsertSelectiveEle); logger.debug("itfsw(批量插入插件):" + introspectedTable.getMyBatis3XmlMapperFileName() + "增加batchInsertSelective实现方法。"); return true; } }
public class class_name { public static base_responses update(nitro_service client, nstimer resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nstimer updateresources[] = new nstimer[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new nstimer(); updateresources[i].name = resources[i].name; updateresources[i].interval = resources[i].interval; updateresources[i].unit = resources[i].unit; updateresources[i].comment = resources[i].comment; } result = update_bulk_request(client, updateresources); } return result; } }
public class class_name { public static base_responses update(nitro_service client, nstimer resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nstimer updateresources[] = new nstimer[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new nstimer(); // depends on control dependency: [for], data = [i] updateresources[i].name = resources[i].name; // depends on control dependency: [for], data = [i] updateresources[i].interval = resources[i].interval; // depends on control dependency: [for], data = [i] updateresources[i].unit = resources[i].unit; // depends on control dependency: [for], data = [i] updateresources[i].comment = resources[i].comment; // depends on control dependency: [for], data = [i] } result = update_bulk_request(client, updateresources); } return result; } }
public class class_name { public ResourceBundle getResourceBundle(Class<?> aClass, String bundleName, List<Locale> locales) { ResourceBundle bundle = null; ClassLoader classLoader = null; // instead of waiting for ResourceBundle to throw the NPE, do it now if (bundleName == null) throw new NullPointerException("Unable to load resource bundle: null bundleName"); if (locales == null) { locales = new ArrayList<Locale>(); } if (locales.isEmpty()) { locales.add(Locale.getDefault()); } // The 'top requested' locale is the Locale we want to use... ?? Locale locale = locales.get(0); Control control = new LocaleListControl(locales); // TODO: add resource bundle cache.. ? // yikes! TRY to figure out the class from the callstack-- // have to do this every time aClass is null coming in, which is // definitely not optimal, but at least makes sure the resource bundle // is loaded from the right place if (aClass == null) { StackFinder finder = StackFinder.getInstance(); aClass = finder.getCaller(); } if (aClass != null) { // If aClass is NOT null (it was passed in, or we found it), // use its classloader first to try loading the resource bundle try { classLoader = aClass.getClassLoader(); bundle = ResourceBundle.getBundle(bundleName, locale, classLoader, control); } catch (RuntimeException re) { logEvent("Unable to load {0} from {1} (from class {2}) in {3}; caught exception: {4}", new Object[] { bundleName, classLoader, aClass, locale, re }); } } if (bundle == null) { // If the bundle wasn't found using the class' classloader, try the default classloader (in OSGi, // will be in the RAS bundle..) try { bundle = ResourceBundle.getBundle(bundleName, locale, control); } catch (RuntimeException re) { logEvent("Unable to load {0} from {1} in {2}; caught exception: {3}", new Object[] { bundleName, classLoader, locale, re }); try { // Try the context classloader classLoader = (ClassLoader) AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { @Override public Object run() throws Exception { return Thread.currentThread().getContextClassLoader(); } }); bundle = ResourceBundle.getBundle(bundleName, locale, classLoader, control); } catch (PrivilegedActionException pae) { logEvent("Unable to load {0} from {1} in {2}; caught exception: {3}", new Object[] { bundleName, classLoader, locale, pae }); throw new RuntimeException("Unable to get context classloader", pae); } } } return bundle; } }
public class class_name { public ResourceBundle getResourceBundle(Class<?> aClass, String bundleName, List<Locale> locales) { ResourceBundle bundle = null; ClassLoader classLoader = null; // instead of waiting for ResourceBundle to throw the NPE, do it now if (bundleName == null) throw new NullPointerException("Unable to load resource bundle: null bundleName"); if (locales == null) { locales = new ArrayList<Locale>(); // depends on control dependency: [if], data = [none] } if (locales.isEmpty()) { locales.add(Locale.getDefault()); // depends on control dependency: [if], data = [none] } // The 'top requested' locale is the Locale we want to use... ?? Locale locale = locales.get(0); Control control = new LocaleListControl(locales); // TODO: add resource bundle cache.. ? // yikes! TRY to figure out the class from the callstack-- // have to do this every time aClass is null coming in, which is // definitely not optimal, but at least makes sure the resource bundle // is loaded from the right place if (aClass == null) { StackFinder finder = StackFinder.getInstance(); aClass = finder.getCaller(); // depends on control dependency: [if], data = [none] } if (aClass != null) { // If aClass is NOT null (it was passed in, or we found it), // use its classloader first to try loading the resource bundle try { classLoader = aClass.getClassLoader(); // depends on control dependency: [try], data = [none] bundle = ResourceBundle.getBundle(bundleName, locale, classLoader, control); // depends on control dependency: [try], data = [none] } catch (RuntimeException re) { logEvent("Unable to load {0} from {1} (from class {2}) in {3}; caught exception: {4}", new Object[] { bundleName, classLoader, aClass, locale, re }); } // depends on control dependency: [catch], data = [none] } if (bundle == null) { // If the bundle wasn't found using the class' classloader, try the default classloader (in OSGi, // will be in the RAS bundle..) try { bundle = ResourceBundle.getBundle(bundleName, locale, control); // depends on control dependency: [try], data = [none] } catch (RuntimeException re) { logEvent("Unable to load {0} from {1} in {2}; caught exception: {3}", new Object[] { bundleName, classLoader, locale, re }); try { // Try the context classloader classLoader = (ClassLoader) AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { @Override public Object run() throws Exception { return Thread.currentThread().getContextClassLoader(); } }); // depends on control dependency: [try], data = [none] bundle = ResourceBundle.getBundle(bundleName, locale, classLoader, control); // depends on control dependency: [try], data = [none] } catch (PrivilegedActionException pae) { logEvent("Unable to load {0} from {1} in {2}; caught exception: {3}", new Object[] { bundleName, classLoader, locale, pae }); throw new RuntimeException("Unable to get context classloader", pae); } // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] } return bundle; } }
public class class_name { private void categorizeCurrentFile(final Reference ref) { final URI currentFile = ref.filename; if (listFilter.hasConaction()) { conrefpushSet.add(currentFile); } if (listFilter.hasConRef()) { conrefSet.add(currentFile); } if (listFilter.hasKeyRef()) { keyrefSet.add(currentFile); } if (listFilter.hasCodeRef()) { coderefSet.add(currentFile); } if (listFilter.isDitaTopic()) { if (ref.format != null && !ref.format.equals(ATTR_FORMAT_VALUE_DITA)) { assert currentFile.getFragment() == null; if (!sourceFormat.containsKey(currentFile)) { sourceFormat.put(currentFile, ref.format); } } fullTopicSet.add(currentFile); hrefTargetSet.add(currentFile); if (listFilter.hasHref()) { hrefTopicSet.add(currentFile); } } else if (listFilter.isDitaMap()) { fullMapSet.add(currentFile); } } }
public class class_name { private void categorizeCurrentFile(final Reference ref) { final URI currentFile = ref.filename; if (listFilter.hasConaction()) { conrefpushSet.add(currentFile); // depends on control dependency: [if], data = [none] } if (listFilter.hasConRef()) { conrefSet.add(currentFile); // depends on control dependency: [if], data = [none] } if (listFilter.hasKeyRef()) { keyrefSet.add(currentFile); // depends on control dependency: [if], data = [none] } if (listFilter.hasCodeRef()) { coderefSet.add(currentFile); // depends on control dependency: [if], data = [none] } if (listFilter.isDitaTopic()) { if (ref.format != null && !ref.format.equals(ATTR_FORMAT_VALUE_DITA)) { assert currentFile.getFragment() == null; if (!sourceFormat.containsKey(currentFile)) { sourceFormat.put(currentFile, ref.format); // depends on control dependency: [if], data = [none] } } fullTopicSet.add(currentFile); // depends on control dependency: [if], data = [none] hrefTargetSet.add(currentFile); // depends on control dependency: [if], data = [none] if (listFilter.hasHref()) { hrefTopicSet.add(currentFile); // depends on control dependency: [if], data = [none] } } else if (listFilter.isDitaMap()) { fullMapSet.add(currentFile); // depends on control dependency: [if], data = [none] } } }
public class class_name { private Pair<Double, String> summarizeBalance(final Map<Integer, Integer> nodeIdToPartitionCount, String title) { StringBuilder builder = new StringBuilder(); builder.append("\n" + title + "\n"); Map<Integer, ZoneBalanceStats> zoneToBalanceStats = new HashMap<Integer, ZoneBalanceStats>(); for(Integer zoneId: cluster.getZoneIds()) { zoneToBalanceStats.put(zoneId, new ZoneBalanceStats()); } for(Node node: cluster.getNodes()) { int curCount = nodeIdToPartitionCount.get(node.getId()); builder.append("\tNode ID: " + node.getId() + " : " + curCount + " (" + node.getHost() + ")\n"); zoneToBalanceStats.get(node.getZoneId()).addPartitions(curCount); } // double utilityToBeMinimized = Double.MIN_VALUE; double utilityToBeMinimized = 0; for(Integer zoneId: cluster.getZoneIds()) { builder.append("Zone " + zoneId + "\n"); builder.append(zoneToBalanceStats.get(zoneId).dumpStats()); utilityToBeMinimized += zoneToBalanceStats.get(zoneId).getUtility(); /*- * Another utility function to consider if(zoneToBalanceStats.get(zoneId).getMaxMinRatio() > utilityToBeMinimized) { utilityToBeMinimized = zoneToBalanceStats.get(zoneId).getUtility(); } */ } return Pair.create(utilityToBeMinimized, builder.toString()); } }
public class class_name { private Pair<Double, String> summarizeBalance(final Map<Integer, Integer> nodeIdToPartitionCount, String title) { StringBuilder builder = new StringBuilder(); builder.append("\n" + title + "\n"); Map<Integer, ZoneBalanceStats> zoneToBalanceStats = new HashMap<Integer, ZoneBalanceStats>(); for(Integer zoneId: cluster.getZoneIds()) { zoneToBalanceStats.put(zoneId, new ZoneBalanceStats()); // depends on control dependency: [for], data = [zoneId] } for(Node node: cluster.getNodes()) { int curCount = nodeIdToPartitionCount.get(node.getId()); builder.append("\tNode ID: " + node.getId() + " : " + curCount + " (" + node.getHost() + ")\n"); zoneToBalanceStats.get(node.getZoneId()).addPartitions(curCount); // depends on control dependency: [for], data = [node] } // double utilityToBeMinimized = Double.MIN_VALUE; double utilityToBeMinimized = 0; for(Integer zoneId: cluster.getZoneIds()) { builder.append("Zone " + zoneId + "\n"); // depends on control dependency: [for], data = [zoneId] builder.append(zoneToBalanceStats.get(zoneId).dumpStats()); // depends on control dependency: [for], data = [zoneId] utilityToBeMinimized += zoneToBalanceStats.get(zoneId).getUtility(); // depends on control dependency: [for], data = [zoneId] /*- * Another utility function to consider if(zoneToBalanceStats.get(zoneId).getMaxMinRatio() > utilityToBeMinimized) { utilityToBeMinimized = zoneToBalanceStats.get(zoneId).getUtility(); } */ } return Pair.create(utilityToBeMinimized, builder.toString()); } }
public class class_name { public void index(final ByteBuffer key, final ColumnFamily columnFamily, final long timestamp) { if (indexQueue == null) { indexInner(key, columnFamily, timestamp); } else { indexQueue.submitAsynchronous(key, new Runnable() { @Override public void run() { indexInner(key, columnFamily, timestamp); } }); } } }
public class class_name { public void index(final ByteBuffer key, final ColumnFamily columnFamily, final long timestamp) { if (indexQueue == null) { indexInner(key, columnFamily, timestamp); // depends on control dependency: [if], data = [none] } else { indexQueue.submitAsynchronous(key, new Runnable() { @Override public void run() { indexInner(key, columnFamily, timestamp); } }); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void generateGetType(SQLiteDatabaseSchema schema) { MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder("getType").addModifiers(Modifier.PUBLIC).addAnnotation(Override.class).returns(String.class); methodBuilder.addParameter(Uri.class, "uri"); methodBuilder.beginControlFlow("switch (sURIMatcher.match(uri))"); for (Entry<String, ContentEntry> item : uriSet.entrySet()) { methodBuilder.beginControlFlow("case $L:", item.getValue().pathIndex); methodBuilder.addStatement("return $S", item.getValue().getContentType()); methodBuilder.endControlFlow(); } methodBuilder.endControlFlow(); methodBuilder.addStatement("throw new $T(\"Unknown URI for $L operation: \" + uri)", IllegalArgumentException.class, "getType"); classBuilder.addMethod(methodBuilder.build()); } }
public class class_name { private void generateGetType(SQLiteDatabaseSchema schema) { MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder("getType").addModifiers(Modifier.PUBLIC).addAnnotation(Override.class).returns(String.class); methodBuilder.addParameter(Uri.class, "uri"); methodBuilder.beginControlFlow("switch (sURIMatcher.match(uri))"); for (Entry<String, ContentEntry> item : uriSet.entrySet()) { methodBuilder.beginControlFlow("case $L:", item.getValue().pathIndex); // depends on control dependency: [for], data = [item] methodBuilder.addStatement("return $S", item.getValue().getContentType()); // depends on control dependency: [for], data = [item] methodBuilder.endControlFlow(); // depends on control dependency: [for], data = [none] } methodBuilder.endControlFlow(); methodBuilder.addStatement("throw new $T(\"Unknown URI for $L operation: \" + uri)", IllegalArgumentException.class, "getType"); classBuilder.addMethod(methodBuilder.build()); } }
public class class_name { public static base_responses add(nitro_service client, rnat6 resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { rnat6 addresources[] = new rnat6[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new rnat6(); addresources[i].name = resources[i].name; addresources[i].network = resources[i].network; addresources[i].acl6name = resources[i].acl6name; addresources[i].redirectport = resources[i].redirectport; } result = add_bulk_request(client, addresources); } return result; } }
public class class_name { public static base_responses add(nitro_service client, rnat6 resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { rnat6 addresources[] = new rnat6[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new rnat6(); // depends on control dependency: [for], data = [i] addresources[i].name = resources[i].name; // depends on control dependency: [for], data = [i] addresources[i].network = resources[i].network; // depends on control dependency: [for], data = [i] addresources[i].acl6name = resources[i].acl6name; // depends on control dependency: [for], data = [i] addresources[i].redirectport = resources[i].redirectport; // depends on control dependency: [for], data = [i] } result = add_bulk_request(client, addresources); } return result; } }
public class class_name { @Override public void unindexHelpModule(HelpModule helpModule) { try { log.info("Removing index for help module " + helpModule.getLocalizedId()); Term term = new Term("module", helpModule.getLocalizedId()); writer.deleteDocuments(term); writer.commit(); indexTracker.remove(helpModule); } catch (IOException e) { MiscUtil.toUnchecked(e); } } }
public class class_name { @Override public void unindexHelpModule(HelpModule helpModule) { try { log.info("Removing index for help module " + helpModule.getLocalizedId()); // depends on control dependency: [try], data = [none] Term term = new Term("module", helpModule.getLocalizedId()); writer.deleteDocuments(term); // depends on control dependency: [try], data = [none] writer.commit(); // depends on control dependency: [try], data = [none] indexTracker.remove(helpModule); // depends on control dependency: [try], data = [none] } catch (IOException e) { MiscUtil.toUnchecked(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public ResultScanner<Row> readRows(Query request) { final ResultScanner<FlatRow> delegate = readFlatRows(request); return new ResultScanner<Row>() { @Override public Row next() throws IOException { return FlatRowConverter.convertToModelRow(delegate.next()); } @Override public Row[] next(int count) throws IOException { FlatRow[] flatRows = delegate.next(count); Row[] rows = new Row[flatRows.length]; for (int i = 0; i < flatRows.length; i++) { rows[i] = FlatRowConverter.convertToModelRow(flatRows[i]); } return rows; } @Override public void close() throws IOException { delegate.close(); } @Override public int available() { return delegate.available(); } }; } }
public class class_name { @Override public ResultScanner<Row> readRows(Query request) { final ResultScanner<FlatRow> delegate = readFlatRows(request); return new ResultScanner<Row>() { @Override public Row next() throws IOException { return FlatRowConverter.convertToModelRow(delegate.next()); } @Override public Row[] next(int count) throws IOException { FlatRow[] flatRows = delegate.next(count); Row[] rows = new Row[flatRows.length]; for (int i = 0; i < flatRows.length; i++) { rows[i] = FlatRowConverter.convertToModelRow(flatRows[i]); // depends on control dependency: [for], data = [i] } return rows; } @Override public void close() throws IOException { delegate.close(); } @Override public int available() { return delegate.available(); } }; } }
public class class_name { void initializeNonPersistent(BaseDestinationHandler destinationHandler, SIMPTransactionManager txManager) throws MessageStoreException { if (tc.isEntryEnabled()) SibTr.entry(tc, "initializeNonPersistent", new Object[] {destinationHandler, txManager}); this.destinationHandler = destinationHandler; /* * Iterate through all contained Protocol Items, rebuilding * associated target streams for each. */ NonLockingCursor cursor = null; try { cursor = newNonLockingItemCursor(new ClassEqualsFilter(StreamSet.class)); AbstractItem item = null; while (null != (item = cursor.next())) { StreamSet streamSet = (StreamSet)item; streamSet.initializeNonPersistent(txManager); } } finally { if (cursor != null) cursor.finished(); } if (tc.isEntryEnabled()) SibTr.exit(tc, "initializeNonPersistent"); } }
public class class_name { void initializeNonPersistent(BaseDestinationHandler destinationHandler, SIMPTransactionManager txManager) throws MessageStoreException { if (tc.isEntryEnabled()) SibTr.entry(tc, "initializeNonPersistent", new Object[] {destinationHandler, txManager}); this.destinationHandler = destinationHandler; /* * Iterate through all contained Protocol Items, rebuilding * associated target streams for each. */ NonLockingCursor cursor = null; try { cursor = newNonLockingItemCursor(new ClassEqualsFilter(StreamSet.class)); // depends on control dependency: [try], data = [none] AbstractItem item = null; while (null != (item = cursor.next())) { StreamSet streamSet = (StreamSet)item; streamSet.initializeNonPersistent(txManager); // depends on control dependency: [while], data = [none] } } finally { if (cursor != null) cursor.finished(); } if (tc.isEntryEnabled()) SibTr.exit(tc, "initializeNonPersistent"); } }
public class class_name { public Serializer getSerializer(Class cls) { SerializerWrapper w = getSerializerWrapper(cls); if (w != null) { return w.serializer; } return null; } }
public class class_name { public Serializer getSerializer(Class cls) { SerializerWrapper w = getSerializerWrapper(cls); if (w != null) { return w.serializer; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { protected void xor(byte[] dest, byte[] src) { for (int i = 0; i < dest.length; i++) { dest[i] ^= src[i]; } } }
public class class_name { protected void xor(byte[] dest, byte[] src) { for (int i = 0; i < dest.length; i++) { dest[i] ^= src[i]; // depends on control dependency: [for], data = [i] } } }
public class class_name { @Get("/projects") public CompletableFuture<List<ProjectDto>> listProjects(@Param("status") Optional<String> status) { if (status.isPresent()) { checkStatusArgument(status.get()); return CompletableFuture.supplyAsync(() -> projectManager().listRemoved().stream() .map(ProjectDto::new) .collect(toImmutableList())); } return CompletableFuture.supplyAsync(() -> projectManager().list().values().stream() .map(DtoConverter::convert) .collect(toImmutableList())); } }
public class class_name { @Get("/projects") public CompletableFuture<List<ProjectDto>> listProjects(@Param("status") Optional<String> status) { if (status.isPresent()) { checkStatusArgument(status.get()); // depends on control dependency: [if], data = [none] return CompletableFuture.supplyAsync(() -> projectManager().listRemoved().stream() .map(ProjectDto::new) .collect(toImmutableList())); // depends on control dependency: [if], data = [none] } return CompletableFuture.supplyAsync(() -> projectManager().list().values().stream() .map(DtoConverter::convert) .collect(toImmutableList())); } }
public class class_name { public String getString() { int rank = getRank(); if (rank == 0) { return new String(storage); } if (rank != 1) throw new IllegalArgumentException("ArayChar.getString rank must be 1"); int strLen = indexCalc.getShape(0); int count = 0; for (int k = 0; k < strLen; k++) { if (0 == storage[k]) break; count++; } return new String(storage, 0, count); } }
public class class_name { public String getString() { int rank = getRank(); if (rank == 0) { return new String(storage); // depends on control dependency: [if], data = [none] } if (rank != 1) throw new IllegalArgumentException("ArayChar.getString rank must be 1"); int strLen = indexCalc.getShape(0); int count = 0; for (int k = 0; k < strLen; k++) { if (0 == storage[k]) break; count++; // depends on control dependency: [for], data = [none] } return new String(storage, 0, count); } }
public class class_name { public String getQuery( URIContext uriContext ) { if(_parameters == null || !_parameters.hasParameters()) return null; String paramSeparator = AMP_ENTITY; if ( uriContext == null ) { uriContext = getDefaultContext(); } if ( !uriContext.useAmpEntity() ) { paramSeparator = AMP_CHAR; } InternalStringBuilder query = new InternalStringBuilder( 64 ); boolean firstParam = true; for(Iterator iterator = _parameters.iterator(); iterator.hasNext(); ) { QueryParameters.Parameter parameter = (QueryParameters.Parameter)iterator.next(); String name = parameter.name; String value = parameter.value; if (firstParam) firstParam = false; else query.append( paramSeparator ); query.append( name ); /* todo: does the '=' need to be here in order for the parsing to work correctly? */ if(value != null) { query.append( '=' ).append( value ); } } return query.toString(); } }
public class class_name { public String getQuery( URIContext uriContext ) { if(_parameters == null || !_parameters.hasParameters()) return null; String paramSeparator = AMP_ENTITY; if ( uriContext == null ) { uriContext = getDefaultContext(); // depends on control dependency: [if], data = [none] } if ( !uriContext.useAmpEntity() ) { paramSeparator = AMP_CHAR; // depends on control dependency: [if], data = [none] } InternalStringBuilder query = new InternalStringBuilder( 64 ); boolean firstParam = true; for(Iterator iterator = _parameters.iterator(); iterator.hasNext(); ) { QueryParameters.Parameter parameter = (QueryParameters.Parameter)iterator.next(); String name = parameter.name; String value = parameter.value; if (firstParam) firstParam = false; else query.append( paramSeparator ); query.append( name ); // depends on control dependency: [for], data = [none] /* todo: does the '=' need to be here in order for the parsing to work correctly? */ if(value != null) { query.append( '=' ).append( value ); // depends on control dependency: [if], data = [none] } } return query.toString(); } }
public class class_name { protected void markStreamBroken() { if(anyAreSet(state, STATE_STREAM_BROKEN)) { return; } synchronized (lock) { state |= STATE_STREAM_BROKEN; PooledByteBuffer data = this.data; if(data != null) { try { data.close(); //may have been closed by the read thread } catch (Throwable e) { //ignore } this.data = null; } for(FrameData frame : pendingFrameData) { frame.frameData.close(); } pendingFrameData.clear(); if(isReadResumed()) { resumeReadsInternal(true); } if (waiters > 0) { lock.notifyAll(); } } } }
public class class_name { protected void markStreamBroken() { if(anyAreSet(state, STATE_STREAM_BROKEN)) { return; // depends on control dependency: [if], data = [none] } synchronized (lock) { state |= STATE_STREAM_BROKEN; PooledByteBuffer data = this.data; if(data != null) { try { data.close(); //may have been closed by the read thread // depends on control dependency: [try], data = [none] } catch (Throwable e) { //ignore } // depends on control dependency: [catch], data = [none] this.data = null; // depends on control dependency: [if], data = [none] } for(FrameData frame : pendingFrameData) { frame.frameData.close(); // depends on control dependency: [for], data = [frame] } pendingFrameData.clear(); if(isReadResumed()) { resumeReadsInternal(true); // depends on control dependency: [if], data = [none] } if (waiters > 0) { lock.notifyAll(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void addConnection() throws SQLException { //create new connection Protocol protocol = Utils.retrieveProxy(urlParser, globalInfo); MariaDbConnection connection = new MariaDbConnection(protocol); MariaDbPooledConnection pooledConnection = createPoolConnection(connection); if (options.staticGlobal) { //on first connection load initial state if (globalInfo == null) { initializePoolGlobalState(connection); } //set default transaction isolation level to permit resetting to initial state connection.setDefaultTransactionIsolation(globalInfo.getDefaultTransactionIsolation()); } else { //set default transaction isolation level to permit resetting to initial state connection.setDefaultTransactionIsolation(connection.getTransactionIsolation()); } if (poolState.get() == POOL_STATE_OK && totalConnection.incrementAndGet() <= options.maxPoolSize) { idleConnections.addFirst(pooledConnection); if (logger.isDebugEnabled()) { logger.debug("pool {} new physical connection created (total:{}, active:{}, pending:{})", poolTag, totalConnection.get(), getActiveConnections(), pendingRequestNumber.get()); } return; } silentCloseConnection(pooledConnection); } }
public class class_name { private void addConnection() throws SQLException { //create new connection Protocol protocol = Utils.retrieveProxy(urlParser, globalInfo); MariaDbConnection connection = new MariaDbConnection(protocol); MariaDbPooledConnection pooledConnection = createPoolConnection(connection); if (options.staticGlobal) { //on first connection load initial state if (globalInfo == null) { initializePoolGlobalState(connection); // depends on control dependency: [if], data = [none] } //set default transaction isolation level to permit resetting to initial state connection.setDefaultTransactionIsolation(globalInfo.getDefaultTransactionIsolation()); } else { //set default transaction isolation level to permit resetting to initial state connection.setDefaultTransactionIsolation(connection.getTransactionIsolation()); } if (poolState.get() == POOL_STATE_OK && totalConnection.incrementAndGet() <= options.maxPoolSize) { idleConnections.addFirst(pooledConnection); if (logger.isDebugEnabled()) { logger.debug("pool {} new physical connection created (total:{}, active:{}, pending:{})", poolTag, totalConnection.get(), getActiveConnections(), pendingRequestNumber.get()); // depends on control dependency: [if], data = [none] } return; } silentCloseConnection(pooledConnection); } }
public class class_name { protected static final int generateVersionNumber(String s) { int i = -1; StringTokenizer stringtokenizer = new StringTokenizer(s, "VRM", false); if (stringtokenizer.countTokens() == 3) { String s1 = stringtokenizer.nextToken(); s1 = s1 + stringtokenizer.nextToken(); s1 = s1 + stringtokenizer.nextToken(); i = Integer.parseInt(s1); } return i; } }
public class class_name { protected static final int generateVersionNumber(String s) { int i = -1; StringTokenizer stringtokenizer = new StringTokenizer(s, "VRM", false); if (stringtokenizer.countTokens() == 3) { String s1 = stringtokenizer.nextToken(); s1 = s1 + stringtokenizer.nextToken(); // depends on control dependency: [if], data = [none] s1 = s1 + stringtokenizer.nextToken(); // depends on control dependency: [if], data = [none] i = Integer.parseInt(s1); // depends on control dependency: [if], data = [none] } return i; } }
public class class_name { protected String getLocalizedType(int flags) { if ((flags & CmsAccessControlEntry.ACCESS_FLAGS_USER) > 0) { return key(Messages.GUI_LABEL_USER_0); } else { return key(Messages.GUI_LABEL_GROUP_0); } } }
public class class_name { protected String getLocalizedType(int flags) { if ((flags & CmsAccessControlEntry.ACCESS_FLAGS_USER) > 0) { return key(Messages.GUI_LABEL_USER_0); // depends on control dependency: [if], data = [0)] } else { return key(Messages.GUI_LABEL_GROUP_0); // depends on control dependency: [if], data = [0)] } } }
public class class_name { @SuppressWarnings("all") public static File findPidFile(File path) { Assert.isTrue(FileSystemUtils.isExisting(path), "The path [%s] to search for the .pid file must not be null and must actually exist", path); File searchDirectory = (path.isDirectory() ? path : path.getParentFile()); for (File file : searchDirectory.listFiles(DIRECTORY_PID_FILE_FILTER)) { if (file.isDirectory()) { file = findPidFile(file); } if (PID_FILE_FILTER.accept(file)) { return file; } } return null; } }
public class class_name { @SuppressWarnings("all") public static File findPidFile(File path) { Assert.isTrue(FileSystemUtils.isExisting(path), "The path [%s] to search for the .pid file must not be null and must actually exist", path); File searchDirectory = (path.isDirectory() ? path : path.getParentFile()); for (File file : searchDirectory.listFiles(DIRECTORY_PID_FILE_FILTER)) { if (file.isDirectory()) { file = findPidFile(file); // depends on control dependency: [if], data = [none] } if (PID_FILE_FILTER.accept(file)) { return file; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { @SafeVarargs public static Byte[] box(final byte... a) { if (a == null) { return null; } return box(a, 0, a.length); } }
public class class_name { @SafeVarargs public static Byte[] box(final byte... a) { if (a == null) { return null; // depends on control dependency: [if], data = [none] } return box(a, 0, a.length); } }
public class class_name { public static AccessibilityNodeInfoCompat refreshNode( AccessibilityNodeInfoCompat node) { if (node == null) { return null; } AccessibilityNodeInfoCompat result = refreshFromChild(node); if (result == null) { result = refreshFromParent(node); } return result; } }
public class class_name { public static AccessibilityNodeInfoCompat refreshNode( AccessibilityNodeInfoCompat node) { if (node == null) { return null; // depends on control dependency: [if], data = [none] } AccessibilityNodeInfoCompat result = refreshFromChild(node); if (result == null) { result = refreshFromParent(node); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public Collection<ArtifactSpec> getTransientDependencies(ArtifactSpec artifact) { Set<ArtifactSpec> deps = new HashSet<>(); if (this.isDirectDep(artifact)) { deps.addAll(getTransientDeps(artifact)); } if (presolvedDependencies.isDirectDep(artifact)) { deps.addAll(presolvedDependencies.getTransientDeps(artifact)); } return deps; } }
public class class_name { public Collection<ArtifactSpec> getTransientDependencies(ArtifactSpec artifact) { Set<ArtifactSpec> deps = new HashSet<>(); if (this.isDirectDep(artifact)) { deps.addAll(getTransientDeps(artifact)); // depends on control dependency: [if], data = [none] } if (presolvedDependencies.isDirectDep(artifact)) { deps.addAll(presolvedDependencies.getTransientDeps(artifact)); // depends on control dependency: [if], data = [none] } return deps; } }
public class class_name { protected AttributeSplitSuggestion searchForBestSplitOption(Node currentNode, AttributeSplitSuggestion currentBestOption, SplitCriterion criterion, int attIndex) { // Return null if the current node is null or we have finished looking through all the possible splits if (currentNode == null || countRightTotal == 0.0) { return currentBestOption; } if (currentNode.left != null) { currentBestOption = searchForBestSplitOption(currentNode.left, currentBestOption, criterion, attIndex); } sumTotalLeft += currentNode.leftStatistics.getValue(1); sumTotalRight -= currentNode.leftStatistics.getValue(1); sumSqTotalLeft += currentNode.leftStatistics.getValue(2); sumSqTotalRight -= currentNode.leftStatistics.getValue(2); countLeftTotal += currentNode.leftStatistics.getValue(0); countRightTotal -= currentNode.leftStatistics.getValue(0); double[][] postSplitDists = new double[][]{{countLeftTotal, sumTotalLeft, sumSqTotalLeft}, {countRightTotal, sumTotalRight, sumSqTotalRight}}; double[] preSplitDist = new double[]{(countLeftTotal + countRightTotal), (sumTotalLeft + sumTotalRight), (sumSqTotalLeft + sumSqTotalRight)}; double merit = criterion.getMeritOfSplit(preSplitDist, postSplitDists); if ((currentBestOption == null) || (merit > currentBestOption.merit)) { currentBestOption = new AttributeSplitSuggestion( new NumericAttributeBinaryTest(attIndex, currentNode.cut_point, true), postSplitDists, merit); } if (currentNode.right != null) { currentBestOption = searchForBestSplitOption(currentNode.right, currentBestOption, criterion, attIndex); } sumTotalLeft -= currentNode.leftStatistics.getValue(1); sumTotalRight += currentNode.leftStatistics.getValue(1); sumSqTotalLeft -= currentNode.leftStatistics.getValue(2); sumSqTotalRight += currentNode.leftStatistics.getValue(2); countLeftTotal -= currentNode.leftStatistics.getValue(0); countRightTotal += currentNode.leftStatistics.getValue(0); return currentBestOption; } }
public class class_name { protected AttributeSplitSuggestion searchForBestSplitOption(Node currentNode, AttributeSplitSuggestion currentBestOption, SplitCriterion criterion, int attIndex) { // Return null if the current node is null or we have finished looking through all the possible splits if (currentNode == null || countRightTotal == 0.0) { return currentBestOption; // depends on control dependency: [if], data = [none] } if (currentNode.left != null) { currentBestOption = searchForBestSplitOption(currentNode.left, currentBestOption, criterion, attIndex); // depends on control dependency: [if], data = [(currentNode.left] } sumTotalLeft += currentNode.leftStatistics.getValue(1); sumTotalRight -= currentNode.leftStatistics.getValue(1); sumSqTotalLeft += currentNode.leftStatistics.getValue(2); sumSqTotalRight -= currentNode.leftStatistics.getValue(2); countLeftTotal += currentNode.leftStatistics.getValue(0); countRightTotal -= currentNode.leftStatistics.getValue(0); double[][] postSplitDists = new double[][]{{countLeftTotal, sumTotalLeft, sumSqTotalLeft}, {countRightTotal, sumTotalRight, sumSqTotalRight}}; double[] preSplitDist = new double[]{(countLeftTotal + countRightTotal), (sumTotalLeft + sumTotalRight), (sumSqTotalLeft + sumSqTotalRight)}; double merit = criterion.getMeritOfSplit(preSplitDist, postSplitDists); if ((currentBestOption == null) || (merit > currentBestOption.merit)) { currentBestOption = new AttributeSplitSuggestion( new NumericAttributeBinaryTest(attIndex, currentNode.cut_point, true), postSplitDists, merit); // depends on control dependency: [if], data = [none] } if (currentNode.right != null) { currentBestOption = searchForBestSplitOption(currentNode.right, currentBestOption, criterion, attIndex); // depends on control dependency: [if], data = [(currentNode.right] } sumTotalLeft -= currentNode.leftStatistics.getValue(1); sumTotalRight += currentNode.leftStatistics.getValue(1); sumSqTotalLeft -= currentNode.leftStatistics.getValue(2); sumSqTotalRight += currentNode.leftStatistics.getValue(2); countLeftTotal -= currentNode.leftStatistics.getValue(0); countRightTotal += currentNode.leftStatistics.getValue(0); return currentBestOption; } }
public class class_name { public Enumeration<NetworkInterface> getSubInterfaces() { class subIFs implements Enumeration<NetworkInterface> { private int i=0; subIFs() { } public NetworkInterface nextElement() { if (i < childs.length) { return childs[i++]; } else { throw new NoSuchElementException(); } } public boolean hasMoreElements() { return (i < childs.length); } } return new subIFs(); } }
public class class_name { public Enumeration<NetworkInterface> getSubInterfaces() { class subIFs implements Enumeration<NetworkInterface> { private int i=0; subIFs() { } public NetworkInterface nextElement() { if (i < childs.length) { return childs[i++]; // depends on control dependency: [if], data = [none] } else { throw new NoSuchElementException(); } } public boolean hasMoreElements() { return (i < childs.length); } } return new subIFs(); } }
public class class_name { public static String capitalize(String input) { if (input == null) { return null; } if (input.length() > 1) { for (int i = 0; i < input.length(); i++) { if (Character.isAlphabetic(input.charAt(i))) { return input.substring(0, i) + Character.toString(input.charAt(i)).toUpperCase() + input.substring(i + 1); } } } return input.toUpperCase(); } }
public class class_name { public static String capitalize(String input) { if (input == null) { return null; // depends on control dependency: [if], data = [none] } if (input.length() > 1) { for (int i = 0; i < input.length(); i++) { if (Character.isAlphabetic(input.charAt(i))) { return input.substring(0, i) + Character.toString(input.charAt(i)).toUpperCase() + input.substring(i + 1); // depends on control dependency: [if], data = [none] } } } return input.toUpperCase(); } }
public class class_name { public CompletableFuture<Queue<T>> take(int maxCount) { synchronized (this.contents) { Exceptions.checkNotClosed(this.closed, this); Preconditions.checkState(this.pendingTake == null, "Cannot have more than one concurrent pending take() request."); Queue<T> result = fetch(maxCount); if (result.size() > 0) { return CompletableFuture.completedFuture(result); } else { this.pendingTake = new CompletableFuture<>(); return this.pendingTake; } } } }
public class class_name { public CompletableFuture<Queue<T>> take(int maxCount) { synchronized (this.contents) { Exceptions.checkNotClosed(this.closed, this); Preconditions.checkState(this.pendingTake == null, "Cannot have more than one concurrent pending take() request."); Queue<T> result = fetch(maxCount); if (result.size() > 0) { return CompletableFuture.completedFuture(result); // depends on control dependency: [if], data = [none] } else { this.pendingTake = new CompletableFuture<>(); // depends on control dependency: [if], data = [none] return this.pendingTake; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void characters(char[] ch, int start, int length) throws RepositoryException { StringBuilder text = new StringBuilder(); text.append(ch, start, length); if (log.isDebugEnabled()) { log.debug("Property:xmltext=" + text + " Parent=" + getParent().getQPath().getAsString()); } if (xmlCharactersProperty != null) { xmlCharactersPropertyValue += text.toString(); xmlCharactersProperty.setValue(new TransientValueData(xmlCharactersPropertyValue)); } else { ImportNodeData nodeData = ImportNodeData.createNodeData(getParent(), Constants.JCR_XMLTEXT, Constants.NT_UNSTRUCTURED, getNodeIndex(getParent(), Constants.JCR_XMLTEXT, null), getNextChildOrderNum(getParent())); changesLog.add(new ItemState(nodeData, ItemState.ADDED, true, getAncestorToSave())); if (log.isDebugEnabled()) { log.debug("New node " + nodeData.getQPath().getAsString()); } ImportPropertyData newProperty = new ImportPropertyData(QPath.makeChildPath(nodeData.getQPath(), Constants.JCR_PRIMARYTYPE), IdGenerator.generate(), -1, PropertyType.NAME, nodeData.getIdentifier(), false); newProperty.setValue(new TransientValueData(Constants.NT_UNSTRUCTURED)); changesLog.add(new ItemState(newProperty, ItemState.ADDED, true, getAncestorToSave())); newProperty = new ImportPropertyData(QPath.makeChildPath(nodeData.getQPath(), Constants.JCR_XMLCHARACTERS), IdGenerator.generate(), -1, PropertyType.STRING, nodeData.getIdentifier(), false); newProperty.setValue(new TransientValueData(text.toString())); changesLog.add(new ItemState(newProperty, ItemState.ADDED, true, getAncestorToSave())); xmlCharactersProperty = newProperty; xmlCharactersPropertyValue = text.toString(); } } }
public class class_name { public void characters(char[] ch, int start, int length) throws RepositoryException { StringBuilder text = new StringBuilder(); text.append(ch, start, length); if (log.isDebugEnabled()) { log.debug("Property:xmltext=" + text + " Parent=" + getParent().getQPath().getAsString()); } if (xmlCharactersProperty != null) { xmlCharactersPropertyValue += text.toString(); xmlCharactersProperty.setValue(new TransientValueData(xmlCharactersPropertyValue)); } else { ImportNodeData nodeData = ImportNodeData.createNodeData(getParent(), Constants.JCR_XMLTEXT, Constants.NT_UNSTRUCTURED, getNodeIndex(getParent(), Constants.JCR_XMLTEXT, null), getNextChildOrderNum(getParent())); changesLog.add(new ItemState(nodeData, ItemState.ADDED, true, getAncestorToSave())); if (log.isDebugEnabled()) { log.debug("New node " + nodeData.getQPath().getAsString()); // depends on control dependency: [if], data = [none] } ImportPropertyData newProperty = new ImportPropertyData(QPath.makeChildPath(nodeData.getQPath(), Constants.JCR_PRIMARYTYPE), IdGenerator.generate(), -1, PropertyType.NAME, nodeData.getIdentifier(), false); newProperty.setValue(new TransientValueData(Constants.NT_UNSTRUCTURED)); changesLog.add(new ItemState(newProperty, ItemState.ADDED, true, getAncestorToSave())); newProperty = new ImportPropertyData(QPath.makeChildPath(nodeData.getQPath(), Constants.JCR_XMLCHARACTERS), IdGenerator.generate(), -1, PropertyType.STRING, nodeData.getIdentifier(), false); newProperty.setValue(new TransientValueData(text.toString())); changesLog.add(new ItemState(newProperty, ItemState.ADDED, true, getAncestorToSave())); xmlCharactersProperty = newProperty; xmlCharactersPropertyValue = text.toString(); } } }
public class class_name { @SuppressWarnings("unchecked") public Set<QueryableEntry> query(Predicate predicate) { stats.incrementQueryCount(); if (!haveAtLeastOneIndex() || !(predicate instanceof IndexAwarePredicate)) { return null; } IndexAwarePredicate indexAwarePredicate = (IndexAwarePredicate) predicate; QueryContext queryContext = queryContextProvider.obtainContextFor(this); if (!indexAwarePredicate.isIndexed(queryContext)) { return null; } Set<QueryableEntry> result = indexAwarePredicate.filter(queryContext); if (result != null) { stats.incrementIndexedQueryCount(); queryContext.applyPerQueryStats(); } return result; } }
public class class_name { @SuppressWarnings("unchecked") public Set<QueryableEntry> query(Predicate predicate) { stats.incrementQueryCount(); if (!haveAtLeastOneIndex() || !(predicate instanceof IndexAwarePredicate)) { return null; // depends on control dependency: [if], data = [none] } IndexAwarePredicate indexAwarePredicate = (IndexAwarePredicate) predicate; QueryContext queryContext = queryContextProvider.obtainContextFor(this); if (!indexAwarePredicate.isIndexed(queryContext)) { return null; // depends on control dependency: [if], data = [none] } Set<QueryableEntry> result = indexAwarePredicate.filter(queryContext); if (result != null) { stats.incrementIndexedQueryCount(); // depends on control dependency: [if], data = [none] queryContext.applyPerQueryStats(); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public void addSourceFolders(Iterable<File> folders) { Assert.notNull(folders, "Folders must not be null"); synchronized (this.monitor) { for (File folder : folders) { addSourceFolder(folder); } } } }
public class class_name { public void addSourceFolders(Iterable<File> folders) { Assert.notNull(folders, "Folders must not be null"); synchronized (this.monitor) { for (File folder : folders) { addSourceFolder(folder); // depends on control dependency: [for], data = [folder] } } } }
public class class_name { public void marshall(AvailSettings availSettings, ProtocolMarshaller protocolMarshaller) { if (availSettings == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(availSettings.getScte35SpliceInsert(), SCTE35SPLICEINSERT_BINDING); protocolMarshaller.marshall(availSettings.getScte35TimeSignalApos(), SCTE35TIMESIGNALAPOS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(AvailSettings availSettings, ProtocolMarshaller protocolMarshaller) { if (availSettings == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(availSettings.getScte35SpliceInsert(), SCTE35SPLICEINSERT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(availSettings.getScte35TimeSignalApos(), SCTE35TIMESIGNALAPOS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static Shape createArrowShape(int w, int y0, int y1) { Path2D path = new Path2D.Double(); path.moveTo(0, y0); if ((w & 1) == 0) { path.lineTo(w>>1, y1); } else { int c = w>>1; path.lineTo(c, y1); path.lineTo(c+1, y1); } path.lineTo(w, y0); path.closePath(); return path; } }
public class class_name { private static Shape createArrowShape(int w, int y0, int y1) { Path2D path = new Path2D.Double(); path.moveTo(0, y0); if ((w & 1) == 0) { path.lineTo(w>>1, y1); // depends on control dependency: [if], data = [none] } else { int c = w>>1; path.lineTo(c, y1); // depends on control dependency: [if], data = [none] path.lineTo(c+1, y1); // depends on control dependency: [if], data = [none] } path.lineTo(w, y0); path.closePath(); return path; } }
public class class_name { @Override public final DataSource getJtaDataSource() { if (ivJtaDataSource == null || ivJtaDataSource instanceof GenericDataSource) { // d455055 ivJtaDataSource = getJPADataSource(ivJtaDataSourceJNDIName); } return ivJtaDataSource; } }
public class class_name { @Override public final DataSource getJtaDataSource() { if (ivJtaDataSource == null || ivJtaDataSource instanceof GenericDataSource) { // d455055 ivJtaDataSource = getJPADataSource(ivJtaDataSourceJNDIName); // depends on control dependency: [if], data = [(ivJtaDataSource] } return ivJtaDataSource; } }
public class class_name { private final void print( Object[] kvs ) { for( int i=0; i<len(kvs); i++ ) { Object K = key(kvs,i); if( K != null ) { String KS = (K == TOMBSTONE) ? "XXX" : K.toString(); Object V = val(kvs,i); Object U = Prime.unbox(V); String p = (V==U) ? "" : "prime_"; String US = (U == TOMBSTONE) ? "tombstone" : U.toString(); System.out.println(""+i+" ("+KS+","+p+US+")"); } } Object[] newkvs = chm(kvs)._newkvs; // New table, if any if( newkvs != null ) { System.out.println("----"); print(newkvs); } } }
public class class_name { private final void print( Object[] kvs ) { for( int i=0; i<len(kvs); i++ ) { Object K = key(kvs,i); if( K != null ) { String KS = (K == TOMBSTONE) ? "XXX" : K.toString(); Object V = val(kvs,i); Object U = Prime.unbox(V); String p = (V==U) ? "" : "prime_"; String US = (U == TOMBSTONE) ? "tombstone" : U.toString(); System.out.println(""+i+" ("+KS+","+p+US+")"); } } Object[] newkvs = chm(kvs)._newkvs; // New table, if any if( newkvs != null ) { System.out.println("----"); print(newkvs); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void init(ClassLoader loader, ContextSource[] contextSources, String[] prefixes, boolean profilingEnabled) throws Exception { mSources = contextSources; int len = contextSources.length; ArrayList<Class<?>> contextList = new ArrayList<Class<?>>(len); ArrayList<ClassLoader> delegateList = new ArrayList<ClassLoader>(len); for (int j = 0; j < contextSources.length; j++) { Class<?> type = contextSources[j].getContextType(); if (type != null) { contextList.add(type); ClassLoader scout = type.getClassLoader(); if (scout != null && !delegateList.contains(scout)) { delegateList.add(scout); } } } mContextsInOrder = contextList.toArray(new Class[contextList.size()]); ClassLoader[] delegateLoaders = delegateList.toArray(new ClassLoader[delegateList.size()]); mInjector = new ClassInjector (new DelegateClassLoader(loader, delegateLoaders)); mProfilingEnabled = profilingEnabled; int observerMode = profilingEnabled ? MergedClass.OBSERVER_ENABLED | MergedClass.OBSERVER_EXTERNAL : MergedClass.OBSERVER_ENABLED; // temporarily include interface for UtilityContext for backwards // compatibility with old code relying on it. Class<?>[] interfaces = { UtilityContext.class }; mConstr = MergedClass.getConstructor2(mInjector, mContextsInOrder, prefixes, interfaces, observerMode); } }
public class class_name { public void init(ClassLoader loader, ContextSource[] contextSources, String[] prefixes, boolean profilingEnabled) throws Exception { mSources = contextSources; int len = contextSources.length; ArrayList<Class<?>> contextList = new ArrayList<Class<?>>(len); ArrayList<ClassLoader> delegateList = new ArrayList<ClassLoader>(len); for (int j = 0; j < contextSources.length; j++) { Class<?> type = contextSources[j].getContextType(); if (type != null) { contextList.add(type); ClassLoader scout = type.getClassLoader(); if (scout != null && !delegateList.contains(scout)) { delegateList.add(scout); // depends on control dependency: [if], data = [(scout] } } } mContextsInOrder = contextList.toArray(new Class[contextList.size()]); ClassLoader[] delegateLoaders = delegateList.toArray(new ClassLoader[delegateList.size()]); mInjector = new ClassInjector (new DelegateClassLoader(loader, delegateLoaders)); mProfilingEnabled = profilingEnabled; int observerMode = profilingEnabled ? MergedClass.OBSERVER_ENABLED | MergedClass.OBSERVER_EXTERNAL : MergedClass.OBSERVER_ENABLED; // temporarily include interface for UtilityContext for backwards // compatibility with old code relying on it. Class<?>[] interfaces = { UtilityContext.class }; mConstr = MergedClass.getConstructor2(mInjector, mContextsInOrder, prefixes, interfaces, observerMode); } }
public class class_name { public XNodeSet getNodeSetDTMByKey( XPathContext xctxt, int doc, QName name, XMLString ref, PrefixResolver nscontext) throws javax.xml.transform.TransformerException { XNodeSet nl = null; ElemTemplateElement template = (ElemTemplateElement) nscontext; // yuck -sb if ((null != template) && null != template.getStylesheetRoot().getKeysComposed()) { boolean foundDoc = false; if (null == m_key_tables) { m_key_tables = new Vector(4); } else { int nKeyTables = m_key_tables.size(); for (int i = 0; i < nKeyTables; i++) { KeyTable kt = (KeyTable) m_key_tables.elementAt(i); if (kt.getKeyTableName().equals(name) && doc == kt.getDocKey()) { nl = kt.getNodeSetDTMByKey(name, ref); if (nl != null) { foundDoc = true; break; } } } } if ((null == nl) &&!foundDoc /* && m_needToBuildKeysTable */) { KeyTable kt = new KeyTable(doc, nscontext, name, template.getStylesheetRoot().getKeysComposed(), xctxt); m_key_tables.addElement(kt); if (doc == kt.getDocKey()) { foundDoc = true; nl = kt.getNodeSetDTMByKey(name, ref); } } } return nl; } }
public class class_name { public XNodeSet getNodeSetDTMByKey( XPathContext xctxt, int doc, QName name, XMLString ref, PrefixResolver nscontext) throws javax.xml.transform.TransformerException { XNodeSet nl = null; ElemTemplateElement template = (ElemTemplateElement) nscontext; // yuck -sb if ((null != template) && null != template.getStylesheetRoot().getKeysComposed()) { boolean foundDoc = false; if (null == m_key_tables) { m_key_tables = new Vector(4); // depends on control dependency: [if], data = [none] } else { int nKeyTables = m_key_tables.size(); for (int i = 0; i < nKeyTables; i++) { KeyTable kt = (KeyTable) m_key_tables.elementAt(i); if (kt.getKeyTableName().equals(name) && doc == kt.getDocKey()) { nl = kt.getNodeSetDTMByKey(name, ref); // depends on control dependency: [if], data = [none] if (nl != null) { foundDoc = true; // depends on control dependency: [if], data = [none] break; } } } } if ((null == nl) &&!foundDoc /* && m_needToBuildKeysTable */) { KeyTable kt = new KeyTable(doc, nscontext, name, template.getStylesheetRoot().getKeysComposed(), xctxt); m_key_tables.addElement(kt); // depends on control dependency: [if], data = [none] if (doc == kt.getDocKey()) { foundDoc = true; // depends on control dependency: [if], data = [none] nl = kt.getNodeSetDTMByKey(name, ref); // depends on control dependency: [if], data = [none] } } } return nl; } }
public class class_name { @Value("${locator.strategy}") public void setDefaultLocatorSelectionStrategy(String defaultLocatorSelectionStrategy) { this.defaultLocatorSelectionStrategy = defaultLocatorSelectionStrategy; if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "Default strategy " + defaultLocatorSelectionStrategy + " was set for LocatorClientRegistrar."); } } }
public class class_name { @Value("${locator.strategy}") public void setDefaultLocatorSelectionStrategy(String defaultLocatorSelectionStrategy) { this.defaultLocatorSelectionStrategy = defaultLocatorSelectionStrategy; if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "Default strategy " + defaultLocatorSelectionStrategy + " was set for LocatorClientRegistrar."); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected static String getLang() { Locale locale = Locale.getDefault(); if (null == locale) return DEFAULT_LANGUAGE_CODE; String language = locale.getLanguage(); String country = locale.getCountry(); String localeString = String.format("%s_%s", language != null ? language.toLowerCase(Locale.ENGLISH) : "", country != null ? country.toUpperCase(Locale.ENGLISH) : ""); // 1. if no language is specified, return the default language if (null == language) return DEFAULT_LANGUAGE_CODE; // 2. try to match the language or the entire locale string among the // list of available language codes String matchedLanguageCode = null; for (String languageCode : VALID_LANGUAGE_CODES) { if (languageCode.equals(localeString)) { // return here as this is the most precise match we can get return localeString; } if (languageCode.equals(language)) { // set the matched language code, and continue iterating as we // may match the localeString in a later iteration. matchedLanguageCode = language; } } if (null != matchedLanguageCode) return matchedLanguageCode; return DEFAULT_LANGUAGE_CODE; } }
public class class_name { protected static String getLang() { Locale locale = Locale.getDefault(); if (null == locale) return DEFAULT_LANGUAGE_CODE; String language = locale.getLanguage(); String country = locale.getCountry(); String localeString = String.format("%s_%s", language != null ? language.toLowerCase(Locale.ENGLISH) : "", country != null ? country.toUpperCase(Locale.ENGLISH) : ""); // 1. if no language is specified, return the default language if (null == language) return DEFAULT_LANGUAGE_CODE; // 2. try to match the language or the entire locale string among the // list of available language codes String matchedLanguageCode = null; for (String languageCode : VALID_LANGUAGE_CODES) { if (languageCode.equals(localeString)) { // return here as this is the most precise match we can get return localeString; // depends on control dependency: [if], data = [none] } if (languageCode.equals(language)) { // set the matched language code, and continue iterating as we // may match the localeString in a later iteration. matchedLanguageCode = language; // depends on control dependency: [if], data = [none] } } if (null != matchedLanguageCode) return matchedLanguageCode; return DEFAULT_LANGUAGE_CODE; } }
public class class_name { @Override public <T> T putAttachment(final AttachmentKey<T> key, final T value) { if (key == null) { throw UndertowMessages.MESSAGES.argumentCannotBeNull("key"); } if(attachments == null) { attachments = createAttachmentMap(); } return (T) attachments.put(key, value); } }
public class class_name { @Override public <T> T putAttachment(final AttachmentKey<T> key, final T value) { if (key == null) { throw UndertowMessages.MESSAGES.argumentCannotBeNull("key"); } if(attachments == null) { attachments = createAttachmentMap(); // depends on control dependency: [if], data = [none] } return (T) attachments.put(key, value); } }
public class class_name { public BeanDefinition removeBean(final String name) { BeanDefinition bd = beans.remove(name); if (bd == null) { return null; } bd.scopeRemove(); return bd; } }
public class class_name { public BeanDefinition removeBean(final String name) { BeanDefinition bd = beans.remove(name); if (bd == null) { return null; // depends on control dependency: [if], data = [none] } bd.scopeRemove(); return bd; } }
public class class_name { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); // The following program should not be reachable since the factory should // produce errors if it is unable to create an instantiator. throw new IllegalStateException(); } }
public class class_name { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; // depends on control dependency: [for], data = [instantiator] } errors.throwIfHasErrors(); // The following program should not be reachable since the factory should // produce errors if it is unable to create an instantiator. throw new IllegalStateException(); } }
public class class_name { private static void readField(Object[] vals, int fieldIdx, TypeDescription schema, ColumnVector vector, int childCount) { // check the type of the vector to decide how to read it. switch (schema.getCategory()) { case BOOLEAN: if (vector.noNulls) { readNonNullLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readBoolean); } else { readLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readBoolean); } break; case BYTE: if (vector.noNulls) { readNonNullLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readByte); } else { readLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readByte); } break; case SHORT: if (vector.noNulls) { readNonNullLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readShort); } else { readLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readShort); } break; case INT: if (vector.noNulls) { readNonNullLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readInt); } else { readLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readInt); } break; case LONG: if (vector.noNulls) { readNonNullLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readLong); } else { readLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readLong); } break; case FLOAT: if (vector.noNulls) { readNonNullDoubleColumn(vals, fieldIdx, (DoubleColumnVector) vector, childCount, OrcBatchReader::readFloat); } else { readDoubleColumn(vals, fieldIdx, (DoubleColumnVector) vector, childCount, OrcBatchReader::readFloat); } break; case DOUBLE: if (vector.noNulls) { readNonNullDoubleColumn(vals, fieldIdx, (DoubleColumnVector) vector, childCount, OrcBatchReader::readDouble); } else { readDoubleColumn(vals, fieldIdx, (DoubleColumnVector) vector, childCount, OrcBatchReader::readDouble); } break; case CHAR: case VARCHAR: case STRING: if (vector.noNulls) { readNonNullBytesColumnAsString(vals, fieldIdx, (BytesColumnVector) vector, childCount); } else { readBytesColumnAsString(vals, fieldIdx, (BytesColumnVector) vector, childCount); } break; case DATE: if (vector.noNulls) { readNonNullLongColumnAsDate(vals, fieldIdx, (LongColumnVector) vector, childCount); } else { readLongColumnAsDate(vals, fieldIdx, (LongColumnVector) vector, childCount); } break; case TIMESTAMP: if (vector.noNulls) { readNonNullTimestampColumn(vals, fieldIdx, (TimestampColumnVector) vector, childCount); } else { readTimestampColumn(vals, fieldIdx, (TimestampColumnVector) vector, childCount); } break; case BINARY: if (vector.noNulls) { readNonNullBytesColumnAsBinary(vals, fieldIdx, (BytesColumnVector) vector, childCount); } else { readBytesColumnAsBinary(vals, fieldIdx, (BytesColumnVector) vector, childCount); } break; case DECIMAL: if (vector.noNulls) { readNonNullDecimalColumn(vals, fieldIdx, (DecimalColumnVector) vector, childCount); } else { readDecimalColumn(vals, fieldIdx, (DecimalColumnVector) vector, childCount); } break; case STRUCT: if (vector.noNulls) { readNonNullStructColumn(vals, fieldIdx, (StructColumnVector) vector, schema, childCount); } else { readStructColumn(vals, fieldIdx, (StructColumnVector) vector, schema, childCount); } break; case LIST: if (vector.noNulls) { readNonNullListColumn(vals, fieldIdx, (ListColumnVector) vector, schema, childCount); } else { readListColumn(vals, fieldIdx, (ListColumnVector) vector, schema, childCount); } break; case MAP: if (vector.noNulls) { readNonNullMapColumn(vals, fieldIdx, (MapColumnVector) vector, schema, childCount); } else { readMapColumn(vals, fieldIdx, (MapColumnVector) vector, schema, childCount); } break; case UNION: throw new UnsupportedOperationException("UNION type not supported yet"); default: throw new IllegalArgumentException("Unknown type " + schema); } } }
public class class_name { private static void readField(Object[] vals, int fieldIdx, TypeDescription schema, ColumnVector vector, int childCount) { // check the type of the vector to decide how to read it. switch (schema.getCategory()) { case BOOLEAN: if (vector.noNulls) { readNonNullLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readBoolean); // depends on control dependency: [if], data = [none] } else { readLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readBoolean); // depends on control dependency: [if], data = [none] } break; case BYTE: if (vector.noNulls) { readNonNullLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readByte); // depends on control dependency: [if], data = [none] } else { readLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readByte); // depends on control dependency: [if], data = [none] } break; case SHORT: if (vector.noNulls) { readNonNullLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readShort); // depends on control dependency: [if], data = [none] } else { readLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readShort); // depends on control dependency: [if], data = [none] } break; case INT: if (vector.noNulls) { readNonNullLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readInt); // depends on control dependency: [if], data = [none] } else { readLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readInt); // depends on control dependency: [if], data = [none] } break; case LONG: if (vector.noNulls) { readNonNullLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readLong); // depends on control dependency: [if], data = [none] } else { readLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readLong); // depends on control dependency: [if], data = [none] } break; case FLOAT: if (vector.noNulls) { readNonNullDoubleColumn(vals, fieldIdx, (DoubleColumnVector) vector, childCount, OrcBatchReader::readFloat); // depends on control dependency: [if], data = [none] } else { readDoubleColumn(vals, fieldIdx, (DoubleColumnVector) vector, childCount, OrcBatchReader::readFloat); // depends on control dependency: [if], data = [none] } break; case DOUBLE: if (vector.noNulls) { readNonNullDoubleColumn(vals, fieldIdx, (DoubleColumnVector) vector, childCount, OrcBatchReader::readDouble); // depends on control dependency: [if], data = [none] } else { readDoubleColumn(vals, fieldIdx, (DoubleColumnVector) vector, childCount, OrcBatchReader::readDouble); // depends on control dependency: [if], data = [none] } break; case CHAR: case VARCHAR: case STRING: if (vector.noNulls) { readNonNullBytesColumnAsString(vals, fieldIdx, (BytesColumnVector) vector, childCount); // depends on control dependency: [if], data = [none] } else { readBytesColumnAsString(vals, fieldIdx, (BytesColumnVector) vector, childCount); // depends on control dependency: [if], data = [none] } break; case DATE: if (vector.noNulls) { readNonNullLongColumnAsDate(vals, fieldIdx, (LongColumnVector) vector, childCount); // depends on control dependency: [if], data = [none] } else { readLongColumnAsDate(vals, fieldIdx, (LongColumnVector) vector, childCount); // depends on control dependency: [if], data = [none] } break; case TIMESTAMP: if (vector.noNulls) { readNonNullTimestampColumn(vals, fieldIdx, (TimestampColumnVector) vector, childCount); // depends on control dependency: [if], data = [none] } else { readTimestampColumn(vals, fieldIdx, (TimestampColumnVector) vector, childCount); // depends on control dependency: [if], data = [none] } break; case BINARY: if (vector.noNulls) { readNonNullBytesColumnAsBinary(vals, fieldIdx, (BytesColumnVector) vector, childCount); // depends on control dependency: [if], data = [none] } else { readBytesColumnAsBinary(vals, fieldIdx, (BytesColumnVector) vector, childCount); // depends on control dependency: [if], data = [none] } break; case DECIMAL: if (vector.noNulls) { readNonNullDecimalColumn(vals, fieldIdx, (DecimalColumnVector) vector, childCount); // depends on control dependency: [if], data = [none] } else { readDecimalColumn(vals, fieldIdx, (DecimalColumnVector) vector, childCount); // depends on control dependency: [if], data = [none] } break; case STRUCT: if (vector.noNulls) { readNonNullStructColumn(vals, fieldIdx, (StructColumnVector) vector, schema, childCount); // depends on control dependency: [if], data = [none] } else { readStructColumn(vals, fieldIdx, (StructColumnVector) vector, schema, childCount); // depends on control dependency: [if], data = [none] } break; case LIST: if (vector.noNulls) { readNonNullListColumn(vals, fieldIdx, (ListColumnVector) vector, schema, childCount); // depends on control dependency: [if], data = [none] } else { readListColumn(vals, fieldIdx, (ListColumnVector) vector, schema, childCount); // depends on control dependency: [if], data = [none] } break; case MAP: if (vector.noNulls) { readNonNullMapColumn(vals, fieldIdx, (MapColumnVector) vector, schema, childCount); // depends on control dependency: [if], data = [none] } else { readMapColumn(vals, fieldIdx, (MapColumnVector) vector, schema, childCount); // depends on control dependency: [if], data = [none] } break; case UNION: throw new UnsupportedOperationException("UNION type not supported yet"); default: throw new IllegalArgumentException("Unknown type " + schema); } } }
public class class_name { public static void hess(Matrix A, ExecutorService threadpool) { if(!A.isSquare()) throw new ArithmeticException("Only square matrices can be converted to Upper Hessenberg form"); int m = A.rows(); /** * Space used to store the vector for updating the columns of A */ DenseVector columnUpdateTmp = new DenseVector(m); double[] vk = new double[m]; /** * Space used for updating the sub matrix at step i */ double[] subMatrixUpdateTmp = new double[m]; double tmp;//Used for temp values for(int i = 0; i < m-2; i++) { //Holds the norm, sqrt{a_i^2 + ... + a_m^2} double s = 0.0; //First step of the loop done outside to do extra bit double sigh = A.get(i+1, i);//Holds the multiplication factor vk[i+1] = sigh; s += sigh*sigh; sigh = sigh > 0 ? 1 : -1;//Sign dosnt change the squaring, so we do it first for(int j = i+2; j < m; j++) { tmp = A.get(j, i); vk[j] = tmp; s += tmp*tmp; } double s1 = -sigh*Math.sqrt(s); //Now re use s to quickly get the norm of vk, since it will be almost the same vector s -= vk[i+1]*vk[i+1]; vk[i+1] -= s1; s += vk[i+1]*vk[i+1]; double s1Inv = 1.0/Math.sqrt(s);//Re use to store the norm of vk. Do the inverse to multiply quickly instead of divide for(int j = i+1; j < m; j++) vk[j] *= s1Inv; //Update sub sub matrix A[i+1:m, i:m] //NOTE: The first column that will be altered can be done ourslves, since we know the value set (s1) and that all below it will ber zero Matrix subA = new SubMatrix(A, i+1, i, m, m); DenseVector vVec = new DenseVector(vk, i+1, m); Vec tmpV = new DenseVector(subMatrixUpdateTmp, i, m); tmpV.zeroOut(); vVec.multiply(subA, tmpV); if(threadpool == null) OuterProductUpdate(subA, vVec, tmpV, -2.0); else OuterProductUpdate(subA, vVec, tmpV, -2.0, threadpool); //Zero out ourselves after. //TODO implement so we dont compute the first row A.set(i+1, i, s1); for(int j = i+2; j < m; j++) A.set(j, i, 0.0); //Update the columns of A[0:m, i+1:m] subA = new SubMatrix(A, 0, i+1, m, m); columnUpdateTmp.zeroOut(); subA.multiply(vVec, 1.0, columnUpdateTmp); if(threadpool == null) OuterProductUpdate(subA, columnUpdateTmp, vVec, -2.0); else OuterProductUpdate(subA, columnUpdateTmp, vVec, -2.0, threadpool); } } }
public class class_name { public static void hess(Matrix A, ExecutorService threadpool) { if(!A.isSquare()) throw new ArithmeticException("Only square matrices can be converted to Upper Hessenberg form"); int m = A.rows(); /** * Space used to store the vector for updating the columns of A */ DenseVector columnUpdateTmp = new DenseVector(m); double[] vk = new double[m]; /** * Space used for updating the sub matrix at step i */ double[] subMatrixUpdateTmp = new double[m]; double tmp;//Used for temp values for(int i = 0; i < m-2; i++) { //Holds the norm, sqrt{a_i^2 + ... + a_m^2} double s = 0.0; //First step of the loop done outside to do extra bit double sigh = A.get(i+1, i);//Holds the multiplication factor vk[i+1] = sigh; // depends on control dependency: [for], data = [i] s += sigh*sigh; // depends on control dependency: [for], data = [none] sigh = sigh > 0 ? 1 : -1;//Sign dosnt change the squaring, so we do it first // depends on control dependency: [for], data = [none] for(int j = i+2; j < m; j++) { tmp = A.get(j, i); // depends on control dependency: [for], data = [j] vk[j] = tmp; // depends on control dependency: [for], data = [j] s += tmp*tmp; // depends on control dependency: [for], data = [none] } double s1 = -sigh*Math.sqrt(s); //Now re use s to quickly get the norm of vk, since it will be almost the same vector s -= vk[i+1]*vk[i+1]; // depends on control dependency: [for], data = [i] vk[i+1] -= s1; // depends on control dependency: [for], data = [i] s += vk[i+1]*vk[i+1]; // depends on control dependency: [for], data = [i] double s1Inv = 1.0/Math.sqrt(s);//Re use to store the norm of vk. Do the inverse to multiply quickly instead of divide for(int j = i+1; j < m; j++) vk[j] *= s1Inv; //Update sub sub matrix A[i+1:m, i:m] //NOTE: The first column that will be altered can be done ourslves, since we know the value set (s1) and that all below it will ber zero Matrix subA = new SubMatrix(A, i+1, i, m, m); DenseVector vVec = new DenseVector(vk, i+1, m); Vec tmpV = new DenseVector(subMatrixUpdateTmp, i, m); tmpV.zeroOut(); // depends on control dependency: [for], data = [none] vVec.multiply(subA, tmpV); // depends on control dependency: [for], data = [none] if(threadpool == null) OuterProductUpdate(subA, vVec, tmpV, -2.0); else OuterProductUpdate(subA, vVec, tmpV, -2.0, threadpool); //Zero out ourselves after. //TODO implement so we dont compute the first row A.set(i+1, i, s1); // depends on control dependency: [for], data = [i] for(int j = i+2; j < m; j++) A.set(j, i, 0.0); //Update the columns of A[0:m, i+1:m] subA = new SubMatrix(A, 0, i+1, m, m); // depends on control dependency: [for], data = [i] columnUpdateTmp.zeroOut(); // depends on control dependency: [for], data = [none] subA.multiply(vVec, 1.0, columnUpdateTmp); // depends on control dependency: [for], data = [none] if(threadpool == null) OuterProductUpdate(subA, columnUpdateTmp, vVec, -2.0); else OuterProductUpdate(subA, columnUpdateTmp, vVec, -2.0, threadpool); } } }
public class class_name { private void disableStrictSSL() { // Create a trust manager that does not validate certificate chains TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[0]; } public void checkClientTrusted(X509Certificate[] certs, String authType) { } public void checkServerTrusted(X509Certificate[] certs, String authType) { } } }; // Ignore differences between given hostname and certificate hostname HostnameVerifier hv = new HostnameVerifier() { public boolean verify(String hostname, SSLSession session) { return true; } }; // Install the all-trusting trust manager try { SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, trustAllCerts, new SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); HttpsURLConnection.setDefaultHostnameVerifier(hv); } catch (Exception e) { } } }
public class class_name { private void disableStrictSSL() { // Create a trust manager that does not validate certificate chains TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[0]; } public void checkClientTrusted(X509Certificate[] certs, String authType) { } public void checkServerTrusted(X509Certificate[] certs, String authType) { } } }; // Ignore differences between given hostname and certificate hostname HostnameVerifier hv = new HostnameVerifier() { public boolean verify(String hostname, SSLSession session) { return true; } }; // Install the all-trusting trust manager try { SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, trustAllCerts, new SecureRandom()); // depends on control dependency: [try], data = [none] HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); // depends on control dependency: [try], data = [none] HttpsURLConnection.setDefaultHostnameVerifier(hv); // depends on control dependency: [try], data = [none] } catch (Exception e) { } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static byte[] decode(String s) { int len = s.length(); if (len % 2 != 0) { return null; } byte[] bytes = new byte[len / 2]; int pos = 0; for (int i = 0; i < len; i += 2) { byte hi = (byte) Character.digit(s.charAt(i), 16); byte lo = (byte) Character.digit(s.charAt(i + 1), 16); bytes[pos++] = (byte) (hi * 16 + lo); } return bytes; } }
public class class_name { public static byte[] decode(String s) { int len = s.length(); if (len % 2 != 0) { return null; // depends on control dependency: [if], data = [none] } byte[] bytes = new byte[len / 2]; int pos = 0; for (int i = 0; i < len; i += 2) { byte hi = (byte) Character.digit(s.charAt(i), 16); byte lo = (byte) Character.digit(s.charAt(i + 1), 16); bytes[pos++] = (byte) (hi * 16 + lo); // depends on control dependency: [for], data = [none] } return bytes; } }
public class class_name { public static MultiPolygon extractWalls(Polygon polygon, double height){ GeometryFactory factory = polygon.getFactory(); //We process the exterior ring final LineString shell = getClockWise(polygon.getExteriorRing()); ArrayList<Polygon> walls = new ArrayList<Polygon>(); for (int i = 1; i < shell.getNumPoints(); i++) { walls.add(extrudeEdge(shell.getCoordinateN(i - 1), shell.getCoordinateN(i), height, factory)); } // We create the walls for all holes int nbOfHoles = polygon.getNumInteriorRing(); for (int i = 0; i < nbOfHoles; i++) { final LineString hole = getCounterClockWise(polygon.getInteriorRingN(i)); for (int j = 1; j < hole.getNumPoints(); j++) { walls.add(extrudeEdge(hole.getCoordinateN(j - 1), hole.getCoordinateN(j), height, factory)); } } return polygon.getFactory().createMultiPolygon(walls.toArray(new Polygon[0])); } }
public class class_name { public static MultiPolygon extractWalls(Polygon polygon, double height){ GeometryFactory factory = polygon.getFactory(); //We process the exterior ring final LineString shell = getClockWise(polygon.getExteriorRing()); ArrayList<Polygon> walls = new ArrayList<Polygon>(); for (int i = 1; i < shell.getNumPoints(); i++) { walls.add(extrudeEdge(shell.getCoordinateN(i - 1), shell.getCoordinateN(i), height, factory)); // depends on control dependency: [for], data = [i] } // We create the walls for all holes int nbOfHoles = polygon.getNumInteriorRing(); for (int i = 0; i < nbOfHoles; i++) { final LineString hole = getCounterClockWise(polygon.getInteriorRingN(i)); for (int j = 1; j < hole.getNumPoints(); j++) { walls.add(extrudeEdge(hole.getCoordinateN(j - 1), hole.getCoordinateN(j), height, factory)); // depends on control dependency: [for], data = [j] } } return polygon.getFactory().createMultiPolygon(walls.toArray(new Polygon[0])); } }
public class class_name { public static Map<String, Object> replaceDataReferences(final Map<String, Object> input, final Map<String, Map<String, String>> data, Converter<String, String> converter, boolean failIfUnexpanded, boolean blankIfUnexpanded ) { final HashMap<String, Object> output = new HashMap<>(); for (final String s : input.keySet()) { Object o = input.get(s); output.put(s, replaceDataReferencesInObject(o, data, converter, failIfUnexpanded, blankIfUnexpanded)); } return output; } }
public class class_name { public static Map<String, Object> replaceDataReferences(final Map<String, Object> input, final Map<String, Map<String, String>> data, Converter<String, String> converter, boolean failIfUnexpanded, boolean blankIfUnexpanded ) { final HashMap<String, Object> output = new HashMap<>(); for (final String s : input.keySet()) { Object o = input.get(s); output.put(s, replaceDataReferencesInObject(o, data, converter, failIfUnexpanded, blankIfUnexpanded)); // depends on control dependency: [for], data = [s] } return output; } }
public class class_name { @Override public Integer getTotalCallDetailRecords(CallDetailRecordFilter filter) { final SqlSession session = sessions.openSession(); try { final Integer total = session.selectOne(namespace + "getTotalCallDetailRecordByUsingFilters", filter); return total; } finally { session.close(); } } }
public class class_name { @Override public Integer getTotalCallDetailRecords(CallDetailRecordFilter filter) { final SqlSession session = sessions.openSession(); try { final Integer total = session.selectOne(namespace + "getTotalCallDetailRecordByUsingFilters", filter); return total; // depends on control dependency: [try], data = [none] } finally { session.close(); } } }
public class class_name { public List<MeasureTraitType.AttributeSet> getAttributeSet() { if (attributeSet == null) { attributeSet = new ArrayList<MeasureTraitType.AttributeSet>(); } return this.attributeSet; } }
public class class_name { public List<MeasureTraitType.AttributeSet> getAttributeSet() { if (attributeSet == null) { attributeSet = new ArrayList<MeasureTraitType.AttributeSet>(); // depends on control dependency: [if], data = [none] } return this.attributeSet; } }
public class class_name { protected String getSessionIndex(final Assertion subjectAssertion) { List<AuthnStatement> authnStatements = subjectAssertion.getAuthnStatements(); if (authnStatements != null && authnStatements.size() > 0) { AuthnStatement statement = authnStatements.get(0); if (statement != null) { return statement.getSessionIndex(); } } return null; } }
public class class_name { protected String getSessionIndex(final Assertion subjectAssertion) { List<AuthnStatement> authnStatements = subjectAssertion.getAuthnStatements(); if (authnStatements != null && authnStatements.size() > 0) { AuthnStatement statement = authnStatements.get(0); if (statement != null) { return statement.getSessionIndex(); // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public static void genTagOutput(TagletManager tagletManager, Element element, List<Taglet> taglets, TagletWriter writer, Content output) { Utils utils = writer.configuration().utils; tagletManager.checkTags(utils, element, utils.getBlockTags(element), false); tagletManager.checkTags(utils, element, utils.getFullBody(element), true); for (Taglet taglet : taglets) { if (utils.isTypeElement(element) && taglet instanceof ParamTaglet) { //The type parameters are documented in a special section away //from the tag info, so skip here. continue; } if (taglet instanceof DeprecatedTaglet) { //Deprecated information is documented "inline", not in tag info //section. continue; } Content currentOutput = null; try { currentOutput = taglet.getTagletOutput(element, writer); } catch (UnsupportedTagletOperationException utoe) { //The taglet does not take a member as an argument. Let's try //a single tag. List<? extends DocTree> tags = utils.getBlockTags(element, taglet.getName()); if (!tags.isEmpty()) { currentOutput = taglet.getTagletOutput(element, tags.get(0), writer); } } if (currentOutput != null) { tagletManager.seenCustomTag(taglet.getName()); output.addContent(currentOutput); } } } }
public class class_name { public static void genTagOutput(TagletManager tagletManager, Element element, List<Taglet> taglets, TagletWriter writer, Content output) { Utils utils = writer.configuration().utils; tagletManager.checkTags(utils, element, utils.getBlockTags(element), false); tagletManager.checkTags(utils, element, utils.getFullBody(element), true); for (Taglet taglet : taglets) { if (utils.isTypeElement(element) && taglet instanceof ParamTaglet) { //The type parameters are documented in a special section away //from the tag info, so skip here. continue; } if (taglet instanceof DeprecatedTaglet) { //Deprecated information is documented "inline", not in tag info //section. continue; } Content currentOutput = null; try { currentOutput = taglet.getTagletOutput(element, writer); // depends on control dependency: [try], data = [none] } catch (UnsupportedTagletOperationException utoe) { //The taglet does not take a member as an argument. Let's try //a single tag. List<? extends DocTree> tags = utils.getBlockTags(element, taglet.getName()); if (!tags.isEmpty()) { currentOutput = taglet.getTagletOutput(element, tags.get(0), writer); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] if (currentOutput != null) { tagletManager.seenCustomTag(taglet.getName()); // depends on control dependency: [if], data = [none] output.addContent(currentOutput); // depends on control dependency: [if], data = [(currentOutput] } } } }
public class class_name { public void marshall(DescribeElasticsearchInstanceTypeLimitsRequest describeElasticsearchInstanceTypeLimitsRequest, ProtocolMarshaller protocolMarshaller) { if (describeElasticsearchInstanceTypeLimitsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeElasticsearchInstanceTypeLimitsRequest.getDomainName(), DOMAINNAME_BINDING); protocolMarshaller.marshall(describeElasticsearchInstanceTypeLimitsRequest.getInstanceType(), INSTANCETYPE_BINDING); protocolMarshaller.marshall(describeElasticsearchInstanceTypeLimitsRequest.getElasticsearchVersion(), ELASTICSEARCHVERSION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DescribeElasticsearchInstanceTypeLimitsRequest describeElasticsearchInstanceTypeLimitsRequest, ProtocolMarshaller protocolMarshaller) { if (describeElasticsearchInstanceTypeLimitsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeElasticsearchInstanceTypeLimitsRequest.getDomainName(), DOMAINNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeElasticsearchInstanceTypeLimitsRequest.getInstanceType(), INSTANCETYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeElasticsearchInstanceTypeLimitsRequest.getElasticsearchVersion(), ELASTICSEARCHVERSION_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void copyBaseDirs(File[] baseDirs) { this.baseDirs = new File[baseDirs.length]; for (int i = 0; i < baseDirs.length; i++) { this.baseDirs[i] = baseDirs[i].getAbsoluteFile(); } } }
public class class_name { private void copyBaseDirs(File[] baseDirs) { this.baseDirs = new File[baseDirs.length]; for (int i = 0; i < baseDirs.length; i++) { this.baseDirs[i] = baseDirs[i].getAbsoluteFile(); // depends on control dependency: [for], data = [i] } } }
public class class_name { @Execute public HtmlResponse edit(final EditForm form) { final String jspType = "view"; final File jspFile = getJspFile(form.fileName, jspType); try { form.content = new String(FileUtil.readBytes(jspFile), Constants.UTF_8); } catch (final UnsupportedEncodingException e) { throw new FessSystemException("Invalid encoding", e); } saveToken(); return asEditHtml(form); } }
public class class_name { @Execute public HtmlResponse edit(final EditForm form) { final String jspType = "view"; final File jspFile = getJspFile(form.fileName, jspType); try { form.content = new String(FileUtil.readBytes(jspFile), Constants.UTF_8); // depends on control dependency: [try], data = [none] } catch (final UnsupportedEncodingException e) { throw new FessSystemException("Invalid encoding", e); } // depends on control dependency: [catch], data = [none] saveToken(); return asEditHtml(form); } }
public class class_name { public static ExternalSessionKey fromJsonResponseBody(String responseBody) { try { Map<String, Object> json = new Json().toType(responseBody, MAP_TYPE); if (json.get("sessionId") instanceof String) { return new ExternalSessionKey((String) json.get("sessionId")); } // W3C response if (json.get("value") instanceof Map) { Map<?, ?> value = (Map<?, ?>) json.get("value"); if (value.get("sessionId") instanceof String) { return new ExternalSessionKey((String) value.get("sessionId")); } } } catch (JsonException | ClassCastException e) { return null; } return null; } }
public class class_name { public static ExternalSessionKey fromJsonResponseBody(String responseBody) { try { Map<String, Object> json = new Json().toType(responseBody, MAP_TYPE); if (json.get("sessionId") instanceof String) { return new ExternalSessionKey((String) json.get("sessionId")); // depends on control dependency: [if], data = [none] } // W3C response if (json.get("value") instanceof Map) { Map<?, ?> value = (Map<?, ?>) json.get("value"); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] if (value.get("sessionId") instanceof String) { return new ExternalSessionKey((String) value.get("sessionId")); // depends on control dependency: [if], data = [none] } } } catch (JsonException | ClassCastException e) { return null; } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { public static GSIConstants.CertificateType getCertificateType(X509Certificate cert, CertStore trustedCerts) throws CertificateException { try { TBSCertificateStructure crt = getTBSCertificateStructure(cert); GSIConstants.CertificateType type = getCertificateType(crt); // check subject of the cert in trusted cert list // to make sure the cert is not a ca cert if (type == GSIConstants.CertificateType.EEC) { X509CertSelector selector = new X509CertSelector(); selector.setSubject(cert.getSubjectX500Principal()); Collection c = trustedCerts.getCertificates(selector); if (c != null && c.size() > 0) { type = GSIConstants.CertificateType.CA; } } return type; } catch (Exception e) { // but this should not happen throw new CertificateException("", e); } } }
public class class_name { public static GSIConstants.CertificateType getCertificateType(X509Certificate cert, CertStore trustedCerts) throws CertificateException { try { TBSCertificateStructure crt = getTBSCertificateStructure(cert); GSIConstants.CertificateType type = getCertificateType(crt); // check subject of the cert in trusted cert list // to make sure the cert is not a ca cert if (type == GSIConstants.CertificateType.EEC) { X509CertSelector selector = new X509CertSelector(); selector.setSubject(cert.getSubjectX500Principal()); Collection c = trustedCerts.getCertificates(selector); if (c != null && c.size() > 0) { type = GSIConstants.CertificateType.CA; // depends on control dependency: [if], data = [none] } } return type; } catch (Exception e) { // but this should not happen throw new CertificateException("", e); } } }
public class class_name { public void startThreads() { if (this.sortThread != null) { this.sortThread.start(); } if (this.spillThread != null) { this.spillThread.start(); } if (this.mergeThread != null) { this.mergeThread.start(); } } }
public class class_name { public void startThreads() { if (this.sortThread != null) { this.sortThread.start(); // depends on control dependency: [if], data = [none] } if (this.spillThread != null) { this.spillThread.start(); // depends on control dependency: [if], data = [none] } if (this.mergeThread != null) { this.mergeThread.start(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static long headerSize(Class clazz) { Preconditions.checkNotNull(clazz); // TODO Should be calculated based on the platform // TODO maybe unsafe.addressSize() would help? long len = 12; // JVM_64 has a 12 byte header 8 + 4 (with compressed pointers on) if (clazz.isArray()) { len += 4; } return len; } }
public class class_name { public static long headerSize(Class clazz) { Preconditions.checkNotNull(clazz); // TODO Should be calculated based on the platform // TODO maybe unsafe.addressSize() would help? long len = 12; // JVM_64 has a 12 byte header 8 + 4 (with compressed pointers on) if (clazz.isArray()) { len += 4; // depends on control dependency: [if], data = [none] } return len; } }
public class class_name { public static String utf8ToUnicode(String inStr) { char[] myBuffer = inStr.toCharArray(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < inStr.length(); i++) { Character.UnicodeBlock ub = Character.UnicodeBlock.of(myBuffer[i]); if (ub == Character.UnicodeBlock.BASIC_LATIN) { sb.append(myBuffer[i]); } else if (ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS) { int j = (int) myBuffer[i] - 65248; sb.append((char) j); } else { int chr1 = (char) myBuffer[i]; String hexS = Integer.toHexString(chr1); String unicode = "\\u" + hexS; sb.append(unicode.toLowerCase()); } } return sb.toString(); } }
public class class_name { public static String utf8ToUnicode(String inStr) { char[] myBuffer = inStr.toCharArray(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < inStr.length(); i++) { Character.UnicodeBlock ub = Character.UnicodeBlock.of(myBuffer[i]); if (ub == Character.UnicodeBlock.BASIC_LATIN) { sb.append(myBuffer[i]); // depends on control dependency: [if], data = [none] } else if (ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS) { int j = (int) myBuffer[i] - 65248; sb.append((char) j); // depends on control dependency: [if], data = [none] } else { int chr1 = (char) myBuffer[i]; String hexS = Integer.toHexString(chr1); String unicode = "\\u" + hexS; sb.append(unicode.toLowerCase()); // depends on control dependency: [if], data = [none] } } return sb.toString(); } }
public class class_name { public static final boolean iOs3_2Plus() { if (cachediOs3_2Plus == null) { cachediOs3_2Plus = false; if (Platform.getName().equals(PLATFORM_IPHONE_OS)) { String[] version = Javascript.stringSplit(Platform.getVersion(), "."); int major = Integer.parseInt(version[0]); int minor = Integer.parseInt(version[1]); if ((major > 3) || ((major == 3) && (minor > 1))) { cachediOs3_2Plus = true; } } } return cachediOs3_2Plus; } }
public class class_name { public static final boolean iOs3_2Plus() { if (cachediOs3_2Plus == null) { cachediOs3_2Plus = false; // depends on control dependency: [if], data = [none] if (Platform.getName().equals(PLATFORM_IPHONE_OS)) { String[] version = Javascript.stringSplit(Platform.getVersion(), "."); int major = Integer.parseInt(version[0]); int minor = Integer.parseInt(version[1]); if ((major > 3) || ((major == 3) && (minor > 1))) { cachediOs3_2Plus = true; // depends on control dependency: [if], data = [none] } } } return cachediOs3_2Plus; } }
public class class_name { public void info(Object m) { if (m instanceof Throwable) { logger.info("", (Throwable) m); } else { logger.info(String.valueOf(m)); } } }
public class class_name { public void info(Object m) { if (m instanceof Throwable) { logger.info("", (Throwable) m); // depends on control dependency: [if], data = [none] } else { logger.info(String.valueOf(m)); // depends on control dependency: [if], data = [none] } } }
public class class_name { private String selectDataCenterForPlacements(String... placements) { // Get the set of data centers that have local access to all the placements. Then pick one deterministically // (pick the one that sorts first alphabetically) and designate that one as the one to perform maintenance. Set<DataCenter> intersection = null; for (String placement : placements) { Set<DataCenter> dataCenters = Sets.newLinkedHashSet(_placementFactory.getDataCenters(placement)); if (intersection == null) { intersection = dataCenters; } else { intersection.retainAll(dataCenters); } } if (intersection == null || intersection.isEmpty()) { return null; } return Ordering.natural().min(intersection).getName(); } }
public class class_name { private String selectDataCenterForPlacements(String... placements) { // Get the set of data centers that have local access to all the placements. Then pick one deterministically // (pick the one that sorts first alphabetically) and designate that one as the one to perform maintenance. Set<DataCenter> intersection = null; for (String placement : placements) { Set<DataCenter> dataCenters = Sets.newLinkedHashSet(_placementFactory.getDataCenters(placement)); if (intersection == null) { intersection = dataCenters; // depends on control dependency: [if], data = [none] } else { intersection.retainAll(dataCenters); // depends on control dependency: [if], data = [none] } } if (intersection == null || intersection.isEmpty()) { return null; // depends on control dependency: [if], data = [none] } return Ordering.natural().min(intersection).getName(); } }
public class class_name { public void doIt() { Collections.shuffle(this.nodes); final List<DoubleProperty> opacities = new ArrayList<>(); // DoubleProperty dp; int idx = 0; final int nodesCount = this.nodes.size(); final int groupCount = nodesCount / 2; for (int i = 0; i < groupCount; i++) { // dp = new SimpleDoubleProperty(1.0); for (int j = idx; j < 20 && j < this.nodes.size(); j++) { // nodes.get(j).opacityProperty().bind(dp); // nodes.get(j).scaleXProperty().bind(dp); opacities.add(/* dp */this.nodes.get(j).opacityProperty()); idx++; } // opacities.add(/* dp */nodes.get(j).opacityProperty()); } final List<KeyFrame> keyFrames = new ArrayList<>(); // List<KeyValue> keyValues; long d = 100; // keyValues = new ArrayList<>(); for (int i = 0; i < opacities.size(); i++) { // keyFrames.add(new KeyFrame(Duration.millis(d), new EventHandler<ActionEvent>() { // // @Override // public void handle(final ActionEvent arg0) { // // System.out.println(arg0.toString()); // // nothing to do // } // }, new KeyValue(opacities.get(i), 1.0/* , Interpolator.EASE_IN */))); d += 1000; // } } this.timeline = TimelineBuilder.create() .keyFrames(keyFrames) .build(); } }
public class class_name { public void doIt() { Collections.shuffle(this.nodes); final List<DoubleProperty> opacities = new ArrayList<>(); // DoubleProperty dp; int idx = 0; final int nodesCount = this.nodes.size(); final int groupCount = nodesCount / 2; for (int i = 0; i < groupCount; i++) { // dp = new SimpleDoubleProperty(1.0); for (int j = idx; j < 20 && j < this.nodes.size(); j++) { // nodes.get(j).opacityProperty().bind(dp); // nodes.get(j).scaleXProperty().bind(dp); opacities.add(/* dp */this.nodes.get(j).opacityProperty()); // depends on control dependency: [for], data = [j] idx++; // depends on control dependency: [for], data = [none] } // opacities.add(/* dp */nodes.get(j).opacityProperty()); } final List<KeyFrame> keyFrames = new ArrayList<>(); // List<KeyValue> keyValues; long d = 100; // keyValues = new ArrayList<>(); for (int i = 0; i < opacities.size(); i++) { // keyFrames.add(new KeyFrame(Duration.millis(d), new EventHandler<ActionEvent>() { // // @Override // public void handle(final ActionEvent arg0) { // // System.out.println(arg0.toString()); // // nothing to do // } // }, new KeyValue(opacities.get(i), 1.0/* , Interpolator.EASE_IN */))); d += 1000; // depends on control dependency: [for], data = [none] // } } this.timeline = TimelineBuilder.create() .keyFrames(keyFrames) .build(); } }
public class class_name { public TemplateEntry compileTemplate( final File templateFile ) { TemplateEntry templateEntry = null; try { // Parse the template's content and find the (optional) output String templateFileContent = Utils.readFileContent( templateFile ); Matcher m = Pattern.compile( "\\{\\{!\\s*roboconf-output:(.*)\\}\\}" ).matcher( templateFileContent.trim()); String targetFilePath = null; if( m.find()) targetFilePath = m.group( 1 ).trim(); // Compile the template file final Template template = this.handlebars.compile( new StringTemplateSource( templateFile.toString(), templateFileContent )); // Create the entry templateEntry = new TemplateEntry( templateFile, targetFilePath, template, TemplateUtils.findApplicationName( this.templateDir, templateFile )); } catch( IOException | IllegalArgumentException | HandlebarsException e ) { this.logger.warning("Cannot compile template " + templateFile); Utils.logException(this.logger, e); } return templateEntry; } }
public class class_name { public TemplateEntry compileTemplate( final File templateFile ) { TemplateEntry templateEntry = null; try { // Parse the template's content and find the (optional) output String templateFileContent = Utils.readFileContent( templateFile ); Matcher m = Pattern.compile( "\\{\\{!\\s*roboconf-output:(.*)\\}\\}" ).matcher( templateFileContent.trim()); String targetFilePath = null; if( m.find()) targetFilePath = m.group( 1 ).trim(); // Compile the template file final Template template = this.handlebars.compile( new StringTemplateSource( templateFile.toString(), templateFileContent )); // Create the entry templateEntry = new TemplateEntry( templateFile, targetFilePath, template, TemplateUtils.findApplicationName( this.templateDir, templateFile )); // depends on control dependency: [try], data = [none] } catch( IOException | IllegalArgumentException | HandlebarsException e ) { this.logger.warning("Cannot compile template " + templateFile); Utils.logException(this.logger, e); } // depends on control dependency: [catch], data = [none] return templateEntry; } }
public class class_name { @Override public boolean addAll(Collection<? extends Integer> c) { Iterator<? extends Integer> iter=c.iterator(); boolean didOne=false; while(iter.hasNext()) { add(iter.next().intValue()); didOne=true; } return didOne; } }
public class class_name { @Override public boolean addAll(Collection<? extends Integer> c) { Iterator<? extends Integer> iter=c.iterator(); boolean didOne=false; while(iter.hasNext()) { add(iter.next().intValue()); // depends on control dependency: [while], data = [none] didOne=true; // depends on control dependency: [while], data = [none] } return didOne; } }
public class class_name { public void marshall(DescribeElasticIpsRequest describeElasticIpsRequest, ProtocolMarshaller protocolMarshaller) { if (describeElasticIpsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeElasticIpsRequest.getInstanceId(), INSTANCEID_BINDING); protocolMarshaller.marshall(describeElasticIpsRequest.getStackId(), STACKID_BINDING); protocolMarshaller.marshall(describeElasticIpsRequest.getIps(), IPS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DescribeElasticIpsRequest describeElasticIpsRequest, ProtocolMarshaller protocolMarshaller) { if (describeElasticIpsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeElasticIpsRequest.getInstanceId(), INSTANCEID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeElasticIpsRequest.getStackId(), STACKID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeElasticIpsRequest.getIps(), IPS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private CmsListInfoBean buildSitemapTypeInfo(I_CmsResourceType sitemapType) { CmsListInfoBean result = new CmsListInfoBean(); CmsWorkplaceManager wm = OpenCms.getWorkplaceManager(); String typeName = sitemapType.getTypeName(); Locale wpLocale = wm.getWorkplaceLocale(getCmsObject()); String title = typeName; String description = ""; try { title = CmsWorkplaceMessages.getResourceTypeName(wpLocale, typeName); } catch (Throwable e) { LOG.warn(e.getLocalizedMessage(), e); } try { description = CmsWorkplaceMessages.getResourceTypeDescription(wpLocale, typeName); } catch (Throwable e) { LOG.warn(e.getLocalizedMessage(), e); } result.setResourceType(typeName); result.setTitle(title); result.setSubTitle(description); return result; } }
public class class_name { private CmsListInfoBean buildSitemapTypeInfo(I_CmsResourceType sitemapType) { CmsListInfoBean result = new CmsListInfoBean(); CmsWorkplaceManager wm = OpenCms.getWorkplaceManager(); String typeName = sitemapType.getTypeName(); Locale wpLocale = wm.getWorkplaceLocale(getCmsObject()); String title = typeName; String description = ""; try { title = CmsWorkplaceMessages.getResourceTypeName(wpLocale, typeName); // depends on control dependency: [try], data = [none] } catch (Throwable e) { LOG.warn(e.getLocalizedMessage(), e); } // depends on control dependency: [catch], data = [none] try { description = CmsWorkplaceMessages.getResourceTypeDescription(wpLocale, typeName); // depends on control dependency: [try], data = [none] } catch (Throwable e) { LOG.warn(e.getLocalizedMessage(), e); } // depends on control dependency: [catch], data = [none] result.setResourceType(typeName); result.setTitle(title); result.setSubTitle(description); return result; } }
public class class_name { @DefaultVisibilityForTesting static MetricsComponent loadMetricsComponent(@Nullable ClassLoader classLoader) { try { // Call Class.forName with literal string name of the class to help shading tools. return Provider.createInstance( Class.forName( "io.opencensus.impl.metrics.MetricsComponentImpl", /*initialize=*/ true, classLoader), MetricsComponent.class); } catch (ClassNotFoundException e) { logger.log( Level.FINE, "Couldn't load full implementation for MetricsComponent, now trying to load lite " + "implementation.", e); } try { // Call Class.forName with literal string name of the class to help shading tools. return Provider.createInstance( Class.forName( "io.opencensus.impllite.metrics.MetricsComponentImplLite", /*initialize=*/ true, classLoader), MetricsComponent.class); } catch (ClassNotFoundException e) { logger.log( Level.FINE, "Couldn't load lite implementation for MetricsComponent, now using default " + "implementation for MetricsComponent.", e); } return MetricsComponent.newNoopMetricsComponent(); } }
public class class_name { @DefaultVisibilityForTesting static MetricsComponent loadMetricsComponent(@Nullable ClassLoader classLoader) { try { // Call Class.forName with literal string name of the class to help shading tools. return Provider.createInstance( Class.forName( "io.opencensus.impl.metrics.MetricsComponentImpl", /*initialize=*/ true, classLoader), MetricsComponent.class); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException e) { logger.log( Level.FINE, "Couldn't load full implementation for MetricsComponent, now trying to load lite " + "implementation.", e); } try { // Call Class.forName with literal string name of the class to help shading tools. return Provider.createInstance( Class.forName( "io.opencensus.impllite.metrics.MetricsComponentImplLite", /*initialize=*/ true, classLoader), MetricsComponent.class); } catch (ClassNotFoundException e) { logger.log( Level.FINE, "Couldn't load lite implementation for MetricsComponent, now using default " + "implementation for MetricsComponent.", e); } // depends on control dependency: [catch], data = [none] return MetricsComponent.newNoopMetricsComponent(); } }
public class class_name { public Observable<ServiceResponse<EnqueueTrainingResponse>> trainVersionWithServiceResponseAsync(UUID appId, String versionId) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); return service.trainVersion(appId, versionId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<EnqueueTrainingResponse>>>() { @Override public Observable<ServiceResponse<EnqueueTrainingResponse>> call(Response<ResponseBody> response) { try { ServiceResponse<EnqueueTrainingResponse> clientResponse = trainVersionDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<EnqueueTrainingResponse>> trainVersionWithServiceResponseAsync(UUID appId, String versionId) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); return service.trainVersion(appId, versionId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<EnqueueTrainingResponse>>>() { @Override public Observable<ServiceResponse<EnqueueTrainingResponse>> call(Response<ResponseBody> response) { try { ServiceResponse<EnqueueTrainingResponse> clientResponse = trainVersionDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { public void text(int row, int col, String expectedText, double seconds) { double end = System.currentTimeMillis() + (seconds * 1000); try { elementPresent(seconds); while (!element.get().tableCell(row, col).get().text().equals(expectedText) && System.currentTimeMillis() < end) ; double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000; checkText(row, col, expectedText, seconds, timeTook); } catch (TimeoutException e) { checkText(row, col, expectedText, seconds, seconds); } } }
public class class_name { public void text(int row, int col, String expectedText, double seconds) { double end = System.currentTimeMillis() + (seconds * 1000); try { elementPresent(seconds); // depends on control dependency: [try], data = [none] while (!element.get().tableCell(row, col).get().text().equals(expectedText) && System.currentTimeMillis() < end) ; double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000; checkText(row, col, expectedText, seconds, timeTook); // depends on control dependency: [try], data = [none] } catch (TimeoutException e) { checkText(row, col, expectedText, seconds, seconds); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public SparseUndirectedGraph copy(Set<Integer> vertices) { // special case for If the called is requesting a copy of the entire // graph, which is more easily handled with the copy constructor if (vertices.size() == order() && vertices.equals(vertices())) return new SparseUndirectedGraph(this); SparseUndirectedGraph g = new SparseUndirectedGraph(); for (int v : vertices) { if (!contains(v)) throw new IllegalArgumentException( "Requested copy with non-existant vertex: " + v); g.add(v); for (Edge e : getAdjacencyList(v)) if (vertices.contains(e.from()) && vertices.contains(e.to())) g.add(e); } return g; } }
public class class_name { @Override public SparseUndirectedGraph copy(Set<Integer> vertices) { // special case for If the called is requesting a copy of the entire // graph, which is more easily handled with the copy constructor if (vertices.size() == order() && vertices.equals(vertices())) return new SparseUndirectedGraph(this); SparseUndirectedGraph g = new SparseUndirectedGraph(); for (int v : vertices) { if (!contains(v)) throw new IllegalArgumentException( "Requested copy with non-existant vertex: " + v); g.add(v); // depends on control dependency: [for], data = [v] for (Edge e : getAdjacencyList(v)) if (vertices.contains(e.from()) && vertices.contains(e.to())) g.add(e); } return g; } }
public class class_name { public static <K, V> ImmutableSet<V> getAllAsSet(final Multimap<K, V> multimap, final Iterable<K> keys) { final ImmutableSet.Builder<V> ret = ImmutableSet.builder(); for (final K key : keys) { ret.addAll(multimap.get(key)); } return ret.build(); } }
public class class_name { public static <K, V> ImmutableSet<V> getAllAsSet(final Multimap<K, V> multimap, final Iterable<K> keys) { final ImmutableSet.Builder<V> ret = ImmutableSet.builder(); for (final K key : keys) { ret.addAll(multimap.get(key)); // depends on control dependency: [for], data = [key] } return ret.build(); } }
public class class_name { private static XmlElement generateCommColumnsSelective(List<IntrospectedColumn> columns, String prefix, boolean bracket, int type) { XmlElement trimEle = generateTrim(bracket); for (IntrospectedColumn introspectedColumn : columns) { generateSelectiveToTrimEleTo(trimEle, introspectedColumn, prefix, type); } return trimEle; } }
public class class_name { private static XmlElement generateCommColumnsSelective(List<IntrospectedColumn> columns, String prefix, boolean bracket, int type) { XmlElement trimEle = generateTrim(bracket); for (IntrospectedColumn introspectedColumn : columns) { generateSelectiveToTrimEleTo(trimEle, introspectedColumn, prefix, type); // depends on control dependency: [for], data = [introspectedColumn] } return trimEle; } }
public class class_name { public void marshall(PutAttributesRequest putAttributesRequest, ProtocolMarshaller protocolMarshaller) { if (putAttributesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(putAttributesRequest.getCluster(), CLUSTER_BINDING); protocolMarshaller.marshall(putAttributesRequest.getAttributes(), ATTRIBUTES_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(PutAttributesRequest putAttributesRequest, ProtocolMarshaller protocolMarshaller) { if (putAttributesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(putAttributesRequest.getCluster(), CLUSTER_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putAttributesRequest.getAttributes(), ATTRIBUTES_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 boolean login(String userName, String password, String projectName, String siteRoot, String resourceName) { if (getCms().getRequestContext().getCurrentUser().isGuestUser()) { if (CmsStringUtil.isEmptyOrWhitespaceOnly(userName) || CmsStringUtil.isEmptyOrWhitespaceOnly(password)) { return false; } // login the user try { getCms().loginUser(userName, password, getCms().getRequestContext().getRemoteAddress()); } catch (CmsException e) { m_loginException = e; return false; } } // the user is logged in CmsUserSettings userSettings = new CmsUserSettings(getCms()); // set the project try { if (CmsStringUtil.isEmptyOrWhitespaceOnly(projectName)) { // use the default project of the user projectName = userSettings.getStartProject(); } // read the project CmsProject project = getCms().readProject(projectName); if (OpenCms.getOrgUnitManager().getAllAccessibleProjects(getCms(), project.getOuFqn(), false).contains( project)) { // user has access to the project, set this as current project getCms().getRequestContext().setCurrentProject(project); } else { throw new CmsSecurityException( Messages.get().container(Messages.ERR_PROJECT_NOT_ACCESSIBLE_2, userName, projectName)); } } catch (CmsException e) { m_loginException = e; } if (m_loginException == null) { // set the site try { if (CmsStringUtil.isEmptyOrWhitespaceOnly(siteRoot)) { // set the default site root of the user siteRoot = userSettings.getStartSite(); } // set the site root if accessible String oldSite = getCms().getRequestContext().getSiteRoot(); try { getCms().getRequestContext().setSiteRoot(""); getCms().readResource(siteRoot); } finally { getCms().getRequestContext().setSiteRoot(oldSite); } boolean hasAccess = false; CmsSite site = OpenCms.getSiteManager().getSiteForSiteRoot(siteRoot); Iterator<CmsSite> accessibles = OpenCms.getSiteManager().getAvailableSites(getCms(), false).iterator(); while (accessibles.hasNext() && !hasAccess && (site != null)) { CmsSite accessible = accessibles.next(); if (accessible.getSiteRoot().equals(site.getSiteRoot())) { hasAccess = true; } } if (hasAccess) { // user has access to the site, set this as current site getCms().getRequestContext().setSiteRoot(siteRoot); } else { throw new CmsSecurityException( Messages.get().container(Messages.ERR_SITE_NOT_ACCESSIBLE_2, userName, siteRoot)); } } catch (CmsException e) { m_loginException = e; } } // try to read the resource to display try { getCms().readResource(resourceName); } catch (CmsException e) { m_loginException = e; } if (m_loginException != null) { // if an error occurred during login, invalidate the session HttpSession session = getJsp().getRequest().getSession(false); if (session != null) { session.invalidate(); } return false; } // only for content creators so that direct edit works if (OpenCms.getRoleManager().hasRole(getCms(), CmsRole.ELEMENT_AUTHOR)) { // get / create the workplace settings CmsWorkplaceSettings wpSettings = getSettings(); if (wpSettings == null) { // create the settings object wpSettings = new CmsWorkplaceSettings(); wpSettings = initWorkplaceSettings(getCms(), wpSettings, false); } // set the settings for the workplace wpSettings.setSite(getCms().getRequestContext().getSiteRoot()); wpSettings.setProject(getCms().getRequestContext().getCurrentProject().getUuid()); wpSettings.setUser(getCms().getRequestContext().getCurrentUser()); HttpSession session = getJsp().getRequest().getSession(true); storeSettings(session, wpSettings); } return true; } }
public class class_name { public boolean login(String userName, String password, String projectName, String siteRoot, String resourceName) { if (getCms().getRequestContext().getCurrentUser().isGuestUser()) { if (CmsStringUtil.isEmptyOrWhitespaceOnly(userName) || CmsStringUtil.isEmptyOrWhitespaceOnly(password)) { return false; // depends on control dependency: [if], data = [none] } // login the user try { getCms().loginUser(userName, password, getCms().getRequestContext().getRemoteAddress()); // depends on control dependency: [try], data = [none] } catch (CmsException e) { m_loginException = e; return false; } // depends on control dependency: [catch], data = [none] } // the user is logged in CmsUserSettings userSettings = new CmsUserSettings(getCms()); // set the project try { if (CmsStringUtil.isEmptyOrWhitespaceOnly(projectName)) { // use the default project of the user projectName = userSettings.getStartProject(); // depends on control dependency: [if], data = [none] } // read the project CmsProject project = getCms().readProject(projectName); if (OpenCms.getOrgUnitManager().getAllAccessibleProjects(getCms(), project.getOuFqn(), false).contains( project)) { // user has access to the project, set this as current project getCms().getRequestContext().setCurrentProject(project); // depends on control dependency: [if], data = [none] } else { throw new CmsSecurityException( Messages.get().container(Messages.ERR_PROJECT_NOT_ACCESSIBLE_2, userName, projectName)); } } catch (CmsException e) { m_loginException = e; } // depends on control dependency: [catch], data = [none] if (m_loginException == null) { // set the site try { if (CmsStringUtil.isEmptyOrWhitespaceOnly(siteRoot)) { // set the default site root of the user siteRoot = userSettings.getStartSite(); // depends on control dependency: [if], data = [none] } // set the site root if accessible String oldSite = getCms().getRequestContext().getSiteRoot(); try { getCms().getRequestContext().setSiteRoot(""); // depends on control dependency: [try], data = [none] getCms().readResource(siteRoot); // depends on control dependency: [try], data = [none] } finally { getCms().getRequestContext().setSiteRoot(oldSite); } boolean hasAccess = false; CmsSite site = OpenCms.getSiteManager().getSiteForSiteRoot(siteRoot); Iterator<CmsSite> accessibles = OpenCms.getSiteManager().getAvailableSites(getCms(), false).iterator(); while (accessibles.hasNext() && !hasAccess && (site != null)) { CmsSite accessible = accessibles.next(); if (accessible.getSiteRoot().equals(site.getSiteRoot())) { hasAccess = true; // depends on control dependency: [if], data = [none] } } if (hasAccess) { // user has access to the site, set this as current site getCms().getRequestContext().setSiteRoot(siteRoot); // depends on control dependency: [if], data = [none] } else { throw new CmsSecurityException( Messages.get().container(Messages.ERR_SITE_NOT_ACCESSIBLE_2, userName, siteRoot)); } } catch (CmsException e) { m_loginException = e; } // depends on control dependency: [catch], data = [none] } // try to read the resource to display try { getCms().readResource(resourceName); // depends on control dependency: [try], data = [none] } catch (CmsException e) { m_loginException = e; } // depends on control dependency: [catch], data = [none] if (m_loginException != null) { // if an error occurred during login, invalidate the session HttpSession session = getJsp().getRequest().getSession(false); if (session != null) { session.invalidate(); // depends on control dependency: [if], data = [none] } return false; // depends on control dependency: [if], data = [none] } // only for content creators so that direct edit works if (OpenCms.getRoleManager().hasRole(getCms(), CmsRole.ELEMENT_AUTHOR)) { // get / create the workplace settings CmsWorkplaceSettings wpSettings = getSettings(); if (wpSettings == null) { // create the settings object wpSettings = new CmsWorkplaceSettings(); // depends on control dependency: [if], data = [none] wpSettings = initWorkplaceSettings(getCms(), wpSettings, false); // depends on control dependency: [if], data = [none] } // set the settings for the workplace wpSettings.setSite(getCms().getRequestContext().getSiteRoot()); // depends on control dependency: [if], data = [none] wpSettings.setProject(getCms().getRequestContext().getCurrentProject().getUuid()); // depends on control dependency: [if], data = [none] wpSettings.setUser(getCms().getRequestContext().getCurrentUser()); // depends on control dependency: [if], data = [none] HttpSession session = getJsp().getRequest().getSession(true); storeSettings(session, wpSettings); // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public static String getArtworkUrl(SoundCloudTrack track, String size) { String defaultUrl = track.getArtworkUrl(); if (defaultUrl == null) { return null; } switch (size) { case MINI: case TINY: case SMALL: case BADGE: case LARGE: case XLARGE: case XXLARGE: case XXXLARGE: return defaultUrl.replace(LARGE, size); default: return defaultUrl; } } }
public class class_name { public static String getArtworkUrl(SoundCloudTrack track, String size) { String defaultUrl = track.getArtworkUrl(); if (defaultUrl == null) { return null; // depends on control dependency: [if], data = [none] } switch (size) { case MINI: case TINY: case SMALL: case BADGE: case LARGE: case XLARGE: case XXLARGE: case XXXLARGE: return defaultUrl.replace(LARGE, size); default: return defaultUrl; } } }
public class class_name { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static <T> Maybe<T> wrap(MaybeSource<T> source) { if (source instanceof Maybe) { return RxJavaPlugins.onAssembly((Maybe<T>)source); } ObjectHelper.requireNonNull(source, "onSubscribe is null"); return RxJavaPlugins.onAssembly(new MaybeUnsafeCreate<T>(source)); } }
public class class_name { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static <T> Maybe<T> wrap(MaybeSource<T> source) { if (source instanceof Maybe) { return RxJavaPlugins.onAssembly((Maybe<T>)source); // depends on control dependency: [if], data = [none] } ObjectHelper.requireNonNull(source, "onSubscribe is null"); return RxJavaPlugins.onAssembly(new MaybeUnsafeCreate<T>(source)); } }
public class class_name { public MomentInterval at(ZonalOffset offset) { Boundary<Moment> b1; Boundary<Moment> b2; if (this.getStart().isInfinite()) { b1 = Boundary.infinitePast(); } else { Moment m1 = this.getStart().getTemporal().at(offset); b1 = Boundary.of(this.getStart().getEdge(), m1); } if (this.getEnd().isInfinite()) { b2 = Boundary.infiniteFuture(); } else { Moment m2 = this.getEnd().getTemporal().at(offset); b2 = Boundary.of(this.getEnd().getEdge(), m2); } return new MomentInterval(b1, b2); } }
public class class_name { public MomentInterval at(ZonalOffset offset) { Boundary<Moment> b1; Boundary<Moment> b2; if (this.getStart().isInfinite()) { b1 = Boundary.infinitePast(); // depends on control dependency: [if], data = [none] } else { Moment m1 = this.getStart().getTemporal().at(offset); b1 = Boundary.of(this.getStart().getEdge(), m1); // depends on control dependency: [if], data = [none] } if (this.getEnd().isInfinite()) { b2 = Boundary.infiniteFuture(); // depends on control dependency: [if], data = [none] } else { Moment m2 = this.getEnd().getTemporal().at(offset); b2 = Boundary.of(this.getEnd().getEdge(), m2); // depends on control dependency: [if], data = [none] } return new MomentInterval(b1, b2); } }
public class class_name { @Override public void registerAdapterDataObserver(RecyclerView.AdapterDataObserver observer) { super.registerAdapterDataObserver(observer); if (mAdapter != null) { mAdapter.registerAdapterDataObserver(observer); } } }
public class class_name { @Override public void registerAdapterDataObserver(RecyclerView.AdapterDataObserver observer) { super.registerAdapterDataObserver(observer); if (mAdapter != null) { mAdapter.registerAdapterDataObserver(observer); // depends on control dependency: [if], data = [none] } } }
public class class_name { public String key(String keyName, boolean allowNull) { try { if (m_resourceBundle != null) { return m_resourceBundle.getString(keyName); } } catch (MissingResourceException e) { // not found, return warning if (allowNull) { return null; } } return formatUnknownKey(keyName); } }
public class class_name { public String key(String keyName, boolean allowNull) { try { if (m_resourceBundle != null) { return m_resourceBundle.getString(keyName); // depends on control dependency: [if], data = [none] } } catch (MissingResourceException e) { // not found, return warning if (allowNull) { return null; // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] return formatUnknownKey(keyName); } }
public class class_name { public static int indexOf( Functor<Integer, Integer> symbols, String text, int begin, int end, char target, Functor<Integer, Integer> extra ) { ArrayDeque<Integer> deque = new ArrayDeque<>(); while (begin < end) { int c = text.charAt(begin); if (deque.size() > 0 && c == balance(symbols, deque.peek(), extra)) { deque.pop(); } else if (balance(symbols, c, extra) > 0) { if (deque.size() == 0 || balance(symbols, deque.peek(), extra) != deque.peek()) deque.push(c); } else if (deque.size() == 0 && c == target) { return begin; } ++begin; } return -1; } }
public class class_name { public static int indexOf( Functor<Integer, Integer> symbols, String text, int begin, int end, char target, Functor<Integer, Integer> extra ) { ArrayDeque<Integer> deque = new ArrayDeque<>(); while (begin < end) { int c = text.charAt(begin); if (deque.size() > 0 && c == balance(symbols, deque.peek(), extra)) { deque.pop(); // depends on control dependency: [if], data = [none] } else if (balance(symbols, c, extra) > 0) { if (deque.size() == 0 || balance(symbols, deque.peek(), extra) != deque.peek()) deque.push(c); } else if (deque.size() == 0 && c == target) { return begin; // depends on control dependency: [if], data = [none] } ++begin; // depends on control dependency: [while], data = [none] } return -1; } }
public class class_name { public String generate(final int[] nodeSizes, final int bad) { buf.setLength(0); for (int i = 0; i < nodes.size() && i < nodeSizes.length; i++) { buf.append(nodes.get(i).getCharacters(nodeSizes[i], bad)); } String value = buf.toString(); buf.setLength(0); return value; } }
public class class_name { public String generate(final int[] nodeSizes, final int bad) { buf.setLength(0); for (int i = 0; i < nodes.size() && i < nodeSizes.length; i++) { buf.append(nodes.get(i).getCharacters(nodeSizes[i], bad)); // depends on control dependency: [for], data = [i] } String value = buf.toString(); buf.setLength(0); return value; } }
public class class_name { public List<TaskAction> getCustomActions() throws ServiceException, DataAccessException { CodeTimer timer = new CodeTimer("getCustomActions()", true); List<TaskAction> dynamicTaskActions = new ArrayList<TaskAction>(); try { ActivityInstance activityInstance = getActivityInstance(true); if (activityInstance != null) { Long processInstanceId = activityInstance.getProcessInstanceId(); ProcessInstance processInstance = ServiceLocator.getWorkflowServices().getProcess(processInstanceId); Process processVO = null; if (processInstance.getProcessInstDefId() > 0L) processVO = ProcessCache.getProcessInstanceDefiniton(processInstance.getProcessId(), processInstance.getProcessInstDefId()); if (processVO == null) processVO = ProcessCache.getProcess(processInstance.getProcessId()); if (processInstance.isEmbedded()) processVO = processVO.getSubProcessVO(new Long(processInstance.getComment())); List<Transition> outgoingWorkTransVOs = processVO.getAllTransitions(activityInstance.getActivityId()); for (Transition workTransVO : outgoingWorkTransVOs) { String resultCode = workTransVO.getCompletionCode(); if (resultCode != null) { Integer eventType = workTransVO.getEventType(); if (eventType.equals(EventType.FINISH) || eventType.equals(EventType.RESUME) || TaskAction.FORWARD.equals(resultCode)) { TaskAction taskAction = new TaskAction(); taskAction.setTaskActionName(resultCode); taskAction.setCustom(true); dynamicTaskActions.add(taskAction); } } } } } catch (Exception ex) { logger.severeException(ex.getMessage(), ex); } timer.stopAndLogTiming(""); return dynamicTaskActions; } }
public class class_name { public List<TaskAction> getCustomActions() throws ServiceException, DataAccessException { CodeTimer timer = new CodeTimer("getCustomActions()", true); List<TaskAction> dynamicTaskActions = new ArrayList<TaskAction>(); try { ActivityInstance activityInstance = getActivityInstance(true); if (activityInstance != null) { Long processInstanceId = activityInstance.getProcessInstanceId(); ProcessInstance processInstance = ServiceLocator.getWorkflowServices().getProcess(processInstanceId); Process processVO = null; if (processInstance.getProcessInstDefId() > 0L) processVO = ProcessCache.getProcessInstanceDefiniton(processInstance.getProcessId(), processInstance.getProcessInstDefId()); if (processVO == null) processVO = ProcessCache.getProcess(processInstance.getProcessId()); if (processInstance.isEmbedded()) processVO = processVO.getSubProcessVO(new Long(processInstance.getComment())); List<Transition> outgoingWorkTransVOs = processVO.getAllTransitions(activityInstance.getActivityId()); for (Transition workTransVO : outgoingWorkTransVOs) { String resultCode = workTransVO.getCompletionCode(); if (resultCode != null) { Integer eventType = workTransVO.getEventType(); if (eventType.equals(EventType.FINISH) || eventType.equals(EventType.RESUME) || TaskAction.FORWARD.equals(resultCode)) { TaskAction taskAction = new TaskAction(); taskAction.setTaskActionName(resultCode); // depends on control dependency: [if], data = [none] taskAction.setCustom(true); // depends on control dependency: [if], data = [none] dynamicTaskActions.add(taskAction); // depends on control dependency: [if], data = [none] } } } } } catch (Exception ex) { logger.severeException(ex.getMessage(), ex); } timer.stopAndLogTiming(""); return dynamicTaskActions; } }
public class class_name { public void translateClassArrays () { ImportSet arrayTypes = new ImportSet(); Iterator<String> i = _imports.iterator(); while (i.hasNext()) { String name = i.next(); int bracket = name.lastIndexOf('['); if (bracket != -1 && name.charAt(bracket + 1) == 'L') { arrayTypes.add(name.substring(bracket + 2, name.length() - 1)); } } addAll(arrayTypes); } }
public class class_name { public void translateClassArrays () { ImportSet arrayTypes = new ImportSet(); Iterator<String> i = _imports.iterator(); while (i.hasNext()) { String name = i.next(); int bracket = name.lastIndexOf('['); if (bracket != -1 && name.charAt(bracket + 1) == 'L') { arrayTypes.add(name.substring(bracket + 2, name.length() - 1)); // depends on control dependency: [if], data = [(bracket] } } addAll(arrayTypes); } }
public class class_name { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { //Measure our width in whatever mode specified final int measuredWidth = MeasureSpec.getSize(widthMeasureSpec); //Determine our height float height; final int heightSpecMode = MeasureSpec.getMode(heightMeasureSpec); if (heightSpecMode == MeasureSpec.EXACTLY) { //We were told how big to be height = MeasureSpec.getSize(heightMeasureSpec); } else { //Calculate the text bounds mBounds.setEmpty(); mBounds.bottom = (int) (mPaintText.descent() - mPaintText.ascent()); height = mBounds.bottom - mBounds.top + mFooterLineHeight + mFooterPadding + mTopPadding; if (mFooterIndicatorStyle != IndicatorStyle.None) { height += mFooterIndicatorHeight; } } final int measuredHeight = (int)height; setMeasuredDimension(measuredWidth, measuredHeight); } }
public class class_name { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { //Measure our width in whatever mode specified final int measuredWidth = MeasureSpec.getSize(widthMeasureSpec); //Determine our height float height; final int heightSpecMode = MeasureSpec.getMode(heightMeasureSpec); if (heightSpecMode == MeasureSpec.EXACTLY) { //We were told how big to be height = MeasureSpec.getSize(heightMeasureSpec); // depends on control dependency: [if], data = [none] } else { //Calculate the text bounds mBounds.setEmpty(); // depends on control dependency: [if], data = [none] mBounds.bottom = (int) (mPaintText.descent() - mPaintText.ascent()); // depends on control dependency: [if], data = [none] height = mBounds.bottom - mBounds.top + mFooterLineHeight + mFooterPadding + mTopPadding; // depends on control dependency: [if], data = [none] if (mFooterIndicatorStyle != IndicatorStyle.None) { height += mFooterIndicatorHeight; // depends on control dependency: [if], data = [none] } } final int measuredHeight = (int)height; setMeasuredDimension(measuredWidth, measuredHeight); } }
public class class_name { protected final Set<AggregatedGroupMapping> collectAllGroupsFromParams( Set<K> keys, AggregatedGroupMapping[] aggregatedGroupMappings) { final Builder<AggregatedGroupMapping> groupsBuilder = ImmutableSet.<AggregatedGroupMapping>builder(); // Add all groups from the keyset for (K aggregationKey : keys) { groupsBuilder.add(aggregationKey.getAggregatedGroup()); } // Add groups from parameters groupsBuilder.add(aggregatedGroupMappings); return groupsBuilder.build(); } }
public class class_name { protected final Set<AggregatedGroupMapping> collectAllGroupsFromParams( Set<K> keys, AggregatedGroupMapping[] aggregatedGroupMappings) { final Builder<AggregatedGroupMapping> groupsBuilder = ImmutableSet.<AggregatedGroupMapping>builder(); // Add all groups from the keyset for (K aggregationKey : keys) { groupsBuilder.add(aggregationKey.getAggregatedGroup()); // depends on control dependency: [for], data = [aggregationKey] } // Add groups from parameters groupsBuilder.add(aggregatedGroupMappings); return groupsBuilder.build(); } }