code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public void actionDelete() throws JspException { // save initialized instance of this class in request attribute for included sub-elements getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this); try { boolean isFolder = false; if (!isMultiOperation()) { isFolder = getCms().readResource(getParamResource(), CmsResourceFilter.ALL).isFolder(); } if (performDialogOperation()) { // if no exception is caused and "true" is returned delete operation was successful if (isMultiOperation() || isFolder) { // set request attribute to reload the explorer tree view List<String> folderList = new ArrayList<String>(1); folderList.add(CmsResource.getParentFolder(getResourceList().get(0))); getJsp().getRequest().setAttribute(REQUEST_ATTRIBUTE_RELOADTREE, folderList); } actionCloseDialog(); } else { // "false" returned, display "please wait" screen getJsp().include(FILE_DIALOG_SCREEN_WAIT); } } catch (Throwable e) { // prepare common message part includeErrorpage(this, e); } } }
public class class_name { public void actionDelete() throws JspException { // save initialized instance of this class in request attribute for included sub-elements getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this); try { boolean isFolder = false; if (!isMultiOperation()) { isFolder = getCms().readResource(getParamResource(), CmsResourceFilter.ALL).isFolder(); // depends on control dependency: [if], data = [none] } if (performDialogOperation()) { // if no exception is caused and "true" is returned delete operation was successful if (isMultiOperation() || isFolder) { // set request attribute to reload the explorer tree view List<String> folderList = new ArrayList<String>(1); folderList.add(CmsResource.getParentFolder(getResourceList().get(0))); // depends on control dependency: [if], data = [none] getJsp().getRequest().setAttribute(REQUEST_ATTRIBUTE_RELOADTREE, folderList); // depends on control dependency: [if], data = [none] } actionCloseDialog(); // depends on control dependency: [if], data = [none] } else { // "false" returned, display "please wait" screen getJsp().include(FILE_DIALOG_SCREEN_WAIT); // depends on control dependency: [if], data = [none] } } catch (Throwable e) { // prepare common message part includeErrorpage(this, e); } } }
public class class_name { public void marshall(SourceAuth sourceAuth, ProtocolMarshaller protocolMarshaller) { if (sourceAuth == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(sourceAuth.getType(), TYPE_BINDING); protocolMarshaller.marshall(sourceAuth.getResource(), RESOURCE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(SourceAuth sourceAuth, ProtocolMarshaller protocolMarshaller) { if (sourceAuth == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(sourceAuth.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(sourceAuth.getResource(), RESOURCE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public final Scene setPixelSize(final int wide, final int high) { m_wide = wide; m_high = high; getElement().getStyle().setWidth(wide, Unit.PX); getElement().getStyle().setHeight(high, Unit.PX); final NFastArrayList<Layer> layers = getChildNodes(); if (null != layers) { final int size = layers.size(); for (int i = 0; i < size; i++) { final Layer layer = layers.get(i); if (null != layer) { layer.setPixelSize(wide, high); } } } return this; } }
public class class_name { public final Scene setPixelSize(final int wide, final int high) { m_wide = wide; m_high = high; getElement().getStyle().setWidth(wide, Unit.PX); getElement().getStyle().setHeight(high, Unit.PX); final NFastArrayList<Layer> layers = getChildNodes(); if (null != layers) { final int size = layers.size(); for (int i = 0; i < size; i++) { final Layer layer = layers.get(i); if (null != layer) { layer.setPixelSize(wide, high); // depends on control dependency: [if], data = [none] } } } return this; } }
public class class_name { public Sheet packImages(ArrayList images, int width, int height, int border, File out) throws IOException { Collections.sort(images, new Comparator() { public int compare(Object o1, Object o2) { Sprite a = (Sprite) o1; Sprite b = (Sprite) o2; int asize = a.getHeight(); int bsize = b.getHeight(); return bsize - asize; } }); int x = 0; int y = 0; BufferedImage result = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics g = result.getGraphics(); int rowHeight = 0; try { PrintStream pout = null; if (out != null) { pout = new PrintStream(new FileOutputStream(new File(out.getParentFile(), out.getName()+".xml"))); pout.println("<sheet>"); } for (int i=0;i<images.size();i++) { Sprite current = (Sprite) images.get(i); if (x + current.getWidth() > width) { x = 0; y += rowHeight; rowHeight = 0; } if (rowHeight == 0) { rowHeight = current.getHeight() + border; } if (out != null) { pout.print("\t<sprite "); pout.print("name=\""+current.getName()+"\" "); pout.print("x=\""+x+"\" "); pout.print("y=\""+y+"\" "); pout.print("width=\""+current.getWidth()+"\" "); pout.print("height=\""+current.getHeight()+"\" "); pout.println("/>"); } current.setPosition(x,y); g.drawImage(current.getImage(), x, y, null); x += current.getWidth() + border; } g.dispose(); if (out != null) { pout.println("</sheet>"); pout.close(); } } catch (Exception e) { e.printStackTrace(); IOException io = new IOException("Failed writing image XML"); io.initCause(e); throw io; } if (out != null) { try { ImageIO.write(result, "PNG", out); } catch (IOException e) { e.printStackTrace(); IOException io = new IOException("Failed writing image"); io.initCause(e); throw io; } } return new Sheet(result, images); } }
public class class_name { public Sheet packImages(ArrayList images, int width, int height, int border, File out) throws IOException { Collections.sort(images, new Comparator() { public int compare(Object o1, Object o2) { Sprite a = (Sprite) o1; Sprite b = (Sprite) o2; int asize = a.getHeight(); int bsize = b.getHeight(); return bsize - asize; } }); int x = 0; int y = 0; BufferedImage result = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics g = result.getGraphics(); int rowHeight = 0; try { PrintStream pout = null; if (out != null) { pout = new PrintStream(new FileOutputStream(new File(out.getParentFile(), out.getName()+".xml"))); // depends on control dependency: [if], data = [(out] pout.println("<sheet>"); // depends on control dependency: [if], data = [none] } for (int i=0;i<images.size();i++) { Sprite current = (Sprite) images.get(i); if (x + current.getWidth() > width) { x = 0; // depends on control dependency: [if], data = [none] y += rowHeight; // depends on control dependency: [if], data = [none] rowHeight = 0; // depends on control dependency: [if], data = [none] } if (rowHeight == 0) { rowHeight = current.getHeight() + border; // depends on control dependency: [if], data = [none] } if (out != null) { pout.print("\t<sprite "); pout.print("name=\""+current.getName()+"\" "); // depends on control dependency: [if], data = [none] pout.print("x=\""+x+"\" "); // depends on control dependency: [if], data = [none] pout.print("y=\""+y+"\" "); // depends on control dependency: [if], data = [none] pout.print("width=\""+current.getWidth()+"\" "); // depends on control dependency: [if], data = [none] pout.print("height=\""+current.getHeight()+"\" "); // depends on control dependency: [if], data = [none] pout.println("/>"); // depends on control dependency: [if], data = [none] } current.setPosition(x,y); // depends on control dependency: [for], data = [none] g.drawImage(current.getImage(), x, y, null); // depends on control dependency: [for], data = [none] x += current.getWidth() + border; // depends on control dependency: [for], data = [none] } g.dispose(); if (out != null) { pout.println("</sheet>"); // depends on control dependency: [if], data = [none] pout.close(); // depends on control dependency: [if], data = [none] } } catch (Exception e) { e.printStackTrace(); IOException io = new IOException("Failed writing image XML"); io.initCause(e); throw io; } if (out != null) { try { ImageIO.write(result, "PNG", out); } catch (IOException e) { e.printStackTrace(); IOException io = new IOException("Failed writing image"); io.initCause(e); throw io; } } return new Sheet(result, images); } }
public class class_name { private lineType getLineType(SpanManager sm, Span lineSpan) { switch (lineSpan.charAt(0, sm)) { case '{': if (lineSpan.charAt(1, sm) == '|') { return lineType.TABLE; } else { return lineType.PARAGRAPH; } case '=': if (lineSpan.length() > 2 && sm.charAt(lineSpan.getEnd() - 1) == '=') { return lineType.SECTION; } else { return lineType.PARAGRAPH; } case '-': if (lineSpan.charAt(1, sm) == '-' && lineSpan.charAt(2, sm) == '-' && lineSpan.charAt(3, sm) == '-') { return lineType.HR; } else { return lineType.PARAGRAPH; } case '*': return lineType.NESTEDLIST; case '#': return lineType.NESTEDLIST_NR; case ';': return lineType.DEFINITIONLIST; case ':': if (lineSpan.length() > 1) { if (lineSpan.length() > 2 && lineSpan.charAt(1, sm) == '{' && lineSpan.charAt(2, sm) == '|') { return lineType.TABLE; } else { return lineType.PARAGRAPH_INDENTED; } } else { return lineType.PARAGRAPH; } case ' ': int nonWSPos = lineSpan.nonWSCharPos(sm); switch (lineSpan.charAt(nonWSPos, sm)) { case Span.ERRORCHAR: return lineType.EMPTYLINE; case '{': if (lineSpan.charAt(nonWSPos + 1, sm) == '|') { return lineType.TABLE; } default: return lineType.PARAGRAPH_BOXED; } case Span.ERRORCHAR: return lineType.EMPTYLINE; default: return lineType.PARAGRAPH; } } }
public class class_name { private lineType getLineType(SpanManager sm, Span lineSpan) { switch (lineSpan.charAt(0, sm)) { case '{': if (lineSpan.charAt(1, sm) == '|') { return lineType.TABLE; // depends on control dependency: [if], data = [none] } else { return lineType.PARAGRAPH; // depends on control dependency: [if], data = [none] } case '=': if (lineSpan.length() > 2 && sm.charAt(lineSpan.getEnd() - 1) == '=') { return lineType.SECTION; // depends on control dependency: [if], data = [none] } else { return lineType.PARAGRAPH; // depends on control dependency: [if], data = [none] } case '-': if (lineSpan.charAt(1, sm) == '-' && lineSpan.charAt(2, sm) == '-' && lineSpan.charAt(3, sm) == '-') { return lineType.HR; // depends on control dependency: [if], data = [none] } else { return lineType.PARAGRAPH; // depends on control dependency: [if], data = [none] } case '*': return lineType.NESTEDLIST; case '#': return lineType.NESTEDLIST_NR; case ';': return lineType.DEFINITIONLIST; case ':': if (lineSpan.length() > 1) { if (lineSpan.length() > 2 && lineSpan.charAt(1, sm) == '{' && lineSpan.charAt(2, sm) == '|') { return lineType.TABLE; // depends on control dependency: [if], data = [none] } else { return lineType.PARAGRAPH_INDENTED; // depends on control dependency: [if], data = [none] } } else { return lineType.PARAGRAPH; // depends on control dependency: [if], data = [none] } case ' ': int nonWSPos = lineSpan.nonWSCharPos(sm); switch (lineSpan.charAt(nonWSPos, sm)) { case Span.ERRORCHAR: return lineType.EMPTYLINE; case '{': if (lineSpan.charAt(nonWSPos + 1, sm) == '|') { return lineType.TABLE; // depends on control dependency: [if], data = [none] } default: return lineType.PARAGRAPH_BOXED; } case Span.ERRORCHAR: return lineType.EMPTYLINE; default: return lineType.PARAGRAPH; } } }
public class class_name { public void marshall(ComplianceByConfigRule complianceByConfigRule, ProtocolMarshaller protocolMarshaller) { if (complianceByConfigRule == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(complianceByConfigRule.getConfigRuleName(), CONFIGRULENAME_BINDING); protocolMarshaller.marshall(complianceByConfigRule.getCompliance(), COMPLIANCE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ComplianceByConfigRule complianceByConfigRule, ProtocolMarshaller protocolMarshaller) { if (complianceByConfigRule == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(complianceByConfigRule.getConfigRuleName(), CONFIGRULENAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(complianceByConfigRule.getCompliance(), COMPLIANCE_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 void setFragment(Fragment fragment,String title) { setFragment(fragment,title,null); if(!isCurrentFragmentChild) {// remove the last child from the stack childFragmentStack.remove(childFragmentStack.size() - 1); childTitleStack.remove(childTitleStack.size() - 1); } else for(int i = childFragmentStack.size()-1; i >= 0;i--) { // if a section is clicked when user is into a child remove all childs from stack childFragmentStack.remove(i); childTitleStack.remove(i); } // add to the childStack the Fragment and title childFragmentStack.add(fragment); childTitleStack.add(title); isCurrentFragmentChild = false; } }
public class class_name { public void setFragment(Fragment fragment,String title) { setFragment(fragment,title,null); if(!isCurrentFragmentChild) {// remove the last child from the stack childFragmentStack.remove(childFragmentStack.size() - 1); // depends on control dependency: [if], data = [none] childTitleStack.remove(childTitleStack.size() - 1); // depends on control dependency: [if], data = [none] } else for(int i = childFragmentStack.size()-1; i >= 0;i--) { // if a section is clicked when user is into a child remove all childs from stack childFragmentStack.remove(i); // depends on control dependency: [for], data = [i] childTitleStack.remove(i); // depends on control dependency: [for], data = [i] } // add to the childStack the Fragment and title childFragmentStack.add(fragment); childTitleStack.add(title); isCurrentFragmentChild = false; } }
public class class_name { private void init() { validatePreSignedUrls(); try { conn = new AWSAuthConnection(access_key, secret_access_key); // Determine the bucket name if prefix is set or if pre-signed URLs are being used if (prefix != null && prefix.length() > 0) { ListAllMyBucketsResponse bucket_list = conn.listAllMyBuckets(null); List buckets = bucket_list.entries; if (buckets != null) { boolean found = false; for (Object tmp : buckets) { if (tmp instanceof Bucket) { Bucket bucket = (Bucket) tmp; if (bucket.name.startsWith(prefix)) { location = bucket.name; found = true; } } } if (!found) { location = prefix + "-" + java.util.UUID.randomUUID().toString(); } } } if (usingPreSignedUrls()) { PreSignedUrlParser parsedPut = new PreSignedUrlParser(pre_signed_put_url); location = parsedPut.getBucket(); } if (!conn.checkBucketExists(location)) { conn.createBucket(location, AWSAuthConnection.LOCATION_DEFAULT, null).connection.getResponseMessage(); } } catch (Exception e) { throw HostControllerLogger.ROOT_LOGGER.cannotAccessS3Bucket(location, e.getLocalizedMessage()); } } }
public class class_name { private void init() { validatePreSignedUrls(); try { conn = new AWSAuthConnection(access_key, secret_access_key); // depends on control dependency: [try], data = [none] // Determine the bucket name if prefix is set or if pre-signed URLs are being used if (prefix != null && prefix.length() > 0) { ListAllMyBucketsResponse bucket_list = conn.listAllMyBuckets(null); List buckets = bucket_list.entries; if (buckets != null) { boolean found = false; for (Object tmp : buckets) { if (tmp instanceof Bucket) { Bucket bucket = (Bucket) tmp; if (bucket.name.startsWith(prefix)) { location = bucket.name; // depends on control dependency: [if], data = [none] found = true; // depends on control dependency: [if], data = [none] } } } if (!found) { location = prefix + "-" + java.util.UUID.randomUUID().toString(); // depends on control dependency: [if], data = [none] } } } if (usingPreSignedUrls()) { PreSignedUrlParser parsedPut = new PreSignedUrlParser(pre_signed_put_url); location = parsedPut.getBucket(); // depends on control dependency: [if], data = [none] } if (!conn.checkBucketExists(location)) { conn.createBucket(location, AWSAuthConnection.LOCATION_DEFAULT, null).connection.getResponseMessage(); // depends on control dependency: [if], data = [none] } } catch (Exception e) { throw HostControllerLogger.ROOT_LOGGER.cannotAccessS3Bucket(location, e.getLocalizedMessage()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public SortArgs get(String pattern) { LettuceAssert.notNull(pattern, "Pattern must not be null"); if (get == null) { get = new ArrayList<>(); } get.add(pattern); return this; } }
public class class_name { public SortArgs get(String pattern) { LettuceAssert.notNull(pattern, "Pattern must not be null"); if (get == null) { get = new ArrayList<>(); // depends on control dependency: [if], data = [none] } get.add(pattern); return this; } }
public class class_name { public void marshall(BatchGetLinkAttributesResponse batchGetLinkAttributesResponse, ProtocolMarshaller protocolMarshaller) { if (batchGetLinkAttributesResponse == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(batchGetLinkAttributesResponse.getAttributes(), ATTRIBUTES_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(BatchGetLinkAttributesResponse batchGetLinkAttributesResponse, ProtocolMarshaller protocolMarshaller) { if (batchGetLinkAttributesResponse == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(batchGetLinkAttributesResponse.getAttributes(), ATTRIBUTES_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void processTypeVariables(TypeVariable<?>[] variables, Type[] values) { for (int i = 0; i < variables.length; i++) { processTypeVariable(variables[i], values[i]); } } }
public class class_name { private void processTypeVariables(TypeVariable<?>[] variables, Type[] values) { for (int i = 0; i < variables.length; i++) { processTypeVariable(variables[i], values[i]); // depends on control dependency: [for], data = [i] } } }
public class class_name { public Object getNestedProperty(Object obj, String propertyName) { if (obj != null && propertyName != null) { return PresentationManager.getPm().get(obj, propertyName); } return null; } }
public class class_name { public Object getNestedProperty(Object obj, String propertyName) { if (obj != null && propertyName != null) { return PresentationManager.getPm().get(obj, propertyName); // depends on control dependency: [if], data = [(obj] } return null; } }
public class class_name { public Duration getBaselineEstimatedDuration(int baselineNumber) { Object result = getCachedValue(selectField(TaskFieldLists.BASELINE_ESTIMATED_DURATIONS, baselineNumber)); if (!(result instanceof Duration)) { result = null; } return (Duration) result; } }
public class class_name { public Duration getBaselineEstimatedDuration(int baselineNumber) { Object result = getCachedValue(selectField(TaskFieldLists.BASELINE_ESTIMATED_DURATIONS, baselineNumber)); if (!(result instanceof Duration)) { result = null; // depends on control dependency: [if], data = [none] } return (Duration) result; } }
public class class_name { public static void Backward(double[] data) { double[] result = new double[data.length]; double sum; double scale = Math.sqrt(2.0 / data.length); for (int t = 0; t < data.length; t++) { sum = 0; for (int j = 0; j < data.length; j++) { double cos = Math.cos(((2 * t + 1) * j * Math.PI) / (2 * data.length)); sum += alpha(j) * data[j] * cos; } result[t] = scale * sum; } for (int i = 0; i < data.length; i++) { data[i] = result[i]; } } }
public class class_name { public static void Backward(double[] data) { double[] result = new double[data.length]; double sum; double scale = Math.sqrt(2.0 / data.length); for (int t = 0; t < data.length; t++) { sum = 0; // depends on control dependency: [for], data = [none] for (int j = 0; j < data.length; j++) { double cos = Math.cos(((2 * t + 1) * j * Math.PI) / (2 * data.length)); sum += alpha(j) * data[j] * cos; // depends on control dependency: [for], data = [j] } result[t] = scale * sum; // depends on control dependency: [for], data = [t] } for (int i = 0; i < data.length; i++) { data[i] = result[i]; // depends on control dependency: [for], data = [i] } } }
public class class_name { public com.google.protobuf.ByteString getDomainSocketPathBytes() { java.lang.Object ref = domainSocketPath_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); domainSocketPath_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } }
public class class_name { public com.google.protobuf.ByteString getDomainSocketPathBytes() { java.lang.Object ref = domainSocketPath_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); domainSocketPath_ = b; // depends on control dependency: [if], data = [none] return b; // depends on control dependency: [if], data = [none] } else { return (com.google.protobuf.ByteString) ref; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public List<String> getRoles(String name, String... domain) { if (domain.length == 1) { name = domain[0] + "::" + name; } else if (domain.length > 1) { throw new Error("error: domain should be 1 parameter"); } if (!hasRole(name)) { throw new Error("error: name does not exist"); } List<String> roles = createRole(name).getRoles(); if (domain.length == 1) { for (int i = 0; i < roles.size(); i ++) { roles.set(i, roles.get(i).substring(domain[0].length() + 2, roles.get(i).length())); } } return roles; } }
public class class_name { @Override public List<String> getRoles(String name, String... domain) { if (domain.length == 1) { name = domain[0] + "::" + name; // depends on control dependency: [if], data = [none] } else if (domain.length > 1) { throw new Error("error: domain should be 1 parameter"); } if (!hasRole(name)) { throw new Error("error: name does not exist"); } List<String> roles = createRole(name).getRoles(); if (domain.length == 1) { for (int i = 0; i < roles.size(); i ++) { roles.set(i, roles.get(i).substring(domain[0].length() + 2, roles.get(i).length())); // depends on control dependency: [for], data = [i] } } return roles; } }
public class class_name { public String serialize( final ILoggingEvent event, final String eventName, @Nullable final Map<String, ? extends Object> map) throws Exception { final StringWriter jsonWriter = new StringWriter(); final JsonGenerator jsonGenerator = _jsonFactory.createGenerator(jsonWriter); // Start wrapper StenoSerializationHelper.startStenoWrapper(event, eventName, jsonGenerator, _objectMapper); // Write event data jsonGenerator.writeObjectFieldStart("data"); if (map != null) { for (final Map.Entry<String, ? extends Object> entry : map.entrySet()) { if (StenoSerializationHelper.isSimpleType(entry.getValue())) { jsonGenerator.writeObjectField(entry.getKey(), entry.getValue()); } else { jsonGenerator.writeFieldName(entry.getKey()); _objectMapper.writeValue( jsonGenerator, entry.getValue()); } } } jsonGenerator.writeEndObject(); // End 'data' field // Output throwable StenoSerializationHelper.writeThrowable(event.getThrowableProxy(), jsonGenerator, _objectMapper); // End wrapper StenoSerializationHelper.endStenoWrapper(event, eventName, jsonGenerator, _objectMapper, _encoder); return jsonWriter.toString(); } }
public class class_name { public String serialize( final ILoggingEvent event, final String eventName, @Nullable final Map<String, ? extends Object> map) throws Exception { final StringWriter jsonWriter = new StringWriter(); final JsonGenerator jsonGenerator = _jsonFactory.createGenerator(jsonWriter); // Start wrapper StenoSerializationHelper.startStenoWrapper(event, eventName, jsonGenerator, _objectMapper); // Write event data jsonGenerator.writeObjectFieldStart("data"); if (map != null) { for (final Map.Entry<String, ? extends Object> entry : map.entrySet()) { if (StenoSerializationHelper.isSimpleType(entry.getValue())) { jsonGenerator.writeObjectField(entry.getKey(), entry.getValue()); // depends on control dependency: [if], data = [none] } else { jsonGenerator.writeFieldName(entry.getKey()); // depends on control dependency: [if], data = [none] _objectMapper.writeValue( jsonGenerator, entry.getValue()); // depends on control dependency: [if], data = [none] } } } jsonGenerator.writeEndObject(); // End 'data' field // Output throwable StenoSerializationHelper.writeThrowable(event.getThrowableProxy(), jsonGenerator, _objectMapper); // End wrapper StenoSerializationHelper.endStenoWrapper(event, eventName, jsonGenerator, _objectMapper, _encoder); return jsonWriter.toString(); } }
public class class_name { private LineType parseLine(final String line, final LineType... allowedLineTypes) throws ExceptionParseException { for (final LineType possibleType : allowedLineTypes) { if ((possibleType == LineType.POST_END) || (possibleType == LineType.PRE_START)) { // this is garbage, all is accepted without parsing return possibleType; } final ExceptionLine parsedLine = possibleType.parse(line); if (parsedLine != null) { if (possibleType == LineType.PRE_STACK_TRACE) { // in case the cause is multi-line, update the cause final ExceptionLine currentTop = this.parsedLines.remove(this.parsedLines.size() - 1); if (!((currentTop instanceof CauseLine) && (parsedLine instanceof PlainTextLine))) { throw new IllegalStateException("Garbage in the exception message."); } this.parsedLines.add(new CauseLine((CauseLine) currentTop, (PlainTextLine) parsedLine)); } else { this.parsedLines.add(parsedLine); } return possibleType; } } throw new ExceptionParseException(line, "Line not any of the expected types: " + Arrays.toString(allowedLineTypes)); } }
public class class_name { private LineType parseLine(final String line, final LineType... allowedLineTypes) throws ExceptionParseException { for (final LineType possibleType : allowedLineTypes) { if ((possibleType == LineType.POST_END) || (possibleType == LineType.PRE_START)) { // this is garbage, all is accepted without parsing return possibleType; // depends on control dependency: [if], data = [none] } final ExceptionLine parsedLine = possibleType.parse(line); if (parsedLine != null) { if (possibleType == LineType.PRE_STACK_TRACE) { // in case the cause is multi-line, update the cause final ExceptionLine currentTop = this.parsedLines.remove(this.parsedLines.size() - 1); if (!((currentTop instanceof CauseLine) && (parsedLine instanceof PlainTextLine))) { throw new IllegalStateException("Garbage in the exception message."); } this.parsedLines.add(new CauseLine((CauseLine) currentTop, (PlainTextLine) parsedLine)); // depends on control dependency: [if], data = [none] } else { this.parsedLines.add(parsedLine); // depends on control dependency: [if], data = [none] } return possibleType; // depends on control dependency: [if], data = [none] } } throw new ExceptionParseException(line, "Line not any of the expected types: " + Arrays.toString(allowedLineTypes)); } }
public class class_name { private JarFile getJarFile(String jarFileUrl) throws IOException { if (jarFileUrl.startsWith("file:")) { try { final URI uri = new URI(jarFileUrl.replaceAll(" ", "\\%20")); final String jarFileName = uri.getSchemeSpecificPart(); logger.info("Creating new JarFile based on URI-scheme filename: {}", jarFileName); return new JarFile(jarFileName); } catch (URISyntaxException ex) { // Fallback for URLs that are not valid URIs (should hardly ever // happen). final String jarFileName = jarFileUrl.substring("file:".length()); logger.info("Creating new JarFile based on alternative filename: {}", jarFileName); return new JarFile(jarFileName); } } else { logger.info("Creating new JarFile based on URI (with '!/'): {}", jarFileUrl); return new JarFile(jarFileUrl); } } }
public class class_name { private JarFile getJarFile(String jarFileUrl) throws IOException { if (jarFileUrl.startsWith("file:")) { try { final URI uri = new URI(jarFileUrl.replaceAll(" ", "\\%20")); final String jarFileName = uri.getSchemeSpecificPart(); logger.info("Creating new JarFile based on URI-scheme filename: {}", jarFileName); // depends on control dependency: [try], data = [none] return new JarFile(jarFileName); // depends on control dependency: [try], data = [none] } catch (URISyntaxException ex) { // Fallback for URLs that are not valid URIs (should hardly ever // happen). final String jarFileName = jarFileUrl.substring("file:".length()); logger.info("Creating new JarFile based on alternative filename: {}", jarFileName); return new JarFile(jarFileName); } // depends on control dependency: [catch], data = [none] } else { logger.info("Creating new JarFile based on URI (with '!/'): {}", jarFileUrl); return new JarFile(jarFileUrl); } } }
public class class_name { public static String shuffle(final String value) { validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER); String[] chars = chars(value); Random random = new Random(); for (int i = 0; i < chars.length; i++) { int r = random.nextInt(chars.length); String tmp = chars[i]; chars[i] = chars[r]; chars[r] = tmp; } return Arrays.stream(chars).collect(joining()); } }
public class class_name { public static String shuffle(final String value) { validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER); String[] chars = chars(value); Random random = new Random(); for (int i = 0; i < chars.length; i++) { int r = random.nextInt(chars.length); String tmp = chars[i]; chars[i] = chars[r]; // depends on control dependency: [for], data = [i] chars[r] = tmp; // depends on control dependency: [for], data = [none] } return Arrays.stream(chars).collect(joining()); } }
public class class_name { private static final int find(final int[] auxArr, final int lgAuxArrInts, final int lgConfigK, final int slotNo) { assert lgAuxArrInts < lgConfigK; final int auxArrMask = (1 << lgAuxArrInts) - 1; final int configKmask = (1 << lgConfigK) - 1; int probe = slotNo & auxArrMask; final int loopIndex = probe; do { final int arrVal = auxArr[probe]; if (arrVal == EMPTY) { //Compares on entire entry return ~probe; //empty } else if (slotNo == (arrVal & configKmask)) { //Compares only on slotNo return probe; //found given slotNo, return probe = index into aux array } final int stride = (slotNo >>> lgAuxArrInts) | 1; probe = (probe + stride) & auxArrMask; } while (probe != loopIndex); throw new SketchesArgumentException("Key not found and no empty slots!"); } }
public class class_name { private static final int find(final int[] auxArr, final int lgAuxArrInts, final int lgConfigK, final int slotNo) { assert lgAuxArrInts < lgConfigK; final int auxArrMask = (1 << lgAuxArrInts) - 1; final int configKmask = (1 << lgConfigK) - 1; int probe = slotNo & auxArrMask; final int loopIndex = probe; do { final int arrVal = auxArr[probe]; if (arrVal == EMPTY) { //Compares on entire entry return ~probe; //empty // depends on control dependency: [if], data = [none] } else if (slotNo == (arrVal & configKmask)) { //Compares only on slotNo return probe; //found given slotNo, return probe = index into aux array // depends on control dependency: [if], data = [none] } final int stride = (slotNo >>> lgAuxArrInts) | 1; probe = (probe + stride) & auxArrMask; } while (probe != loopIndex); throw new SketchesArgumentException("Key not found and no empty slots!"); } }
public class class_name { public static void indexClasspath(final URLClassLoader classLoader, final Indexer indexer, final List<File> knownFiles) { // Variant that works with Maven "exec:java" final List<File> classPathFiles = Utils4J.localFilesFromUrlClassLoader(classLoader); for (final File file : classPathFiles) { if (Utils4J.nonJreJarFile(file)) { indexJar(indexer, knownFiles, file); } else if (file.isDirectory() && !file.getName().startsWith(".")) { indexDir(indexer, knownFiles, file); } } // Variant that works for Maven surefire tests for (final File file : Utils4J.classpathFiles(Utils4J::nonJreJarFile)) { indexJar(indexer, knownFiles, file); } for (final File file : Utils4J.classpathFiles(Utils4J::classFile)) { indexClassFile(indexer, knownFiles, file); } } }
public class class_name { public static void indexClasspath(final URLClassLoader classLoader, final Indexer indexer, final List<File> knownFiles) { // Variant that works with Maven "exec:java" final List<File> classPathFiles = Utils4J.localFilesFromUrlClassLoader(classLoader); for (final File file : classPathFiles) { if (Utils4J.nonJreJarFile(file)) { indexJar(indexer, knownFiles, file); // depends on control dependency: [if], data = [none] } else if (file.isDirectory() && !file.getName().startsWith(".")) { indexDir(indexer, knownFiles, file); // depends on control dependency: [if], data = [none] } } // Variant that works for Maven surefire tests for (final File file : Utils4J.classpathFiles(Utils4J::nonJreJarFile)) { indexJar(indexer, knownFiles, file); // depends on control dependency: [for], data = [file] } for (final File file : Utils4J.classpathFiles(Utils4J::classFile)) { indexClassFile(indexer, knownFiles, file); // depends on control dependency: [for], data = [file] } } }
public class class_name { public static <TVertex extends IVertex<TValue>, TValue extends Object, TProcessedValue extends Object> IGraph<TVertex, TValue, TProcessedValue> build(final TVertex...vertices) { final DirectedAcyclicGraph<TVertex, TValue, TProcessedValue> g = new DirectedAcyclicGraph<TVertex, TValue, TProcessedValue>(); if (vertices != null) { for(TVertex d : vertices) { g.addVertex(d); } } return g; } }
public class class_name { public static <TVertex extends IVertex<TValue>, TValue extends Object, TProcessedValue extends Object> IGraph<TVertex, TValue, TProcessedValue> build(final TVertex...vertices) { final DirectedAcyclicGraph<TVertex, TValue, TProcessedValue> g = new DirectedAcyclicGraph<TVertex, TValue, TProcessedValue>(); if (vertices != null) { for(TVertex d : vertices) { g.addVertex(d); // depends on control dependency: [for], data = [d] } } return g; } }
public class class_name { public AutomationExecution withTargetMaps(java.util.Map<String, java.util.List<String>>... targetMaps) { if (this.targetMaps == null) { setTargetMaps(new com.amazonaws.internal.SdkInternalList<java.util.Map<String, java.util.List<String>>>(targetMaps.length)); } for (java.util.Map<String, java.util.List<String>> ele : targetMaps) { this.targetMaps.add(ele); } return this; } }
public class class_name { public AutomationExecution withTargetMaps(java.util.Map<String, java.util.List<String>>... targetMaps) { if (this.targetMaps == null) { setTargetMaps(new com.amazonaws.internal.SdkInternalList<java.util.Map<String, java.util.List<String>>>(targetMaps.length)); // depends on control dependency: [if], data = [none] } for (java.util.Map<String, java.util.List<String>> ele : targetMaps) { this.targetMaps.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public String getValue(String key) { for (Iterator iter = components.values().iterator(); iter.hasNext();) { LdapRdnComponent component = (LdapRdnComponent) iter.next(); if (ObjectUtils.nullSafeEquals(component.getKey(), key)) { return component.getValue(); } } throw new IllegalArgumentException("No RdnComponent with the key " + key); } }
public class class_name { public String getValue(String key) { for (Iterator iter = components.values().iterator(); iter.hasNext();) { LdapRdnComponent component = (LdapRdnComponent) iter.next(); if (ObjectUtils.nullSafeEquals(component.getKey(), key)) { return component.getValue(); // depends on control dependency: [if], data = [none] } } throw new IllegalArgumentException("No RdnComponent with the key " + key); } }
public class class_name { public void write(final byte[] src) { if(src == null) throw new NullPointerException(); if(src.length < buffer.length - pos) { System.arraycopy(src, 0, buffer, pos, src.length); pos += src.length; size += src.length; return; } writeLoop(src, 0, src.length); } }
public class class_name { public void write(final byte[] src) { if(src == null) throw new NullPointerException(); if(src.length < buffer.length - pos) { System.arraycopy(src, 0, buffer, pos, src.length); // depends on control dependency: [if], data = [none] pos += src.length; // depends on control dependency: [if], data = [none] size += src.length; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } writeLoop(src, 0, src.length); } }
public class class_name { private void stopDragging() { if (dragging) { dragging = false; getContainer().remove(circle); getContainer().remove(line); } } }
public class class_name { private void stopDragging() { if (dragging) { dragging = false; // depends on control dependency: [if], data = [none] getContainer().remove(circle); // depends on control dependency: [if], data = [none] getContainer().remove(line); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static <T> Source<T> join(final Iterator<Source<T>> iterator) { return new AbstractSource<T>() { private Source<T> current = popSource(); @Override public T computeNext() throws IOException { while (current != null) { if (current.hasNext()) { return current.next(); } else { current.close(); current = popSource(); } } return endOfData(); } @Override public void close() { while (current != null) { current.close(); current = popSource(); } } private Source<T> popSource() { if (iterator.hasNext()) { return iterator.next(); } else { return null; } } }; } }
public class class_name { public static <T> Source<T> join(final Iterator<Source<T>> iterator) { return new AbstractSource<T>() { private Source<T> current = popSource(); @Override public T computeNext() throws IOException { while (current != null) { if (current.hasNext()) { return current.next(); } else { current.close(); current = popSource(); } } return endOfData(); } @Override public void close() { while (current != null) { current.close(); // depends on control dependency: [while], data = [none] current = popSource(); // depends on control dependency: [while], data = [none] } } private Source<T> popSource() { if (iterator.hasNext()) { return iterator.next(); // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }; } }
public class class_name { public static void close(Object... objsToClose) { for (Object obj : objsToClose) { if (obj instanceof AutoCloseable) { IoUtil.close((AutoCloseable) obj); } else if (obj instanceof Closeable) { IoUtil.close((Closeable) obj); } else { try { if (obj != null) { if (obj instanceof ResultSet) { ((ResultSet) obj).close(); } else if (obj instanceof Statement) { ((Statement) obj).close(); } else if (obj instanceof PreparedStatement) { ((PreparedStatement) obj).close(); } else if (obj instanceof Connection) { ((Connection) obj).close(); } else { log.warn("Object {} not a ResultSet or Statement or PreparedStatement or Connection!", obj.getClass().getName()); } } } catch (SQLException e) { // ignore } } } } }
public class class_name { public static void close(Object... objsToClose) { for (Object obj : objsToClose) { if (obj instanceof AutoCloseable) { IoUtil.close((AutoCloseable) obj); // depends on control dependency: [if], data = [none] } else if (obj instanceof Closeable) { IoUtil.close((Closeable) obj); // depends on control dependency: [if], data = [none] } else { try { if (obj != null) { if (obj instanceof ResultSet) { ((ResultSet) obj).close(); // depends on control dependency: [if], data = [none] } else if (obj instanceof Statement) { ((Statement) obj).close(); // depends on control dependency: [if], data = [none] } else if (obj instanceof PreparedStatement) { ((PreparedStatement) obj).close(); // depends on control dependency: [if], data = [none] } else if (obj instanceof Connection) { ((Connection) obj).close(); // depends on control dependency: [if], data = [none] } else { log.warn("Object {} not a ResultSet or Statement or PreparedStatement or Connection!", obj.getClass().getName()); // depends on control dependency: [if], data = [none] } } } catch (SQLException e) { // ignore } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { private void update(float deltaTime) { float vel = mAngularVelocity; float velSqr = vel*vel; if (vel > 0f) { //TODO the damping is not based on time mAngularVelocity -= velSqr * VELOCITY_FRICTION_COEFFICIENT + CONSTANT_FRICTION_COEFFICIENT; if (mAngularVelocity < 0f) mAngularVelocity = 0f; } else if (vel < 0f) { mAngularVelocity -= velSqr * -VELOCITY_FRICTION_COEFFICIENT - CONSTANT_FRICTION_COEFFICIENT; if (mAngularVelocity > 0f) mAngularVelocity = 0f; } if (mAngularVelocity != 0f) { addAngle(mAngularVelocity * deltaTime); } else { mRequiresUpdate = false; } } }
public class class_name { private void update(float deltaTime) { float vel = mAngularVelocity; float velSqr = vel*vel; if (vel > 0f) { //TODO the damping is not based on time mAngularVelocity -= velSqr * VELOCITY_FRICTION_COEFFICIENT + CONSTANT_FRICTION_COEFFICIENT; // depends on control dependency: [if], data = [none] if (mAngularVelocity < 0f) mAngularVelocity = 0f; } else if (vel < 0f) { mAngularVelocity -= velSqr * -VELOCITY_FRICTION_COEFFICIENT - CONSTANT_FRICTION_COEFFICIENT; // depends on control dependency: [if], data = [none] if (mAngularVelocity > 0f) mAngularVelocity = 0f; } if (mAngularVelocity != 0f) { addAngle(mAngularVelocity * deltaTime); // depends on control dependency: [if], data = [(mAngularVelocity] } else { mRequiresUpdate = false; // depends on control dependency: [if], data = [none] } } }
public class class_name { @SuppressWarnings("unchecked") public <T> T read(Object jsonObject, Configuration configuration) { boolean optAsPathList = configuration.containsOption(AS_PATH_LIST); boolean optAlwaysReturnList = configuration.containsOption(Option.ALWAYS_RETURN_LIST); boolean optSuppressExceptions = configuration.containsOption(Option.SUPPRESS_EXCEPTIONS); try { if (path.isFunctionPath()) { if (optAsPathList || optAlwaysReturnList) { throw new JsonPathException("Options " + AS_PATH_LIST + " and " + ALWAYS_RETURN_LIST + " are not allowed when using path functions!"); } return path.evaluate(jsonObject, jsonObject, configuration).getValue(true); } else if (optAsPathList) { return (T) path.evaluate(jsonObject, jsonObject, configuration).getPath(); } else { Object res = path.evaluate(jsonObject, jsonObject, configuration).getValue(false); if (optAlwaysReturnList && path.isDefinite()) { Object array = configuration.jsonProvider().createArray(); configuration.jsonProvider().setArrayIndex(array, 0, res); return (T) array; } else { return (T) res; } } } catch (RuntimeException e) { if (!optSuppressExceptions) { throw e; } else { if (optAsPathList) { return (T) configuration.jsonProvider().createArray(); } else { if (optAlwaysReturnList) { return (T) configuration.jsonProvider().createArray(); } else { return (T) (path.isDefinite() ? null : configuration.jsonProvider().createArray()); } } } } } }
public class class_name { @SuppressWarnings("unchecked") public <T> T read(Object jsonObject, Configuration configuration) { boolean optAsPathList = configuration.containsOption(AS_PATH_LIST); boolean optAlwaysReturnList = configuration.containsOption(Option.ALWAYS_RETURN_LIST); boolean optSuppressExceptions = configuration.containsOption(Option.SUPPRESS_EXCEPTIONS); try { if (path.isFunctionPath()) { if (optAsPathList || optAlwaysReturnList) { throw new JsonPathException("Options " + AS_PATH_LIST + " and " + ALWAYS_RETURN_LIST + " are not allowed when using path functions!"); } return path.evaluate(jsonObject, jsonObject, configuration).getValue(true); // depends on control dependency: [if], data = [none] } else if (optAsPathList) { return (T) path.evaluate(jsonObject, jsonObject, configuration).getPath(); // depends on control dependency: [if], data = [none] } else { Object res = path.evaluate(jsonObject, jsonObject, configuration).getValue(false); if (optAlwaysReturnList && path.isDefinite()) { Object array = configuration.jsonProvider().createArray(); configuration.jsonProvider().setArrayIndex(array, 0, res); // depends on control dependency: [if], data = [none] return (T) array; // depends on control dependency: [if], data = [none] } else { return (T) res; // depends on control dependency: [if], data = [none] } } } catch (RuntimeException e) { if (!optSuppressExceptions) { throw e; } else { if (optAsPathList) { return (T) configuration.jsonProvider().createArray(); // depends on control dependency: [if], data = [none] } else { if (optAlwaysReturnList) { return (T) configuration.jsonProvider().createArray(); // depends on control dependency: [if], data = [none] } else { return (T) (path.isDefinite() ? null : configuration.jsonProvider().createArray()); // depends on control dependency: [if], data = [none] } } } } // depends on control dependency: [catch], data = [none] } }
public class class_name { private boolean doValidation(final Object value, final CellFormAttributes attr, final int rowIndex, final int colIndex, final Sheet sheet) { boolean pass; String attrValue = attr.getValue(); attrValue = attrValue.replace("$value", value.toString() + "").replace("$rowIndex", rowIndex + "") .replace("$colIndex", colIndex + "").replace("$sheetName", sheet.getSheetName()); attrValue = ConfigurationUtility.replaceExpressionWithCellValue(attrValue, rowIndex, sheet); if (attrValue.contains(TieConstants.EL_START)) { Object returnObj = FacesUtility.evaluateExpression(attrValue, Object.class); attrValue = returnObj.toString(); pass = Boolean.parseBoolean(attrValue); } else { pass = parent.getCellHelper().evalBoolExpression(attrValue); } return pass; } }
public class class_name { private boolean doValidation(final Object value, final CellFormAttributes attr, final int rowIndex, final int colIndex, final Sheet sheet) { boolean pass; String attrValue = attr.getValue(); attrValue = attrValue.replace("$value", value.toString() + "").replace("$rowIndex", rowIndex + "") .replace("$colIndex", colIndex + "").replace("$sheetName", sheet.getSheetName()); attrValue = ConfigurationUtility.replaceExpressionWithCellValue(attrValue, rowIndex, sheet); if (attrValue.contains(TieConstants.EL_START)) { Object returnObj = FacesUtility.evaluateExpression(attrValue, Object.class); attrValue = returnObj.toString(); // depends on control dependency: [if], data = [none] pass = Boolean.parseBoolean(attrValue); // depends on control dependency: [if], data = [none] } else { pass = parent.getCellHelper().evalBoolExpression(attrValue); // depends on control dependency: [if], data = [none] } return pass; } }
public class class_name { public V put(K key, V value) { if ((key != null) && (value != null)) { return m_internalMap.put(key, value); } Exception e = new Exception(); try { // we want to print a stack trace when null is used as a key/value throw e; } catch (Exception e2) { e = e2; } if (key == null) { LOG.warn("Invalid null key in map", e); return null; } if (value == null) { LOG.warn("Invalid null value in map", e); return m_internalMap.remove(key); } return null; } }
public class class_name { public V put(K key, V value) { if ((key != null) && (value != null)) { return m_internalMap.put(key, value); // depends on control dependency: [if], data = [none] } Exception e = new Exception(); try { // we want to print a stack trace when null is used as a key/value throw e; } catch (Exception e2) { e = e2; } // depends on control dependency: [catch], data = [none] if (key == null) { LOG.warn("Invalid null key in map", e); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } if (value == null) { LOG.warn("Invalid null value in map", e); // depends on control dependency: [if], data = [none] return m_internalMap.remove(key); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { private void configureTag(Tag tag, Map attributes) throws JellyException { if ( tag instanceof DynaTag ) { DynaTag dynaTag = (DynaTag) tag; for (Object o : attributes.entrySet()) { Entry entry = (Entry) o; String name = (String) entry.getKey(); if(name.equals("xmlns")) continue; // we'll process this by ourselves Object value = getValue(entry, dynaTag.getAttributeType(name)); dynaTag.setAttribute(name, value); } } else { // treat the tag as a bean DynaBean dynaBean = new ConvertingWrapDynaBean( tag ); for (Object o : attributes.entrySet()) { Entry entry = (Entry) o; String name = (String) entry.getKey(); if(name.equals("xmlns")) continue; // we'll process this by ourselves DynaProperty property = dynaBean.getDynaClass().getDynaProperty(name); if (property == null) { throw new JellyException("This tag does not understand the '" + name + "' attribute"); } dynaBean.set(name, getValue(entry,property.getType())); } } } }
public class class_name { private void configureTag(Tag tag, Map attributes) throws JellyException { if ( tag instanceof DynaTag ) { DynaTag dynaTag = (DynaTag) tag; for (Object o : attributes.entrySet()) { Entry entry = (Entry) o; String name = (String) entry.getKey(); if(name.equals("xmlns")) continue; // we'll process this by ourselves Object value = getValue(entry, dynaTag.getAttributeType(name)); dynaTag.setAttribute(name, value); // depends on control dependency: [for], data = [none] } } else { // treat the tag as a bean DynaBean dynaBean = new ConvertingWrapDynaBean( tag ); for (Object o : attributes.entrySet()) { Entry entry = (Entry) o; String name = (String) entry.getKey(); if(name.equals("xmlns")) continue; // we'll process this by ourselves DynaProperty property = dynaBean.getDynaClass().getDynaProperty(name); if (property == null) { throw new JellyException("This tag does not understand the '" + name + "' attribute"); } dynaBean.set(name, getValue(entry,property.getType())); // depends on control dependency: [for], data = [o] } } } }
public class class_name { private static Properties load() { Properties properties = new Properties(); String file = System.getProperty(CONFIGURATION_PROPERTY); try { if (file != null) { InputStream stream; if (URL_DETECTION_PATTERN.matcher(file).matches()) { stream = new URL(file).openStream(); } else { stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(file); if (stream == null) { stream = new FileInputStream(file); } } load(properties, stream); } else { InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(DEFAULT_CONFIGURATION_FILE); if (stream != null) { load(properties, stream); } } } catch (IOException ex) { InternalLogger.log(Level.ERROR, "Failed loading configuration from '" + file + "'"); } for (Object key : new ArrayList<Object>(System.getProperties().keySet())) { String name = (String) key; if (name.startsWith(PROPERTIES_PREFIX)) { properties.put(name.substring(PROPERTIES_PREFIX.length()), System.getProperty(name)); } } for (Entry<Object, Object> entry : properties.entrySet()) { String value = (String) entry.getValue(); if (value.indexOf('{') != -1) { value = resolve(value, EnvironmentVariableResolver.INSTANCE); value = resolve(value, SystemPropertyResolver.INSTANCE); properties.put(entry.getKey(), value); } } return properties; } }
public class class_name { private static Properties load() { Properties properties = new Properties(); String file = System.getProperty(CONFIGURATION_PROPERTY); try { if (file != null) { InputStream stream; if (URL_DETECTION_PATTERN.matcher(file).matches()) { stream = new URL(file).openStream(); // depends on control dependency: [if], data = [none] } else { stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(file); // depends on control dependency: [if], data = [none] if (stream == null) { stream = new FileInputStream(file); // depends on control dependency: [if], data = [none] } } load(properties, stream); // depends on control dependency: [if], data = [none] } else { InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(DEFAULT_CONFIGURATION_FILE); if (stream != null) { load(properties, stream); // depends on control dependency: [if], data = [none] } } } catch (IOException ex) { InternalLogger.log(Level.ERROR, "Failed loading configuration from '" + file + "'"); } // depends on control dependency: [catch], data = [none] for (Object key : new ArrayList<Object>(System.getProperties().keySet())) { String name = (String) key; if (name.startsWith(PROPERTIES_PREFIX)) { properties.put(name.substring(PROPERTIES_PREFIX.length()), System.getProperty(name)); // depends on control dependency: [if], data = [none] } } for (Entry<Object, Object> entry : properties.entrySet()) { String value = (String) entry.getValue(); if (value.indexOf('{') != -1) { value = resolve(value, EnvironmentVariableResolver.INSTANCE); // depends on control dependency: [if], data = [none] value = resolve(value, SystemPropertyResolver.INSTANCE); // depends on control dependency: [if], data = [none] properties.put(entry.getKey(), value); // depends on control dependency: [if], data = [none] } } return properties; } }
public class class_name { boolean updateState(State state) { if (isResetRequired) { // Applying initial state state.set(0f, 0f, zoomBounds.set(state).getFitZoom(), 0f); GravityUtils.getImagePosition(state, settings, tmpRect); state.translateTo(tmpRect.left, tmpRect.top); // We can correctly reset state only when we have both image size and viewport size // but there can be a delay before we have all values properly set // (waiting for layout or waiting for image to be loaded) isResetRequired = !settings.hasImageSize() || !settings.hasViewportSize(); return !isResetRequired; } else { // Restricts state's translation and zoom bounds, disallowing overscroll / overzoom. restrictStateBounds(state, state, Float.NaN, Float.NaN, false, false, true); return false; } } }
public class class_name { boolean updateState(State state) { if (isResetRequired) { // Applying initial state state.set(0f, 0f, zoomBounds.set(state).getFitZoom(), 0f); // depends on control dependency: [if], data = [none] GravityUtils.getImagePosition(state, settings, tmpRect); // depends on control dependency: [if], data = [none] state.translateTo(tmpRect.left, tmpRect.top); // depends on control dependency: [if], data = [none] // We can correctly reset state only when we have both image size and viewport size // but there can be a delay before we have all values properly set // (waiting for layout or waiting for image to be loaded) isResetRequired = !settings.hasImageSize() || !settings.hasViewportSize(); // depends on control dependency: [if], data = [none] return !isResetRequired; // depends on control dependency: [if], data = [none] } else { // Restricts state's translation and zoom bounds, disallowing overscroll / overzoom. restrictStateBounds(state, state, Float.NaN, Float.NaN, false, false, true); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static IsNullValue merge(IsNullValue a, IsNullValue b) { if (a == b) { return a; } if (a.equals(b)) { return a; } int aKind = a.kind & 0xff; int bKind = b.kind & 0xff; int aFlags = a.getFlags(); int bFlags = b.getFlags(); int combinedFlags = aFlags & bFlags; if (!(a.isNullOnSomePath() || a.isDefinitelyNull()) && b.isException()) { combinedFlags |= EXCEPTION; } else if (!(b.isNullOnSomePath() || b.isDefinitelyNull()) && a.isException()) { combinedFlags |= EXCEPTION; } // Left hand value should be >=, since it is used // as the first dimension of the matrix to index. if (aKind < bKind) { int tmp = aKind; aKind = bKind; bKind = tmp; } assert aKind >= bKind; int result = mergeMatrix[aKind][bKind]; IsNullValue resultValue = (result == NO_KABOOM_NN) ? noKaboomNonNullValue(a.locationOfKaBoom) : instanceByFlagsList[combinedFlags >> FLAG_SHIFT][result]; return resultValue; } }
public class class_name { public static IsNullValue merge(IsNullValue a, IsNullValue b) { if (a == b) { return a; // depends on control dependency: [if], data = [none] } if (a.equals(b)) { return a; // depends on control dependency: [if], data = [none] } int aKind = a.kind & 0xff; int bKind = b.kind & 0xff; int aFlags = a.getFlags(); int bFlags = b.getFlags(); int combinedFlags = aFlags & bFlags; if (!(a.isNullOnSomePath() || a.isDefinitelyNull()) && b.isException()) { combinedFlags |= EXCEPTION; // depends on control dependency: [if], data = [none] } else if (!(b.isNullOnSomePath() || b.isDefinitelyNull()) && a.isException()) { combinedFlags |= EXCEPTION; // depends on control dependency: [if], data = [none] } // Left hand value should be >=, since it is used // as the first dimension of the matrix to index. if (aKind < bKind) { int tmp = aKind; aKind = bKind; // depends on control dependency: [if], data = [none] bKind = tmp; // depends on control dependency: [if], data = [none] } assert aKind >= bKind; int result = mergeMatrix[aKind][bKind]; IsNullValue resultValue = (result == NO_KABOOM_NN) ? noKaboomNonNullValue(a.locationOfKaBoom) : instanceByFlagsList[combinedFlags >> FLAG_SHIFT][result]; return resultValue; } }
public class class_name { private static void initializeDefaultModules(SecurityContext context) { if (context.isInitialized()) { return; } if (LOGGER.isDebugEnabled()) { LOGGER.debug("SecurityContext default module initializer starting"); } String moduleName; // Loop through the module names for (int i=0; i<DEFAULT_MODULES.length; i++) { moduleName = DEFAULT_MODULES[i]; try { LOGGER.debug(moduleName + MODULE_INITIALIZER_CLASS); // Get a class instance for the module initializer Class<?> clazz = Class.forName(moduleName + MODULE_INITIALIZER_CLASS); // Get the method instance for the module initializer's initialization method Method method = clazz.getMethod(MODULE_INITIALIZER_METHOD, (Class[])null); // Invoke the initialization method Object invokeResult = method.invoke(clazz.newInstance(), (Object[])null); // Validate that the result of the initialization is a valid module context if (invokeResult instanceof AbstractModuleContext) { // Register the module context context.registerModuleContext(moduleName, (AbstractModuleContext)invokeResult); } else { throw new IllegalArgumentException("Initializer method did not return correct type"); } if (LOGGER.isInfoEnabled()) { LOGGER.info("SecurityContext module "+ moduleName + " initialized"); } } catch (ClassNotFoundException cnfe) { LOGGER.warn("SecurityContext module "+ moduleName + " not found, skipping."); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Stack trace: ", cnfe); } } catch (NoSuchMethodException nsme) { LOGGER.warn("SecurityContext module "+ moduleName + " does not support default initialization, skipping.", nsme); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Stack trace: ", nsme); } } catch (Throwable t) { LOGGER.error("Error initializing SecurityContext module "+ moduleName, t); } finally { } } if (LOGGER.isDebugEnabled()) { LOGGER.debug("SecurityContext default module initializer ending"); } } }
public class class_name { private static void initializeDefaultModules(SecurityContext context) { if (context.isInitialized()) { return; // depends on control dependency: [if], data = [none] } if (LOGGER.isDebugEnabled()) { LOGGER.debug("SecurityContext default module initializer starting"); // depends on control dependency: [if], data = [none] } String moduleName; // Loop through the module names for (int i=0; i<DEFAULT_MODULES.length; i++) { moduleName = DEFAULT_MODULES[i]; try { LOGGER.debug(moduleName + MODULE_INITIALIZER_CLASS); // Get a class instance for the module initializer Class<?> clazz = Class.forName(moduleName + MODULE_INITIALIZER_CLASS); // Get the method instance for the module initializer's initialization method Method method = clazz.getMethod(MODULE_INITIALIZER_METHOD, (Class[])null); // Invoke the initialization method Object invokeResult = method.invoke(clazz.newInstance(), (Object[])null); // Validate that the result of the initialization is a valid module context if (invokeResult instanceof AbstractModuleContext) { // Register the module context context.registerModuleContext(moduleName, (AbstractModuleContext)invokeResult); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Initializer method did not return correct type"); } if (LOGGER.isInfoEnabled()) { LOGGER.info("SecurityContext module "+ moduleName + " initialized"); // depends on control dependency: [if], data = [none] } } catch (ClassNotFoundException cnfe) { LOGGER.warn("SecurityContext module "+ moduleName + " not found, skipping."); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Stack trace: ", cnfe); } } catch (NoSuchMethodException nsme) { LOGGER.warn("SecurityContext module "+ moduleName + " does not support default initialization, skipping.", nsme); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Stack trace: ", nsme); } } catch (Throwable t) { LOGGER.error("Error initializing SecurityContext module "+ moduleName, t); } finally { } } if (LOGGER.isDebugEnabled()) { LOGGER.debug("SecurityContext default module initializer ending"); } } }
public class class_name { public <T> JSONAPIDocument<T> readDocument(InputStream dataStream, Class<T> clazz) { try { resourceCache.init(); JsonNode rootNode = objectMapper.readTree(dataStream); // Validate ValidationUtils.ensureNotError(objectMapper, rootNode); ValidationUtils.ensureValidResource(rootNode); JsonNode dataNode = rootNode.get(DATA); // Parse data node without handling relationships T resourceObject; boolean cached = false; if (dataNode != null && dataNode.isObject()) { String identifier = createIdentifier(dataNode); cached = identifier != null && resourceCache.contains(identifier); if (cached) { resourceObject = (T) resourceCache.get(identifier); } else { resourceObject = readObject(dataNode, clazz, false); } } else { resourceObject = null; } // Parse all included resources resourceCache.cache(parseIncluded(rootNode)); // Connect data node's relationships now that all resources have been parsed if (resourceObject != null && !cached) { handleRelationships(dataNode, resourceObject); } JSONAPIDocument<T> result = new JSONAPIDocument<>(resourceObject, objectMapper); // Handle top-level meta if (rootNode.has(META)) { result.setMeta(mapMeta(rootNode.get(META))); } // Handle top-level links if (rootNode.has(LINKS)) { result.setLinks(new Links(mapLinks(rootNode.get(LINKS)))); } return result; } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } finally { resourceCache.clear(); } } }
public class class_name { public <T> JSONAPIDocument<T> readDocument(InputStream dataStream, Class<T> clazz) { try { resourceCache.init(); // depends on control dependency: [try], data = [none] JsonNode rootNode = objectMapper.readTree(dataStream); // Validate ValidationUtils.ensureNotError(objectMapper, rootNode); // depends on control dependency: [try], data = [none] ValidationUtils.ensureValidResource(rootNode); // depends on control dependency: [try], data = [none] JsonNode dataNode = rootNode.get(DATA); // Parse data node without handling relationships T resourceObject; boolean cached = false; if (dataNode != null && dataNode.isObject()) { String identifier = createIdentifier(dataNode); cached = identifier != null && resourceCache.contains(identifier); // depends on control dependency: [if], data = [none] if (cached) { resourceObject = (T) resourceCache.get(identifier); // depends on control dependency: [if], data = [none] } else { resourceObject = readObject(dataNode, clazz, false); // depends on control dependency: [if], data = [none] } } else { resourceObject = null; // depends on control dependency: [if], data = [none] } // Parse all included resources resourceCache.cache(parseIncluded(rootNode)); // depends on control dependency: [try], data = [none] // Connect data node's relationships now that all resources have been parsed if (resourceObject != null && !cached) { handleRelationships(dataNode, resourceObject); // depends on control dependency: [if], data = [none] } JSONAPIDocument<T> result = new JSONAPIDocument<>(resourceObject, objectMapper); // Handle top-level meta if (rootNode.has(META)) { result.setMeta(mapMeta(rootNode.get(META))); // depends on control dependency: [if], data = [none] } // Handle top-level links if (rootNode.has(LINKS)) { result.setLinks(new Links(mapLinks(rootNode.get(LINKS)))); // depends on control dependency: [if], data = [none] } return result; // depends on control dependency: [try], data = [none] } catch (RuntimeException e) { throw e; } catch (Exception e) { // depends on control dependency: [catch], data = [none] throw new RuntimeException(e); } finally { // depends on control dependency: [catch], data = [none] resourceCache.clear(); } } }
public class class_name { @SuppressWarnings("checkstyle:ReturnCount") public static int compareBuff(final DirectBuffer o1, final DirectBuffer o2) { requireNonNull(o1); requireNonNull(o2); if (o1.equals(o2)) { return 0; } final int minLength = Math.min(o1.capacity(), o2.capacity()); final int minWords = minLength / Long.BYTES; for (int i = 0; i < minWords * Long.BYTES; i += Long.BYTES) { final long lw = o1.getLong(i, BIG_ENDIAN); final long rw = o2.getLong(i, BIG_ENDIAN); final int diff = Long.compareUnsigned(lw, rw); if (diff != 0) { return diff; } } for (int i = minWords * Long.BYTES; i < minLength; i++) { final int lw = Byte.toUnsignedInt(o1.getByte(i)); final int rw = Byte.toUnsignedInt(o2.getByte(i)); final int result = Integer.compareUnsigned(lw, rw); if (result != 0) { return result; } } return o1.capacity() - o2.capacity(); } }
public class class_name { @SuppressWarnings("checkstyle:ReturnCount") public static int compareBuff(final DirectBuffer o1, final DirectBuffer o2) { requireNonNull(o1); requireNonNull(o2); if (o1.equals(o2)) { return 0; // depends on control dependency: [if], data = [none] } final int minLength = Math.min(o1.capacity(), o2.capacity()); final int minWords = minLength / Long.BYTES; for (int i = 0; i < minWords * Long.BYTES; i += Long.BYTES) { final long lw = o1.getLong(i, BIG_ENDIAN); final long rw = o2.getLong(i, BIG_ENDIAN); final int diff = Long.compareUnsigned(lw, rw); if (diff != 0) { return diff; // depends on control dependency: [if], data = [none] } } for (int i = minWords * Long.BYTES; i < minLength; i++) { final int lw = Byte.toUnsignedInt(o1.getByte(i)); final int rw = Byte.toUnsignedInt(o2.getByte(i)); final int result = Integer.compareUnsigned(lw, rw); if (result != 0) { return result; // depends on control dependency: [if], data = [none] } } return o1.capacity() - o2.capacity(); } }
public class class_name { public ImmutableTerm getObjectAtom(PredicateObjectMap pom, String joinCond) { ImmutableTerm objectAtom = null; if (pom.getObjectMaps().isEmpty()) { return null; } ObjectMap om = pom.getObjectMap(0); String lan = om.getLanguageTag(); IRI datatype = om.getDatatype(); // we check if the object map is a constant (can be a iri or a literal) // TODO(xiao): toString() is suspicious RDFTerm constantObj = om.getConstant(); if (constantObj != null) { // boolean isURI = false; // try { // java.net.URI.create(obj); // isURI = true; // } catch (IllegalArgumentException e){ // // } // if the literal has a language property or a datatype property we // create the function object later if (lan != null || datatype != null) { ValueConstant constantLiteral = termFactory.getConstantLiteral(((Literal) constantObj).getLexicalForm()); objectAtom = constantLiteral; } else { if (constantObj instanceof Literal){ ValueConstant constantLiteral = termFactory.getConstantLiteral(((Literal) constantObj).getLexicalForm()); Literal constantLit1 = (Literal) constantObj; String lanConstant = om.getLanguageTag(); IRI datatypeConstant = constantLit1.getDatatype(); // we check if it is a literal with language tag if (lanConstant != null) { objectAtom = termFactory.getImmutableTypedTerm(constantLiteral, lanConstant); } // we check if it is a typed literal else if (datatypeConstant != null) { RDFDatatype type = typeFactory.getDatatype(datatypeConstant); objectAtom = termFactory.getImmutableTypedTerm(constantLiteral, type); } else { objectAtom = constantLiteral; // .RDFS_LITERAL; } } else if (constantObj instanceof IRI){ objectAtom = termFactory.getImmutableUriTemplate(termFactory.getConstantLiteral( ((IRI) constantObj).getIRIString())); } } } // we check if the object map is a column // if it has a datatype or language property or its a iri we check it later String col = om.getColumn(); if (col != null) { col = trim(col); if (!joinCond.isEmpty()) { col = joinCond + col; } objectAtom = termFactory.getVariable(col); } // we check if the object map is a template (can be a iri, a literal or // a blank node) Template t = om.getTemplate(); IRI typ = om.getTermType(); boolean concat = false; if (t != null) { //we check if the template is a literal //then we check if the template includes concat concat = isConcat(t.toString()); if (typ.equals(R2RMLVocabulary.literal) && (concat)){ objectAtom = getTypedFunction(t.toString(), 4, joinCond); }else { // a template can be a rr:IRI, a // rr:Literal or rr:BlankNode // if the literal has a language property or a datatype property // we // create the function object later if (lan != null || datatype != null) { String value = t.getColumnName(0); if (!joinCond.isEmpty()) { value = joinCond + value; } objectAtom = termFactory.getVariable(value); } else { IRI type = om.getTermType(); // we check if the template is a IRI a simple literal or a // blank // node and create the function object objectAtom = getTermTypeAtom(t.toString(), type, joinCond); } } } else{ //assign iri template TermMap.TermMapType termMapType = om.getTermMapType(); if(termMapType.equals(TermMap.TermMapType.CONSTANT_VALUED)){ } else if(termMapType.equals(TermMap.TermMapType.COLUMN_VALUED)){ if(typ.equals(R2RMLVocabulary.iri)) { objectAtom = termFactory.getImmutableUriTemplate(objectAtom); } } } // we check if it is a literal with language tag if (lan != null) { objectAtom = termFactory.getImmutableTypedTerm(objectAtom, lan); } // we check if it is a typed literal if (datatype != null) { RDFDatatype type = typeFactory.getDatatype(datatype); objectAtom = termFactory.getImmutableTypedTerm(objectAtom, type); } return objectAtom; } }
public class class_name { public ImmutableTerm getObjectAtom(PredicateObjectMap pom, String joinCond) { ImmutableTerm objectAtom = null; if (pom.getObjectMaps().isEmpty()) { return null; // depends on control dependency: [if], data = [none] } ObjectMap om = pom.getObjectMap(0); String lan = om.getLanguageTag(); IRI datatype = om.getDatatype(); // we check if the object map is a constant (can be a iri or a literal) // TODO(xiao): toString() is suspicious RDFTerm constantObj = om.getConstant(); if (constantObj != null) { // boolean isURI = false; // try { // java.net.URI.create(obj); // isURI = true; // } catch (IllegalArgumentException e){ // // } // if the literal has a language property or a datatype property we // create the function object later if (lan != null || datatype != null) { ValueConstant constantLiteral = termFactory.getConstantLiteral(((Literal) constantObj).getLexicalForm()); objectAtom = constantLiteral; // depends on control dependency: [if], data = [none] } else { if (constantObj instanceof Literal){ ValueConstant constantLiteral = termFactory.getConstantLiteral(((Literal) constantObj).getLexicalForm()); Literal constantLit1 = (Literal) constantObj; String lanConstant = om.getLanguageTag(); IRI datatypeConstant = constantLit1.getDatatype(); // we check if it is a literal with language tag if (lanConstant != null) { objectAtom = termFactory.getImmutableTypedTerm(constantLiteral, lanConstant); // depends on control dependency: [if], data = [none] } // we check if it is a typed literal else if (datatypeConstant != null) { RDFDatatype type = typeFactory.getDatatype(datatypeConstant); objectAtom = termFactory.getImmutableTypedTerm(constantLiteral, type); // depends on control dependency: [if], data = [none] } else { objectAtom = constantLiteral; // depends on control dependency: [if], data = [none] // .RDFS_LITERAL; } } else if (constantObj instanceof IRI){ objectAtom = termFactory.getImmutableUriTemplate(termFactory.getConstantLiteral( ((IRI) constantObj).getIRIString())); // depends on control dependency: [if], data = [none] } } } // we check if the object map is a column // if it has a datatype or language property or its a iri we check it later String col = om.getColumn(); if (col != null) { col = trim(col); // depends on control dependency: [if], data = [(col] if (!joinCond.isEmpty()) { col = joinCond + col; // depends on control dependency: [if], data = [none] } objectAtom = termFactory.getVariable(col); // depends on control dependency: [if], data = [(col] } // we check if the object map is a template (can be a iri, a literal or // a blank node) Template t = om.getTemplate(); IRI typ = om.getTermType(); boolean concat = false; if (t != null) { //we check if the template is a literal //then we check if the template includes concat concat = isConcat(t.toString()); // depends on control dependency: [if], data = [(t] if (typ.equals(R2RMLVocabulary.literal) && (concat)){ objectAtom = getTypedFunction(t.toString(), 4, joinCond); // depends on control dependency: [if], data = [none] }else { // a template can be a rr:IRI, a // rr:Literal or rr:BlankNode // if the literal has a language property or a datatype property // we // create the function object later if (lan != null || datatype != null) { String value = t.getColumnName(0); if (!joinCond.isEmpty()) { value = joinCond + value; // depends on control dependency: [if], data = [none] } objectAtom = termFactory.getVariable(value); // depends on control dependency: [if], data = [none] } else { IRI type = om.getTermType(); // we check if the template is a IRI a simple literal or a // blank // node and create the function object objectAtom = getTermTypeAtom(t.toString(), type, joinCond); // depends on control dependency: [if], data = [none] } } } else{ //assign iri template TermMap.TermMapType termMapType = om.getTermMapType(); if(termMapType.equals(TermMap.TermMapType.CONSTANT_VALUED)){ } else if(termMapType.equals(TermMap.TermMapType.COLUMN_VALUED)){ if(typ.equals(R2RMLVocabulary.iri)) { objectAtom = termFactory.getImmutableUriTemplate(objectAtom); // depends on control dependency: [if], data = [none] } } } // we check if it is a literal with language tag if (lan != null) { objectAtom = termFactory.getImmutableTypedTerm(objectAtom, lan); // depends on control dependency: [if], data = [none] } // we check if it is a typed literal if (datatype != null) { RDFDatatype type = typeFactory.getDatatype(datatype); objectAtom = termFactory.getImmutableTypedTerm(objectAtom, type); // depends on control dependency: [if], data = [none] } return objectAtom; } }
public class class_name { @GwtIncompatible("incompatible method") private static boolean annotationArrayMemberEquals(final Annotation[] a1, final Annotation[] a2) { if (a1.length != a2.length) { return false; } for (int i = 0; i < a1.length; i++) { if (!equals(a1[i], a2[i])) { return false; } } return true; } }
public class class_name { @GwtIncompatible("incompatible method") private static boolean annotationArrayMemberEquals(final Annotation[] a1, final Annotation[] a2) { if (a1.length != a2.length) { return false; // depends on control dependency: [if], data = [none] } for (int i = 0; i < a1.length; i++) { if (!equals(a1[i], a2[i])) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { public void leave(T physicalAddress) { if (trace) log.tracef("LEAVE(%s)", physicalAddress); Set<Address> remove = new HashSet<Address>(); for (Entry<Address, T> entry : nodes.entrySet()) { if (physicalAddress.equals(entry.getValue())) { remove.add(entry.getKey()); } } if (!remove.isEmpty()) { for (Address logicalAddress : remove) { nodes.remove(logicalAddress); DistributedWorkManager dwm = workManagerCoordinator.resolveDistributedWorkManager(logicalAddress); if (dwm != null) { Collection<NotificationListener> copy = new ArrayList<NotificationListener>(dwm.getNotificationListeners()); for (NotificationListener nl : copy) { nl.leave(logicalAddress); } } else { WorkManagerEventQueue wmeq = WorkManagerEventQueue.getInstance(); wmeq.addEvent(new WorkManagerEvent(WorkManagerEvent.TYPE_LEAVE, logicalAddress)); } } } } }
public class class_name { public void leave(T physicalAddress) { if (trace) log.tracef("LEAVE(%s)", physicalAddress); Set<Address> remove = new HashSet<Address>(); for (Entry<Address, T> entry : nodes.entrySet()) { if (physicalAddress.equals(entry.getValue())) { remove.add(entry.getKey()); // depends on control dependency: [if], data = [none] } } if (!remove.isEmpty()) { for (Address logicalAddress : remove) { nodes.remove(logicalAddress); // depends on control dependency: [for], data = [logicalAddress] DistributedWorkManager dwm = workManagerCoordinator.resolveDistributedWorkManager(logicalAddress); if (dwm != null) { Collection<NotificationListener> copy = new ArrayList<NotificationListener>(dwm.getNotificationListeners()); for (NotificationListener nl : copy) { nl.leave(logicalAddress); // depends on control dependency: [for], data = [nl] } } else { WorkManagerEventQueue wmeq = WorkManagerEventQueue.getInstance(); wmeq.addEvent(new WorkManagerEvent(WorkManagerEvent.TYPE_LEAVE, logicalAddress)); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public void setDragView(View dragView) { if (mDragView != null) { mDragView.setOnClickListener(null); } mDragView = dragView; if (mDragView != null) { mDragView.setClickable(true); mDragView.setFocusable(false); mDragView.setFocusableInTouchMode(false); mDragView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (!isEnabled()) return; if (!isPanelExpanded()) { expandPanel(mAnchorPoint); } else { collapsePanel(); } } });; } } }
public class class_name { public void setDragView(View dragView) { if (mDragView != null) { mDragView.setOnClickListener(null); // depends on control dependency: [if], data = [null)] } mDragView = dragView; if (mDragView != null) { mDragView.setClickable(true); // depends on control dependency: [if], data = [none] mDragView.setFocusable(false); // depends on control dependency: [if], data = [none] mDragView.setFocusableInTouchMode(false); // depends on control dependency: [if], data = [none] mDragView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (!isEnabled()) return; if (!isPanelExpanded()) { expandPanel(mAnchorPoint); // depends on control dependency: [if], data = [none] } else { collapsePanel(); // depends on control dependency: [if], data = [none] } } });; // depends on control dependency: [if], data = [none] } } }
public class class_name { public float getQuantile(final double fraction) { if (isEmpty()) { return Float.NaN; } if (fraction == 0.0) { return minValue_; } if (fraction == 1.0) { return maxValue_; } if ((fraction < 0.0) || (fraction > 1.0)) { throw new SketchesArgumentException("Fraction cannot be less than zero or greater than 1.0"); } final KllFloatsQuantileCalculator quant = getQuantileCalculator(); return quant.getQuantile(fraction); } }
public class class_name { public float getQuantile(final double fraction) { if (isEmpty()) { return Float.NaN; } // depends on control dependency: [if], data = [none] if (fraction == 0.0) { return minValue_; } // depends on control dependency: [if], data = [none] if (fraction == 1.0) { return maxValue_; } // depends on control dependency: [if], data = [none] if ((fraction < 0.0) || (fraction > 1.0)) { throw new SketchesArgumentException("Fraction cannot be less than zero or greater than 1.0"); } final KllFloatsQuantileCalculator quant = getQuantileCalculator(); return quant.getQuantile(fraction); } }
public class class_name { public void marshall(TimeToLiveDescription timeToLiveDescription, ProtocolMarshaller protocolMarshaller) { if (timeToLiveDescription == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(timeToLiveDescription.getTimeToLiveStatus(), TIMETOLIVESTATUS_BINDING); protocolMarshaller.marshall(timeToLiveDescription.getAttributeName(), ATTRIBUTENAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(TimeToLiveDescription timeToLiveDescription, ProtocolMarshaller protocolMarshaller) { if (timeToLiveDescription == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(timeToLiveDescription.getTimeToLiveStatus(), TIMETOLIVESTATUS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(timeToLiveDescription.getAttributeName(), ATTRIBUTENAME_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public boolean isTargetClassAndCurrentJvmTargetClassMatch() { Class<?> targetClassOnThisJVM; // JVM에 Class가 없는 상황 try { targetClassOnThisJVM = Class.forName(targetClassName); } catch (ClassNotFoundException e) { log.error("target class " + targetClassName + " does not exist on this JVM."); return false; } ObjectStreamClass osc = ObjectStreamClass.lookup(targetClassOnThisJVM); // JVM Class가 Not serializable if (osc == null) { return false; } return targetClassSerialVersionUID == osc.getSerialVersionUID(); } }
public class class_name { public boolean isTargetClassAndCurrentJvmTargetClassMatch() { Class<?> targetClassOnThisJVM; // JVM에 Class가 없는 상황 try { targetClassOnThisJVM = Class.forName(targetClassName); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException e) { log.error("target class " + targetClassName + " does not exist on this JVM."); return false; } // depends on control dependency: [catch], data = [none] ObjectStreamClass osc = ObjectStreamClass.lookup(targetClassOnThisJVM); // JVM Class가 Not serializable if (osc == null) { return false; // depends on control dependency: [if], data = [none] } return targetClassSerialVersionUID == osc.getSerialVersionUID(); } }
public class class_name { @SuppressWarnings("squid:S1168") public Element tableRow(int rowNum) { Element rows = tableRows(); if (rows == null) { return null; } if (numOfTableRows() < rowNum) { return null; } return rows.get(rowNum); } }
public class class_name { @SuppressWarnings("squid:S1168") public Element tableRow(int rowNum) { Element rows = tableRows(); if (rows == null) { return null; // depends on control dependency: [if], data = [none] } if (numOfTableRows() < rowNum) { return null; // depends on control dependency: [if], data = [none] } return rows.get(rowNum); } }
public class class_name { public static void main(String[] args) throws UnsupportedBusNumberException, IOException { // initialize bus final I2CBus bus = I2CFactory.getInstance(I2CBus.BUS_1); try { final MicrochipPotentiometer a = new MCP4641( bus, false, false, false, MicrochipPotentiometerChannel.A, MicrochipPotentiometerNonVolatileMode.VOLATILE_ONLY); final MicrochipPotentiometer b = new MCP4641( bus, false, false, false, MicrochipPotentiometerChannel.B, MicrochipPotentiometerNonVolatileMode.VOLATILE_ONLY); // Check device-status final MicrochipPotentiometerDeviceStatus aStatus = a.getDeviceStatus(); System.out.println("WiperLock for A active: " + aStatus.isWiperLockActive()); final MicrochipPotentiometerDeviceStatus bStatus = b.getDeviceStatus(); System.out.println("WiperLock for B active: " + bStatus.isWiperLockActive()); // print current values System.out.println("A: " + a.getCurrentValue() + "/" + a.updateCacheFromDevice()); System.out.println("B: " + b.getCurrentValue() + "/" + b.updateCacheFromDevice()); // for about 3 seconds for (int i = 0; i < MCP4641.maxValue() / 2; ++i) { // increase a a.increase(); // decrease b b.decrease(); // wait a little bit try { Thread.sleep(24); // assume 1 ms for I2C-communication } catch (InterruptedException e) { // never mind } } // print current values System.out.println("A: " + a.getCurrentValue() + "/" + a.updateCacheFromDevice()); System.out.println("B: " + b.getCurrentValue() + "/" + b.updateCacheFromDevice()); // 5 seconds at 26 steps boolean aDirectionUp = false; boolean bDirectionUp = true; final int counter1 = 5 * 26; for (int i = 0; i < counter1; ++i) { // change wipers if (aDirectionUp) { a.increase(10); } else { a.decrease(10); } if (bDirectionUp) { b.increase(10); } else { b.decrease(10); } // reverse direction if ((aDirectionUp && (a.getCurrentValue() == a.getMaxValue())) || (!aDirectionUp && (a.getCurrentValue() == 0))) { aDirectionUp = !aDirectionUp; } if ((bDirectionUp && (b.getCurrentValue() == b.getMaxValue())) || (!bDirectionUp && (b.getCurrentValue() == 0))) { bDirectionUp = !bDirectionUp; } // wait a little bit try { Thread.sleep(39); // assume 1 ms for I2C-communication } catch (InterruptedException e) { // never mind } } // 5 seconds at 2 steps Random randomizer = new Random(System.currentTimeMillis()); int counter2 = 5 * 2; for (int i = 0; i < counter2; ++i) { int nextA = randomizer.nextInt(MCP4641.maxValue() + 1); a.setCurrentValue(nextA); int nextB = randomizer.nextInt(MCP4641.maxValue() + 1); b.setCurrentValue(nextB); // wait a little bit try { Thread.sleep(499); // assume 1 ms for I2C-communication } catch (InterruptedException e) { // never mind } } // print current values System.out.println("A: " + a.getCurrentValue() + "/" + a.updateCacheFromDevice()); System.out.println("B: " + b.getCurrentValue() + "/" + b.updateCacheFromDevice()); // set non-volatile wipers to random values ((MCP4641)a).setNonVolatileMode(MicrochipPotentiometerNonVolatileMode.VOLATILE_AND_NONVOLATILE); int nextA = randomizer.nextInt(MCP4641.maxValue() + 1); a.setCurrentValue(nextA); int nextB = randomizer.nextInt(MCP4641.maxValue() + 1); b.setCurrentValue(nextB); } finally { try { bus.close(); } catch (Throwable e) { e.printStackTrace(); } } } }
public class class_name { public static void main(String[] args) throws UnsupportedBusNumberException, IOException { // initialize bus final I2CBus bus = I2CFactory.getInstance(I2CBus.BUS_1); try { final MicrochipPotentiometer a = new MCP4641( bus, false, false, false, MicrochipPotentiometerChannel.A, MicrochipPotentiometerNonVolatileMode.VOLATILE_ONLY); final MicrochipPotentiometer b = new MCP4641( bus, false, false, false, MicrochipPotentiometerChannel.B, MicrochipPotentiometerNonVolatileMode.VOLATILE_ONLY); // Check device-status final MicrochipPotentiometerDeviceStatus aStatus = a.getDeviceStatus(); System.out.println("WiperLock for A active: " + aStatus.isWiperLockActive()); final MicrochipPotentiometerDeviceStatus bStatus = b.getDeviceStatus(); System.out.println("WiperLock for B active: " + bStatus.isWiperLockActive()); // print current values System.out.println("A: " + a.getCurrentValue() + "/" + a.updateCacheFromDevice()); System.out.println("B: " + b.getCurrentValue() + "/" + b.updateCacheFromDevice()); // for about 3 seconds for (int i = 0; i < MCP4641.maxValue() / 2; ++i) { // increase a a.increase(); // depends on control dependency: [for], data = [none] // decrease b b.decrease(); // depends on control dependency: [for], data = [none] // wait a little bit try { Thread.sleep(24); // assume 1 ms for I2C-communication // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { // never mind } // depends on control dependency: [catch], data = [none] } // print current values System.out.println("A: " + a.getCurrentValue() + "/" + a.updateCacheFromDevice()); System.out.println("B: " + b.getCurrentValue() + "/" + b.updateCacheFromDevice()); // 5 seconds at 26 steps boolean aDirectionUp = false; boolean bDirectionUp = true; final int counter1 = 5 * 26; for (int i = 0; i < counter1; ++i) { // change wipers if (aDirectionUp) { a.increase(10); // depends on control dependency: [if], data = [none] } else { a.decrease(10); // depends on control dependency: [if], data = [none] } if (bDirectionUp) { b.increase(10); // depends on control dependency: [if], data = [none] } else { b.decrease(10); // depends on control dependency: [if], data = [none] } // reverse direction if ((aDirectionUp && (a.getCurrentValue() == a.getMaxValue())) || (!aDirectionUp && (a.getCurrentValue() == 0))) { aDirectionUp = !aDirectionUp; // depends on control dependency: [if], data = [none] } if ((bDirectionUp && (b.getCurrentValue() == b.getMaxValue())) || (!bDirectionUp && (b.getCurrentValue() == 0))) { bDirectionUp = !bDirectionUp; // depends on control dependency: [if], data = [none] } // wait a little bit try { Thread.sleep(39); // assume 1 ms for I2C-communication // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { // never mind } // depends on control dependency: [catch], data = [none] } // 5 seconds at 2 steps Random randomizer = new Random(System.currentTimeMillis()); int counter2 = 5 * 2; for (int i = 0; i < counter2; ++i) { int nextA = randomizer.nextInt(MCP4641.maxValue() + 1); a.setCurrentValue(nextA); // depends on control dependency: [for], data = [none] int nextB = randomizer.nextInt(MCP4641.maxValue() + 1); b.setCurrentValue(nextB); // depends on control dependency: [for], data = [none] // wait a little bit try { Thread.sleep(499); // assume 1 ms for I2C-communication // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { // never mind } // depends on control dependency: [catch], data = [none] } // print current values System.out.println("A: " + a.getCurrentValue() + "/" + a.updateCacheFromDevice()); System.out.println("B: " + b.getCurrentValue() + "/" + b.updateCacheFromDevice()); // set non-volatile wipers to random values ((MCP4641)a).setNonVolatileMode(MicrochipPotentiometerNonVolatileMode.VOLATILE_AND_NONVOLATILE); int nextA = randomizer.nextInt(MCP4641.maxValue() + 1); a.setCurrentValue(nextA); int nextB = randomizer.nextInt(MCP4641.maxValue() + 1); b.setCurrentValue(nextB); } finally { try { bus.close(); // depends on control dependency: [try], data = [none] } catch (Throwable e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { @Override public Object getProperty(IClientConfigKey key, Object defaultVal){ Object val = getProperty(key); if (val == null){ return defaultVal; } return val; } }
public class class_name { @Override public Object getProperty(IClientConfigKey key, Object defaultVal){ Object val = getProperty(key); if (val == null){ return defaultVal; // depends on control dependency: [if], data = [none] } return val; } }
public class class_name { private String getActivityID(Task task) { String result = null; if (m_activityIDField != null) { Object value = task.getCachedValue(m_activityIDField); if (value != null) { result = value.toString(); } } return result; } }
public class class_name { private String getActivityID(Task task) { String result = null; if (m_activityIDField != null) { Object value = task.getCachedValue(m_activityIDField); if (value != null) { result = value.toString(); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { @Override public void close() { log.debug("close"); // spawn a thread to finish up our flv writer work boolean locked = false; try { // try to get a lock within x time locked = lock.tryAcquire(500L, TimeUnit.MILLISECONDS); if (locked) { finalizeFlv(); } } catch (InterruptedException e) { log.warn("Exception acquiring lock", e); } finally { if (locked) { lock.release(); } if (executor != null && !executor.isTerminated()) { executor.shutdown(); } } } }
public class class_name { @Override public void close() { log.debug("close"); // spawn a thread to finish up our flv writer work boolean locked = false; try { // try to get a lock within x time locked = lock.tryAcquire(500L, TimeUnit.MILLISECONDS); // depends on control dependency: [try], data = [none] if (locked) { finalizeFlv(); // depends on control dependency: [if], data = [none] } } catch (InterruptedException e) { log.warn("Exception acquiring lock", e); } finally { // depends on control dependency: [catch], data = [none] if (locked) { lock.release(); // depends on control dependency: [if], data = [none] } if (executor != null && !executor.isTerminated()) { executor.shutdown(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @SafeVarargs public static <T> T[] insertAll(final T[] a, final int index, final T... b) { N.checkArgNotNull(a, "a"); final T[] newArray = (T[]) Array.newInstance(a.getClass().getComponentType(), a.length + b.length); if (index > 0) { copy(a, 0, newArray, 0, index); } copy(b, 0, newArray, index, b.length); if (index < a.length) { copy(a, index, newArray, index + b.length, a.length - index); } return newArray; } }
public class class_name { @SafeVarargs public static <T> T[] insertAll(final T[] a, final int index, final T... b) { N.checkArgNotNull(a, "a"); final T[] newArray = (T[]) Array.newInstance(a.getClass().getComponentType(), a.length + b.length); if (index > 0) { copy(a, 0, newArray, 0, index); // depends on control dependency: [if], data = [none] } copy(b, 0, newArray, index, b.length); if (index < a.length) { copy(a, index, newArray, index + b.length, a.length - index); // depends on control dependency: [if], data = [none] } return newArray; } }
public class class_name { public void setOrganizationNodes(java.util.Collection<OrganizationNode> organizationNodes) { if (organizationNodes == null) { this.organizationNodes = null; return; } this.organizationNodes = new java.util.ArrayList<OrganizationNode>(organizationNodes); } }
public class class_name { public void setOrganizationNodes(java.util.Collection<OrganizationNode> organizationNodes) { if (organizationNodes == null) { this.organizationNodes = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.organizationNodes = new java.util.ArrayList<OrganizationNode>(organizationNodes); } }
public class class_name { public static HashMap<String, ArrayList<String>> getIcnDistribution(HashMap data, String icin) { HashMap<String, ArrayList<String>> results = new HashMap<String, ArrayList<String>>(); ArrayList<HashMap<String, String>> soilLayers; soilLayers = getSoilLayer(data); icin = sum(icin); if (icin == null) { LOG.error("Input variable ICIN come with invalid value icin={}", icin); return results; } String lastSllb = "0"; String[] productSBXTH = new String[soilLayers.size()]; for (int i = 0; i < soilLayers.size(); i++) { HashMap<String, String> soilLayer = soilLayers.get(i); String sllb = getValueOr(soilLayer, "sllb", ""); String slbdm = getValueOr(soilLayer, "slbdm", ""); String thick = substract(sllb, lastSllb); productSBXTH[i] = product(slbdm, thick); if (productSBXTH[i] == null) { LOG.error("Invalid SLLB and/or SLBDM in the soil layer data with value sllb={}, slbdm={}", sllb, slbdm); return results; } lastSllb = sllb; } String totalSBXTH = sum(productSBXTH); if (compare(totalSBXTH, "0", CompareMode.EQUAL)) { LOG.error("Total SLBDM * thick is 0"); return results; } String nppm = divide(product(icin, "10"), totalSBXTH); String icnh4 = product("0.1", nppm); String icno3 = product("0.9", nppm); ArrayList<String> icnTotArr = new ArrayList(); ArrayList<String> icnh4Arr = new ArrayList(); ArrayList<String> icno3Arr = new ArrayList(); for (int i = 0; i < productSBXTH.length; i++) { String icn_tot = divide(product(productSBXTH[i], icin), totalSBXTH); icnTotArr.add(round(icn_tot, 2)); icnh4Arr.add(round(icnh4, 2)); icno3Arr.add(round(icno3, 2)); } results.put("icn_tot", icnTotArr); results.put("icnh4", icnh4Arr); results.put("icno3", icno3Arr); return results; } }
public class class_name { public static HashMap<String, ArrayList<String>> getIcnDistribution(HashMap data, String icin) { HashMap<String, ArrayList<String>> results = new HashMap<String, ArrayList<String>>(); ArrayList<HashMap<String, String>> soilLayers; soilLayers = getSoilLayer(data); icin = sum(icin); if (icin == null) { LOG.error("Input variable ICIN come with invalid value icin={}", icin); // depends on control dependency: [if], data = [none] return results; // depends on control dependency: [if], data = [none] } String lastSllb = "0"; String[] productSBXTH = new String[soilLayers.size()]; for (int i = 0; i < soilLayers.size(); i++) { HashMap<String, String> soilLayer = soilLayers.get(i); String sllb = getValueOr(soilLayer, "sllb", ""); String slbdm = getValueOr(soilLayer, "slbdm", ""); String thick = substract(sllb, lastSllb); productSBXTH[i] = product(slbdm, thick); // depends on control dependency: [for], data = [i] if (productSBXTH[i] == null) { LOG.error("Invalid SLLB and/or SLBDM in the soil layer data with value sllb={}, slbdm={}", sllb, slbdm); // depends on control dependency: [if], data = [none] return results; // depends on control dependency: [if], data = [none] } lastSllb = sllb; // depends on control dependency: [for], data = [none] } String totalSBXTH = sum(productSBXTH); if (compare(totalSBXTH, "0", CompareMode.EQUAL)) { LOG.error("Total SLBDM * thick is 0"); // depends on control dependency: [if], data = [none] return results; // depends on control dependency: [if], data = [none] } String nppm = divide(product(icin, "10"), totalSBXTH); String icnh4 = product("0.1", nppm); String icno3 = product("0.9", nppm); ArrayList<String> icnTotArr = new ArrayList(); ArrayList<String> icnh4Arr = new ArrayList(); ArrayList<String> icno3Arr = new ArrayList(); for (int i = 0; i < productSBXTH.length; i++) { String icn_tot = divide(product(productSBXTH[i], icin), totalSBXTH); icnTotArr.add(round(icn_tot, 2)); // depends on control dependency: [for], data = [none] icnh4Arr.add(round(icnh4, 2)); // depends on control dependency: [for], data = [none] icno3Arr.add(round(icno3, 2)); // depends on control dependency: [for], data = [none] } results.put("icn_tot", icnTotArr); results.put("icnh4", icnh4Arr); results.put("icno3", icno3Arr); return results; } }
public class class_name { public DescribeDirectoryConfigsResult withDirectoryConfigs(DirectoryConfig... directoryConfigs) { if (this.directoryConfigs == null) { setDirectoryConfigs(new java.util.ArrayList<DirectoryConfig>(directoryConfigs.length)); } for (DirectoryConfig ele : directoryConfigs) { this.directoryConfigs.add(ele); } return this; } }
public class class_name { public DescribeDirectoryConfigsResult withDirectoryConfigs(DirectoryConfig... directoryConfigs) { if (this.directoryConfigs == null) { setDirectoryConfigs(new java.util.ArrayList<DirectoryConfig>(directoryConfigs.length)); // depends on control dependency: [if], data = [none] } for (DirectoryConfig ele : directoryConfigs) { this.directoryConfigs.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private void readHeader() { String id = ""; for (int i = 0; i < 6; i++) { id += (char) read(); } if (!id.startsWith("GIF")) { header.status = GifDecoder.STATUS_FORMAT_ERROR; return; } readLSD(); if (header.gctFlag && !err()) { header.gct = readColorTable(header.gctSize); header.bgColor = header.gct[header.bgIndex]; } } }
public class class_name { private void readHeader() { String id = ""; for (int i = 0; i < 6; i++) { id += (char) read(); // depends on control dependency: [for], data = [none] } if (!id.startsWith("GIF")) { header.status = GifDecoder.STATUS_FORMAT_ERROR; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } readLSD(); if (header.gctFlag && !err()) { header.gct = readColorTable(header.gctSize); // depends on control dependency: [if], data = [none] header.bgColor = header.gct[header.bgIndex]; // depends on control dependency: [if], data = [none] } } }
public class class_name { protected VarRefAssignExpress parseAssingInExp(AssignGeneralInExpContext agc) { VarRefAssignExpress vas = null; ExpressionContext expCtx = agc.generalAssignExp().expression(); Expression exp = parseExpress(expCtx); VarRefContext varRefCtx = agc.generalAssignExp().varRef(); VarRef ref = this.parseVarRefInLeftExpression(varRefCtx); vas = new VarRefAssignExpress(exp,ref); if (ref.attributes.length==0) { // 变量定义: Token token = varRefCtx.Identifier().getSymbol(); if (pbCtx.hasDefined(token.getText()) != null) { registerVar(vas); return vas; } else { BeetlException ex = new BeetlException(BeetlException.VAR_NOT_DEFINED); ex.pushToken(this.getBTToken(token)); throw ex; } } return vas; } }
public class class_name { protected VarRefAssignExpress parseAssingInExp(AssignGeneralInExpContext agc) { VarRefAssignExpress vas = null; ExpressionContext expCtx = agc.generalAssignExp().expression(); Expression exp = parseExpress(expCtx); VarRefContext varRefCtx = agc.generalAssignExp().varRef(); VarRef ref = this.parseVarRefInLeftExpression(varRefCtx); vas = new VarRefAssignExpress(exp,ref); if (ref.attributes.length==0) { // 变量定义: Token token = varRefCtx.Identifier().getSymbol(); if (pbCtx.hasDefined(token.getText()) != null) { registerVar(vas); // depends on control dependency: [if], data = [none] return vas; // depends on control dependency: [if], data = [none] } else { BeetlException ex = new BeetlException(BeetlException.VAR_NOT_DEFINED); ex.pushToken(this.getBTToken(token)); // depends on control dependency: [if], data = [none] throw ex; } } return vas; } }
public class class_name { public static RangeInclusiveL checkRangeIncludedInLong( final RangeInclusiveL inner, final String inner_name, final RangeInclusiveL outer, final String outer_name) { Objects.requireNonNull(inner, "Inner range"); Objects.requireNonNull(inner_name, "Inner range name"); Objects.requireNonNull(outer, "Outer range"); Objects.requireNonNull(outer_name, "Outer range name"); if (inner.isIncludedIn(outer)) { return inner; } final var message = String.format( "Inner range %s (%s) not included in outer range %s (%s)", inner_name, inner, outer_name, outer); throw new RangeCheckException(message); } }
public class class_name { public static RangeInclusiveL checkRangeIncludedInLong( final RangeInclusiveL inner, final String inner_name, final RangeInclusiveL outer, final String outer_name) { Objects.requireNonNull(inner, "Inner range"); Objects.requireNonNull(inner_name, "Inner range name"); Objects.requireNonNull(outer, "Outer range"); Objects.requireNonNull(outer_name, "Outer range name"); if (inner.isIncludedIn(outer)) { return inner; // depends on control dependency: [if], data = [none] } final var message = String.format( "Inner range %s (%s) not included in outer range %s (%s)", inner_name, inner, outer_name, outer); throw new RangeCheckException(message); } }
public class class_name { @Override public EEnum getCompareType() { if (compareTypeEEnum == null) { compareTypeEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(35); } return compareTypeEEnum; } }
public class class_name { @Override public EEnum getCompareType() { if (compareTypeEEnum == null) { compareTypeEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(35); // depends on control dependency: [if], data = [none] } return compareTypeEEnum; } }
public class class_name { @Override public void accept(Visitor<Operator<?>> visitor) { boolean descend = visitor.preVisit(this); if (descend) { this.input1.accept(visitor); this.input2.accept(visitor); for (Operator<?> c : this.broadcastInputs.values()) { c.accept(visitor); } visitor.postVisit(this); } } }
public class class_name { @Override public void accept(Visitor<Operator<?>> visitor) { boolean descend = visitor.preVisit(this); if (descend) { this.input1.accept(visitor); this.input2.accept(visitor); for (Operator<?> c : this.broadcastInputs.values()) { c.accept(visitor); // depends on control dependency: [for], data = [c] } visitor.postVisit(this); } } }
public class class_name { @Nullable @Override public SolrPersistentProperty getScoreProperty() { SolrPersistentProperty scoreProperty = getPersistentProperty(Score.class); if (scoreProperty != null) { return scoreProperty; } return getPersistentProperty(org.springframework.data.solr.repository.Score.class); } }
public class class_name { @Nullable @Override public SolrPersistentProperty getScoreProperty() { SolrPersistentProperty scoreProperty = getPersistentProperty(Score.class); if (scoreProperty != null) { return scoreProperty; // depends on control dependency: [if], data = [none] } return getPersistentProperty(org.springframework.data.solr.repository.Score.class); } }
public class class_name { HttpParameter[] asPostParameterArray() { List<HttpParameter> list = asPostParameterList(SMCP, COUNT); if (list.size() == 0) { return NULL_PARAMETER_ARRAY; } return list.toArray(new HttpParameter[list.size()]); } }
public class class_name { HttpParameter[] asPostParameterArray() { List<HttpParameter> list = asPostParameterList(SMCP, COUNT); if (list.size() == 0) { return NULL_PARAMETER_ARRAY; // depends on control dependency: [if], data = [none] } return list.toArray(new HttpParameter[list.size()]); } }
public class class_name { protected String postProcess(String trimmedWord, String pluralizedWord) { if (pluPattern1.matcher(trimmedWord).matches()) { return pluralizedWord.toUpperCase(locale); } else if (pluPattern2.matcher(trimmedWord).matches()) { return pluralizedWord.substring(0, 1) .toUpperCase(locale) + pluralizedWord.substring(1); } return pluralizedWord; } }
public class class_name { protected String postProcess(String trimmedWord, String pluralizedWord) { if (pluPattern1.matcher(trimmedWord).matches()) { return pluralizedWord.toUpperCase(locale); // depends on control dependency: [if], data = [none] } else if (pluPattern2.matcher(trimmedWord).matches()) { return pluralizedWord.substring(0, 1) .toUpperCase(locale) + pluralizedWord.substring(1); } // depends on control dependency: [if], data = [none] return pluralizedWord; } }
public class class_name { protected Object convertValue(AnnotatedElement element, String value) { Class<?> type = getValueType(element); Type genericType = getValueGenericType(element); try { if (element.isAnnotationPresent(Use.class)) { Converter converter = getConverterForElementWithUseAnnotation(element); return converter.convert(value); } if (Collection.class.isAssignableFrom(type)) { return manager.convert(type, getCollectionElementType(genericType), value); } return manager.convert(type, value); } catch (Exception e) { throw new PropertyLoaderException(String.format( "Can't convert value <%s> to type <%s>", value, type), e); } } }
public class class_name { protected Object convertValue(AnnotatedElement element, String value) { Class<?> type = getValueType(element); Type genericType = getValueGenericType(element); try { if (element.isAnnotationPresent(Use.class)) { Converter converter = getConverterForElementWithUseAnnotation(element); return converter.convert(value); // depends on control dependency: [if], data = [none] } if (Collection.class.isAssignableFrom(type)) { return manager.convert(type, getCollectionElementType(genericType), value); // depends on control dependency: [if], data = [none] } return manager.convert(type, value); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new PropertyLoaderException(String.format( "Can't convert value <%s> to type <%s>", value, type), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void startTimer() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "startTimer"); btmLockManager.lockExclusive(); try { //only start if currently stopped if (isStopped) { //set stopped to false isStopped = false; //iterate over the entries currently in the active list LinkedListEntry entry = (LinkedListEntry) activeEntries.getFirst(); while(entry != null && activeEntries.contains(entry)) { //start an alarm for each entry startNewAlarm(entry); entry = (LinkedListEntry) entry.getNext(); } } } finally { btmLockManager.unlockExclusive(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "startTimer"); } }
public class class_name { public void startTimer() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "startTimer"); btmLockManager.lockExclusive(); try { //only start if currently stopped if (isStopped) { //set stopped to false isStopped = false; // depends on control dependency: [if], data = [none] //iterate over the entries currently in the active list LinkedListEntry entry = (LinkedListEntry) activeEntries.getFirst(); while(entry != null && activeEntries.contains(entry)) { //start an alarm for each entry startNewAlarm(entry); // depends on control dependency: [while], data = [(entry] entry = (LinkedListEntry) entry.getNext(); // depends on control dependency: [while], data = [none] } } } finally { btmLockManager.unlockExclusive(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "startTimer"); } }
public class class_name { public ImmutableList<String> readLines() throws IOException { Closer closer = Closer.create(); try { BufferedReader reader = closer.register(openBufferedStream()); List<String> result = Lists.newArrayList(); String line; while ((line = reader.readLine()) != null) { result.add(line); } return ImmutableList.copyOf(result); } catch (Throwable e) { throw closer.rethrow(e); } finally { closer.close(); } } }
public class class_name { public ImmutableList<String> readLines() throws IOException { Closer closer = Closer.create(); try { BufferedReader reader = closer.register(openBufferedStream()); List<String> result = Lists.newArrayList(); String line; while ((line = reader.readLine()) != null) { result.add(line); // depends on control dependency: [while], data = [none] } return ImmutableList.copyOf(result); } catch (Throwable e) { throw closer.rethrow(e); } finally { closer.close(); } } }
public class class_name { private static Map<String, String> genericNameValueProcess(String s) { Map<String, String> params = new HashMap<String, String>(); List<String> parameters = split(s, ";"); for (String parameter : parameters) { List<String> parts = split(parameter, "="); // do a check, otherwise we might get NPE if (parts.size() == 2) { String second = parts.get(1).trim(); if (second.startsWith("\"") && second.endsWith("\"")) second = second.substring(1, second.length() - 1); String first = parts.get(0).trim(); // make sure for directives we clear out any space as in "directive :=value" if (first.endsWith(":")) { first = first.substring(0, first.length() - 1).trim() + ":"; } params.put(first, second); } } return params; } }
public class class_name { private static Map<String, String> genericNameValueProcess(String s) { Map<String, String> params = new HashMap<String, String>(); List<String> parameters = split(s, ";"); for (String parameter : parameters) { List<String> parts = split(parameter, "="); // do a check, otherwise we might get NPE if (parts.size() == 2) { String second = parts.get(1).trim(); if (second.startsWith("\"") && second.endsWith("\"")) second = second.substring(1, second.length() - 1); String first = parts.get(0).trim(); // make sure for directives we clear out any space as in "directive :=value" if (first.endsWith(":")) { first = first.substring(0, first.length() - 1).trim() + ":"; // depends on control dependency: [if], data = [none] } params.put(first, second); // depends on control dependency: [if], data = [none] } } return params; } }
public class class_name { @Route(method = HttpMethod.POST, uri = "/json/hello") public Result hello() { JsonNode json = context().body(JsonNode.class); if (json == null) { return badRequest("Expecting Json data"); } else { String name = json.findPath("name").textValue(); if (name == null) { return badRequest("Missing parameter [name]"); } else { return ok("Hello " + name); } } } }
public class class_name { @Route(method = HttpMethod.POST, uri = "/json/hello") public Result hello() { JsonNode json = context().body(JsonNode.class); if (json == null) { return badRequest("Expecting Json data"); // depends on control dependency: [if], data = [none] } else { String name = json.findPath("name").textValue(); if (name == null) { return badRequest("Missing parameter [name]"); // depends on control dependency: [if], data = [none] } else { return ok("Hello " + name); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static int findFirstNonCellNamePosition(String input, int startPosition) { char c; for (int i = startPosition; i < input.length(); i++) { c = input.charAt(i); if ( c!='$' && !Character.isLetterOrDigit(c)) { return i; } } return -1; // not found } }
public class class_name { public static int findFirstNonCellNamePosition(String input, int startPosition) { char c; for (int i = startPosition; i < input.length(); i++) { c = input.charAt(i); // depends on control dependency: [for], data = [i] if ( c!='$' && !Character.isLetterOrDigit(c)) { return i; // depends on control dependency: [if], data = [none] } } return -1; // not found } }
public class class_name { @SuppressWarnings("unchecked") @Override public T getEndpoint(String nodeID) { Endpoint[] array; if (nodeID == null && preferLocal) { array = getEndpointsByNodeID(this.nodeID); if (array.length == 0) { array = endpoints; } } else { array = getEndpointsByNodeID(nodeID); } if (array.length == 0) { return null; } if (array.length == 1) { return (T) array[0]; } return (T) next(array); } }
public class class_name { @SuppressWarnings("unchecked") @Override public T getEndpoint(String nodeID) { Endpoint[] array; if (nodeID == null && preferLocal) { array = getEndpointsByNodeID(this.nodeID); // depends on control dependency: [if], data = [none] if (array.length == 0) { array = endpoints; // depends on control dependency: [if], data = [none] } } else { array = getEndpointsByNodeID(nodeID); // depends on control dependency: [if], data = [(nodeID] } if (array.length == 0) { return null; // depends on control dependency: [if], data = [none] } if (array.length == 1) { return (T) array[0]; // depends on control dependency: [if], data = [none] } return (T) next(array); } }
public class class_name { @Override public EClass getIfcResourceObjectSelect() { if (ifcResourceObjectSelectEClass == null) { ifcResourceObjectSelectEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(1153); } return ifcResourceObjectSelectEClass; } }
public class class_name { @Override public EClass getIfcResourceObjectSelect() { if (ifcResourceObjectSelectEClass == null) { ifcResourceObjectSelectEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(1153); // depends on control dependency: [if], data = [none] } return ifcResourceObjectSelectEClass; } }
public class class_name { private void handleAlarm() { AlarmListener listener = getListener(); if (listener == null) { return; } Thread thread = Thread.currentThread(); ClassLoader loader = getContextLoader(); if (loader != null) { thread.setContextClassLoader(loader); } else { thread.setContextClassLoader(_systemLoader); } try { listener.handleAlarm(this); } finally { thread.setContextClassLoader(_systemLoader); } } }
public class class_name { private void handleAlarm() { AlarmListener listener = getListener(); if (listener == null) { return; // depends on control dependency: [if], data = [none] } Thread thread = Thread.currentThread(); ClassLoader loader = getContextLoader(); if (loader != null) { thread.setContextClassLoader(loader); // depends on control dependency: [if], data = [(loader] } else { thread.setContextClassLoader(_systemLoader); // depends on control dependency: [if], data = [none] } try { listener.handleAlarm(this); // depends on control dependency: [try], data = [none] } finally { thread.setContextClassLoader(_systemLoader); } } }
public class class_name { public static <S extends Solution<?>> List<S> getSubsetOfEvenlyDistributedSolutions( List<S> solutionList, int newSolutionListSize) { List<S> resultSolutionList = new ArrayList<>(newSolutionListSize) ; if (solutionList == null) { throw new JMetalException("The solution list is null") ; } if (solutionList.size() > 0) { int numberOfObjectives = solutionList.get(0).getNumberOfObjectives() ; if (numberOfObjectives == 2) { twoObjectivesCase(solutionList, resultSolutionList, newSolutionListSize) ; } else { moreThanTwoObjectivesCase(solutionList, resultSolutionList, newSolutionListSize) ; } } return resultSolutionList ; } }
public class class_name { public static <S extends Solution<?>> List<S> getSubsetOfEvenlyDistributedSolutions( List<S> solutionList, int newSolutionListSize) { List<S> resultSolutionList = new ArrayList<>(newSolutionListSize) ; if (solutionList == null) { throw new JMetalException("The solution list is null") ; } if (solutionList.size() > 0) { int numberOfObjectives = solutionList.get(0).getNumberOfObjectives() ; if (numberOfObjectives == 2) { twoObjectivesCase(solutionList, resultSolutionList, newSolutionListSize) ; // depends on control dependency: [if], data = [none] } else { moreThanTwoObjectivesCase(solutionList, resultSolutionList, newSolutionListSize) ; // depends on control dependency: [if], data = [none] } } return resultSolutionList ; } }
public class class_name { @Override public void execute(TridentTuple tuple, TridentCollector collector) { Map<String, String> logMap = null; try { logMap = convertToMap(tuple); } catch (IOException ex) { logger.warn("Map convert failed. Trash tuple. Tuple=" + tuple, ex); return; } try { ApacheLog convertedEntity = createEntity(logMap); collector.emit(new Values(convertedEntity.getKey(), convertedEntity)); } catch (Exception ex) { logger.info("Entity convert failed. Trash tuple. LogMap=" + logMap, ex); } } }
public class class_name { @Override public void execute(TridentTuple tuple, TridentCollector collector) { Map<String, String> logMap = null; try { logMap = convertToMap(tuple); // depends on control dependency: [try], data = [none] } catch (IOException ex) { logger.warn("Map convert failed. Trash tuple. Tuple=" + tuple, ex); return; } // depends on control dependency: [catch], data = [none] try { ApacheLog convertedEntity = createEntity(logMap); collector.emit(new Values(convertedEntity.getKey(), convertedEntity)); // depends on control dependency: [try], data = [none] } catch (Exception ex) { logger.info("Entity convert failed. Trash tuple. LogMap=" + logMap, ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); if (cls.getMajor() >= Const.MAJOR_1_5) { stack = new OpcodeStack(); checkedFields = new HashSet<>(); enumRegs = new HashMap<>(); enumFields = new HashMap<>(); super.visitClassContext(classContext); } } finally { stack = null; checkedFields = null; enumRegs = null; enumFields = null; } } }
public class class_name { @Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); if (cls.getMajor() >= Const.MAJOR_1_5) { stack = new OpcodeStack(); // depends on control dependency: [if], data = [none] checkedFields = new HashSet<>(); // depends on control dependency: [if], data = [none] enumRegs = new HashMap<>(); // depends on control dependency: [if], data = [none] enumFields = new HashMap<>(); // depends on control dependency: [if], data = [none] super.visitClassContext(classContext); // depends on control dependency: [if], data = [none] } } finally { stack = null; checkedFields = null; enumRegs = null; enumFields = null; } } }
public class class_name { protected T build() { final T instance; try { instance = build(connection(), maxContentLength(), isValidateHttpHeaders(), isPropagateSettings()); } catch (Throwable t) { throw new IllegalStateException("failed to create a new InboundHttp2ToHttpAdapter", t); } connection.addListener(instance); return instance; } }
public class class_name { protected T build() { final T instance; try { instance = build(connection(), maxContentLength(), isValidateHttpHeaders(), isPropagateSettings()); // depends on control dependency: [try], data = [none] } catch (Throwable t) { throw new IllegalStateException("failed to create a new InboundHttp2ToHttpAdapter", t); } // depends on control dependency: [catch], data = [none] connection.addListener(instance); return instance; } }
public class class_name { private void resolveName(ConfigurationMetadataItem item) { item.setName(item.getId()); // fallback ConfigurationMetadataSource source = getSource(item); if (source != null) { String groupId = source.getGroupId(); String dottedPrefix = groupId + "."; String id = item.getId(); if (hasLength(groupId) && id.startsWith(dottedPrefix)) { String name = id.substring(dottedPrefix.length()); item.setName(name); } } } }
public class class_name { private void resolveName(ConfigurationMetadataItem item) { item.setName(item.getId()); // fallback ConfigurationMetadataSource source = getSource(item); if (source != null) { String groupId = source.getGroupId(); String dottedPrefix = groupId + "."; String id = item.getId(); if (hasLength(groupId) && id.startsWith(dottedPrefix)) { String name = id.substring(dottedPrefix.length()); item.setName(name); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public synchronized void remoteServerRegistrations(RESTRequest request) { Iterator<Entry<NotificationTargetInformation, List<ServerNotification>>> serverNotificationsIter = serverNotifications.entrySet().iterator(); while (serverNotificationsIter.hasNext()) { Entry<NotificationTargetInformation, List<ServerNotification>> entry = serverNotificationsIter.next(); NotificationTargetInformation nti = entry.getKey(); // Check whether the producer of the notification is local or remote. if (nti.getRoutingInformation() == null) { //Traverse the list for that ObjectName ObjectName objName = RESTHelper.objectNameConverter(nti.getNameAsString(), false, null); if (MBeanServerHelper.isRegistered(objName)) { for (ServerNotification notification : entry.getValue()) { MBeanServerHelper.removeServerNotification(objName, notification.listener, (NotificationFilter) getObject(notification.filter, null, null), getObject(notification.handback, null, null), null); } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "The MBean is not registered with the MBean server."); } } } else { // Remove the notification listener from the Target-Client Manager through EventAdmin MBeanRoutedNotificationHelper helper = MBeanRoutedNotificationHelper.getMBeanRoutedNotificationHelper(); for (ServerNotification notification : entry.getValue()) { helper.removeRoutedServerNotificationListener(nti, notification.listener, (NotificationFilter) getObject(notification.filter, null, null), getObject(notification.handback, null, null), null); } } } //Clear the map serverNotifications.clear(); //We don't have any more server notifications, so we can clear our library clearObjectLibrary(); } }
public class class_name { public synchronized void remoteServerRegistrations(RESTRequest request) { Iterator<Entry<NotificationTargetInformation, List<ServerNotification>>> serverNotificationsIter = serverNotifications.entrySet().iterator(); while (serverNotificationsIter.hasNext()) { Entry<NotificationTargetInformation, List<ServerNotification>> entry = serverNotificationsIter.next(); NotificationTargetInformation nti = entry.getKey(); // Check whether the producer of the notification is local or remote. if (nti.getRoutingInformation() == null) { //Traverse the list for that ObjectName ObjectName objName = RESTHelper.objectNameConverter(nti.getNameAsString(), false, null); if (MBeanServerHelper.isRegistered(objName)) { for (ServerNotification notification : entry.getValue()) { MBeanServerHelper.removeServerNotification(objName, notification.listener, (NotificationFilter) getObject(notification.filter, null, null), getObject(notification.handback, null, null), null); // depends on control dependency: [for], data = [none] } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "The MBean is not registered with the MBean server."); // depends on control dependency: [if], data = [none] } } } else { // Remove the notification listener from the Target-Client Manager through EventAdmin MBeanRoutedNotificationHelper helper = MBeanRoutedNotificationHelper.getMBeanRoutedNotificationHelper(); for (ServerNotification notification : entry.getValue()) { helper.removeRoutedServerNotificationListener(nti, notification.listener, (NotificationFilter) getObject(notification.filter, null, null), getObject(notification.handback, null, null), null); // depends on control dependency: [for], data = [none] } } } //Clear the map serverNotifications.clear(); //We don't have any more server notifications, so we can clear our library clearObjectLibrary(); } }
public class class_name { @Override public void onNext(final TransportEvent e) { final RemoteEvent<byte[]> re = codec.decode(e.getData()); re.setLocalAddress(e.getLocalAddress()); re.setRemoteAddress(e.getRemoteAddress()); if (LOG.isLoggable(Level.FINER)) { LOG.log(Level.FINER, "{0} {1}", new Object[]{e, re}); } handler.onNext(re); } }
public class class_name { @Override public void onNext(final TransportEvent e) { final RemoteEvent<byte[]> re = codec.decode(e.getData()); re.setLocalAddress(e.getLocalAddress()); re.setRemoteAddress(e.getRemoteAddress()); if (LOG.isLoggable(Level.FINER)) { LOG.log(Level.FINER, "{0} {1}", new Object[]{e, re}); // depends on control dependency: [if], data = [none] } handler.onNext(re); } }
public class class_name { public String getFormattedMessage(String key, Object[] args, String defaultString) { try { String result = getString(key); return MessageFormat.format(result, args); } catch (MissingResourceException e) { return MessageFormat.format(defaultString, args); } } }
public class class_name { public String getFormattedMessage(String key, Object[] args, String defaultString) { try { String result = getString(key); return MessageFormat.format(result, args); // depends on control dependency: [try], data = [none] } catch (MissingResourceException e) { return MessageFormat.format(defaultString, args); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private TextToken text(Token prev) { int startIndex = curCharIndex; while (curChar != '{' && curChar != EOF) { consume(); } return new TextToken(prev, curCharIndex - startIndex); } }
public class class_name { private TextToken text(Token prev) { int startIndex = curCharIndex; while (curChar != '{' && curChar != EOF) { consume(); // depends on control dependency: [while], data = [none] } return new TextToken(prev, curCharIndex - startIndex); } }
public class class_name { protected final Dictionary createNgramDictionary( final ObjectStream<POSSample> aDictSamples, final int aNgramCutoff) { Dictionary ngramDict = null; if (aNgramCutoff != Flags.DEFAULT_DICT_CUTOFF) { System.err.print("Building ngram dictionary ... "); try { ngramDict = POSTaggerME .buildNGramDictionary(aDictSamples, aNgramCutoff); this.dictSamples.reset(); } catch (final IOException e) { throw new TerminateToolException(-1, "IO error while building NGram Dictionary: " + e.getMessage(), e); } System.err.println("done"); } return ngramDict; } }
public class class_name { protected final Dictionary createNgramDictionary( final ObjectStream<POSSample> aDictSamples, final int aNgramCutoff) { Dictionary ngramDict = null; if (aNgramCutoff != Flags.DEFAULT_DICT_CUTOFF) { System.err.print("Building ngram dictionary ... "); // depends on control dependency: [if], data = [none] try { ngramDict = POSTaggerME .buildNGramDictionary(aDictSamples, aNgramCutoff); // depends on control dependency: [try], data = [none] this.dictSamples.reset(); // depends on control dependency: [try], data = [none] } catch (final IOException e) { throw new TerminateToolException(-1, "IO error while building NGram Dictionary: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] System.err.println("done"); // depends on control dependency: [if], data = [none] } return ngramDict; } }
public class class_name { public void marshall(DeleteAliasRequest deleteAliasRequest, ProtocolMarshaller protocolMarshaller) { if (deleteAliasRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteAliasRequest.getOrganizationId(), ORGANIZATIONID_BINDING); protocolMarshaller.marshall(deleteAliasRequest.getEntityId(), ENTITYID_BINDING); protocolMarshaller.marshall(deleteAliasRequest.getAlias(), ALIAS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteAliasRequest deleteAliasRequest, ProtocolMarshaller protocolMarshaller) { if (deleteAliasRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteAliasRequest.getOrganizationId(), ORGANIZATIONID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteAliasRequest.getEntityId(), ENTITYID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteAliasRequest.getAlias(), ALIAS_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 Field.TermVector getTermVectorParameter(int flags) { if (((flags & STORE_POSITION_WITH_TERM_VECTOR_FLAG) > 0) && ((flags & STORE_OFFSET_WITH_TERM_VECTOR_FLAG) > 0)) { return Field.TermVector.WITH_POSITIONS_OFFSETS; } else if ((flags & STORE_POSITION_WITH_TERM_VECTOR_FLAG) > 0) { return Field.TermVector.WITH_POSITIONS; } else if ((flags & STORE_OFFSET_WITH_TERM_VECTOR_FLAG) > 0) { return Field.TermVector.WITH_OFFSETS; } else if ((flags & STORE_TERM_VECTOR_FLAG) > 0) { return Field.TermVector.YES; } else { return Field.TermVector.NO; } } }
public class class_name { private static Field.TermVector getTermVectorParameter(int flags) { if (((flags & STORE_POSITION_WITH_TERM_VECTOR_FLAG) > 0) && ((flags & STORE_OFFSET_WITH_TERM_VECTOR_FLAG) > 0)) { return Field.TermVector.WITH_POSITIONS_OFFSETS; // depends on control dependency: [if], data = [none] } else if ((flags & STORE_POSITION_WITH_TERM_VECTOR_FLAG) > 0) { return Field.TermVector.WITH_POSITIONS; // depends on control dependency: [if], data = [none] } else if ((flags & STORE_OFFSET_WITH_TERM_VECTOR_FLAG) > 0) { return Field.TermVector.WITH_OFFSETS; // depends on control dependency: [if], data = [none] } else if ((flags & STORE_TERM_VECTOR_FLAG) > 0) { return Field.TermVector.YES; // depends on control dependency: [if], data = [none] } else { return Field.TermVector.NO; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String getPrefixErrorMessage(final Object pObject) { StringBuilder buffer = new StringBuilder(); buffer.append(ERROR); buffer.append(getTimestamp()); buffer.append(" "); if (pObject == null) { buffer.append("[unknown class]"); } else { if (pObject instanceof String) { buffer.append((String) pObject); } else { buffer.append(getClassName(pObject)); } } buffer.append(": "); return buffer.toString(); } }
public class class_name { public static String getPrefixErrorMessage(final Object pObject) { StringBuilder buffer = new StringBuilder(); buffer.append(ERROR); buffer.append(getTimestamp()); buffer.append(" "); if (pObject == null) { buffer.append("[unknown class]"); // depends on control dependency: [if], data = [none] } else { if (pObject instanceof String) { buffer.append((String) pObject); // depends on control dependency: [if], data = [none] } else { buffer.append(getClassName(pObject)); // depends on control dependency: [if], data = [none] } } buffer.append(": "); return buffer.toString(); } }
public class class_name { public void deleteOld() { Iterator<CmsResourceTypeStatResult> iterator = m_results.iterator(); while (iterator.hasNext()) { CmsResourceTypeStatResult res = iterator.next(); if (isToOld(res)) { iterator.remove(); } } } }
public class class_name { public void deleteOld() { Iterator<CmsResourceTypeStatResult> iterator = m_results.iterator(); while (iterator.hasNext()) { CmsResourceTypeStatResult res = iterator.next(); if (isToOld(res)) { iterator.remove(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @SuppressWarnings("WeakerAccess") public static Set<String> getOrderedStringSet(String key, final Set<String> defValue) { SharedPreferences prefs = getPreferences(); if (prefs.contains(key + LENGTH)) { LinkedHashSet<String> set = new LinkedHashSet<>(); int stringSetLength = prefs.getInt(key + LENGTH, -1); if (stringSetLength >= 0) { for (int i = 0; i < stringSetLength; i++) { set.add(prefs.getString(key + "[" + i + "]", null)); } } return set; } return defValue; } }
public class class_name { @SuppressWarnings("WeakerAccess") public static Set<String> getOrderedStringSet(String key, final Set<String> defValue) { SharedPreferences prefs = getPreferences(); if (prefs.contains(key + LENGTH)) { LinkedHashSet<String> set = new LinkedHashSet<>(); int stringSetLength = prefs.getInt(key + LENGTH, -1); if (stringSetLength >= 0) { for (int i = 0; i < stringSetLength; i++) { set.add(prefs.getString(key + "[" + i + "]", null)); // depends on control dependency: [for], data = [i] } } return set; // depends on control dependency: [if], data = [none] } return defValue; } }
public class class_name { public void replaceNode(final ADTNode<S, I, O> oldNode, final ADTNode<S, I, O> newNode) { if (this.root.equals(oldNode)) { this.root = newNode; } else if (ADTUtil.isResetNode(oldNode)) { final ADTNode<S, I, O> endOfPreviousADS = oldNode.getParent(); final O outputToReset = ADTUtil.getOutputForSuccessor(endOfPreviousADS, oldNode); newNode.setParent(endOfPreviousADS); endOfPreviousADS.getChildren().put(outputToReset, newNode); } else { final ADTNode<S, I, O> oldNodeParent = oldNode.getParent(); //reset node assert ADTUtil.isResetNode(oldNodeParent); final ADTNode<S, I, O> endOfPreviousADS = oldNodeParent.getParent(); final O outputToReset = ADTUtil.getOutputForSuccessor(endOfPreviousADS, oldNodeParent); final ADTNode<S, I, O> newResetNode = new ADTResetNode<>(newNode); newResetNode.setParent(endOfPreviousADS); newNode.setParent(newResetNode); endOfPreviousADS.getChildren().put(outputToReset, newResetNode); } } }
public class class_name { public void replaceNode(final ADTNode<S, I, O> oldNode, final ADTNode<S, I, O> newNode) { if (this.root.equals(oldNode)) { this.root = newNode; // depends on control dependency: [if], data = [none] } else if (ADTUtil.isResetNode(oldNode)) { final ADTNode<S, I, O> endOfPreviousADS = oldNode.getParent(); final O outputToReset = ADTUtil.getOutputForSuccessor(endOfPreviousADS, oldNode); newNode.setParent(endOfPreviousADS); // depends on control dependency: [if], data = [none] endOfPreviousADS.getChildren().put(outputToReset, newNode); // depends on control dependency: [if], data = [none] } else { final ADTNode<S, I, O> oldNodeParent = oldNode.getParent(); //reset node assert ADTUtil.isResetNode(oldNodeParent); // depends on control dependency: [if], data = [none] final ADTNode<S, I, O> endOfPreviousADS = oldNodeParent.getParent(); final O outputToReset = ADTUtil.getOutputForSuccessor(endOfPreviousADS, oldNodeParent); final ADTNode<S, I, O> newResetNode = new ADTResetNode<>(newNode); newResetNode.setParent(endOfPreviousADS); // depends on control dependency: [if], data = [none] newNode.setParent(newResetNode); // depends on control dependency: [if], data = [none] endOfPreviousADS.getChildren().put(outputToReset, newResetNode); // depends on control dependency: [if], data = [none] } } }
public class class_name { boolean buildTransmission(WsByteBuffer xmitBuffer) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "buildTransmission", xmitBuffer); SIErrorException error = null; while(!exhausedXmitBuffer && !transmissionBuilt && (error == null)) { if (tc.isDebugEnabled()) SibTr.debug(this, tc, "state="+state+" layout="+layout); switch(state) { case(STATE_BUILDING_PRIMARY_HEADER): if (buildHeader(primaryHeaderFields, xmitBuffer)) { if (layout == JFapChannelConstants.XMIT_PRIMARY_ONLY) state = STATE_BUILDING_PAYLOAD; else if (layout == JFapChannelConstants.XMIT_CONVERSATION) state = STATE_BUILDING_CONVERSATION_HEADER; else if (layout == JFapChannelConstants.XMIT_SEGMENT_START) state = STATE_BUILDING_CONVERSATION_HEADER; else if (layout == JFapChannelConstants.XMIT_SEGMENT_MIDDLE) state = STATE_BUILDING_CONVERSATION_HEADER; else if (layout == JFapChannelConstants.XMIT_SEGMENT_END) state = STATE_BUILDING_CONVERSATION_HEADER; else { if (tc.isDebugEnabled()) SibTr.debug(this, tc, "unexpected layout: "+layout+" in state: "+state); state = STATE_ERROR; error = new SIErrorException("unexpected layout: "+layout+" in state: "+state); } } break; case(STATE_BUILDING_CONVERSATION_HEADER): if (buildHeader(conversationHeaderFields, xmitBuffer)) { if (layout == JFapChannelConstants.XMIT_CONVERSATION) state = STATE_BUILDING_PAYLOAD; else if (layout == JFapChannelConstants.XMIT_SEGMENT_START) state = STATE_BUILDING_SEGMENT_HEADER; else if (layout == JFapChannelConstants.XMIT_SEGMENT_MIDDLE) state = STATE_BUILDING_PAYLOAD; else if (layout == JFapChannelConstants.XMIT_SEGMENT_END) state = STATE_BUILDING_PAYLOAD; else { if (tc.isDebugEnabled()) SibTr.debug(this, tc, "unexpected layout: "+layout+" in state: "+state); state = STATE_ERROR; error = new SIErrorException("unexpected layout: "+layout+" in state: "+state); } } break; case(STATE_BUILDING_SEGMENT_HEADER): if (buildHeader(segmentedTransmissionHeaderFields, xmitBuffer)) { if (layout == JFapChannelConstants.XMIT_SEGMENT_START) state = STATE_BUILDING_PAYLOAD; else { if (tc.isDebugEnabled()) SibTr.debug(this, tc, "unexpected layout: "+layout+" in state: "+state); state = STATE_ERROR; error = new SIErrorException("unexpected layout: "+layout+" in state: "+state); } } break; case(STATE_BUILDING_PAYLOAD): if (buildPayload(xmitBuffer)) { transmissionBuilt = true; state = STATE_BUILDING_PRIMARY_HEADER; currentXmitDataBufferIndex = 0; headerScratchSpace.clear(); } break; case(STATE_ERROR): if (error == null) error = new SIErrorException("Entered error state without exception been set"); connection.invalidate(true, error, "error building transmission"); // D224570 break; default: } } boolean retValue = transmissionBuilt; if (transmissionBuilt) transmissionBuilt = false; exhausedXmitBuffer = false; if (tc.isEntryEnabled()) SibTr.entry(this, tc, "buildTransmission", ""+retValue); return retValue; } }
public class class_name { boolean buildTransmission(WsByteBuffer xmitBuffer) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "buildTransmission", xmitBuffer); SIErrorException error = null; while(!exhausedXmitBuffer && !transmissionBuilt && (error == null)) { if (tc.isDebugEnabled()) SibTr.debug(this, tc, "state="+state+" layout="+layout); switch(state) { case(STATE_BUILDING_PRIMARY_HEADER): if (buildHeader(primaryHeaderFields, xmitBuffer)) { if (layout == JFapChannelConstants.XMIT_PRIMARY_ONLY) state = STATE_BUILDING_PAYLOAD; else if (layout == JFapChannelConstants.XMIT_CONVERSATION) state = STATE_BUILDING_CONVERSATION_HEADER; else if (layout == JFapChannelConstants.XMIT_SEGMENT_START) state = STATE_BUILDING_CONVERSATION_HEADER; else if (layout == JFapChannelConstants.XMIT_SEGMENT_MIDDLE) state = STATE_BUILDING_CONVERSATION_HEADER; else if (layout == JFapChannelConstants.XMIT_SEGMENT_END) state = STATE_BUILDING_CONVERSATION_HEADER; else { if (tc.isDebugEnabled()) SibTr.debug(this, tc, "unexpected layout: "+layout+" in state: "+state); state = STATE_ERROR; // depends on control dependency: [if], data = [none] error = new SIErrorException("unexpected layout: "+layout+" in state: "+state); // depends on control dependency: [if], data = [none] } } break; case(STATE_BUILDING_CONVERSATION_HEADER): if (buildHeader(conversationHeaderFields, xmitBuffer)) { if (layout == JFapChannelConstants.XMIT_CONVERSATION) state = STATE_BUILDING_PAYLOAD; else if (layout == JFapChannelConstants.XMIT_SEGMENT_START) state = STATE_BUILDING_SEGMENT_HEADER; else if (layout == JFapChannelConstants.XMIT_SEGMENT_MIDDLE) state = STATE_BUILDING_PAYLOAD; else if (layout == JFapChannelConstants.XMIT_SEGMENT_END) state = STATE_BUILDING_PAYLOAD; else { if (tc.isDebugEnabled()) SibTr.debug(this, tc, "unexpected layout: "+layout+" in state: "+state); state = STATE_ERROR; // depends on control dependency: [if], data = [none] error = new SIErrorException("unexpected layout: "+layout+" in state: "+state); // depends on control dependency: [if], data = [none] } } break; case(STATE_BUILDING_SEGMENT_HEADER): if (buildHeader(segmentedTransmissionHeaderFields, xmitBuffer)) { if (layout == JFapChannelConstants.XMIT_SEGMENT_START) state = STATE_BUILDING_PAYLOAD; else { if (tc.isDebugEnabled()) SibTr.debug(this, tc, "unexpected layout: "+layout+" in state: "+state); state = STATE_ERROR; // depends on control dependency: [if], data = [none] error = new SIErrorException("unexpected layout: "+layout+" in state: "+state); // depends on control dependency: [if], data = [none] } } break; case(STATE_BUILDING_PAYLOAD): if (buildPayload(xmitBuffer)) { transmissionBuilt = true; // depends on control dependency: [if], data = [none] state = STATE_BUILDING_PRIMARY_HEADER; // depends on control dependency: [if], data = [none] currentXmitDataBufferIndex = 0; // depends on control dependency: [if], data = [none] headerScratchSpace.clear(); // depends on control dependency: [if], data = [none] } break; case(STATE_ERROR): if (error == null) error = new SIErrorException("Entered error state without exception been set"); connection.invalidate(true, error, "error building transmission"); // D224570 break; default: } } boolean retValue = transmissionBuilt; if (transmissionBuilt) transmissionBuilt = false; exhausedXmitBuffer = false; if (tc.isEntryEnabled()) SibTr.entry(this, tc, "buildTransmission", ""+retValue); return retValue; } }
public class class_name { public DateTimeZoneBuilder addCutover(int year, char mode, int monthOfYear, int dayOfMonth, int dayOfWeek, boolean advanceDayOfWeek, int millisOfDay) { if (iRuleSets.size() > 0) { OfYear ofYear = new OfYear (mode, monthOfYear, dayOfMonth, dayOfWeek, advanceDayOfWeek, millisOfDay); RuleSet lastRuleSet = iRuleSets.get(iRuleSets.size() - 1); lastRuleSet.setUpperLimit(year, ofYear); } iRuleSets.add(new RuleSet()); return this; } }
public class class_name { public DateTimeZoneBuilder addCutover(int year, char mode, int monthOfYear, int dayOfMonth, int dayOfWeek, boolean advanceDayOfWeek, int millisOfDay) { if (iRuleSets.size() > 0) { OfYear ofYear = new OfYear (mode, monthOfYear, dayOfMonth, dayOfWeek, advanceDayOfWeek, millisOfDay); RuleSet lastRuleSet = iRuleSets.get(iRuleSets.size() - 1); lastRuleSet.setUpperLimit(year, ofYear); // depends on control dependency: [if], data = [none] } iRuleSets.add(new RuleSet()); return this; } }
public class class_name { public void normalizeDatastreams(DigitalObject obj, int transContext, String characterEncoding) throws UnsupportedEncodingException { if (transContext == AS_IS) { return; } if (obj.hasContentModel( Models.SERVICE_DEPLOYMENT_3_0)) { Iterator<String> datastreams = obj.datastreamIdIterator(); while (datastreams.hasNext()) { String dsid = datastreams.next(); if (dsid.equals("WSDL") || dsid.equals("SERVICE-PROFILE")) { for (Datastream d : obj.datastreams(dsid)) { if (!(d instanceof DatastreamXMLMetadata)) { logger.warn(obj.getPid() + " : Refusing to normalize URLs in datastream " + dsid + " because it is not inline XML"); continue; } DatastreamXMLMetadata xd = (DatastreamXMLMetadata) d; if (logger.isDebugEnabled()) logger.debug("{} : normalising URLs in {}", obj.getPid(), dsid); String origContent = new String(xd.xmlContent, "UTF-8"); String normal = normalizeInlineXML(origContent, transContext); if (!normal.equals(origContent) || !"UTF-8".equalsIgnoreCase(characterEncoding)){ xd.xmlContent = normal.getBytes(characterEncoding); } xd.DSSize = xd.xmlContent.length; } } } } } }
public class class_name { public void normalizeDatastreams(DigitalObject obj, int transContext, String characterEncoding) throws UnsupportedEncodingException { if (transContext == AS_IS) { return; } if (obj.hasContentModel( Models.SERVICE_DEPLOYMENT_3_0)) { Iterator<String> datastreams = obj.datastreamIdIterator(); while (datastreams.hasNext()) { String dsid = datastreams.next(); if (dsid.equals("WSDL") || dsid.equals("SERVICE-PROFILE")) { for (Datastream d : obj.datastreams(dsid)) { if (!(d instanceof DatastreamXMLMetadata)) { logger.warn(obj.getPid() + " : Refusing to normalize URLs in datastream " + dsid + " because it is not inline XML"); // depends on control dependency: [if], data = [none] continue; } DatastreamXMLMetadata xd = (DatastreamXMLMetadata) d; if (logger.isDebugEnabled()) logger.debug("{} : normalising URLs in {}", obj.getPid(), dsid); String origContent = new String(xd.xmlContent, "UTF-8"); String normal = normalizeInlineXML(origContent, transContext); if (!normal.equals(origContent) || !"UTF-8".equalsIgnoreCase(characterEncoding)){ xd.xmlContent = normal.getBytes(characterEncoding); // depends on control dependency: [if], data = [none] } xd.DSSize = xd.xmlContent.length; // depends on control dependency: [for], data = [d] } } } } } }
public class class_name { @Override protected boolean isBefore(int x, int y, Rectangle innerAlloc) { // System.err.println("isBefore: " + innerAlloc + " my bounds " + // box.getAbsoluteBounds()); // System.err.println("XY: " + x + " : " + y); innerAlloc.setBounds(box.getAbsoluteBounds()); if (majorAxis == View.X_AXIS) { return (x < innerAlloc.x); } else { return (y < innerAlloc.y); } } }
public class class_name { @Override protected boolean isBefore(int x, int y, Rectangle innerAlloc) { // System.err.println("isBefore: " + innerAlloc + " my bounds " + // box.getAbsoluteBounds()); // System.err.println("XY: " + x + " : " + y); innerAlloc.setBounds(box.getAbsoluteBounds()); if (majorAxis == View.X_AXIS) { return (x < innerAlloc.x); // depends on control dependency: [if], data = [none] } else { return (y < innerAlloc.y); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void extractFundmental( DMatrixRMaj F21 , DMatrixRMaj F31 ) { // compute the camera matrices one column at a time for( int i = 0; i < 3; i++ ) { DMatrixRMaj T = tensor.getT(i); GeometryMath_F64.mult(T,e3,temp0); GeometryMath_F64.cross(e2,temp0,column); F21.set(0,i,column.x); F21.set(1,i,column.y); F21.set(2,i,column.z); GeometryMath_F64.multTran(T,e2,temp0); GeometryMath_F64.cross(e3,temp0,column); F31.set(0,i,column.x); F31.set(1,i,column.y); F31.set(2,i,column.z); } } }
public class class_name { public void extractFundmental( DMatrixRMaj F21 , DMatrixRMaj F31 ) { // compute the camera matrices one column at a time for( int i = 0; i < 3; i++ ) { DMatrixRMaj T = tensor.getT(i); GeometryMath_F64.mult(T,e3,temp0); // depends on control dependency: [for], data = [none] GeometryMath_F64.cross(e2,temp0,column); // depends on control dependency: [for], data = [none] F21.set(0,i,column.x); // depends on control dependency: [for], data = [i] F21.set(1,i,column.y); // depends on control dependency: [for], data = [i] F21.set(2,i,column.z); // depends on control dependency: [for], data = [i] GeometryMath_F64.multTran(T,e2,temp0); // depends on control dependency: [for], data = [none] GeometryMath_F64.cross(e3,temp0,column); // depends on control dependency: [for], data = [none] F31.set(0,i,column.x); // depends on control dependency: [for], data = [i] F31.set(1,i,column.y); // depends on control dependency: [for], data = [i] F31.set(2,i,column.z); // depends on control dependency: [for], data = [i] } } }
public class class_name { public char[] asCharArray() { int n = getIndexCount(); if (getIndexSize() != 2) { throw new UnsupportedOperationException("Cannot convert int indices to char array"); } if (n <= 0) { return null; } return NativeIndexBuffer.getShortArray(getNative()); } }
public class class_name { public char[] asCharArray() { int n = getIndexCount(); if (getIndexSize() != 2) { throw new UnsupportedOperationException("Cannot convert int indices to char array"); } if (n <= 0) { return null; // depends on control dependency: [if], data = [none] } return NativeIndexBuffer.getShortArray(getNative()); } }
public class class_name { @Override protected synchronized void handleTransliterate(Replaceable text, Position offsets, boolean isIncremental) { if(csp==null) { return; } if(offsets.start >= offsets.limit) { return; } iter.setText(text); result.setLength(0); int c, delta; // Walk through original string // If there is a case change, modify corresponding position in replaceable iter.setIndex(offsets.start); iter.setLimit(offsets.limit); iter.setContextLimits(offsets.contextStart, offsets.contextLimit); while((c=iter.nextCaseMapCP())>=0) { c=csp.toFullUpper(c, iter, result, caseLocale); if(iter.didReachLimit() && isIncremental) { // the case mapping function tried to look beyond the context limit // wait for more input offsets.start=iter.getCaseMapCPStart(); return; } /* decode the result */ if(c<0) { /* c mapped to itself, no change */ continue; } else if(c<=UCaseProps.MAX_STRING_LENGTH) { /* replace by the mapping string */ delta=iter.replace(result.toString()); result.setLength(0); } else { /* replace by single-code point mapping */ delta=iter.replace(UTF16.valueOf(c)); } if(delta!=0) { offsets.limit += delta; offsets.contextLimit += delta; } } offsets.start = offsets.limit; } }
public class class_name { @Override protected synchronized void handleTransliterate(Replaceable text, Position offsets, boolean isIncremental) { if(csp==null) { return; // depends on control dependency: [if], data = [none] } if(offsets.start >= offsets.limit) { return; // depends on control dependency: [if], data = [none] } iter.setText(text); result.setLength(0); int c, delta; // Walk through original string // If there is a case change, modify corresponding position in replaceable iter.setIndex(offsets.start); iter.setLimit(offsets.limit); iter.setContextLimits(offsets.contextStart, offsets.contextLimit); while((c=iter.nextCaseMapCP())>=0) { c=csp.toFullUpper(c, iter, result, caseLocale); // depends on control dependency: [while], data = [none] if(iter.didReachLimit() && isIncremental) { // the case mapping function tried to look beyond the context limit // wait for more input offsets.start=iter.getCaseMapCPStart(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } /* decode the result */ if(c<0) { /* c mapped to itself, no change */ continue; } else if(c<=UCaseProps.MAX_STRING_LENGTH) { /* replace by the mapping string */ delta=iter.replace(result.toString()); // depends on control dependency: [if], data = [none] result.setLength(0); // depends on control dependency: [if], data = [none] } else { /* replace by single-code point mapping */ delta=iter.replace(UTF16.valueOf(c)); // depends on control dependency: [if], data = [(c] } if(delta!=0) { offsets.limit += delta; // depends on control dependency: [if], data = [none] offsets.contextLimit += delta; // depends on control dependency: [if], data = [none] } } offsets.start = offsets.limit; } }
public class class_name { public static <T> boolean contains(List<T> container, List<T> list, Comparator<T> comparator) { Iterator<T> listIterator = list.iterator(); Iterator<T> containerIterator = container.iterator(); T listElement = listIterator.next(); T containerElement = containerIterator.next(); while (true) { int r = comparator.compare(containerElement, listElement); if (r == 0) { // current element from list is equal to current element from container if (!listIterator.hasNext()) { // no elements remaining in list - all were matched return true; } // next element from list also can be equal to current element from container listElement = listIterator.next(); } else if (r < 0) { // current element from list is greater than current element from container // need to check next element from container if (!containerIterator.hasNext()) { return false; } containerElement = containerIterator.next(); } else { // current element from list is less than current element from container // stop search, because current element from list would be less than any next element from container return false; } } } }
public class class_name { public static <T> boolean contains(List<T> container, List<T> list, Comparator<T> comparator) { Iterator<T> listIterator = list.iterator(); Iterator<T> containerIterator = container.iterator(); T listElement = listIterator.next(); T containerElement = containerIterator.next(); while (true) { int r = comparator.compare(containerElement, listElement); if (r == 0) { // current element from list is equal to current element from container if (!listIterator.hasNext()) { // no elements remaining in list - all were matched return true; // depends on control dependency: [if], data = [none] } // next element from list also can be equal to current element from container listElement = listIterator.next(); // depends on control dependency: [if], data = [none] } else if (r < 0) { // current element from list is greater than current element from container // need to check next element from container if (!containerIterator.hasNext()) { return false; // depends on control dependency: [if], data = [none] } containerElement = containerIterator.next(); // depends on control dependency: [if], data = [none] } else { // current element from list is less than current element from container // stop search, because current element from list would be less than any next element from container return false; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static String simplifyMolecularFormula(String formula) { String newFormula = formula; char thisChar; if (formula.contains(" ")) { newFormula = newFormula.replace(" ", ""); } if (!formula.contains(".")) return breakExtractor(formula); List<String> listMF = new ArrayList<String>(); while (newFormula.contains(".")) { int pos = newFormula.indexOf('.'); String thisFormula = newFormula.substring(0, pos); if (thisFormula.charAt(0) >= '0' && thisFormula.charAt(0) <= '9') thisFormula = multipleExtractor(thisFormula); if (thisFormula.contains("(")) thisFormula = breakExtractor(thisFormula); listMF.add(thisFormula); thisFormula = newFormula.substring(pos + 1, newFormula.length()); if (!thisFormula.contains(".")) { if (thisFormula.charAt(0) >= '0' && thisFormula.charAt(0) <= '9') thisFormula = multipleExtractor(thisFormula); if (thisFormula.contains("(")) thisFormula = breakExtractor(thisFormula); listMF.add(thisFormula); } newFormula = thisFormula; } if (newFormula.contains("(")) newFormula = breakExtractor(newFormula); String recentElementSymbol = ""; String recentElementCountString = "0"; List<String> eleSymb = new ArrayList<String>(); List<Integer> eleCount = new ArrayList<Integer>(); for (int i = 0; i < listMF.size(); i++) { String thisFormula = listMF.get(i); for (int f = 0; f < thisFormula.length(); f++) { thisChar = thisFormula.charAt(f); if (f < thisFormula.length()) { if (thisChar >= 'A' && thisChar <= 'Z') { recentElementSymbol = String.valueOf(thisChar); recentElementCountString = "0"; } if (thisChar >= 'a' && thisChar <= 'z') { recentElementSymbol += thisChar; } if (thisChar >= '0' && thisChar <= '9') { recentElementCountString += thisChar; } } if (f == thisFormula.length() - 1 || (thisFormula.charAt(f + 1) >= 'A' && thisFormula.charAt(f + 1) <= 'Z')) { int posit = eleSymb.indexOf(recentElementSymbol); int count = Integer.valueOf(recentElementCountString); if (posit == -1) { eleSymb.add(recentElementSymbol); eleCount.add(count); } else { int countP = Integer.valueOf(recentElementCountString); if (countP == 0) countP = 1; int countA = eleCount.get(posit); if (countA == 0) countA = 1; int value = countP + countA; eleCount.remove(posit); eleCount.add(posit, value); } } } } String newF = ""; for (int i = 0; i < eleCount.size(); i++) { String element = eleSymb.get(i); int num = eleCount.get(i); if (num == 0) newF += element; else newF += element + num; } return newF; } }
public class class_name { public static String simplifyMolecularFormula(String formula) { String newFormula = formula; char thisChar; if (formula.contains(" ")) { newFormula = newFormula.replace(" ", ""); // depends on control dependency: [if], data = [none] } if (!formula.contains(".")) return breakExtractor(formula); List<String> listMF = new ArrayList<String>(); while (newFormula.contains(".")) { int pos = newFormula.indexOf('.'); String thisFormula = newFormula.substring(0, pos); if (thisFormula.charAt(0) >= '0' && thisFormula.charAt(0) <= '9') thisFormula = multipleExtractor(thisFormula); if (thisFormula.contains("(")) thisFormula = breakExtractor(thisFormula); listMF.add(thisFormula); // depends on control dependency: [while], data = [none] thisFormula = newFormula.substring(pos + 1, newFormula.length()); // depends on control dependency: [while], data = [none] if (!thisFormula.contains(".")) { if (thisFormula.charAt(0) >= '0' && thisFormula.charAt(0) <= '9') thisFormula = multipleExtractor(thisFormula); if (thisFormula.contains("(")) thisFormula = breakExtractor(thisFormula); listMF.add(thisFormula); // depends on control dependency: [if], data = [none] } newFormula = thisFormula; // depends on control dependency: [while], data = [none] } if (newFormula.contains("(")) newFormula = breakExtractor(newFormula); String recentElementSymbol = ""; String recentElementCountString = "0"; List<String> eleSymb = new ArrayList<String>(); List<Integer> eleCount = new ArrayList<Integer>(); for (int i = 0; i < listMF.size(); i++) { String thisFormula = listMF.get(i); for (int f = 0; f < thisFormula.length(); f++) { thisChar = thisFormula.charAt(f); // depends on control dependency: [for], data = [f] if (f < thisFormula.length()) { if (thisChar >= 'A' && thisChar <= 'Z') { recentElementSymbol = String.valueOf(thisChar); // depends on control dependency: [if], data = [(thisChar] recentElementCountString = "0"; // depends on control dependency: [if], data = [none] } if (thisChar >= 'a' && thisChar <= 'z') { recentElementSymbol += thisChar; // depends on control dependency: [if], data = [none] } if (thisChar >= '0' && thisChar <= '9') { recentElementCountString += thisChar; // depends on control dependency: [if], data = [none] } } if (f == thisFormula.length() - 1 || (thisFormula.charAt(f + 1) >= 'A' && thisFormula.charAt(f + 1) <= 'Z')) { int posit = eleSymb.indexOf(recentElementSymbol); int count = Integer.valueOf(recentElementCountString); if (posit == -1) { eleSymb.add(recentElementSymbol); // depends on control dependency: [if], data = [none] eleCount.add(count); // depends on control dependency: [if], data = [none] } else { int countP = Integer.valueOf(recentElementCountString); if (countP == 0) countP = 1; int countA = eleCount.get(posit); if (countA == 0) countA = 1; int value = countP + countA; eleCount.remove(posit); // depends on control dependency: [if], data = [(posit] eleCount.add(posit, value); // depends on control dependency: [if], data = [(posit] } } } } String newF = ""; for (int i = 0; i < eleCount.size(); i++) { String element = eleSymb.get(i); int num = eleCount.get(i); if (num == 0) newF += element; else newF += element + num; } return newF; } }
public class class_name { @Override public Collection<? extends NameClassPair> listInstances(JavaColonNamespace namespace, String nameInContext) { // Get the ComponentMetaData for the currently active component. // There is no comp namespace if there is no active component. ComponentMetaData cmd = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().getComponentMetaData(); if (cmd == null) { return Collections.emptyList(); } if (JavaColonNamespace.COMP_WS.equals(namespace) && "".equals(nameInContext)) { NameClassPair pair = new NameClassPair(nameInContext, ExtendedJTATransaction.class.getName()); return Collections.singletonList(pair); } return Collections.emptyList(); } }
public class class_name { @Override public Collection<? extends NameClassPair> listInstances(JavaColonNamespace namespace, String nameInContext) { // Get the ComponentMetaData for the currently active component. // There is no comp namespace if there is no active component. ComponentMetaData cmd = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().getComponentMetaData(); if (cmd == null) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } if (JavaColonNamespace.COMP_WS.equals(namespace) && "".equals(nameInContext)) { NameClassPair pair = new NameClassPair(nameInContext, ExtendedJTATransaction.class.getName()); return Collections.singletonList(pair); // depends on control dependency: [if], data = [none] } return Collections.emptyList(); } }
public class class_name { public ColorRecord getColorRecord (String className, String colorName) { ClassRecord record = getClassRecord(className); if (record == null) { log.warning("Requested unknown color class", "className", className, "colorName", colorName, new Exception()); return null; } int colorId = 0; try { colorId = record.getColorId(colorName); } catch (ParseException pe) { log.info("Error getting color record by name", "error", pe); return null; } return record.colors.get(colorId); } }
public class class_name { public ColorRecord getColorRecord (String className, String colorName) { ClassRecord record = getClassRecord(className); if (record == null) { log.warning("Requested unknown color class", "className", className, "colorName", colorName, new Exception()); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } int colorId = 0; try { colorId = record.getColorId(colorName); // depends on control dependency: [try], data = [none] } catch (ParseException pe) { log.info("Error getting color record by name", "error", pe); return null; } // depends on control dependency: [catch], data = [none] return record.colors.get(colorId); } }