code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public void write() { try { org.jxls.common.Context ctx = new org.jxls.common.Context(); for (Map.Entry<String, Object> entry : context.getDatas().entrySet()) { ctx.putVar(entry.getKey(), entry.getValue()); } JxlsHelper.getInstance().processTemplate(template.openStream(), outputStream, ctx); } catch (Exception e) { throw new RuntimeException(e.getMessage()); } } }
public class class_name { public void write() { try { org.jxls.common.Context ctx = new org.jxls.common.Context(); for (Map.Entry<String, Object> entry : context.getDatas().entrySet()) { ctx.putVar(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry] } JxlsHelper.getInstance().processTemplate(template.openStream(), outputStream, ctx); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new RuntimeException(e.getMessage()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static TableModel[] entity2ReadOnlyModel(Class<?>... entityClasses) { List<TableModel> l = new ArrayList<TableModel>(); for (Class<?> clazz : entityClasses) { l.add(entity2ReadOnlyModel(clazz)); } return l.toArray(new TableModel[l.size()]); } }
public class class_name { public static TableModel[] entity2ReadOnlyModel(Class<?>... entityClasses) { List<TableModel> l = new ArrayList<TableModel>(); for (Class<?> clazz : entityClasses) { l.add(entity2ReadOnlyModel(clazz)); // depends on control dependency: [for], data = [clazz] } return l.toArray(new TableModel[l.size()]); } }
public class class_name { public boolean add(Object o) { if (isAddedCompletely()) { throw new IllegalStateException("This LargeElement has already been added to the Document."); } try { Element element = (Element) o; if (element.type() == Element.SECTION) { Section section = (Section) o; section.setNumbers(++subsections, numbers); return super.add(section); } else if (o instanceof MarkedSection && ((MarkedObject)o).element.type() == Element.SECTION) { MarkedSection mo = (MarkedSection)o; Section section = (Section)mo.element; section.setNumbers(++subsections, numbers); return super.add(mo); } else if (element.isNestable()) { return super.add(o); } else { throw new ClassCastException("You can't add a " + element.getClass().getName() + " to a Section."); } } catch(ClassCastException cce) { throw new ClassCastException("Insertion of illegal Element: " + cce.getMessage()); } } }
public class class_name { public boolean add(Object o) { if (isAddedCompletely()) { throw new IllegalStateException("This LargeElement has already been added to the Document."); } try { Element element = (Element) o; if (element.type() == Element.SECTION) { Section section = (Section) o; section.setNumbers(++subsections, numbers); // depends on control dependency: [if], data = [none] return super.add(section); // depends on control dependency: [if], data = [none] } else if (o instanceof MarkedSection && ((MarkedObject)o).element.type() == Element.SECTION) { MarkedSection mo = (MarkedSection)o; Section section = (Section)mo.element; section.setNumbers(++subsections, numbers); // depends on control dependency: [if], data = [none] return super.add(mo); // depends on control dependency: [if], data = [none] } else if (element.isNestable()) { return super.add(o); // depends on control dependency: [if], data = [none] } else { throw new ClassCastException("You can't add a " + element.getClass().getName() + " to a Section."); } } catch(ClassCastException cce) { throw new ClassCastException("Insertion of illegal Element: " + cce.getMessage()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void visit(final WebApp webApp) { //CHECKSTYLE:OFF try { httpService.unregister("/"); } catch (Exception ignore) { LOG.warn("Unregistration exception. Skipping.", ignore); } //CHECKSTYLE:ON } }
public class class_name { public void visit(final WebApp webApp) { //CHECKSTYLE:OFF try { httpService.unregister("/"); // depends on control dependency: [try], data = [none] } catch (Exception ignore) { LOG.warn("Unregistration exception. Skipping.", ignore); } // depends on control dependency: [catch], data = [none] //CHECKSTYLE:ON } }
public class class_name { public static MonitoredResource getResource(String projectId, String resourceTypeParam) { String resourceType = resourceTypeParam; if (Strings.isNullOrEmpty(resourceType)) { Resource detectedResourceType = getAutoDetectedResourceType(); resourceType = detectedResourceType.getKey(); } // Currently, "gae_app" is the supported logging Resource type, but we distinguish // between "gae_app_flex", "gae_app_standard" to support zone id, instance name logging on flex // VMs. // Hence, "gae_app_flex", "gae_app_standard" are trimmed to "gae_app" String resourceName = resourceType.startsWith("gae_app") ? "gae_app" : resourceType; MonitoredResource.Builder builder = MonitoredResource.newBuilder(resourceName).addLabel(Label.ProjectId.getKey(), projectId); for (Label label : resourceTypeWithLabels.get(resourceType)) { String value = getValue(label); if (value != null) { builder.addLabel(label.getKey(), value); } } return builder.build(); } }
public class class_name { public static MonitoredResource getResource(String projectId, String resourceTypeParam) { String resourceType = resourceTypeParam; if (Strings.isNullOrEmpty(resourceType)) { Resource detectedResourceType = getAutoDetectedResourceType(); resourceType = detectedResourceType.getKey(); // depends on control dependency: [if], data = [none] } // Currently, "gae_app" is the supported logging Resource type, but we distinguish // between "gae_app_flex", "gae_app_standard" to support zone id, instance name logging on flex // VMs. // Hence, "gae_app_flex", "gae_app_standard" are trimmed to "gae_app" String resourceName = resourceType.startsWith("gae_app") ? "gae_app" : resourceType; MonitoredResource.Builder builder = MonitoredResource.newBuilder(resourceName).addLabel(Label.ProjectId.getKey(), projectId); for (Label label : resourceTypeWithLabels.get(resourceType)) { String value = getValue(label); if (value != null) { builder.addLabel(label.getKey(), value); // depends on control dependency: [if], data = [none] } } return builder.build(); } }
public class class_name { public Q setTime(final int index, final Time value) { initPrepared(); try { preparedStatement.setTime(index, value); } catch (SQLException sex) { throwSetParamError(index, sex); } return _this(); } }
public class class_name { public Q setTime(final int index, final Time value) { initPrepared(); try { preparedStatement.setTime(index, value); // depends on control dependency: [try], data = [none] } catch (SQLException sex) { throwSetParamError(index, sex); } // depends on control dependency: [catch], data = [none] return _this(); } }
public class class_name { public void setSlotTypes(java.util.Collection<SlotTypeMetadata> slotTypes) { if (slotTypes == null) { this.slotTypes = null; return; } this.slotTypes = new java.util.ArrayList<SlotTypeMetadata>(slotTypes); } }
public class class_name { public void setSlotTypes(java.util.Collection<SlotTypeMetadata> slotTypes) { if (slotTypes == null) { this.slotTypes = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.slotTypes = new java.util.ArrayList<SlotTypeMetadata>(slotTypes); } }
public class class_name { static DataSource getDataSource(Object rawDataSource, PageContext pc) throws JspException { DataSource dataSource = null; if (rawDataSource == null) { rawDataSource = Config.find(pc, Config.SQL_DATA_SOURCE); } if (rawDataSource == null) { return null; } /* * If the 'dataSource' attribute's value resolves to a String * after rtexpr/EL evaluation, use the string as JNDI path to * a DataSource */ if (rawDataSource instanceof String) { try { Context ctx = new InitialContext(); // relative to standard JNDI root for J2EE app Context envCtx = (Context) ctx.lookup("java:comp/env"); dataSource = (DataSource) envCtx.lookup((String) rawDataSource); } catch (NamingException ex) { dataSource = getDataSource((String) rawDataSource); } } else if (rawDataSource instanceof DataSource) { dataSource = (DataSource) rawDataSource; } else { throw new JspException( Resources.getMessage("SQL_DATASOURCE_INVALID_TYPE")); } return dataSource; } }
public class class_name { static DataSource getDataSource(Object rawDataSource, PageContext pc) throws JspException { DataSource dataSource = null; if (rawDataSource == null) { rawDataSource = Config.find(pc, Config.SQL_DATA_SOURCE); } if (rawDataSource == null) { return null; } /* * If the 'dataSource' attribute's value resolves to a String * after rtexpr/EL evaluation, use the string as JNDI path to * a DataSource */ if (rawDataSource instanceof String) { try { Context ctx = new InitialContext(); // relative to standard JNDI root for J2EE app Context envCtx = (Context) ctx.lookup("java:comp/env"); dataSource = (DataSource) envCtx.lookup((String) rawDataSource); // depends on control dependency: [try], data = [none] } catch (NamingException ex) { dataSource = getDataSource((String) rawDataSource); } // depends on control dependency: [catch], data = [none] } else if (rawDataSource instanceof DataSource) { dataSource = (DataSource) rawDataSource; } else { throw new JspException( Resources.getMessage("SQL_DATASOURCE_INVALID_TYPE")); } return dataSource; } }
public class class_name { public void setHITLayoutParameters(java.util.Collection<HITLayoutParameter> hITLayoutParameters) { if (hITLayoutParameters == null) { this.hITLayoutParameters = null; return; } this.hITLayoutParameters = new java.util.ArrayList<HITLayoutParameter>(hITLayoutParameters); } }
public class class_name { public void setHITLayoutParameters(java.util.Collection<HITLayoutParameter> hITLayoutParameters) { if (hITLayoutParameters == null) { this.hITLayoutParameters = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.hITLayoutParameters = new java.util.ArrayList<HITLayoutParameter>(hITLayoutParameters); } }
public class class_name { public static ULong[] ulong_a(long... values) { ULong[] array = new ULong[values.length]; for (int i = 0; i < values.length; i++) { array[i] = ulong(values[i]); } return array; } }
public class class_name { public static ULong[] ulong_a(long... values) { ULong[] array = new ULong[values.length]; for (int i = 0; i < values.length; i++) { array[i] = ulong(values[i]); // depends on control dependency: [for], data = [i] } return array; } }
public class class_name { public int consume(Map<String, String> initialVars) { int result = 0; for (int i = 0; i < repeatNumber; i++) { result += super.consume(initialVars); } return result; } }
public class class_name { public int consume(Map<String, String> initialVars) { int result = 0; for (int i = 0; i < repeatNumber; i++) { result += super.consume(initialVars); // depends on control dependency: [for], data = [none] } return result; } }
public class class_name { public ClassNode getClassNode(final String name) { final ClassNode[] result = new ClassNode[]{null}; PrimaryClassNodeOperation handler = new PrimaryClassNodeOperation() { public void call(SourceUnit source, GeneratorContext context, ClassNode classNode) { if (classNode.getName().equals(name)) { result[0] = classNode; } } }; try { applyToPrimaryClassNodes(handler); } catch (CompilationFailedException e) { if (debug) e.printStackTrace(); } return result[0]; } }
public class class_name { public ClassNode getClassNode(final String name) { final ClassNode[] result = new ClassNode[]{null}; PrimaryClassNodeOperation handler = new PrimaryClassNodeOperation() { public void call(SourceUnit source, GeneratorContext context, ClassNode classNode) { if (classNode.getName().equals(name)) { result[0] = classNode; // depends on control dependency: [if], data = [none] } } }; try { applyToPrimaryClassNodes(handler); // depends on control dependency: [try], data = [none] } catch (CompilationFailedException e) { if (debug) e.printStackTrace(); } // depends on control dependency: [catch], data = [none] return result[0]; } }
public class class_name { public void marshall(AutoScalingSettingsUpdate autoScalingSettingsUpdate, ProtocolMarshaller protocolMarshaller) { if (autoScalingSettingsUpdate == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(autoScalingSettingsUpdate.getMinimumUnits(), MINIMUMUNITS_BINDING); protocolMarshaller.marshall(autoScalingSettingsUpdate.getMaximumUnits(), MAXIMUMUNITS_BINDING); protocolMarshaller.marshall(autoScalingSettingsUpdate.getAutoScalingDisabled(), AUTOSCALINGDISABLED_BINDING); protocolMarshaller.marshall(autoScalingSettingsUpdate.getAutoScalingRoleArn(), AUTOSCALINGROLEARN_BINDING); protocolMarshaller.marshall(autoScalingSettingsUpdate.getScalingPolicyUpdate(), SCALINGPOLICYUPDATE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(AutoScalingSettingsUpdate autoScalingSettingsUpdate, ProtocolMarshaller protocolMarshaller) { if (autoScalingSettingsUpdate == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(autoScalingSettingsUpdate.getMinimumUnits(), MINIMUMUNITS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(autoScalingSettingsUpdate.getMaximumUnits(), MAXIMUMUNITS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(autoScalingSettingsUpdate.getAutoScalingDisabled(), AUTOSCALINGDISABLED_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(autoScalingSettingsUpdate.getAutoScalingRoleArn(), AUTOSCALINGROLEARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(autoScalingSettingsUpdate.getScalingPolicyUpdate(), SCALINGPOLICYUPDATE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public String getPropertyUriPattern(PropertyIdValue propertyIdValue) { if (!this.datatypes.containsKey(propertyIdValue.getId())) { fetchPropertyInformation(propertyIdValue); } return this.uriPatterns.get(propertyIdValue.getId()); } }
public class class_name { public String getPropertyUriPattern(PropertyIdValue propertyIdValue) { if (!this.datatypes.containsKey(propertyIdValue.getId())) { fetchPropertyInformation(propertyIdValue); // depends on control dependency: [if], data = [none] } return this.uriPatterns.get(propertyIdValue.getId()); } }
public class class_name { @Override public void write(TextWriterStream out, String label, DoubleDoublePair object) { if(object != null) { String res; if(label != null) { res = label + "=" + object.first + "," + object.second; } else { res = object.first + " " + object.second; } out.inlinePrintNoQuotes(res); } } }
public class class_name { @Override public void write(TextWriterStream out, String label, DoubleDoublePair object) { if(object != null) { String res; if(label != null) { res = label + "=" + object.first + "," + object.second; // depends on control dependency: [if], data = [none] } else { res = object.first + " " + object.second; // depends on control dependency: [if], data = [none] } out.inlinePrintNoQuotes(res); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean accept() { StringBuffer buff = new StringBuffer("Invalid field value "); boolean ok = true; for (Object o : flds.values()) ok &= ((Field) o).accept(buff); if (!ok) { try { JOptionPane.showMessageDialog(PrefPanel.findActiveFrame(), buff.toString()); } catch (HeadlessException e) { } return false; } /* store the text widths if they exist if (storeData != null) { Preferences substore = prefs.node("sizes"); iter = flds.values().iterator(); while (iter.hasNext()) { Field fld = (Field) iter.next(); JComponent comp = fld.getEditComponent(); substore.putInt(fld.getName(), (int) comp.getPreferredSize().getWidth()); } } */ fireEvent(new ActionEvent(this, 0, "Accept")); return true; } }
public class class_name { public boolean accept() { StringBuffer buff = new StringBuffer("Invalid field value "); boolean ok = true; for (Object o : flds.values()) ok &= ((Field) o).accept(buff); if (!ok) { try { JOptionPane.showMessageDialog(PrefPanel.findActiveFrame(), buff.toString()); } // depends on control dependency: [try], data = [none] catch (HeadlessException e) { } // depends on control dependency: [catch], data = [none] return false; // depends on control dependency: [if], data = [none] } /* store the text widths if they exist if (storeData != null) { Preferences substore = prefs.node("sizes"); iter = flds.values().iterator(); while (iter.hasNext()) { Field fld = (Field) iter.next(); JComponent comp = fld.getEditComponent(); substore.putInt(fld.getName(), (int) comp.getPreferredSize().getWidth()); } } */ fireEvent(new ActionEvent(this, 0, "Accept")); return true; } }
public class class_name { public List<TargetRelationship> getPrerequisiteLevelRelationships() { final ArrayList<TargetRelationship> relationships = new ArrayList<TargetRelationship>(); for (final TargetRelationship relationship : levelRelationships) { if (relationship.getType() == RelationshipType.PREREQUISITE) { relationships.add(relationship); } } return relationships; } }
public class class_name { public List<TargetRelationship> getPrerequisiteLevelRelationships() { final ArrayList<TargetRelationship> relationships = new ArrayList<TargetRelationship>(); for (final TargetRelationship relationship : levelRelationships) { if (relationship.getType() == RelationshipType.PREREQUISITE) { relationships.add(relationship); // depends on control dependency: [if], data = [none] } } return relationships; } }
public class class_name { public void setMailDefaultCharset(String charset) throws PageException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_MAIL); if (!hasAccess) throw new SecurityException("no access to update mail server settings"); if (!StringUtil.isEmpty(charset)) { try { IOUtil.checkEncoding(charset); } catch (IOException e) { throw Caster.toPageException(e); } } Element mail = _getRootElement("mail"); mail.setAttribute("default-encoding", charset); // config.setMailDefaultEncoding(charset); } }
public class class_name { public void setMailDefaultCharset(String charset) throws PageException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_MAIL); if (!hasAccess) throw new SecurityException("no access to update mail server settings"); if (!StringUtil.isEmpty(charset)) { try { IOUtil.checkEncoding(charset); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw Caster.toPageException(e); } // depends on control dependency: [catch], data = [none] } Element mail = _getRootElement("mail"); mail.setAttribute("default-encoding", charset); // config.setMailDefaultEncoding(charset); } }
public class class_name { @SuppressWarnings({ "unchecked", "rawtypes" }) public NodeConfig parse(Object rootObject) throws MarshalException { NodeConfig node = new NodeConfig(); List<AttributeConfig> attributeList = new ArrayList<AttributeConfig>(); List<NodeConfig> nodeList = new ArrayList<NodeConfig>(); Class cls = rootObject.getClass(); String nodeName = XmlElementUtils.mapObjectToXML(cls.getSimpleName()); try { Method methods[] = cls.getDeclaredMethods(); for (Method method : methods) { if (method.getName().startsWith(Constant.GET_PREFIX)) { String methodReturnType = method.getReturnType().getName(); String methodName = method.getName(); methodName = XmlElementUtils.mapObjectToXML(methodName.substring(3)); // 如果返回值为字符串类型 if (TypeConver.isBasicType(methodReturnType)) { // 全部加入到XML结构体属性中 Object attributeValue = method.invoke(rootObject, null); if (attributeValue != null) { AttributeConfig attributeConfig = new AttributeConfig(); attributeConfig.setName(methodName); attributeConfig.setValue(attributeValue.toString()); attributeList.add(attributeConfig); } } // 如果返回为List类型, 则循环获取每一项XML结构体 else if (methodReturnType.equals(Constant.LIST_CLASS)) { List list = (List) method.invoke(rootObject, null); for (Object item : list) { nodeList.add(super.parse(methodName, item)); } } // 如果为其他类型, 则递归进入该类进行类解析 else { Object object = method.invoke(rootObject, null); if (object != null) { nodeList.add(super.parse(methodName, object)); } } } } // 如果是getValue方法则获取Value值并附到XML结构体中 try { Method methodValue = cls.getMethod(Constant.GET_VALUE, null); if (methodValue != null) { String value = (String) methodValue.invoke(rootObject, null); node.setValue(value); } } catch (NoSuchMethodException e) { } // 如果是NalaObject的派生类, 则设置命名空间 boolean isNalaObject = rootObject instanceof XmlObject ? true : false; // 判读该类是否继承NalaObject if (isNalaObject) { Method methodNamespace = cls.getMethod(Constant.GET_NAMESPACE, null); List namespaces = (List) methodNamespace.invoke(rootObject, null); if (namespaces != null && namespaces.size() > 0) { for (int i = 0; i < namespaces.size(); i++) { Namespace namespace = (Namespace) namespaces.get(i); node.setNamespace(namespace.getPrefix(), namespace.getUri()); } } } } catch (IllegalAccessException e) { throw new MarshalException(e); } catch (IllegalArgumentException e) { throw new MarshalException(e); } catch (InvocationTargetException e) { throw new MarshalException(e); } catch (SecurityException e) { throw new MarshalException(e); } catch (NoSuchMethodException e) { throw new MarshalException(e); } node.setName(nodeName); node.setAttribute(attributeList); node.setChildrenNodes(nodeList); return node; } }
public class class_name { @SuppressWarnings({ "unchecked", "rawtypes" }) public NodeConfig parse(Object rootObject) throws MarshalException { NodeConfig node = new NodeConfig(); List<AttributeConfig> attributeList = new ArrayList<AttributeConfig>(); List<NodeConfig> nodeList = new ArrayList<NodeConfig>(); Class cls = rootObject.getClass(); String nodeName = XmlElementUtils.mapObjectToXML(cls.getSimpleName()); try { Method methods[] = cls.getDeclaredMethods(); for (Method method : methods) { if (method.getName().startsWith(Constant.GET_PREFIX)) { String methodReturnType = method.getReturnType().getName(); String methodName = method.getName(); methodName = XmlElementUtils.mapObjectToXML(methodName.substring(3)); // depends on control dependency: [if], data = [none] // 如果返回值为字符串类型 if (TypeConver.isBasicType(methodReturnType)) { // 全部加入到XML结构体属性中 Object attributeValue = method.invoke(rootObject, null); if (attributeValue != null) { AttributeConfig attributeConfig = new AttributeConfig(); attributeConfig.setName(methodName); // depends on control dependency: [if], data = [none] attributeConfig.setValue(attributeValue.toString()); // depends on control dependency: [if], data = [(attributeValue] attributeList.add(attributeConfig); // depends on control dependency: [if], data = [none] } } // 如果返回为List类型, 则循环获取每一项XML结构体 else if (methodReturnType.equals(Constant.LIST_CLASS)) { List list = (List) method.invoke(rootObject, null); for (Object item : list) { nodeList.add(super.parse(methodName, item)); // depends on control dependency: [for], data = [item] } } // 如果为其他类型, 则递归进入该类进行类解析 else { Object object = method.invoke(rootObject, null); if (object != null) { nodeList.add(super.parse(methodName, object)); // depends on control dependency: [if], data = [none] } } } } // 如果是getValue方法则获取Value值并附到XML结构体中 try { Method methodValue = cls.getMethod(Constant.GET_VALUE, null); if (methodValue != null) { String value = (String) methodValue.invoke(rootObject, null); node.setValue(value); // depends on control dependency: [if], data = [none] } } catch (NoSuchMethodException e) { } // 如果是NalaObject的派生类, 则设置命名空间 boolean isNalaObject = rootObject instanceof XmlObject ? true : false; // 判读该类是否继承NalaObject if (isNalaObject) { Method methodNamespace = cls.getMethod(Constant.GET_NAMESPACE, null); List namespaces = (List) methodNamespace.invoke(rootObject, null); if (namespaces != null && namespaces.size() > 0) { for (int i = 0; i < namespaces.size(); i++) { Namespace namespace = (Namespace) namespaces.get(i); node.setNamespace(namespace.getPrefix(), namespace.getUri()); // depends on control dependency: [for], data = [none] } } } } catch (IllegalAccessException e) { throw new MarshalException(e); } catch (IllegalArgumentException e) { throw new MarshalException(e); } catch (InvocationTargetException e) { throw new MarshalException(e); } catch (SecurityException e) { throw new MarshalException(e); } catch (NoSuchMethodException e) { throw new MarshalException(e); } node.setName(nodeName); node.setAttribute(attributeList); node.setChildrenNodes(nodeList); return node; } }
public class class_name { public void requestState(long fileId, final FileCallback callback) { if (LOG) { Log.d(TAG, "Requesting state file #" + fileId); } Downloaded downloaded1 = downloaded.getValue(fileId); if (downloaded1 != null) { FileSystemReference reference = Storage.fileFromDescriptor(downloaded1.getDescriptor()); boolean isExist = reference.isExist(); int fileSize = reference.getSize(); if (isExist && fileSize == downloaded1.getFileSize()) { if (LOG) { Log.d(TAG, "- Downloaded"); } final FileSystemReference fileSystemReference = Storage.fileFromDescriptor(downloaded1.getDescriptor()); im.actor.runtime.Runtime.dispatch(() -> callback.onDownloaded(fileSystemReference)); return; } else { if (LOG) { Log.d(TAG, "- File is corrupted"); if (!isExist) { Log.d(TAG, "- File not found"); } if (fileSize != downloaded1.getFileSize()) { Log.d(TAG, "- Incorrect file size. Expected: " + downloaded1.getFileSize() + ", got: " + fileSize); } } downloaded.removeItem(downloaded1.getFileId()); } } final QueueItem queueItem = findItem(fileId); if (queueItem == null) { im.actor.runtime.Runtime.dispatch(() -> callback.onNotDownloaded()); } else { if (queueItem.isStarted) { final float progress = queueItem.progress; im.actor.runtime.Runtime.dispatch(() -> callback.onDownloading(progress)); } else if (queueItem.isStopped) { im.actor.runtime.Runtime.dispatch(() -> callback.onNotDownloaded()); } else { im.actor.runtime.Runtime.dispatch(() -> callback.onDownloading(0)); } } } }
public class class_name { public void requestState(long fileId, final FileCallback callback) { if (LOG) { Log.d(TAG, "Requesting state file #" + fileId); // depends on control dependency: [if], data = [none] } Downloaded downloaded1 = downloaded.getValue(fileId); if (downloaded1 != null) { FileSystemReference reference = Storage.fileFromDescriptor(downloaded1.getDescriptor()); boolean isExist = reference.isExist(); int fileSize = reference.getSize(); if (isExist && fileSize == downloaded1.getFileSize()) { if (LOG) { Log.d(TAG, "- Downloaded"); // depends on control dependency: [if], data = [none] } final FileSystemReference fileSystemReference = Storage.fileFromDescriptor(downloaded1.getDescriptor()); im.actor.runtime.Runtime.dispatch(() -> callback.onDownloaded(fileSystemReference)); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } else { if (LOG) { Log.d(TAG, "- File is corrupted"); // depends on control dependency: [if], data = [none] if (!isExist) { Log.d(TAG, "- File not found"); // depends on control dependency: [if], data = [none] } if (fileSize != downloaded1.getFileSize()) { Log.d(TAG, "- Incorrect file size. Expected: " + downloaded1.getFileSize() + ", got: " + fileSize); // depends on control dependency: [if], data = [none] } } downloaded.removeItem(downloaded1.getFileId()); // depends on control dependency: [if], data = [none] } } final QueueItem queueItem = findItem(fileId); if (queueItem == null) { im.actor.runtime.Runtime.dispatch(() -> callback.onNotDownloaded()); // depends on control dependency: [if], data = [none] } else { if (queueItem.isStarted) { final float progress = queueItem.progress; im.actor.runtime.Runtime.dispatch(() -> callback.onDownloading(progress)); // depends on control dependency: [if], data = [none] } else if (queueItem.isStopped) { im.actor.runtime.Runtime.dispatch(() -> callback.onNotDownloaded()); // depends on control dependency: [if], data = [none] } else { im.actor.runtime.Runtime.dispatch(() -> callback.onDownloading(0)); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void setDeployments(java.util.Collection<BulkDeploymentResult> deployments) { if (deployments == null) { this.deployments = null; return; } this.deployments = new java.util.ArrayList<BulkDeploymentResult>(deployments); } }
public class class_name { public void setDeployments(java.util.Collection<BulkDeploymentResult> deployments) { if (deployments == null) { this.deployments = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.deployments = new java.util.ArrayList<BulkDeploymentResult>(deployments); } }
public class class_name { private void calculateRotationalAxis(Matrix rotation, Atom translation, double c) { // Calculate magnitude of rotationAxis components, but not signs double sum=0; double[] rotAx = new double[3]; for(int i=0;i<3;i++) { rotAx[i] = Math.sqrt(rotation.get(i, i)-c); sum+=rotAx[i]*rotAx[i]; } for(int i=0;i<3;i++) { rotAx[i] /= Math.sqrt(sum); } // Now determine signs double d0 = rotation.get(2,1)-rotation.get(1,2); //=2u[0]*sin(theta) double d1 = rotation.get(0,2)-rotation.get(2,0); //=2u[1]*sin(theta) double d2 = rotation.get(1,0)-rotation.get(0,1); //=2u[2]*sin(theta) double s12 = rotation.get(2,1)+rotation.get(1,2); //=2*u[1]*u[2]*(1-cos(theta)) double s02 = rotation.get(0,2)+rotation.get(2,0); //=2*u[0]*u[2]*(1-cos(theta)) double s01 = rotation.get(1,0)+rotation.get(0,1); //=2*u[0]*u[1]*(1-cos(theta)) //Only use biggest d for the sign directly, for numerical stability around 180deg if( Math.abs(d0) < Math.abs(d1) ) { // not d0 if( Math.abs(d1) < Math.abs(d2) ) { //d2 if(d2>=0){ //u[2] positive if( s02 < 0 ) rotAx[0] = -rotAx[0]; if( s12 < 0 ) rotAx[1] = -rotAx[1]; } else { //u[2] negative rotAx[2] = -rotAx[2]; if( s02 >= 0 ) rotAx[0] = -rotAx[0]; if( s12 >= 0 ) rotAx[1] = -rotAx[1]; } } else { //d1 if(d1>=0) {//u[1] positive if( s01 < 0) rotAx[0] = -rotAx[0]; if( s12 < 0) rotAx[2] = -rotAx[2]; } else { //u[1] negative rotAx[1] = -rotAx[1]; if( s01 >= 0) rotAx[0] = -rotAx[0]; if( s12 >= 0) rotAx[2] = -rotAx[2]; } } } else { // not d1 if( Math.abs(d0) < Math.abs(d2) ) { //d2 if(d2>=0){ //u[2] positive if( s02 < 0 ) rotAx[0] = -rotAx[0]; if( s12 < 0 ) rotAx[1] = -rotAx[1]; } else { //u[2] negative rotAx[2] = -rotAx[2]; if( s02 >= 0 ) rotAx[0] = -rotAx[0]; if( s12 >= 0 ) rotAx[1] = -rotAx[1]; } } else { //d0 if(d0>=0) { //u[0] positive if( s01 < 0 ) rotAx[1] = -rotAx[1]; if( s02 < 0 ) rotAx[2] = -rotAx[2]; } else { //u[0] negative rotAx[0] = -rotAx[0]; if( s01 >= 0 ) rotAx[1] = -rotAx[1]; if( s02 >= 0 ) rotAx[2] = -rotAx[2]; } } } rotationAxis = new AtomImpl(); rotationAxis.setCoords(rotAx); // Calculate screw = (rotationAxis dot translation)*u double dotProduct = Calc.scalarProduct(rotationAxis, translation); screwTranslation = Calc.scale(rotationAxis, dotProduct); otherTranslation = Calc.subtract(translation, screwTranslation); Atom hypot = Calc.vectorProduct(otherTranslation,rotationAxis); Calc.scaleEquals(hypot,.5/Math.tan(theta/2.0)); // Calculate rotation axis position rotationPos = Calc.scaleAdd(.5,otherTranslation, hypot); } }
public class class_name { private void calculateRotationalAxis(Matrix rotation, Atom translation, double c) { // Calculate magnitude of rotationAxis components, but not signs double sum=0; double[] rotAx = new double[3]; for(int i=0;i<3;i++) { rotAx[i] = Math.sqrt(rotation.get(i, i)-c); // depends on control dependency: [for], data = [i] sum+=rotAx[i]*rotAx[i]; // depends on control dependency: [for], data = [i] } for(int i=0;i<3;i++) { rotAx[i] /= Math.sqrt(sum); // depends on control dependency: [for], data = [i] } // Now determine signs double d0 = rotation.get(2,1)-rotation.get(1,2); //=2u[0]*sin(theta) double d1 = rotation.get(0,2)-rotation.get(2,0); //=2u[1]*sin(theta) double d2 = rotation.get(1,0)-rotation.get(0,1); //=2u[2]*sin(theta) double s12 = rotation.get(2,1)+rotation.get(1,2); //=2*u[1]*u[2]*(1-cos(theta)) double s02 = rotation.get(0,2)+rotation.get(2,0); //=2*u[0]*u[2]*(1-cos(theta)) double s01 = rotation.get(1,0)+rotation.get(0,1); //=2*u[0]*u[1]*(1-cos(theta)) //Only use biggest d for the sign directly, for numerical stability around 180deg if( Math.abs(d0) < Math.abs(d1) ) { // not d0 if( Math.abs(d1) < Math.abs(d2) ) { //d2 if(d2>=0){ //u[2] positive if( s02 < 0 ) rotAx[0] = -rotAx[0]; if( s12 < 0 ) rotAx[1] = -rotAx[1]; } else { //u[2] negative rotAx[2] = -rotAx[2]; // depends on control dependency: [if], data = [none] if( s02 >= 0 ) rotAx[0] = -rotAx[0]; if( s12 >= 0 ) rotAx[1] = -rotAx[1]; } } else { //d1 if(d1>=0) {//u[1] positive if( s01 < 0) rotAx[0] = -rotAx[0]; if( s12 < 0) rotAx[2] = -rotAx[2]; } else { //u[1] negative rotAx[1] = -rotAx[1]; // depends on control dependency: [if], data = [none] if( s01 >= 0) rotAx[0] = -rotAx[0]; if( s12 >= 0) rotAx[2] = -rotAx[2]; } } } else { // not d1 if( Math.abs(d0) < Math.abs(d2) ) { //d2 if(d2>=0){ //u[2] positive if( s02 < 0 ) rotAx[0] = -rotAx[0]; if( s12 < 0 ) rotAx[1] = -rotAx[1]; } else { //u[2] negative rotAx[2] = -rotAx[2]; // depends on control dependency: [if], data = [none] if( s02 >= 0 ) rotAx[0] = -rotAx[0]; if( s12 >= 0 ) rotAx[1] = -rotAx[1]; } } else { //d0 if(d0>=0) { //u[0] positive if( s01 < 0 ) rotAx[1] = -rotAx[1]; if( s02 < 0 ) rotAx[2] = -rotAx[2]; } else { //u[0] negative rotAx[0] = -rotAx[0]; // depends on control dependency: [if], data = [none] if( s01 >= 0 ) rotAx[1] = -rotAx[1]; if( s02 >= 0 ) rotAx[2] = -rotAx[2]; } } } rotationAxis = new AtomImpl(); rotationAxis.setCoords(rotAx); // Calculate screw = (rotationAxis dot translation)*u double dotProduct = Calc.scalarProduct(rotationAxis, translation); screwTranslation = Calc.scale(rotationAxis, dotProduct); otherTranslation = Calc.subtract(translation, screwTranslation); Atom hypot = Calc.vectorProduct(otherTranslation,rotationAxis); Calc.scaleEquals(hypot,.5/Math.tan(theta/2.0)); // Calculate rotation axis position rotationPos = Calc.scaleAdd(.5,otherTranslation, hypot); } }
public class class_name { @GwtIncompatible("incompatible method") @Nullable public static Locale parseLocale(final String localeValue) { final String[] tokens = StringUtils.tokenizeLocaleSource(localeValue); if (tokens.length == 1) { return Locale.ENGLISH; } return StringUtils.parseLocaleTokens(localeValue, tokens); } }
public class class_name { @GwtIncompatible("incompatible method") @Nullable public static Locale parseLocale(final String localeValue) { final String[] tokens = StringUtils.tokenizeLocaleSource(localeValue); if (tokens.length == 1) { return Locale.ENGLISH; // depends on control dependency: [if], data = [none] } return StringUtils.parseLocaleTokens(localeValue, tokens); } }
public class class_name { static public GrayF32 nonMaxSuppression4(GrayF32 intensity , GrayS8 direction , GrayF32 output ) { InputSanityCheck.checkSameShape(intensity,direction); output = InputSanityCheck.checkDeclare(intensity,output); if( BoofConcurrency.USE_CONCURRENT ) { ImplEdgeNonMaxSuppression_MT.inner4(intensity, direction, output); ImplEdgeNonMaxSuppression_MT.border4(intensity, direction, output); } else { ImplEdgeNonMaxSuppression.inner4(intensity, direction, output); ImplEdgeNonMaxSuppression.border4(intensity, direction, output); } return output; } }
public class class_name { static public GrayF32 nonMaxSuppression4(GrayF32 intensity , GrayS8 direction , GrayF32 output ) { InputSanityCheck.checkSameShape(intensity,direction); output = InputSanityCheck.checkDeclare(intensity,output); if( BoofConcurrency.USE_CONCURRENT ) { ImplEdgeNonMaxSuppression_MT.inner4(intensity, direction, output); // depends on control dependency: [if], data = [none] ImplEdgeNonMaxSuppression_MT.border4(intensity, direction, output); // depends on control dependency: [if], data = [none] } else { ImplEdgeNonMaxSuppression.inner4(intensity, direction, output); // depends on control dependency: [if], data = [none] ImplEdgeNonMaxSuppression.border4(intensity, direction, output); // depends on control dependency: [if], data = [none] } return output; } }
public class class_name { public void removeErrorPage(PageException pe) { // exception ErrorPage ep = getErrorPage(pe, ErrorPage.TYPE_EXCEPTION); if (ep != null) { pages.remove(ep); hasChanged = true; } // request ep = getErrorPage(pe, ErrorPage.TYPE_REQUEST); if (ep != null) { pages.remove(ep); hasChanged = true; } // validation ep = getErrorPage(pe, ErrorPage.TYPE_VALIDATION); if (ep != null) { pages.remove(ep); hasChanged = true; } } }
public class class_name { public void removeErrorPage(PageException pe) { // exception ErrorPage ep = getErrorPage(pe, ErrorPage.TYPE_EXCEPTION); if (ep != null) { pages.remove(ep); // depends on control dependency: [if], data = [(ep] hasChanged = true; // depends on control dependency: [if], data = [none] } // request ep = getErrorPage(pe, ErrorPage.TYPE_REQUEST); if (ep != null) { pages.remove(ep); // depends on control dependency: [if], data = [(ep] hasChanged = true; // depends on control dependency: [if], data = [none] } // validation ep = getErrorPage(pe, ErrorPage.TYPE_VALIDATION); if (ep != null) { pages.remove(ep); // depends on control dependency: [if], data = [(ep] hasChanged = true; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static byte[] fromString(final String pData) { if (pData == null) { throw new IllegalArgumentException("Argument can't be null"); } StringBuilder sb = new StringBuilder(pData); int j = 0; for (int i = 0; i < sb.length(); i++) { if (!Character.isWhitespace(sb.charAt(i))) { sb.setCharAt(j++, sb.charAt(i)); } } sb.delete(j, sb.length()); if (sb.length() % 2 != 0) { throw new IllegalArgumentException("Hex binary needs to be even-length :" + pData); } byte[] result = new byte[sb.length() / 2]; j = 0; for (int i = 0; i < sb.length(); i += 2) { result[j++] = (byte) ((Character.digit(sb.charAt(i), 16) << 4) + Character.digit(sb.charAt(i + 1), 16)); } return result; } }
public class class_name { public static byte[] fromString(final String pData) { if (pData == null) { throw new IllegalArgumentException("Argument can't be null"); } StringBuilder sb = new StringBuilder(pData); int j = 0; for (int i = 0; i < sb.length(); i++) { if (!Character.isWhitespace(sb.charAt(i))) { sb.setCharAt(j++, sb.charAt(i)); // depends on control dependency: [if], data = [none] } } sb.delete(j, sb.length()); if (sb.length() % 2 != 0) { throw new IllegalArgumentException("Hex binary needs to be even-length :" + pData); } byte[] result = new byte[sb.length() / 2]; j = 0; for (int i = 0; i < sb.length(); i += 2) { result[j++] = (byte) ((Character.digit(sb.charAt(i), 16) << 4) + Character.digit(sb.charAt(i + 1), 16)); // depends on control dependency: [for], data = [i] } return result; } }
public class class_name { public static Put put(String url, byte[] content, int connectTimeout, int readTimeout) { try { return new Put(url, content, connectTimeout, readTimeout); } catch (Exception e) { throw new HttpException("Failed URL: " + url, e); } } }
public class class_name { public static Put put(String url, byte[] content, int connectTimeout, int readTimeout) { try { return new Put(url, content, connectTimeout, readTimeout); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new HttpException("Failed URL: " + url, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private SelectQuery incrementQueryPagination(SelectQuery query, SelectResultValue prevResult) { Map<String, Integer> pagingIdentifiers = prevResult.getPagingIdentifiers(); Map<String, Integer> newPagingIdentifers = new HashMap<>(); for (String segmentId : pagingIdentifiers.keySet()) { int newOffset = pagingIdentifiers.get(segmentId) + 1; newPagingIdentifers.put(segmentId, newOffset); } return query.withPagingSpec(new PagingSpec(newPagingIdentifers, pagingThreshold)); } }
public class class_name { private SelectQuery incrementQueryPagination(SelectQuery query, SelectResultValue prevResult) { Map<String, Integer> pagingIdentifiers = prevResult.getPagingIdentifiers(); Map<String, Integer> newPagingIdentifers = new HashMap<>(); for (String segmentId : pagingIdentifiers.keySet()) { int newOffset = pagingIdentifiers.get(segmentId) + 1; newPagingIdentifers.put(segmentId, newOffset); // depends on control dependency: [for], data = [segmentId] } return query.withPagingSpec(new PagingSpec(newPagingIdentifers, pagingThreshold)); } }
public class class_name { private RegisteredService update(final RegisteredService rs) { val currentDn = getCurrentDnForRegisteredService(rs); if (StringUtils.isNotBlank(currentDn)) { LOGGER.debug("Updating registered service at [{}]", currentDn); val entry = this.ldapServiceMapper.mapFromRegisteredService(this.baseDn, rs); LdapUtils.executeModifyOperation(currentDn, this.connectionFactory, entry); } else { LOGGER.debug("Failed to locate DN for registered service by id [{}]. Attempting to save the service anew", rs.getId()); insert(rs); } return rs; } }
public class class_name { private RegisteredService update(final RegisteredService rs) { val currentDn = getCurrentDnForRegisteredService(rs); if (StringUtils.isNotBlank(currentDn)) { LOGGER.debug("Updating registered service at [{}]", currentDn); val entry = this.ldapServiceMapper.mapFromRegisteredService(this.baseDn, rs); LdapUtils.executeModifyOperation(currentDn, this.connectionFactory, entry); // depends on control dependency: [if], data = [none] } else { LOGGER.debug("Failed to locate DN for registered service by id [{}]. Attempting to save the service anew", rs.getId()); // depends on control dependency: [if], data = [none] insert(rs); // depends on control dependency: [if], data = [none] } return rs; } }
public class class_name { public void setFilters(java.util.Collection<NamespaceFilter> filters) { if (filters == null) { this.filters = null; return; } this.filters = new java.util.ArrayList<NamespaceFilter>(filters); } }
public class class_name { public void setFilters(java.util.Collection<NamespaceFilter> filters) { if (filters == null) { this.filters = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.filters = new java.util.ArrayList<NamespaceFilter>(filters); } }
public class class_name { public StubbedInvocationMatcher addAnswer(Answer answer, boolean isConsecutive, Strictness stubbingStrictness) { Invocation invocation = invocationForStubbing.getInvocation(); mockingProgress().stubbingCompleted(); if (answer instanceof ValidableAnswer) { ((ValidableAnswer) answer).validateFor(invocation); } synchronized (stubbed) { if (isConsecutive) { stubbed.getFirst().addAnswer(answer); } else { Strictness effectiveStrictness = stubbingStrictness != null ? stubbingStrictness : this.mockStrictness; stubbed.addFirst(new StubbedInvocationMatcher(answer, invocationForStubbing, effectiveStrictness)); } return stubbed.getFirst(); } } }
public class class_name { public StubbedInvocationMatcher addAnswer(Answer answer, boolean isConsecutive, Strictness stubbingStrictness) { Invocation invocation = invocationForStubbing.getInvocation(); mockingProgress().stubbingCompleted(); if (answer instanceof ValidableAnswer) { ((ValidableAnswer) answer).validateFor(invocation); // depends on control dependency: [if], data = [none] } synchronized (stubbed) { if (isConsecutive) { stubbed.getFirst().addAnswer(answer); // depends on control dependency: [if], data = [none] } else { Strictness effectiveStrictness = stubbingStrictness != null ? stubbingStrictness : this.mockStrictness; stubbed.addFirst(new StubbedInvocationMatcher(answer, invocationForStubbing, effectiveStrictness)); // depends on control dependency: [if], data = [none] } return stubbed.getFirst(); } } }
public class class_name { public long tryClaim(final int length, final BufferClaim bufferClaim) { checkPayloadLength(length); long newPosition = CLOSED; if (!isClosed) { final long limit = positionLimit.getVolatile(); final ExclusiveTermAppender termAppender = termAppenders[activePartitionIndex]; final long position = termBeginPosition + termOffset; if (position < limit) { final int result = termAppender.claim(termId, termOffset, headerWriter, length, bufferClaim); newPosition = newPosition(result); } else { newPosition = backPressureStatus(position, length); } } return newPosition; } }
public class class_name { public long tryClaim(final int length, final BufferClaim bufferClaim) { checkPayloadLength(length); long newPosition = CLOSED; if (!isClosed) { final long limit = positionLimit.getVolatile(); final ExclusiveTermAppender termAppender = termAppenders[activePartitionIndex]; final long position = termBeginPosition + termOffset; if (position < limit) { final int result = termAppender.claim(termId, termOffset, headerWriter, length, bufferClaim); newPosition = newPosition(result); // depends on control dependency: [if], data = [none] } else { newPosition = backPressureStatus(position, length); // depends on control dependency: [if], data = [(position] } } return newPosition; } }
public class class_name { public List<Point2D> apply(PointFeature feature) { List<Point2D> points = feature.getPoints(); if (points.size() < 4) { return points; } Point2D pointOnHull = points.get(getIndexOfLeftMostPoint(points)); // leftmost point in shape List<Point2D> hull = new ArrayList<Point2D>(); int i = 0; Point2D endpoint = points.get(0); // initial endpoint for a candidate edge on the hull do { hull.add(pointOnHull); endpoint = points.get(0); for (int j = 1; j < points.size(); j++) { if (endpoint == pointOnHull || isLeftOfLine(points.get(j), hull.get(i), endpoint)) { endpoint = points.get(j); // found greater left turn, update endpoint } } i++; pointOnHull = endpoint; } while (endpoint != hull.get(0)); /* i is now equal to the number of points of the hull. * need to make correctly sized hull array now. */ List<Point2D> hullToReturn = new ArrayList<Point2D>(); for (int k = 0; k < i; k++) { hullToReturn.add(hull.get(k)); } return hullToReturn; } }
public class class_name { public List<Point2D> apply(PointFeature feature) { List<Point2D> points = feature.getPoints(); if (points.size() < 4) { return points; // depends on control dependency: [if], data = [none] } Point2D pointOnHull = points.get(getIndexOfLeftMostPoint(points)); // leftmost point in shape List<Point2D> hull = new ArrayList<Point2D>(); int i = 0; Point2D endpoint = points.get(0); // initial endpoint for a candidate edge on the hull do { hull.add(pointOnHull); endpoint = points.get(0); for (int j = 1; j < points.size(); j++) { if (endpoint == pointOnHull || isLeftOfLine(points.get(j), hull.get(i), endpoint)) { endpoint = points.get(j); // found greater left turn, update endpoint // depends on control dependency: [if], data = [none] } } i++; pointOnHull = endpoint; } while (endpoint != hull.get(0)); /* i is now equal to the number of points of the hull. * need to make correctly sized hull array now. */ List<Point2D> hullToReturn = new ArrayList<Point2D>(); for (int k = 0; k < i; k++) { hullToReturn.add(hull.get(k)); // depends on control dependency: [for], data = [k] } return hullToReturn; } }
public class class_name { @Nullable private Node<V> findNode(Node<V> node, String path, int begin, boolean exact) { final int next; switch (node.type()) { case EXACT: final int len = node.path().length(); if (!path.regionMatches(begin, node.path(), 0, len)) { // A given path does not start with the path of this node. return null; } if (len == path.length() - begin) { // Matched. No more input characters. // If this node is not added by a user, then we should return a catch-all child // if it exists. But if 'exact' is true, we just return this node to make caller // have the exact matched node. return exact || node.hasValues() || !node.hasCatchAllChild() ? node : node.catchAllChild(); } next = begin + len; break; case PARAMETER: // Consume characters until the delimiter '/' as a path variable. final int delim = path.indexOf('/', begin); if (delim < 0) { // No more delimiter. return node; } if (path.length() == delim + 1) { final Node<V> trailingSlashNode = node.child('/'); return trailingSlashNode != null ? trailingSlashNode : node; } next = delim; break; default: throw new Error("Should not reach here"); } // The path is not matched to this node, but it is possible to be matched on my children // because the path starts with the path of this node. So we need to visit children as the // following sequences: // - The child which is able to consume the next character of the path. // - The child which has a path variable. // - The child which is able to consume every remaining path. (catch-all) Node<V> child = node.child(path.charAt(next)); if (child != null) { final Node<V> found = findNode(child, path, next, exact); if (found != null) { return found; } } child = node.parameterChild(); if (child != null) { final Node<V> found = findNode(child, path, next, exact); if (found != null) { return found; } } child = node.catchAllChild(); if (child != null) { return child; } return null; } }
public class class_name { @Nullable private Node<V> findNode(Node<V> node, String path, int begin, boolean exact) { final int next; switch (node.type()) { case EXACT: final int len = node.path().length(); if (!path.regionMatches(begin, node.path(), 0, len)) { // A given path does not start with the path of this node. return null; // depends on control dependency: [if], data = [none] } if (len == path.length() - begin) { // Matched. No more input characters. // If this node is not added by a user, then we should return a catch-all child // if it exists. But if 'exact' is true, we just return this node to make caller // have the exact matched node. return exact || node.hasValues() || !node.hasCatchAllChild() ? node : node.catchAllChild(); // depends on control dependency: [if], data = [none] } next = begin + len; break; case PARAMETER: // Consume characters until the delimiter '/' as a path variable. final int delim = path.indexOf('/', begin); if (delim < 0) { // No more delimiter. return node; // depends on control dependency: [if], data = [none] } if (path.length() == delim + 1) { final Node<V> trailingSlashNode = node.child('/'); return trailingSlashNode != null ? trailingSlashNode : node; // depends on control dependency: [if], data = [none] } next = delim; break; default: throw new Error("Should not reach here"); } // The path is not matched to this node, but it is possible to be matched on my children // because the path starts with the path of this node. So we need to visit children as the // following sequences: // - The child which is able to consume the next character of the path. // - The child which has a path variable. // - The child which is able to consume every remaining path. (catch-all) Node<V> child = node.child(path.charAt(next)); if (child != null) { final Node<V> found = findNode(child, path, next, exact); if (found != null) { return found; } } child = node.parameterChild(); if (child != null) { final Node<V> found = findNode(child, path, next, exact); if (found != null) { return found; } } child = node.catchAllChild(); if (child != null) { return child; } return null; } }
public class class_name { public void addValuedTrainingInstance(int id, String label, List<StringDoublePair> features) { List<scala.Tuple2<String,Double>> arr = new ArrayList<scala.Tuple2<String,Double>>(); for (StringDoublePair pair : features) { arr.add(new scala.Tuple2<String,Double>(pair.getString(), pair.getDouble())); } maxent.addValuedInstance(new java.lang.Integer(id), label,arr); } }
public class class_name { public void addValuedTrainingInstance(int id, String label, List<StringDoublePair> features) { List<scala.Tuple2<String,Double>> arr = new ArrayList<scala.Tuple2<String,Double>>(); for (StringDoublePair pair : features) { arr.add(new scala.Tuple2<String,Double>(pair.getString(), pair.getDouble())); // depends on control dependency: [for], data = [pair] } maxent.addValuedInstance(new java.lang.Integer(id), label,arr); } }
public class class_name { public String getTitle() { CmsGallerySearchResult result; try { result = CmsGallerySearch.searchById( m_value.getCmsObject(), m_value.getContentValue().getDocument().getFile().getStructureId(), m_value.getLocale()); return result.getTitle(); } catch (CmsException e) { LOG.warn("Could not retrieve title of series content.", e); return ""; } } }
public class class_name { public String getTitle() { CmsGallerySearchResult result; try { result = CmsGallerySearch.searchById( m_value.getCmsObject(), m_value.getContentValue().getDocument().getFile().getStructureId(), m_value.getLocale()); // depends on control dependency: [try], data = [none] return result.getTitle(); // depends on control dependency: [try], data = [none] } catch (CmsException e) { LOG.warn("Could not retrieve title of series content.", e); return ""; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static boolean verifyTimestampCertificates(TimeStampToken ts, KeyStore keystore, String provider) { if (provider == null) provider = "BC"; try { for (Enumeration aliases = keystore.aliases(); aliases.hasMoreElements();) { try { String alias = (String)aliases.nextElement(); if (!keystore.isCertificateEntry(alias)) continue; X509Certificate certStoreX509 = (X509Certificate)keystore.getCertificate(alias); SignerInformationVerifier siv = new JcaSimpleSignerInfoVerifierBuilder().setProvider(provider).build(certStoreX509); ts.validate(siv); return true; } catch (Exception ex) { } } } catch (Exception e) { } return false; } }
public class class_name { public static boolean verifyTimestampCertificates(TimeStampToken ts, KeyStore keystore, String provider) { if (provider == null) provider = "BC"; try { for (Enumeration aliases = keystore.aliases(); aliases.hasMoreElements();) { try { String alias = (String)aliases.nextElement(); if (!keystore.isCertificateEntry(alias)) continue; X509Certificate certStoreX509 = (X509Certificate)keystore.getCertificate(alias); SignerInformationVerifier siv = new JcaSimpleSignerInfoVerifierBuilder().setProvider(provider).build(certStoreX509); ts.validate(siv); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (Exception ex) { } // depends on control dependency: [catch], data = [none] } } catch (Exception e) { } // depends on control dependency: [catch], data = [none] return false; } }
public class class_name { private void growDataArray() { int newCapacity = data.length + (data.length >> 1); if (newCapacity - MAX_ARRAY_SIZE > 0) { newCapacity = MAX_ARRAY_SIZE; } data = Arrays.copyOf(data, newCapacity); } }
public class class_name { private void growDataArray() { int newCapacity = data.length + (data.length >> 1); if (newCapacity - MAX_ARRAY_SIZE > 0) { newCapacity = MAX_ARRAY_SIZE; // depends on control dependency: [if], data = [none] } data = Arrays.copyOf(data, newCapacity); } }
public class class_name { private List<Byte> asByteList(Object value) { byte[] values = (byte[]) value; List<Byte> list = new ArrayList<Byte>(values.length); for (byte byteValue : values) { list.add(byteValue); } return list; } }
public class class_name { private List<Byte> asByteList(Object value) { byte[] values = (byte[]) value; List<Byte> list = new ArrayList<Byte>(values.length); for (byte byteValue : values) { list.add(byteValue); // depends on control dependency: [for], data = [byteValue] } return list; } }
public class class_name { public static BeanGenConfig parse(String resourceLocator) { String fullFile; if (resourceLocator.contains("/") || resourceLocator.endsWith(".ini")) { fullFile = resourceLocator; } else if (resourceLocator.equals("jdk6")) { // compatibility fullFile = "org/joda/beans/gen/jdk.ini"; } else { fullFile = "org/joda/beans/gen/" + resourceLocator + ".ini"; } ClassLoader loader = BeanGenConfig.class.getClassLoader(); if (loader == null) { throw new IllegalArgumentException("ClassLoader was null: " + fullFile); } URL url = loader.getResource(fullFile); if (url == null) { throw new IllegalArgumentException("Configuration file not found: " + fullFile); } List<String> lines = new ArrayList<>(); BufferedReader in = null; try { in = new BufferedReader(new InputStreamReader(url.openStream(), UTF8)); String line = in.readLine(); while (line != null) { if (line.trim().startsWith("#") == false && line.trim().length() > 0) { lines.add(line); } line = in.readLine(); } return parse(lines); } catch (IOException ex) { throw new RuntimeException(ex.getMessage(), ex); } finally { if (in != null) { try { in.close(); } catch (IOException ex1) { // ignore } } } } }
public class class_name { public static BeanGenConfig parse(String resourceLocator) { String fullFile; if (resourceLocator.contains("/") || resourceLocator.endsWith(".ini")) { fullFile = resourceLocator; // depends on control dependency: [if], data = [none] } else if (resourceLocator.equals("jdk6")) { // compatibility fullFile = "org/joda/beans/gen/jdk.ini"; // depends on control dependency: [if], data = [none] } else { fullFile = "org/joda/beans/gen/" + resourceLocator + ".ini"; // depends on control dependency: [if], data = [none] } ClassLoader loader = BeanGenConfig.class.getClassLoader(); if (loader == null) { throw new IllegalArgumentException("ClassLoader was null: " + fullFile); } URL url = loader.getResource(fullFile); if (url == null) { throw new IllegalArgumentException("Configuration file not found: " + fullFile); } List<String> lines = new ArrayList<>(); BufferedReader in = null; try { in = new BufferedReader(new InputStreamReader(url.openStream(), UTF8)); // depends on control dependency: [try], data = [none] String line = in.readLine(); while (line != null) { if (line.trim().startsWith("#") == false && line.trim().length() > 0) { lines.add(line); // depends on control dependency: [if], data = [none] } line = in.readLine(); // depends on control dependency: [while], data = [none] } return parse(lines); // depends on control dependency: [try], data = [none] } catch (IOException ex) { throw new RuntimeException(ex.getMessage(), ex); } finally { // depends on control dependency: [catch], data = [none] if (in != null) { try { in.close(); // depends on control dependency: [try], data = [none] } catch (IOException ex1) { // ignore } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { public static boolean hasAtLeastOneAnnotation(ClassNode node, String... annotations) { if (hasAtLeastOneAnnotation((AnnotatedNode) node, annotations)) { return true; } for (MethodNode method : node.getMethods()) { if (hasAtLeastOneAnnotation(method, annotations)) { return true; } } return false; } }
public class class_name { public static boolean hasAtLeastOneAnnotation(ClassNode node, String... annotations) { if (hasAtLeastOneAnnotation((AnnotatedNode) node, annotations)) { return true; // depends on control dependency: [if], data = [none] } for (MethodNode method : node.getMethods()) { if (hasAtLeastOneAnnotation(method, annotations)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public static void forEachURLSet (@Nonnull final Consumer <? super XMLSitemapURLSet> aConsumer) { ValueEnforcer.notNull (aConsumer, "Consumer"); for (final IXMLSitemapProviderSPI aSPI : s_aProviders) { final XMLSitemapURLSet aURLSet = aSPI.createURLSet (); aConsumer.accept (aURLSet); } } }
public class class_name { public static void forEachURLSet (@Nonnull final Consumer <? super XMLSitemapURLSet> aConsumer) { ValueEnforcer.notNull (aConsumer, "Consumer"); for (final IXMLSitemapProviderSPI aSPI : s_aProviders) { final XMLSitemapURLSet aURLSet = aSPI.createURLSet (); aConsumer.accept (aURLSet); // depends on control dependency: [for], data = [none] } } }
public class class_name { public String getUriTemplate() { String result = ""; try { result = getCms().readPropertyObject( getParamTempfile(), CmsPropertyDefinition.PROPERTY_TEMPLATE, true).getValue(""); } catch (CmsException e) { LOG.warn(Messages.get().getBundle().key(Messages.LOG_READ_TEMPLATE_PROP_FAILED_0), e); } return result; } }
public class class_name { public String getUriTemplate() { String result = ""; try { result = getCms().readPropertyObject( getParamTempfile(), CmsPropertyDefinition.PROPERTY_TEMPLATE, true).getValue(""); // depends on control dependency: [try], data = [none] } catch (CmsException e) { LOG.warn(Messages.get().getBundle().key(Messages.LOG_READ_TEMPLATE_PROP_FAILED_0), e); } // depends on control dependency: [catch], data = [none] return result; } }
public class class_name { @Nullable public static Workbook readWorkbookFromInputStream (@Nonnull final IHasInputStream aIIS) { InputStream aIS = null; try { // Try to read as XLS aIS = aIIS.getInputStream (); if (aIS == null) { // Failed to open input stream -> no need to continue return null; } return new HSSFWorkbook (aIS); } catch (final OfficeXmlFileException ex) { // No XLS -> try XSLS StreamHelper.close (aIS); try { // Re-retrieve the input stream, to ensure we read from the beginning! aIS = aIIS.getInputStream (); return new XSSFWorkbook (aIS); } catch (final IOException ex2) { LOGGER.error ("Error trying to read XLSX file from " + aIIS, ex); } } catch (final NotOLE2FileException ex) { LOGGER.error ("Error trying to read non-Excel file from " + aIIS + ": " + ex.getMessage ()); } catch (final IOException ex) { LOGGER.error ("Error trying to read XLS file from " + aIIS, ex); } finally { // Ensure the InputStream is closed. The data structures are in memory! StreamHelper.close (aIS); } return null; } }
public class class_name { @Nullable public static Workbook readWorkbookFromInputStream (@Nonnull final IHasInputStream aIIS) { InputStream aIS = null; try { // Try to read as XLS aIS = aIIS.getInputStream (); // depends on control dependency: [try], data = [none] if (aIS == null) { // Failed to open input stream -> no need to continue return null; // depends on control dependency: [if], data = [none] } return new HSSFWorkbook (aIS); // depends on control dependency: [try], data = [none] } catch (final OfficeXmlFileException ex) { // No XLS -> try XSLS StreamHelper.close (aIS); try { // Re-retrieve the input stream, to ensure we read from the beginning! aIS = aIIS.getInputStream (); // depends on control dependency: [try], data = [none] return new XSSFWorkbook (aIS); // depends on control dependency: [try], data = [none] } catch (final IOException ex2) { LOGGER.error ("Error trying to read XLSX file from " + aIIS, ex); } // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] catch (final NotOLE2FileException ex) { LOGGER.error ("Error trying to read non-Excel file from " + aIIS + ": " + ex.getMessage ()); } // depends on control dependency: [catch], data = [none] catch (final IOException ex) { LOGGER.error ("Error trying to read XLS file from " + aIIS, ex); } // depends on control dependency: [catch], data = [none] finally { // Ensure the InputStream is closed. The data structures are in memory! StreamHelper.close (aIS); } return null; } }
public class class_name { public String setPropertyTypeFromStringValue( PropertyIdValue propertyIdValue, StringValue value) { String datatype = getPropertyType(propertyIdValue); if (datatype == null) { logger.warn("Could not fetch datatype of " + propertyIdValue.getIri() + ". Assuming type " + DatatypeIdValue.DT_STRING); return DatatypeIdValue.DT_STRING; // default type for StringValue } else { return datatype; } } }
public class class_name { public String setPropertyTypeFromStringValue( PropertyIdValue propertyIdValue, StringValue value) { String datatype = getPropertyType(propertyIdValue); if (datatype == null) { logger.warn("Could not fetch datatype of " + propertyIdValue.getIri() + ". Assuming type " + DatatypeIdValue.DT_STRING); // depends on control dependency: [if], data = [none] return DatatypeIdValue.DT_STRING; // default type for StringValue // depends on control dependency: [if], data = [none] } else { return datatype; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static boolean setOnce(AtomicReference<Disposable> upstream, Disposable next, Class<?> observer) { AutoDisposeUtil.checkNotNull(next, "next is null"); if (!upstream.compareAndSet(null, next)) { next.dispose(); if (upstream.get() != AutoDisposableHelper.DISPOSED) { reportDoubleSubscription(observer); } return false; } return true; } }
public class class_name { public static boolean setOnce(AtomicReference<Disposable> upstream, Disposable next, Class<?> observer) { AutoDisposeUtil.checkNotNull(next, "next is null"); if (!upstream.compareAndSet(null, next)) { next.dispose(); // depends on control dependency: [if], data = [none] if (upstream.get() != AutoDisposableHelper.DISPOSED) { reportDoubleSubscription(observer); // depends on control dependency: [if], data = [none] } return false; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public void repeat(CmmnActivityExecution execution, String standardEvent) { CmmnActivity activity = execution.getActivity(); boolean repeat = false; if (activity.getEntryCriteria().isEmpty()) { List<String> events = activity.getProperties().get(CmmnProperties.REPEAT_ON_STANDARD_EVENTS); if (events != null && events.contains(standardEvent)) { repeat = evaluateRepetitionRule(execution); } } else { if (ENABLE.equals(standardEvent) || START.equals(standardEvent) || OCCUR.equals(standardEvent)) { repeat = evaluateRepetitionRule(execution); } } if (repeat) { CmmnActivityExecution parent = execution.getParent(); // instantiate a new instance of given activity List<CmmnExecution> children = parent.createChildExecutions(Arrays.asList(activity)); // start the lifecycle of the new instance parent.triggerChildExecutionsLifecycle(children); } } }
public class class_name { public void repeat(CmmnActivityExecution execution, String standardEvent) { CmmnActivity activity = execution.getActivity(); boolean repeat = false; if (activity.getEntryCriteria().isEmpty()) { List<String> events = activity.getProperties().get(CmmnProperties.REPEAT_ON_STANDARD_EVENTS); if (events != null && events.contains(standardEvent)) { repeat = evaluateRepetitionRule(execution); // depends on control dependency: [if], data = [none] } } else { if (ENABLE.equals(standardEvent) || START.equals(standardEvent) || OCCUR.equals(standardEvent)) { repeat = evaluateRepetitionRule(execution); // depends on control dependency: [if], data = [none] } } if (repeat) { CmmnActivityExecution parent = execution.getParent(); // instantiate a new instance of given activity List<CmmnExecution> children = parent.createChildExecutions(Arrays.asList(activity)); // start the lifecycle of the new instance parent.triggerChildExecutionsLifecycle(children); // depends on control dependency: [if], data = [none] } } }
public class class_name { public ServiceCall<Gateway> createGateway(CreateGatewayOptions createGatewayOptions) { Validator.notNull(createGatewayOptions, "createGatewayOptions cannot be null"); String[] pathSegments = { "v1/environments", "gateways" }; String[] pathParameters = { createGatewayOptions.environmentId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters)); builder.query("version", versionDate); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "createGateway"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); if (createGatewayOptions.name() != null) { contentJson.addProperty("name", createGatewayOptions.name()); } builder.bodyJson(contentJson); return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Gateway.class)); } }
public class class_name { public ServiceCall<Gateway> createGateway(CreateGatewayOptions createGatewayOptions) { Validator.notNull(createGatewayOptions, "createGatewayOptions cannot be null"); String[] pathSegments = { "v1/environments", "gateways" }; String[] pathParameters = { createGatewayOptions.environmentId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters)); builder.query("version", versionDate); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "createGateway"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header] } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); if (createGatewayOptions.name() != null) { contentJson.addProperty("name", createGatewayOptions.name()); // depends on control dependency: [if], data = [none] } builder.bodyJson(contentJson); return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Gateway.class)); } }
public class class_name { public static IntComparator rowComparator(Column<?> column, Sort.Order order) { IntComparator rowComparator = column.rowComparator(); if (order == Sort.Order.DESCEND) { return ReversingIntComparator.reverse(rowComparator); } else { return rowComparator; } } }
public class class_name { public static IntComparator rowComparator(Column<?> column, Sort.Order order) { IntComparator rowComparator = column.rowComparator(); if (order == Sort.Order.DESCEND) { return ReversingIntComparator.reverse(rowComparator); // depends on control dependency: [if], data = [none] } else { return rowComparator; // depends on control dependency: [if], data = [none] } } }
public class class_name { public ElementsBuilder addAll(HTMLElement... elements) { for (HTMLElement element : elements) { add(element); } return that(); } }
public class class_name { public ElementsBuilder addAll(HTMLElement... elements) { for (HTMLElement element : elements) { add(element); // depends on control dependency: [for], data = [element] } return that(); } }
public class class_name { public KieServerHttpResponse response() { if( this.response == null ) { this.response = new KieServerHttpResponse() { private String body = null; // @formatter:off @Override public InputStream stream() throws KieServerHttpRequestException { return responseStream(); } @Override public String message() throws KieServerHttpRequestException { return responseMessage(); } @Override public int intHeader( String name ) throws KieServerHttpRequestException { return intResponseHeader(name); } @Override public String[] headers( String name ) { return responseHeaders(name); } @Override public Map<String, List<String>> headers() throws KieServerHttpRequestException { return responseHeaders(); } @Override public Map<String, String> headerParameters( String headerName ) { return responseHeaderParameters(headerName); } @Override public String headerParameter( String headerName, String paramName ) { return responseHeaderParameter(headerName, paramName); } @Override public String header( String name ) throws KieServerHttpRequestException { return responseHeader(name); } @Override public String contentType() { return responseContentType(); } @Override public int contentLength() { return responseContentLength(); } @Override public String contentEncoding() { return responseContentEncoding(); } @Override public int code() throws KieServerHttpRequestException { return responseCode(); } @Override public String charset() { return responseCharset(); } @Override public byte[] bytes() throws KieServerHttpRequestException { return responseBytes(); } @Override public BufferedInputStream buffer() throws KieServerHttpRequestException { return responseBuffer(); } @Override public String body() throws KieServerHttpRequestException { if( body == null ) { body = responseBody(); } return body; } // @formatter:on }; } return this.response; } }
public class class_name { public KieServerHttpResponse response() { if( this.response == null ) { this.response = new KieServerHttpResponse() { private String body = null; // @formatter:off @Override public InputStream stream() throws KieServerHttpRequestException { return responseStream(); } // depends on control dependency: [if], data = [none] @Override public String message() throws KieServerHttpRequestException { return responseMessage(); } @Override public int intHeader( String name ) throws KieServerHttpRequestException { return intResponseHeader(name); } // depends on control dependency: [if], data = [none] @Override public String[] headers( String name ) { return responseHeaders(name); } @Override public Map<String, List<String>> headers() throws KieServerHttpRequestException { return responseHeaders(); } @Override public Map<String, String> headerParameters( String headerName ) { return responseHeaderParameters(headerName); } @Override public String headerParameter( String headerName, String paramName ) { return responseHeaderParameter(headerName, paramName); } @Override public String header( String name ) throws KieServerHttpRequestException { return responseHeader(name); } @Override public String contentType() { return responseContentType(); } @Override public int contentLength() { return responseContentLength(); } @Override public String contentEncoding() { return responseContentEncoding(); } @Override public int code() throws KieServerHttpRequestException { return responseCode(); } @Override public String charset() { return responseCharset(); } @Override public byte[] bytes() throws KieServerHttpRequestException { return responseBytes(); } @Override public BufferedInputStream buffer() throws KieServerHttpRequestException { return responseBuffer(); } @Override public String body() throws KieServerHttpRequestException { if( body == null ) { body = responseBody(); } return body; } // @formatter:on }; } return this.response; } }
public class class_name { public Lexicon create() throws Exception { Lexicon lexicon = new TrieLexicon(caseSensitive, probabilistic, tagAttribute); if (resource != null) { String base = resource.baseName().replaceFirst("\\.[^\\.]*$", ""); try (CSVReader reader = CSV.builder().removeEmptyCells().reader(resource)) { reader.forEach(row -> { if (row.size() > 0) { String lemma = row.get(0); double probability = 1d; Tag tag = null; SerializablePredicate<HString> constraint = null; int nc = 1; if (tagAttribute != null && this.tag != null) { tag = Cast.as(this.tag); } else if (row.size() > nc && tagAttribute != null && !useResourceNameAsTag) { tag = tagAttribute.getValueType().decode(row.get(nc)); if (tag == null) { log.warn("{0} is an invalid {1}, skipping entry {2}.", row.get(nc), tagAttribute.name(), row); return; } nc++; } else if (tagAttribute != null) { tag = tagAttribute.getValueType().decode(base); Preconditions.checkNotNull(tag, base + " is an invalid tag."); } if (probabilistic && row.size() > nc && Doubles.tryParse(row.get(nc)) != null) { probability = Double.parseDouble(row.get(nc)); nc++; } if (hasConstraints && row.size() > nc) { try { constraint = QueryToPredicate.parse(row.get(nc)); } catch (ParseException e) { if (tag == null) { log.warn("Error parsing constraint {0}, skipping entry {1}.", row.get(nc), row); return; } } } lexicon.add(new LexiconEntry(lemma, probability, constraint, tag)); } }); } } return lexicon; } }
public class class_name { public Lexicon create() throws Exception { Lexicon lexicon = new TrieLexicon(caseSensitive, probabilistic, tagAttribute); if (resource != null) { String base = resource.baseName().replaceFirst("\\.[^\\.]*$", ""); try (CSVReader reader = CSV.builder().removeEmptyCells().reader(resource)) { reader.forEach(row -> { if (row.size() > 0) { String lemma = row.get(0); double probability = 1d; Tag tag = null; SerializablePredicate<HString> constraint = null; int nc = 1; if (tagAttribute != null && this.tag != null) { tag = Cast.as(this.tag); // depends on control dependency: [if], data = [none] } else if (row.size() > nc && tagAttribute != null && !useResourceNameAsTag) { tag = tagAttribute.getValueType().decode(row.get(nc)); // depends on control dependency: [if], data = [none] if (tag == null) { log.warn("{0} is an invalid {1}, skipping entry {2}.", row.get(nc), tagAttribute.name(), row); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } nc++; // depends on control dependency: [if], data = [none] } else if (tagAttribute != null) { tag = tagAttribute.getValueType().decode(base); // depends on control dependency: [if], data = [none] Preconditions.checkNotNull(tag, base + " is an invalid tag."); // depends on control dependency: [if], data = [none] } if (probabilistic && row.size() > nc && Doubles.tryParse(row.get(nc)) != null) { probability = Double.parseDouble(row.get(nc)); // depends on control dependency: [if], data = [none] nc++; // depends on control dependency: [if], data = [none] } if (hasConstraints && row.size() > nc) { try { constraint = QueryToPredicate.parse(row.get(nc)); // depends on control dependency: [try], data = [none] } catch (ParseException e) { if (tag == null) { log.warn("Error parsing constraint {0}, skipping entry {1}.", row.get(nc), row); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } lexicon.add(new LexiconEntry(lemma, probability, constraint, tag)); } }); } } return lexicon; } }
public class class_name { public static boolean isAssignable( Class<?>[] classArray, Class<?>[] toClassArray, boolean autoboxing) { if (arrayGetLength(classArray) != arrayGetLength(toClassArray)) { return false; } if (classArray == null) { classArray = EMPTY_CLASS_ARRAY; } if (toClassArray == null) { toClassArray = EMPTY_CLASS_ARRAY; } for (int i = 0; i < classArray.length; i++) { if (isAssignable(classArray[i], toClassArray[i], autoboxing) == false) { return false; } } return true; } }
public class class_name { public static boolean isAssignable( Class<?>[] classArray, Class<?>[] toClassArray, boolean autoboxing) { if (arrayGetLength(classArray) != arrayGetLength(toClassArray)) { return false; // depends on control dependency: [if], data = [none] } if (classArray == null) { classArray = EMPTY_CLASS_ARRAY; // depends on control dependency: [if], data = [none] } if (toClassArray == null) { toClassArray = EMPTY_CLASS_ARRAY; // depends on control dependency: [if], data = [none] } for (int i = 0; i < classArray.length; i++) { if (isAssignable(classArray[i], toClassArray[i], autoboxing) == false) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { public void marshall(ListOriginEndpointsRequest listOriginEndpointsRequest, ProtocolMarshaller protocolMarshaller) { if (listOriginEndpointsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listOriginEndpointsRequest.getChannelId(), CHANNELID_BINDING); protocolMarshaller.marshall(listOriginEndpointsRequest.getMaxResults(), MAXRESULTS_BINDING); protocolMarshaller.marshall(listOriginEndpointsRequest.getNextToken(), NEXTTOKEN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ListOriginEndpointsRequest listOriginEndpointsRequest, ProtocolMarshaller protocolMarshaller) { if (listOriginEndpointsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listOriginEndpointsRequest.getChannelId(), CHANNELID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listOriginEndpointsRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listOriginEndpointsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public List<String> getIdentifiers(String propertyId, boolean ownOnly) throws VCASException { try { Connection con = dataSource.getConnection(); PreparedStatement ps = null; ResultSet rs = null; try { List<String> ids = new ArrayList<String>(); if (ownOnly) { ps = con.prepareStatement(sqlSelectOwnRecords); ps.setString(1, propertyId); rs = ps.executeQuery(); if (rs.next()) { do { rs.getString("SHARED_ID"); if (rs.wasNull()) ids.add(rs.getString("CAS_ID")); } while (rs.next()); return ids; } else { throw new RecordNotFoundException("No records found with propertyId=" + propertyId); } } else { ps = con.prepareStatement(sqlSelectRecords); ps.setString(1, propertyId); rs = ps.executeQuery(); if (rs.next()) { do { ids.add(rs.getString("CAS_ID")); } while (rs.next()); return ids; } else { throw new RecordNotFoundException("No records found with propertyId=" + propertyId); } } } finally { if (rs != null) { try { rs.close(); } catch (SQLException e) { LOG.error("Can't close the ResultSet: " + e.getMessage()); } } if (ps != null) { try { ps.close(); } catch (SQLException e) { LOG.error("Can't close the Statement: " + e.getMessage()); } } con.close(); } } catch (SQLException e) { throw new VCASException("VCAS GET IDs database error: " + e, e); } } }
public class class_name { public List<String> getIdentifiers(String propertyId, boolean ownOnly) throws VCASException { try { Connection con = dataSource.getConnection(); PreparedStatement ps = null; ResultSet rs = null; try { List<String> ids = new ArrayList<String>(); if (ownOnly) { ps = con.prepareStatement(sqlSelectOwnRecords); // depends on control dependency: [if], data = [none] ps.setString(1, propertyId); // depends on control dependency: [if], data = [none] rs = ps.executeQuery(); // depends on control dependency: [if], data = [none] if (rs.next()) { do { rs.getString("SHARED_ID"); if (rs.wasNull()) ids.add(rs.getString("CAS_ID")); } while (rs.next()); return ids; // depends on control dependency: [if], data = [none] } else { throw new RecordNotFoundException("No records found with propertyId=" + propertyId); } } else { ps = con.prepareStatement(sqlSelectRecords); // depends on control dependency: [if], data = [none] ps.setString(1, propertyId); // depends on control dependency: [if], data = [none] rs = ps.executeQuery(); // depends on control dependency: [if], data = [none] if (rs.next()) { do { ids.add(rs.getString("CAS_ID")); } while (rs.next()); return ids; // depends on control dependency: [if], data = [none] } else { throw new RecordNotFoundException("No records found with propertyId=" + propertyId); } } } finally { if (rs != null) { try { rs.close(); // depends on control dependency: [try], data = [none] } catch (SQLException e) { LOG.error("Can't close the ResultSet: " + e.getMessage()); } } if (ps != null) { try { ps.close(); } catch (SQLException e) { LOG.error("Can't close the Statement: " + e.getMessage()); } // depends on control dependency: [catch], data = [none] } con.close(); } } catch (SQLException e) { throw new VCASException("VCAS GET IDs database error: " + e, e); } } }
public class class_name { @Override public void onStart(TestContext<Object> context) { oldErr = System.err; oldOut = System.out; try { System.setErr(remplacementErr); System.setOut(remplacementOut); } catch (SecurityException e) { // ignored } } }
public class class_name { @Override public void onStart(TestContext<Object> context) { oldErr = System.err; oldOut = System.out; try { System.setErr(remplacementErr); // depends on control dependency: [try], data = [none] System.setOut(remplacementOut); // depends on control dependency: [try], data = [none] } catch (SecurityException e) { // ignored } // depends on control dependency: [catch], data = [none] } }
public class class_name { public final void setItsRole(final RoleJetty pRole) { this.itsRole = pRole; if (this.itsId == null) { this.itsId = new IdUserRoleJetty(); } this.itsId.setItsRole(this.itsRole); } }
public class class_name { public final void setItsRole(final RoleJetty pRole) { this.itsRole = pRole; if (this.itsId == null) { this.itsId = new IdUserRoleJetty(); // depends on control dependency: [if], data = [none] } this.itsId.setItsRole(this.itsRole); } }
public class class_name { public @Nonnull Optional<InputStream> getResourceAsStream(@Nonnull String path) { ArgumentUtils.requireNonNull("path", path); Optional<ResourceLoader> resourceLoader = getSupportingLoader(path); if (resourceLoader.isPresent()) { return resourceLoader.get().getResourceAsStream(path); } return Optional.empty(); } }
public class class_name { public @Nonnull Optional<InputStream> getResourceAsStream(@Nonnull String path) { ArgumentUtils.requireNonNull("path", path); Optional<ResourceLoader> resourceLoader = getSupportingLoader(path); if (resourceLoader.isPresent()) { return resourceLoader.get().getResourceAsStream(path); // depends on control dependency: [if], data = [none] } return Optional.empty(); } }
public class class_name { private static void extractArchive(ArchiveInputStream input, File destination, FilenameFilter filter) throws ArchiveExtractionException { ArchiveEntry entry; try { final String destPath = destination.getCanonicalPath(); while ((entry = input.getNextEntry()) != null) { if (entry.isDirectory()) { final File dir = new File(destination, entry.getName()); if (!dir.getCanonicalPath().startsWith(destPath)) { final String msg = String.format( "Archive contains a path (%s) that would be extracted outside of the target directory.", dir.getAbsolutePath()); throw new AnalysisException(msg); } if (!dir.exists() && !dir.mkdirs()) { final String msg = String.format( "Unable to create directory '%s'.", dir.getAbsolutePath()); throw new AnalysisException(msg); } } else { extractFile(input, destination, filter, entry); } } } catch (IOException | AnalysisException ex) { throw new ArchiveExtractionException(ex); } finally { FileUtils.close(input); } } }
public class class_name { private static void extractArchive(ArchiveInputStream input, File destination, FilenameFilter filter) throws ArchiveExtractionException { ArchiveEntry entry; try { final String destPath = destination.getCanonicalPath(); while ((entry = input.getNextEntry()) != null) { if (entry.isDirectory()) { final File dir = new File(destination, entry.getName()); if (!dir.getCanonicalPath().startsWith(destPath)) { final String msg = String.format( "Archive contains a path (%s) that would be extracted outside of the target directory.", dir.getAbsolutePath()); throw new AnalysisException(msg); } if (!dir.exists() && !dir.mkdirs()) { final String msg = String.format( "Unable to create directory '%s'.", dir.getAbsolutePath()); throw new AnalysisException(msg); } } else { extractFile(input, destination, filter, entry); // depends on control dependency: [if], data = [none] } } } catch (IOException | AnalysisException ex) { throw new ArchiveExtractionException(ex); } finally { FileUtils.close(input); } } }
public class class_name { public static void showContent(@NonNull final View loadingView, @NonNull final View contentView, @NonNull final View errorView) { if (contentView.getVisibility() == View.VISIBLE) { // No Changing needed, because contentView is already visible errorView.setVisibility(View.GONE); loadingView.setVisibility(View.GONE); } else { errorView.setVisibility(View.GONE); final Resources resources = loadingView.getResources(); final int translateInPixels = resources.getDimensionPixelSize(R.dimen.lce_content_view_animation_translate_y); // Not visible yet, so animate the view in AnimatorSet set = new AnimatorSet(); ObjectAnimator contentFadeIn = ObjectAnimator.ofFloat(contentView, View.ALPHA, 0f, 1f); ObjectAnimator contentTranslateIn = ObjectAnimator.ofFloat(contentView, View.TRANSLATION_Y, translateInPixels, 0); ObjectAnimator loadingFadeOut = ObjectAnimator.ofFloat(loadingView, View.ALPHA, 1f, 0f); ObjectAnimator loadingTranslateOut = ObjectAnimator.ofFloat(loadingView, View.TRANSLATION_Y, 0, -translateInPixels); set.playTogether(contentFadeIn, contentTranslateIn, loadingFadeOut, loadingTranslateOut); set.setDuration(resources.getInteger(R.integer.lce_content_view_show_animation_time)); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { contentView.setTranslationY(0); loadingView.setTranslationY(0); contentView.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animator animation) { loadingView.setVisibility(View.GONE); loadingView.setAlpha(1f); // For future showLoading calls contentView.setTranslationY(0); loadingView.setTranslationY(0); } }); set.start(); } } }
public class class_name { public static void showContent(@NonNull final View loadingView, @NonNull final View contentView, @NonNull final View errorView) { if (contentView.getVisibility() == View.VISIBLE) { // No Changing needed, because contentView is already visible errorView.setVisibility(View.GONE); // depends on control dependency: [if], data = [none] loadingView.setVisibility(View.GONE); // depends on control dependency: [if], data = [none] } else { errorView.setVisibility(View.GONE); // depends on control dependency: [if], data = [none] final Resources resources = loadingView.getResources(); final int translateInPixels = resources.getDimensionPixelSize(R.dimen.lce_content_view_animation_translate_y); // Not visible yet, so animate the view in AnimatorSet set = new AnimatorSet(); ObjectAnimator contentFadeIn = ObjectAnimator.ofFloat(contentView, View.ALPHA, 0f, 1f); ObjectAnimator contentTranslateIn = ObjectAnimator.ofFloat(contentView, View.TRANSLATION_Y, translateInPixels, 0); ObjectAnimator loadingFadeOut = ObjectAnimator.ofFloat(loadingView, View.ALPHA, 1f, 0f); ObjectAnimator loadingTranslateOut = ObjectAnimator.ofFloat(loadingView, View.TRANSLATION_Y, 0, -translateInPixels); set.playTogether(contentFadeIn, contentTranslateIn, loadingFadeOut, loadingTranslateOut); // depends on control dependency: [if], data = [none] set.setDuration(resources.getInteger(R.integer.lce_content_view_show_animation_time)); // depends on control dependency: [if], data = [none] set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { contentView.setTranslationY(0); loadingView.setTranslationY(0); contentView.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animator animation) { loadingView.setVisibility(View.GONE); loadingView.setAlpha(1f); // For future showLoading calls contentView.setTranslationY(0); loadingView.setTranslationY(0); } }); // depends on control dependency: [if], data = [none] set.start(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private boolean isValidJoinMessage(JoinMessage joinMessage) { try { return validateJoinMessage(joinMessage); } catch (ConfigMismatchException e) { throw e; } catch (Exception e) { return false; } } }
public class class_name { private boolean isValidJoinMessage(JoinMessage joinMessage) { try { return validateJoinMessage(joinMessage); // depends on control dependency: [try], data = [none] } catch (ConfigMismatchException e) { throw e; } catch (Exception e) { // depends on control dependency: [catch], data = [none] return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public int getNodeIdForZoneNary(int zoneId, int zoneNary, byte[] key) { List<Node> replicatingNodes = this.routingStrategy.routeRequest(key); int zoneNAry = -1; for(Node node: replicatingNodes) { // bump up the counter if we encounter a replica in the given zone; // return current node if counter now matches requested if(node.getZoneId() == zoneId) { zoneNAry++; if(zoneNAry == zoneNary) { return node.getId(); } } } if(zoneNAry == -1) { throw new VoldemortException("Could not find any replicas for the key " + ByteUtils.toHexString(key) + " in given zone " + zoneId); } else { throw new VoldemortException("Could not find " + (zoneNary + 1) + " replicas for the key " + ByteUtils.toHexString(key) + " in given zone " + zoneId + ". Only found " + (zoneNAry + 1)); } } }
public class class_name { public int getNodeIdForZoneNary(int zoneId, int zoneNary, byte[] key) { List<Node> replicatingNodes = this.routingStrategy.routeRequest(key); int zoneNAry = -1; for(Node node: replicatingNodes) { // bump up the counter if we encounter a replica in the given zone; // return current node if counter now matches requested if(node.getZoneId() == zoneId) { zoneNAry++; // depends on control dependency: [if], data = [none] if(zoneNAry == zoneNary) { return node.getId(); // depends on control dependency: [if], data = [none] } } } if(zoneNAry == -1) { throw new VoldemortException("Could not find any replicas for the key " + ByteUtils.toHexString(key) + " in given zone " + zoneId); } else { throw new VoldemortException("Could not find " + (zoneNary + 1) + " replicas for the key " + ByteUtils.toHexString(key) + " in given zone " + zoneId + ". Only found " + (zoneNAry + 1)); } } }
public class class_name { public float getFloat(final String key, final float defaultValue) { String val = getStringInternal(key); if (val == null) { return defaultValue; } else { return Float.parseFloat(val); } } }
public class class_name { public float getFloat(final String key, final float defaultValue) { String val = getStringInternal(key); if (val == null) { return defaultValue; // depends on control dependency: [if], data = [none] } else { return Float.parseFloat(val); // depends on control dependency: [if], data = [(val] } } }
public class class_name { public void leave(Conference conference) { try { mg.release(); } catch (Exception e) { logger.error("Error", e); } } }
public class class_name { public void leave(Conference conference) { try { mg.release(); // depends on control dependency: [try], data = [none] } catch (Exception e) { logger.error("Error", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public CalendarQuarter plus(Quarters quarters) { if (quarters.isEmpty()) { return this; } long value = this.year * 4L + this.quarter.getValue() - 1 + quarters.getAmount(); int y = MathUtils.safeCast(MathUtils.floorDivide(value, 4)); Quarter q = Quarter.valueOf(MathUtils.floorModulo(value, 4) + 1); return CalendarQuarter.of(y, q); } }
public class class_name { public CalendarQuarter plus(Quarters quarters) { if (quarters.isEmpty()) { return this; // depends on control dependency: [if], data = [none] } long value = this.year * 4L + this.quarter.getValue() - 1 + quarters.getAmount(); int y = MathUtils.safeCast(MathUtils.floorDivide(value, 4)); Quarter q = Quarter.valueOf(MathUtils.floorModulo(value, 4) + 1); return CalendarQuarter.of(y, q); } }
public class class_name { protected final R parseResponse(HttpResponse response, BaasBox box) throws BaasException { final int status = response.getStatusCode(); final int statusClass = status / 100; try { switch (statusClass) { case 1: return onContinue(status, response, box); case 2: return onOk(status, response, box); case 3: return onRedirect(status, response, box); case 4: return onClientError(status, response, box); case 5: return onServerError(status, response, box); default: throw new BaasIOException("unexpected status code returned from server: " + status); } } catch (BaasInvalidSessionException e) { if (retryOnFailedLogin) { retryOnFailedLogin = false; if (attemptRefreshToken(box)) { return asyncCall(); } else { throw e; } } else { throw e; } } } }
public class class_name { protected final R parseResponse(HttpResponse response, BaasBox box) throws BaasException { final int status = response.getStatusCode(); final int statusClass = status / 100; try { switch (statusClass) { case 1: return onContinue(status, response, box); case 2: return onOk(status, response, box); case 3: return onRedirect(status, response, box); case 4: return onClientError(status, response, box); case 5: return onServerError(status, response, box); default: throw new BaasIOException("unexpected status code returned from server: " + status); } } catch (BaasInvalidSessionException e) { if (retryOnFailedLogin) { retryOnFailedLogin = false; // depends on control dependency: [if], data = [none] if (attemptRefreshToken(box)) { return asyncCall(); // depends on control dependency: [if], data = [none] } else { throw e; } } else { throw e; } } } }
public class class_name { public void marshall(EndpointUser endpointUser, ProtocolMarshaller protocolMarshaller) { if (endpointUser == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(endpointUser.getUserAttributes(), USERATTRIBUTES_BINDING); protocolMarshaller.marshall(endpointUser.getUserId(), USERID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(EndpointUser endpointUser, ProtocolMarshaller protocolMarshaller) { if (endpointUser == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(endpointUser.getUserAttributes(), USERATTRIBUTES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(endpointUser.getUserId(), USERID_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 final boolean checkForCompleteFrame () { if (_length == -1 || _have < _length) { return false; } // prepare the buffer such that this frame can be read _buffer.position(HEADER_SIZE); _buffer.limit(_length); _haveCompleteFrame = true; return true; } }
public class class_name { protected final boolean checkForCompleteFrame () { if (_length == -1 || _have < _length) { return false; // depends on control dependency: [if], data = [none] } // prepare the buffer such that this frame can be read _buffer.position(HEADER_SIZE); _buffer.limit(_length); _haveCompleteFrame = true; return true; } }
public class class_name { @Override protected LogicalFilterWrapper appendAttributeToQuery(LogicalFilterWrapper queryBuilder, final String dataAttribute, final List<Object> queryValues) { if (queryBuilder == null) { queryBuilder = new LogicalFilterWrapper(this.queryType); } for (final Object queryValue : queryValues) { final String queryValueString = queryValue == null ? null : queryValue.toString(); if (StringUtils.isNotBlank(queryValueString)) { final Filter filter; if (!queryValueString.contains("*")) { filter = new EqualsFilter(dataAttribute, queryValueString); } else { filter = new LikeFilter(dataAttribute, queryValueString); } queryBuilder.append(filter); } } return queryBuilder; } }
public class class_name { @Override protected LogicalFilterWrapper appendAttributeToQuery(LogicalFilterWrapper queryBuilder, final String dataAttribute, final List<Object> queryValues) { if (queryBuilder == null) { queryBuilder = new LogicalFilterWrapper(this.queryType); // depends on control dependency: [if], data = [none] } for (final Object queryValue : queryValues) { final String queryValueString = queryValue == null ? null : queryValue.toString(); if (StringUtils.isNotBlank(queryValueString)) { final Filter filter; if (!queryValueString.contains("*")) { filter = new EqualsFilter(dataAttribute, queryValueString); // depends on control dependency: [if], data = [none] } else { filter = new LikeFilter(dataAttribute, queryValueString); // depends on control dependency: [if], data = [none] } queryBuilder.append(filter); // depends on control dependency: [if], data = [none] } } return queryBuilder; } }
public class class_name { public void uncheckFolders(Collection<String> folders) { for (String folder : folders) { CmsLazyTreeItem item = m_itemsByPath.get(folder); if ((item != null) && (item.getCheckBox() != null)) { item.getCheckBox().setChecked(false); } } } }
public class class_name { public void uncheckFolders(Collection<String> folders) { for (String folder : folders) { CmsLazyTreeItem item = m_itemsByPath.get(folder); if ((item != null) && (item.getCheckBox() != null)) { item.getCheckBox().setChecked(false); // depends on control dependency: [if], data = [none] } } } }
public class class_name { protected Pair<NodeRole, String> getRole(@NonNull VoidConfiguration voidConfiguration, @NonNull Collection<String> localIPs) { NodeRole result = NodeRole.CLIENT; for (String ip : voidConfiguration.getShardAddresses()) { String cleansed = ip.replaceAll(":.*", ""); if (localIPs.contains(cleansed)) return Pair.create(NodeRole.SHARD, ip); } if (voidConfiguration.getBackupAddresses() != null) for (String ip : voidConfiguration.getBackupAddresses()) { String cleansed = ip.replaceAll(":.*", ""); if (localIPs.contains(cleansed)) return Pair.create(NodeRole.BACKUP, ip); } String sparkIp = null; if (sparkIp == null && voidConfiguration.getNetworkMask() != null) { NetworkOrganizer organizer = new NetworkOrganizer(voidConfiguration.getNetworkMask()); sparkIp = organizer.getMatchingAddress(); } // last resort here... if (sparkIp == null) sparkIp = System.getenv(ND4JEnvironmentVars.DL4J_VOID_IP); log.info("Got [{}] as sparkIp", sparkIp); if (sparkIp == null) throw new ND4JIllegalStateException("Can't get IP address for UDP communcation"); // local IP from pair is used for shard only, so we don't care return Pair.create(result, sparkIp + ":" + voidConfiguration.getUnicastControllerPort()); } }
public class class_name { protected Pair<NodeRole, String> getRole(@NonNull VoidConfiguration voidConfiguration, @NonNull Collection<String> localIPs) { NodeRole result = NodeRole.CLIENT; for (String ip : voidConfiguration.getShardAddresses()) { String cleansed = ip.replaceAll(":.*", ""); if (localIPs.contains(cleansed)) return Pair.create(NodeRole.SHARD, ip); } if (voidConfiguration.getBackupAddresses() != null) for (String ip : voidConfiguration.getBackupAddresses()) { String cleansed = ip.replaceAll(":.*", ""); if (localIPs.contains(cleansed)) return Pair.create(NodeRole.BACKUP, ip); } String sparkIp = null; if (sparkIp == null && voidConfiguration.getNetworkMask() != null) { NetworkOrganizer organizer = new NetworkOrganizer(voidConfiguration.getNetworkMask()); sparkIp = organizer.getMatchingAddress(); // depends on control dependency: [if], data = [none] } // last resort here... if (sparkIp == null) sparkIp = System.getenv(ND4JEnvironmentVars.DL4J_VOID_IP); log.info("Got [{}] as sparkIp", sparkIp); if (sparkIp == null) throw new ND4JIllegalStateException("Can't get IP address for UDP communcation"); // local IP from pair is used for shard only, so we don't care return Pair.create(result, sparkIp + ":" + voidConfiguration.getUnicastControllerPort()); } }
public class class_name { @Override protected void prepareView() { try { if (view() != null) { view().prepare(); } } catch (final CoreException ce) { throw new CoreRuntimeException(ce); } } }
public class class_name { @Override protected void prepareView() { try { if (view() != null) { view().prepare(); // depends on control dependency: [if], data = [none] } } catch (final CoreException ce) { throw new CoreRuntimeException(ce); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected void payloadDeleted(int totalPayloadSize, int unwrittenPayloadSize) { if (tc.isEntryEnabled()) Tr.entry(tc, "payloadDeleted", new Object[] { this, new Integer(totalPayloadSize), new Integer(unwrittenPayloadSize) }); // Track the payload decreases directly. We take no account for this classes header values // in these figures. _totalDataSize -= totalPayloadSize; _unwrittenDataSize -= unwrittenPayloadSize; // When removing existing payload, if the resulting unwritten data size has gone back down to // zero then there will be no further need to account for the unwritten data header. // When we pass on this payload adjustment we must account for the header size. if (_unwrittenDataSize == 0 && (unwrittenPayloadSize != 0)) { unwrittenPayloadSize += _totalHeaderSize; } // When removing existing payload, if the resulting written data size has gone back down to // zero then there will be no further need to account for the written data header. // When we pass on this payload adjustment we must account for the header size. if (_totalDataSize == 0) { totalPayloadSize += _totalHeaderSize; } // Pass on the payload adjustment to the parent class. _recLog.payloadDeleted(totalPayloadSize, unwrittenPayloadSize); if (tc.isDebugEnabled()) Tr.debug(tc, "unwrittenDataSize = " + _unwrittenDataSize + " totalDataSize = " + _totalDataSize); if (tc.isEntryEnabled()) Tr.exit(tc, "payloadDeleted"); } }
public class class_name { protected void payloadDeleted(int totalPayloadSize, int unwrittenPayloadSize) { if (tc.isEntryEnabled()) Tr.entry(tc, "payloadDeleted", new Object[] { this, new Integer(totalPayloadSize), new Integer(unwrittenPayloadSize) }); // Track the payload decreases directly. We take no account for this classes header values // in these figures. _totalDataSize -= totalPayloadSize; _unwrittenDataSize -= unwrittenPayloadSize; // When removing existing payload, if the resulting unwritten data size has gone back down to // zero then there will be no further need to account for the unwritten data header. // When we pass on this payload adjustment we must account for the header size. if (_unwrittenDataSize == 0 && (unwrittenPayloadSize != 0)) { unwrittenPayloadSize += _totalHeaderSize; // depends on control dependency: [if], data = [none] } // When removing existing payload, if the resulting written data size has gone back down to // zero then there will be no further need to account for the written data header. // When we pass on this payload adjustment we must account for the header size. if (_totalDataSize == 0) { totalPayloadSize += _totalHeaderSize; // depends on control dependency: [if], data = [none] } // Pass on the payload adjustment to the parent class. _recLog.payloadDeleted(totalPayloadSize, unwrittenPayloadSize); if (tc.isDebugEnabled()) Tr.debug(tc, "unwrittenDataSize = " + _unwrittenDataSize + " totalDataSize = " + _totalDataSize); if (tc.isEntryEnabled()) Tr.exit(tc, "payloadDeleted"); } }
public class class_name { public SQLTool select(String tableName, Collection<String> columns) { this.type = SQLType.QUERY; updateTableName(tableName); for (String column : columns) { this.selectSqlCondition.appendSql(column); } return this; } }
public class class_name { public SQLTool select(String tableName, Collection<String> columns) { this.type = SQLType.QUERY; updateTableName(tableName); for (String column : columns) { this.selectSqlCondition.appendSql(column); // depends on control dependency: [for], data = [column] } return this; } }
public class class_name { @SafeVarargs public final FluentCondition<T> and(Condition<T>... conditions) { List<Condition<T>> merged = new ArrayList<>(); merged.add(delegate); for (Condition<T> condition : conditions) { merged.add(condition); } return Conditions.and(merged); } }
public class class_name { @SafeVarargs public final FluentCondition<T> and(Condition<T>... conditions) { List<Condition<T>> merged = new ArrayList<>(); merged.add(delegate); for (Condition<T> condition : conditions) { merged.add(condition); // depends on control dependency: [for], data = [condition] } return Conditions.and(merged); } }
public class class_name { public static String getHashFromString(String str) { try { java.security.MessageDigest md = java.security.MessageDigest.getInstance("SHA-256"); byte[] array = md.digest(str.getBytes("UTF-8")); StringBuilder sb = new StringBuilder(); for (byte anArray : array) { sb.append(Integer.toHexString((anArray & 0xFF) | 0x100).substring(1, 3)); } return sb.toString(); } catch (java.security.NoSuchAlgorithmException | UnsupportedEncodingException e) { throw new IllegalArgumentException("Cannot calculate SHA-256 hash for :" + str, e); } } }
public class class_name { public static String getHashFromString(String str) { try { java.security.MessageDigest md = java.security.MessageDigest.getInstance("SHA-256"); byte[] array = md.digest(str.getBytes("UTF-8")); StringBuilder sb = new StringBuilder(); for (byte anArray : array) { sb.append(Integer.toHexString((anArray & 0xFF) | 0x100).substring(1, 3)); // depends on control dependency: [for], data = [anArray] } return sb.toString(); // depends on control dependency: [try], data = [none] } catch (java.security.NoSuchAlgorithmException | UnsupportedEncodingException e) { throw new IllegalArgumentException("Cannot calculate SHA-256 hash for :" + str, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private File getHomeDirectory() { String dirName = System.getenv(ENV_JQASSISTANT_HOME); if (dirName != null) { File dir = new File(dirName); if (dir.exists()) { LOGGER.debug("Using JQASSISTANT_HOME '" + dir.getAbsolutePath() + "'."); return dir; } else { LOGGER.warn("JQASSISTANT_HOME '" + dir.getAbsolutePath() + "' points to a non-existing directory."); return null; } } LOGGER.warn("JQASSISTANT_HOME is not set."); return null; } }
public class class_name { private File getHomeDirectory() { String dirName = System.getenv(ENV_JQASSISTANT_HOME); if (dirName != null) { File dir = new File(dirName); if (dir.exists()) { LOGGER.debug("Using JQASSISTANT_HOME '" + dir.getAbsolutePath() + "'."); // depends on control dependency: [if], data = [none] return dir; // depends on control dependency: [if], data = [none] } else { LOGGER.warn("JQASSISTANT_HOME '" + dir.getAbsolutePath() + "' points to a non-existing directory."); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } } LOGGER.warn("JQASSISTANT_HOME is not set."); return null; } }
public class class_name { @NullableDecl private Method getFinalizeReferentMethod() { Class<?> finalizableReferenceClass = finalizableReferenceClassReference.get(); if (finalizableReferenceClass == null) { /* * FinalizableReference's class loader was reclaimed. While there's a chance that other * finalizable references could be enqueued subsequently (at which point the class loader * would be resurrected by virtue of us having a strong reference to it), we should pretty * much just shut down and make sure we don't keep it alive any longer than necessary. */ return null; } try { return finalizableReferenceClass.getMethod("finalizeReferent"); } catch (NoSuchMethodException e) { throw new AssertionError(e); } } }
public class class_name { @NullableDecl private Method getFinalizeReferentMethod() { Class<?> finalizableReferenceClass = finalizableReferenceClassReference.get(); if (finalizableReferenceClass == null) { /* * FinalizableReference's class loader was reclaimed. While there's a chance that other * finalizable references could be enqueued subsequently (at which point the class loader * would be resurrected by virtue of us having a strong reference to it), we should pretty * much just shut down and make sure we don't keep it alive any longer than necessary. */ return null; // depends on control dependency: [if], data = [none] } try { return finalizableReferenceClass.getMethod("finalizeReferent"); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException e) { throw new AssertionError(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { static public String backslashEscape(String x, String reservedChars) { if (x == null) { return null; } else if (reservedChars == null) { return x; } boolean ok = true; for (int pos = 0; pos < x.length(); pos++) { char c = x.charAt(pos); if (reservedChars.indexOf(c) >= 0) { ok = false; break; } } if (ok) return x; // gotta do it StringBuilder sb = new StringBuilder(x); for (int pos = 0; pos < sb.length(); pos++) { char c = sb.charAt(pos); if (reservedChars.indexOf(c) < 0) { continue; } sb.setCharAt(pos, '\\'); pos++; sb.insert(pos, c); pos++; } return sb.toString(); } }
public class class_name { static public String backslashEscape(String x, String reservedChars) { if (x == null) { return null; // depends on control dependency: [if], data = [none] } else if (reservedChars == null) { return x; // depends on control dependency: [if], data = [none] } boolean ok = true; for (int pos = 0; pos < x.length(); pos++) { char c = x.charAt(pos); if (reservedChars.indexOf(c) >= 0) { ok = false; // depends on control dependency: [if], data = [none] break; } } if (ok) return x; // gotta do it StringBuilder sb = new StringBuilder(x); for (int pos = 0; pos < sb.length(); pos++) { char c = sb.charAt(pos); if (reservedChars.indexOf(c) < 0) { continue; } sb.setCharAt(pos, '\\'); // depends on control dependency: [for], data = [pos] pos++; // depends on control dependency: [for], data = [pos] sb.insert(pos, c); // depends on control dependency: [for], data = [pos] pos++; // depends on control dependency: [for], data = [pos] } return sb.toString(); } }
public class class_name { public void marshall(SourceTableFeatureDetails sourceTableFeatureDetails, ProtocolMarshaller protocolMarshaller) { if (sourceTableFeatureDetails == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(sourceTableFeatureDetails.getLocalSecondaryIndexes(), LOCALSECONDARYINDEXES_BINDING); protocolMarshaller.marshall(sourceTableFeatureDetails.getGlobalSecondaryIndexes(), GLOBALSECONDARYINDEXES_BINDING); protocolMarshaller.marshall(sourceTableFeatureDetails.getStreamDescription(), STREAMDESCRIPTION_BINDING); protocolMarshaller.marshall(sourceTableFeatureDetails.getTimeToLiveDescription(), TIMETOLIVEDESCRIPTION_BINDING); protocolMarshaller.marshall(sourceTableFeatureDetails.getSSEDescription(), SSEDESCRIPTION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(SourceTableFeatureDetails sourceTableFeatureDetails, ProtocolMarshaller protocolMarshaller) { if (sourceTableFeatureDetails == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(sourceTableFeatureDetails.getLocalSecondaryIndexes(), LOCALSECONDARYINDEXES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(sourceTableFeatureDetails.getGlobalSecondaryIndexes(), GLOBALSECONDARYINDEXES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(sourceTableFeatureDetails.getStreamDescription(), STREAMDESCRIPTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(sourceTableFeatureDetails.getTimeToLiveDescription(), TIMETOLIVEDESCRIPTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(sourceTableFeatureDetails.getSSEDescription(), SSEDESCRIPTION_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 void parseParam(final String param, final List<String> metric_queries, final ExpressionTree root, final TSQuery data_query, final int index) { if (param == null || param.length() == 0) { throw new IllegalArgumentException("Parameter cannot be null or empty"); } if (param.indexOf('(') > 0 && param.indexOf(')') > 0) { // sub expression final ExpressionTree sub_tree = parse(param, metric_queries, data_query); root.addSubExpression(sub_tree, index); } else if (param.indexOf(':') >= 0) { // metric query metric_queries.add(param); root.addSubMetricQuery(param, metric_queries.size() - 1, index); } else { // expression parameter root.addFunctionParameter(param); } } }
public class class_name { private static void parseParam(final String param, final List<String> metric_queries, final ExpressionTree root, final TSQuery data_query, final int index) { if (param == null || param.length() == 0) { throw new IllegalArgumentException("Parameter cannot be null or empty"); } if (param.indexOf('(') > 0 && param.indexOf(')') > 0) { // sub expression final ExpressionTree sub_tree = parse(param, metric_queries, data_query); root.addSubExpression(sub_tree, index); // depends on control dependency: [if], data = [none] } else if (param.indexOf(':') >= 0) { // metric query metric_queries.add(param); // depends on control dependency: [if], data = [none] root.addSubMetricQuery(param, metric_queries.size() - 1, index); // depends on control dependency: [if], data = [none] } else { // expression parameter root.addFunctionParameter(param); // depends on control dependency: [if], data = [none] } } }
public class class_name { public JSONObject getResponseJSON() { String responseText = getResponseText(); if(responseText == null || responseText.length() == 0){ return null; } try { return new JSONObject(responseText); } catch (JSONException e) { logger.warn("Failed to extract JSON from response body. Error: " + e.getMessage()); return null; } } }
public class class_name { public JSONObject getResponseJSON() { String responseText = getResponseText(); if(responseText == null || responseText.length() == 0){ return null; // depends on control dependency: [if], data = [none] } try { return new JSONObject(responseText); // depends on control dependency: [try], data = [none] } catch (JSONException e) { logger.warn("Failed to extract JSON from response body. Error: " + e.getMessage()); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static Collection<Object> filterByJavaBeanPageProperty(ArrayList<Object> aList, String aPropertyName, int fromIndex, int toIndex) { logger.debug("In Organizer filtering: " + aPropertyName); try { if (aList == null) throw new IllegalArgumentException( "aCollection required in filterByJavaBeanProperty"); ArrayList<Object> filteredList = new ArrayList<Object>(aList.size()); Object bean = null; Object beanPropertyValue = null; for (Iterator<Object> i = aList.iterator(); i.hasNext();) { try { bean = i.next(); beanPropertyValue = JavaBean.getProperty(bean, aPropertyName); int beanPropIntVal = Integer.parseInt( beanPropertyValue.toString()); // logger.debug("Got propertyValue: " + beanPropertyValue + // " for propertyName: " + beanPropIntVal); if ( (fromIndex <= beanPropIntVal) && (beanPropIntVal <= toIndex)) { filteredList.add(bean); // logger.debug("Organizer added bean"); } } catch (Exception e) { logger.debug("error occured : " + e); } } filteredList.trimToSize(); return filteredList; } catch (Exception e) { throw new SystemException(e); } } }
public class class_name { public static Collection<Object> filterByJavaBeanPageProperty(ArrayList<Object> aList, String aPropertyName, int fromIndex, int toIndex) { logger.debug("In Organizer filtering: " + aPropertyName); try { if (aList == null) throw new IllegalArgumentException( "aCollection required in filterByJavaBeanProperty"); ArrayList<Object> filteredList = new ArrayList<Object>(aList.size()); Object bean = null; Object beanPropertyValue = null; for (Iterator<Object> i = aList.iterator(); i.hasNext();) { try { bean = i.next(); // depends on control dependency: [try], data = [none] beanPropertyValue = JavaBean.getProperty(bean, aPropertyName); // depends on control dependency: [try], data = [none] int beanPropIntVal = Integer.parseInt( beanPropertyValue.toString()); // logger.debug("Got propertyValue: " + beanPropertyValue + // " for propertyName: " + beanPropIntVal); if ( (fromIndex <= beanPropIntVal) && (beanPropIntVal <= toIndex)) { filteredList.add(bean); // depends on control dependency: [if], data = [none] // logger.debug("Organizer added bean"); } } catch (Exception e) { logger.debug("error occured : " + e); } // depends on control dependency: [catch], data = [none] } filteredList.trimToSize(); // depends on control dependency: [try], data = [none] return filteredList; // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SystemException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void setKeysToSanitize(String... keysToSanitize) { Assert.notNull(keysToSanitize, "KeysToSanitize must not be null"); this.keysToSanitize = new Pattern[keysToSanitize.length]; for (int i = 0; i < keysToSanitize.length; i++) { this.keysToSanitize[i] = getPattern(keysToSanitize[i]); } } }
public class class_name { public void setKeysToSanitize(String... keysToSanitize) { Assert.notNull(keysToSanitize, "KeysToSanitize must not be null"); this.keysToSanitize = new Pattern[keysToSanitize.length]; for (int i = 0; i < keysToSanitize.length; i++) { this.keysToSanitize[i] = getPattern(keysToSanitize[i]); // depends on control dependency: [for], data = [i] } } }
public class class_name { protected String join(List<String> values) { StringBuilder sb = new StringBuilder(100); if(values.size() == 0) return sb.toString(); sb.append(values.get(0)); if(values.size() == 1) return sb.toString(); for (int i = 1; i < values.size(); i++) { sb.append(",").append(values.get(i)); } return sb.toString(); } }
public class class_name { protected String join(List<String> values) { StringBuilder sb = new StringBuilder(100); if(values.size() == 0) return sb.toString(); sb.append(values.get(0)); if(values.size() == 1) return sb.toString(); for (int i = 1; i < values.size(); i++) { sb.append(",").append(values.get(i)); // depends on control dependency: [for], data = [i] } return sb.toString(); } }
public class class_name { @Override public boolean decompose( DMatrixRMaj A ) { setExpectedMaxSize(A.numRows, A.numCols); convertToColumnMajor(A); error = false; for( int j = 0; j < minLength; j++ ) { householder(j); updateA(j); } return !error; } }
public class class_name { @Override public boolean decompose( DMatrixRMaj A ) { setExpectedMaxSize(A.numRows, A.numCols); convertToColumnMajor(A); error = false; for( int j = 0; j < minLength; j++ ) { householder(j); // depends on control dependency: [for], data = [j] updateA(j); // depends on control dependency: [for], data = [j] } return !error; } }
public class class_name { private double distance(final String a, final String b) { if (a.isEmpty()) return b.length(); if (b.isEmpty()) return a.length(); if (a.equals(b)) return 0; final int aLength = b.length(); final int bLength = a.length(); double[] v0 = new double[aLength + 1]; double[] v1 = new double[aLength + 1]; // initialize v0 (the previous row of distances) // this row is A[0][i]: edit distance for an empty a // the distance is just the number of characters to delete from b for (int i = 0; i < v0.length; i++) { v0[i] = i * 1D; } for (int i = 0; i < bLength; i++) { // first element of v1 is A[i+1][0] // edit distance is delete (i+1) chars from s to match empty b v1[0] = (i + 1) * 1D; for (int j = 0; j < aLength; j++) { v1[j + 1] = min(v1[j] + 1D, v0[j + 1] + 1D, v0[j] + (a.charAt(i) == b.charAt(j) ? 0D : 1D)); } final double[] swap = v0; v0 = v1; v1 = swap; } // latest results was in v1 which was swapped with v0 return v0[aLength]; } }
public class class_name { private double distance(final String a, final String b) { if (a.isEmpty()) return b.length(); if (b.isEmpty()) return a.length(); if (a.equals(b)) return 0; final int aLength = b.length(); final int bLength = a.length(); double[] v0 = new double[aLength + 1]; double[] v1 = new double[aLength + 1]; // initialize v0 (the previous row of distances) // this row is A[0][i]: edit distance for an empty a // the distance is just the number of characters to delete from b for (int i = 0; i < v0.length; i++) { v0[i] = i * 1D; // depends on control dependency: [for], data = [i] } for (int i = 0; i < bLength; i++) { // first element of v1 is A[i+1][0] // edit distance is delete (i+1) chars from s to match empty b v1[0] = (i + 1) * 1D; // depends on control dependency: [for], data = [i] for (int j = 0; j < aLength; j++) { v1[j + 1] = min(v1[j] + 1D, v0[j + 1] + 1D, v0[j] + (a.charAt(i) == b.charAt(j) ? 0D : 1D)); // depends on control dependency: [for], data = [j] } final double[] swap = v0; v0 = v1; // depends on control dependency: [for], data = [none] v1 = swap; // depends on control dependency: [for], data = [none] } // latest results was in v1 which was swapped with v0 return v0[aLength]; } }
public class class_name { private String getCompleteCE(String CE) { String localProjString = null; String localSelString = null; if(CE == null) return ""; //remove any leading '?' if(CE.startsWith("?")) CE = CE.substring(1); int selIndex = CE.indexOf('&'); if(selIndex == 0) { localProjString = ""; localSelString = CE; } else if(selIndex > 0) { localSelString = CE.substring(selIndex); localProjString = CE.substring(0, selIndex); } else {// selIndex < 0 localProjString = CE; localSelString = ""; } String ce = projString; if(!localProjString.equals("")) { if(!ce.equals("") && localProjString.indexOf(',') != 0) ce += ","; ce += localProjString; } if(!selString.equals("")) { if(selString.indexOf('&') != 0) ce += "&"; ce += selString; } if(!localSelString.equals("")) { if(localSelString.indexOf('&') != 0) ce += "&"; ce += localSelString; } if(ce.length() > 0) ce = "?" + ce; if(false) { DAPNode.log.debug("projString: '" + projString + "'"); DAPNode.log.debug("localProjString: '" + localProjString + "'"); DAPNode.log.debug("selString: '" + selString + "'"); DAPNode.log.debug("localSelString: '" + localSelString + "'"); DAPNode.log.debug("Complete CE: " + ce); } return ce; // escaping will happen elsewhere } }
public class class_name { private String getCompleteCE(String CE) { String localProjString = null; String localSelString = null; if(CE == null) return ""; //remove any leading '?' if(CE.startsWith("?")) CE = CE.substring(1); int selIndex = CE.indexOf('&'); if(selIndex == 0) { localProjString = ""; localSelString = CE; // depends on control dependency: [if], data = [none] } else if(selIndex > 0) { localSelString = CE.substring(selIndex); // depends on control dependency: [if], data = [(selIndex] localProjString = CE.substring(0, selIndex); // depends on control dependency: [if], data = [none] } else {// selIndex < 0 localProjString = CE; // depends on control dependency: [if], data = [none] localSelString = ""; // depends on control dependency: [if], data = [none] } String ce = projString; if(!localProjString.equals("")) { if(!ce.equals("") && localProjString.indexOf(',') != 0) ce += ","; ce += localProjString; // depends on control dependency: [if], data = [none] } if(!selString.equals("")) { if(selString.indexOf('&') != 0) ce += "&"; ce += selString; // depends on control dependency: [if], data = [none] } if(!localSelString.equals("")) { if(localSelString.indexOf('&') != 0) ce += "&"; ce += localSelString; // depends on control dependency: [if], data = [none] } if(ce.length() > 0) ce = "?" + ce; if(false) { DAPNode.log.debug("projString: '" + projString + "'"); // depends on control dependency: [if], data = [none] DAPNode.log.debug("localProjString: '" + localProjString + "'"); // depends on control dependency: [if], data = [none] DAPNode.log.debug("selString: '" + selString + "'"); // depends on control dependency: [if], data = [none] DAPNode.log.debug("localSelString: '" + localSelString + "'"); // depends on control dependency: [if], data = [none] DAPNode.log.debug("Complete CE: " + ce); // depends on control dependency: [if], data = [none] } return ce; // escaping will happen elsewhere } }
public class class_name { private static synchronized void addTransformer() { if (detailedTransformTrace && tc.isEntryEnabled()) Tr.entry(tc, "addTransformer"); if (registeredTransformer == null && instrumentation != null) { registeredTransformer = new LibertyJava8WorkaroundRuntimeTransformer(); instrumentation.addTransformer(registeredTransformer, false); } if (detailedTransformTrace && tc.isEntryEnabled()) Tr.exit(tc, "addTransformer"); } }
public class class_name { private static synchronized void addTransformer() { if (detailedTransformTrace && tc.isEntryEnabled()) Tr.entry(tc, "addTransformer"); if (registeredTransformer == null && instrumentation != null) { registeredTransformer = new LibertyJava8WorkaroundRuntimeTransformer(); // depends on control dependency: [if], data = [none] instrumentation.addTransformer(registeredTransformer, false); // depends on control dependency: [if], data = [(registeredTransformer] } if (detailedTransformTrace && tc.isEntryEnabled()) Tr.exit(tc, "addTransformer"); } }
public class class_name { @Override public void disconnect() { log.debug("disconnect"); if (conn != null) { streamDataMap.clear(); conn.close(); } else { log.info("Connection was null"); } } }
public class class_name { @Override public void disconnect() { log.debug("disconnect"); if (conn != null) { streamDataMap.clear(); // depends on control dependency: [if], data = [none] conn.close(); // depends on control dependency: [if], data = [none] } else { log.info("Connection was null"); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void queueEvent(final Context context, final JSONObject event, final int eventType) { postAsyncSafely("queueEvent", new Runnable() { @Override public void run() { if (isCurrentUserOptedOut()) { String eventString = event == null ? "null" : event.toString(); getConfigLogger().debug(getAccountId(), "Current user is opted out dropping event: " + eventString); return; } if(shouldDeferProcessingEvent(event,eventType)){ getConfigLogger().debug(getAccountId(),"App Launched not yet processed, re-queuing event "+ event + "after 2s"); getHandlerUsingMainLooper().postDelayed(new Runnable() { @Override public void run() { postAsyncSafely("queueEventWithDelay", new Runnable() { @Override public void run() { lazyCreateSession(context); addToQueue(context, event, eventType); } }); } },2000); }else { lazyCreateSession(context); addToQueue(context, event, eventType); } } }); } }
public class class_name { private void queueEvent(final Context context, final JSONObject event, final int eventType) { postAsyncSafely("queueEvent", new Runnable() { @Override public void run() { if (isCurrentUserOptedOut()) { String eventString = event == null ? "null" : event.toString(); getConfigLogger().debug(getAccountId(), "Current user is opted out dropping event: " + eventString); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if(shouldDeferProcessingEvent(event,eventType)){ getConfigLogger().debug(getAccountId(),"App Launched not yet processed, re-queuing event "+ event + "after 2s"); // depends on control dependency: [if], data = [none] getHandlerUsingMainLooper().postDelayed(new Runnable() { @Override public void run() { postAsyncSafely("queueEventWithDelay", new Runnable() { @Override public void run() { lazyCreateSession(context); addToQueue(context, event, eventType); } }); } },2000); // depends on control dependency: [if], data = [none] }else { lazyCreateSession(context); // depends on control dependency: [if], data = [none] addToQueue(context, event, eventType); // depends on control dependency: [if], data = [none] } } }); } }
public class class_name { protected void ensureCapacity(int newCapacity) { int oldCapacity = data.length; if (newCapacity <= oldCapacity) { return; } if (size == 0) { threshold = calculateThreshold(newCapacity, loadFactor); data = new HashEntry[newCapacity]; } else { HashEntry<K, V> oldEntries[] = data; HashEntry<K, V> newEntries[] = new HashEntry[newCapacity]; modCount++; for (int i = oldCapacity - 1; i >= 0; i--) { HashEntry<K, V> entry = oldEntries[i]; if (entry != null) { oldEntries[i] = null; // gc do { HashEntry<K, V> next = entry.next; int index = hashIndex(entry.hashCode, newCapacity); entry.next = newEntries[index]; newEntries[index] = entry; entry = next; } while (entry != null); } } threshold = calculateThreshold(newCapacity, loadFactor); data = newEntries; } } }
public class class_name { protected void ensureCapacity(int newCapacity) { int oldCapacity = data.length; if (newCapacity <= oldCapacity) { return; // depends on control dependency: [if], data = [none] } if (size == 0) { threshold = calculateThreshold(newCapacity, loadFactor); // depends on control dependency: [if], data = [none] data = new HashEntry[newCapacity]; // depends on control dependency: [if], data = [none] } else { HashEntry<K, V> oldEntries[] = data; HashEntry<K, V> newEntries[] = new HashEntry[newCapacity]; modCount++; // depends on control dependency: [if], data = [none] for (int i = oldCapacity - 1; i >= 0; i--) { HashEntry<K, V> entry = oldEntries[i]; if (entry != null) { oldEntries[i] = null; // gc // depends on control dependency: [if], data = [none] do { HashEntry<K, V> next = entry.next; int index = hashIndex(entry.hashCode, newCapacity); entry.next = newEntries[index]; newEntries[index] = entry; entry = next; } while (entry != null); } } threshold = calculateThreshold(newCapacity, loadFactor); // depends on control dependency: [if], data = [none] data = newEntries; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static boolean equalsIgnoreCaseAndEmpty(String s1, String s2) { String clean1 = trimToNull(s1); String clean2 = trimToNull(s2); if (clean1 == null && clean2 == null) { return true; } else { // Both cannot be null at this point if (clean1 == null || clean2 == null) { return false; } } return clean1.equalsIgnoreCase(clean2); } }
public class class_name { public static boolean equalsIgnoreCaseAndEmpty(String s1, String s2) { String clean1 = trimToNull(s1); String clean2 = trimToNull(s2); if (clean1 == null && clean2 == null) { return true; // depends on control dependency: [if], data = [none] } else { // Both cannot be null at this point if (clean1 == null || clean2 == null) { return false; // depends on control dependency: [if], data = [none] } } return clean1.equalsIgnoreCase(clean2); } }
public class class_name { @Override @Trivial public void addClassLoader(ClassLoader classLoader) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "addClassLoader - " + classLoader); } if (classLoader instanceof ContainerClassLoader) { synchronized (classLoaders) { classLoaders.add((ContainerClassLoader) classLoader); } } else { throw new IllegalArgumentException("classLoader is not a ContainerClassLoader"); } } }
public class class_name { @Override @Trivial public void addClassLoader(ClassLoader classLoader) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "addClassLoader - " + classLoader); // depends on control dependency: [if], data = [none] } if (classLoader instanceof ContainerClassLoader) { synchronized (classLoaders) { // depends on control dependency: [if], data = [none] classLoaders.add((ContainerClassLoader) classLoader); } } else { throw new IllegalArgumentException("classLoader is not a ContainerClassLoader"); } } }
public class class_name { public static String getExample(TypeDeclaration type) { if (type == null || type.example() == null) { return null; } else { return type.example().value(); } } }
public class class_name { public static String getExample(TypeDeclaration type) { if (type == null || type.example() == null) { return null; // depends on control dependency: [if], data = [none] } else { return type.example().value(); // depends on control dependency: [if], data = [none] } } }
public class class_name { static String defineFileName(SQLiteDatabaseSchema model) { int lastIndex = model.fileName.lastIndexOf("."); String schemaName = model.fileName; if (lastIndex > -1) { schemaName = model.fileName.substring(0, lastIndex); } schemaName = schemaName.toLowerCase() + "_schema_" + model.version + ".sql"; return schemaName; } }
public class class_name { static String defineFileName(SQLiteDatabaseSchema model) { int lastIndex = model.fileName.lastIndexOf("."); String schemaName = model.fileName; if (lastIndex > -1) { schemaName = model.fileName.substring(0, lastIndex); // depends on control dependency: [if], data = [none] } schemaName = schemaName.toLowerCase() + "_schema_" + model.version + ".sql"; return schemaName; } }
public class class_name { public ObservableMap<String, Property<?>> getBindings() { if (bindings == null) { bindings = FXCollections.observableHashMap(); } return bindings; } }
public class class_name { public ObservableMap<String, Property<?>> getBindings() { if (bindings == null) { bindings = FXCollections.observableHashMap(); // depends on control dependency: [if], data = [none] } return bindings; } }
public class class_name { public void setFloatValueInMap( WritableRandomIter map, float value ) { if (map == null) { return; } try { map.setSample(col, row, 0, value); } catch (Exception e) { e.printStackTrace(); } } }
public class class_name { public void setFloatValueInMap( WritableRandomIter map, float value ) { if (map == null) { return; // depends on control dependency: [if], data = [none] } try { map.setSample(col, row, 0, value); // depends on control dependency: [try], data = [none] } catch (Exception e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private SSLInformation createSecurityRealm(OperationContext context, Map<PathAddress, ModelNode> migrationOperations, ModelNode legacyModelAddOps, String connector, ModelNode legacyAddOp, List<String> warnings, boolean domainMode) { //read all the info from the SSL definition ModelNode keyAlias = legacyAddOp.get(WebSSLDefinition.KEY_ALIAS.getName()); ModelNode password = legacyAddOp.get(WebSSLDefinition.PASSWORD.getName()); ModelNode certificateKeyFile = legacyAddOp.get(WebSSLDefinition.CERTIFICATE_KEY_FILE.getName()); ModelNode cipherSuite = legacyAddOp.get(WebSSLDefinition.CIPHER_SUITE.getName()); ModelNode protocol = legacyAddOp.get(WebSSLDefinition.PROTOCOL.getName()); ModelNode verifyClient = legacyAddOp.get(WebSSLDefinition.VERIFY_CLIENT.getName()); ModelNode verifyDepth = legacyAddOp.get(WebSSLDefinition.VERIFY_DEPTH.getName()); ModelNode certificateFile = legacyAddOp.get(WebSSLDefinition.CERTIFICATE_FILE.getName()); ModelNode caCertificateFile = legacyAddOp.get(WebSSLDefinition.CA_CERTIFICATE_FILE.getName()); ModelNode caCertificatePassword = legacyAddOp.get(WebSSLDefinition.CA_CERTIFICATE_PASSWORD.getName()); ModelNode csRevocationURL = legacyAddOp.get(WebSSLDefinition.CA_REVOCATION_URL.getName()); ModelNode trustStoreType = legacyAddOp.get(WebSSLDefinition.TRUSTSTORE_TYPE.getName()); ModelNode keystoreType = legacyAddOp.get(WebSSLDefinition.KEYSTORE_TYPE.getName()); ModelNode sessionCacheSize = legacyAddOp.get(WebSSLDefinition.SESSION_CACHE_SIZE.getName()); ModelNode sessionTimeout = legacyAddOp.get(WebSSLDefinition.SESSION_TIMEOUT.getName()); ModelNode sslProvider = legacyAddOp.get(WebSSLDefinition.SSL_PROTOCOL.getName()); if(verifyDepth.isDefined()) { warnings.add(WebLogger.ROOT_LOGGER.couldNotMigrateResource(WebSSLDefinition.VERIFY_DEPTH.getName(), pathAddress(legacyAddOp.get(ADDRESS)))); } if(certificateFile.isDefined()) { warnings.add(WebLogger.ROOT_LOGGER.couldNotMigrateResource(WebSSLDefinition.CERTIFICATE_FILE.getName(), pathAddress(legacyAddOp.get(ADDRESS)))); } if(sslProvider.isDefined()) { warnings.add(WebLogger.ROOT_LOGGER.couldNotMigrateResource(WebSSLDefinition.SSL_PROTOCOL.getName(), pathAddress(legacyAddOp.get(ADDRESS)))); } if(csRevocationURL.isDefined()) { warnings.add(WebLogger.ROOT_LOGGER.couldNotMigrateResource(WebSSLDefinition.CA_REVOCATION_URL.getName(), pathAddress(legacyAddOp.get(ADDRESS)))); } String realmName; PathAddress managementCoreService; if(domainMode) { Set<String> hosts = new HashSet<>(); Resource hostResource = context.readResourceFromRoot(pathAddress(), false); hosts.addAll(hostResource.getChildrenNames(HOST)); //now we need to find a unique name //in domain mode different profiles could have different SSL configurations //but the realms are not scoped to a profile //if we hard coded a name migration would fail when migrating domains with multiple profiles int counter = 1; realmName = REALM_NAME + counter; while(true) { boolean hostOk = true; for(String host : hosts) { Resource root = context.readResourceFromRoot(pathAddress(pathElement(HOST, host), pathElement(CORE_SERVICE, MANAGEMENT)), false); if (root.getChildrenNames(SECURITY_REALM).contains(realmName)) { counter++; realmName = REALM_NAME + counter; hostOk = false; break; } } if(hostOk) { break; } } for (String host : hosts) { createHostSSLConfig(realmName, migrationOperations, keyAlias, password, certificateKeyFile, protocol, caCertificateFile, caCertificatePassword, trustStoreType, keystoreType, pathAddress(pathElement(HOST, host), pathElement(CORE_SERVICE, MANAGEMENT))); } } else { managementCoreService = pathAddress(CORE_SERVICE, MANAGEMENT); //now we need to find a unique name //in domain mode different profiles could have different SSL configurations //but the realms are not scoped to a profile //if we hard coded a name migration would fail when migrating domains with multiple profiles int counter = 1; realmName = REALM_NAME + counter; boolean ok = false; do { Resource root = context.readResourceFromRoot(managementCoreService, false); if (root.getChildrenNames(SECURITY_REALM).contains(realmName)) { counter++; realmName = REALM_NAME + counter; } else { ok = true; } } while (!ok); //we have a unique realm name createHostSSLConfig(realmName, migrationOperations, keyAlias, password, certificateKeyFile, protocol, caCertificateFile, caCertificatePassword, trustStoreType, keystoreType, managementCoreService); } return new SSLInformation(realmName, verifyClient, sessionCacheSize, sessionTimeout, protocol, cipherSuite); } }
public class class_name { private SSLInformation createSecurityRealm(OperationContext context, Map<PathAddress, ModelNode> migrationOperations, ModelNode legacyModelAddOps, String connector, ModelNode legacyAddOp, List<String> warnings, boolean domainMode) { //read all the info from the SSL definition ModelNode keyAlias = legacyAddOp.get(WebSSLDefinition.KEY_ALIAS.getName()); ModelNode password = legacyAddOp.get(WebSSLDefinition.PASSWORD.getName()); ModelNode certificateKeyFile = legacyAddOp.get(WebSSLDefinition.CERTIFICATE_KEY_FILE.getName()); ModelNode cipherSuite = legacyAddOp.get(WebSSLDefinition.CIPHER_SUITE.getName()); ModelNode protocol = legacyAddOp.get(WebSSLDefinition.PROTOCOL.getName()); ModelNode verifyClient = legacyAddOp.get(WebSSLDefinition.VERIFY_CLIENT.getName()); ModelNode verifyDepth = legacyAddOp.get(WebSSLDefinition.VERIFY_DEPTH.getName()); ModelNode certificateFile = legacyAddOp.get(WebSSLDefinition.CERTIFICATE_FILE.getName()); ModelNode caCertificateFile = legacyAddOp.get(WebSSLDefinition.CA_CERTIFICATE_FILE.getName()); ModelNode caCertificatePassword = legacyAddOp.get(WebSSLDefinition.CA_CERTIFICATE_PASSWORD.getName()); ModelNode csRevocationURL = legacyAddOp.get(WebSSLDefinition.CA_REVOCATION_URL.getName()); ModelNode trustStoreType = legacyAddOp.get(WebSSLDefinition.TRUSTSTORE_TYPE.getName()); ModelNode keystoreType = legacyAddOp.get(WebSSLDefinition.KEYSTORE_TYPE.getName()); ModelNode sessionCacheSize = legacyAddOp.get(WebSSLDefinition.SESSION_CACHE_SIZE.getName()); ModelNode sessionTimeout = legacyAddOp.get(WebSSLDefinition.SESSION_TIMEOUT.getName()); ModelNode sslProvider = legacyAddOp.get(WebSSLDefinition.SSL_PROTOCOL.getName()); if(verifyDepth.isDefined()) { warnings.add(WebLogger.ROOT_LOGGER.couldNotMigrateResource(WebSSLDefinition.VERIFY_DEPTH.getName(), pathAddress(legacyAddOp.get(ADDRESS)))); // depends on control dependency: [if], data = [none] } if(certificateFile.isDefined()) { warnings.add(WebLogger.ROOT_LOGGER.couldNotMigrateResource(WebSSLDefinition.CERTIFICATE_FILE.getName(), pathAddress(legacyAddOp.get(ADDRESS)))); // depends on control dependency: [if], data = [none] } if(sslProvider.isDefined()) { warnings.add(WebLogger.ROOT_LOGGER.couldNotMigrateResource(WebSSLDefinition.SSL_PROTOCOL.getName(), pathAddress(legacyAddOp.get(ADDRESS)))); // depends on control dependency: [if], data = [none] } if(csRevocationURL.isDefined()) { warnings.add(WebLogger.ROOT_LOGGER.couldNotMigrateResource(WebSSLDefinition.CA_REVOCATION_URL.getName(), pathAddress(legacyAddOp.get(ADDRESS)))); // depends on control dependency: [if], data = [none] } String realmName; PathAddress managementCoreService; if(domainMode) { Set<String> hosts = new HashSet<>(); Resource hostResource = context.readResourceFromRoot(pathAddress(), false); hosts.addAll(hostResource.getChildrenNames(HOST)); // depends on control dependency: [if], data = [none] //now we need to find a unique name //in domain mode different profiles could have different SSL configurations //but the realms are not scoped to a profile //if we hard coded a name migration would fail when migrating domains with multiple profiles int counter = 1; realmName = REALM_NAME + counter; // depends on control dependency: [if], data = [none] while(true) { boolean hostOk = true; for(String host : hosts) { Resource root = context.readResourceFromRoot(pathAddress(pathElement(HOST, host), pathElement(CORE_SERVICE, MANAGEMENT)), false); if (root.getChildrenNames(SECURITY_REALM).contains(realmName)) { counter++; // depends on control dependency: [if], data = [none] realmName = REALM_NAME + counter; // depends on control dependency: [if], data = [none] hostOk = false; // depends on control dependency: [if], data = [none] break; } } if(hostOk) { break; } } for (String host : hosts) { createHostSSLConfig(realmName, migrationOperations, keyAlias, password, certificateKeyFile, protocol, caCertificateFile, caCertificatePassword, trustStoreType, keystoreType, pathAddress(pathElement(HOST, host), pathElement(CORE_SERVICE, MANAGEMENT))); // depends on control dependency: [for], data = [host] } } else { managementCoreService = pathAddress(CORE_SERVICE, MANAGEMENT); // depends on control dependency: [if], data = [none] //now we need to find a unique name //in domain mode different profiles could have different SSL configurations //but the realms are not scoped to a profile //if we hard coded a name migration would fail when migrating domains with multiple profiles int counter = 1; realmName = REALM_NAME + counter; // depends on control dependency: [if], data = [none] boolean ok = false; do { Resource root = context.readResourceFromRoot(managementCoreService, false); if (root.getChildrenNames(SECURITY_REALM).contains(realmName)) { counter++; // depends on control dependency: [if], data = [none] realmName = REALM_NAME + counter; // depends on control dependency: [if], data = [none] } else { ok = true; // depends on control dependency: [if], data = [none] } } while (!ok); //we have a unique realm name createHostSSLConfig(realmName, migrationOperations, keyAlias, password, certificateKeyFile, protocol, caCertificateFile, caCertificatePassword, trustStoreType, keystoreType, managementCoreService); // depends on control dependency: [if], data = [none] } return new SSLInformation(realmName, verifyClient, sessionCacheSize, sessionTimeout, protocol, cipherSuite); } }
public class class_name { public static void setFlatfile(Set<H2ONode> nodes) { if (nodes == null) { STATIC_H2OS = null; } else { STATIC_H2OS = Collections.newSetFromMap(new ConcurrentHashMap<H2ONode, Boolean>()); STATIC_H2OS.addAll(nodes); } } }
public class class_name { public static void setFlatfile(Set<H2ONode> nodes) { if (nodes == null) { STATIC_H2OS = null; // depends on control dependency: [if], data = [none] } else { STATIC_H2OS = Collections.newSetFromMap(new ConcurrentHashMap<H2ONode, Boolean>()); // depends on control dependency: [if], data = [none] STATIC_H2OS.addAll(nodes); // depends on control dependency: [if], data = [(nodes] } } }