code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public static URI relativize(URI base,URI target) { if(!base.getScheme().equals(target.getScheme())) { return target; } StringBuilder rel = new StringBuilder(); String path = base.getPath(); String separator = "/"; StringTokenizer tokenizer = new StringTokenizer(target.getPath(), separator); String targetPart = ""; if(tokenizer.hasMoreTokens()) { targetPart = tokenizer.nextToken(); } if(path.startsWith(separator)) { path = path.substring(1); } StringTokenizer baseTokenizer = new StringTokenizer(path, separator, true); while(baseTokenizer.hasMoreTokens()) { String basePart = baseTokenizer.nextToken(); if(baseTokenizer.hasMoreTokens()) { // Has a / after this folder name baseTokenizer.nextToken(); // return separator if(!basePart.isEmpty()) { if(!basePart.equals(targetPart)) { rel.append(".."); rel.append(separator); } else if(tokenizer.hasMoreTokens()) { targetPart = tokenizer.nextToken(); } } } } // Add part of target path that is not in base path rel.append(targetPart); while (tokenizer.hasMoreTokens()) { targetPart = tokenizer.nextToken(); rel.append(separator); rel.append(targetPart); } try { return new URI(null, null, rel.toString(), null, null); } catch (URISyntaxException ex) { throw new IllegalArgumentException("Illegal URI provided:\n"+base.toString()+"\n"+target.toString()); } } }
public class class_name { public static URI relativize(URI base,URI target) { if(!base.getScheme().equals(target.getScheme())) { return target; // depends on control dependency: [if], data = [none] } StringBuilder rel = new StringBuilder(); String path = base.getPath(); String separator = "/"; StringTokenizer tokenizer = new StringTokenizer(target.getPath(), separator); String targetPart = ""; if(tokenizer.hasMoreTokens()) { targetPart = tokenizer.nextToken(); // depends on control dependency: [if], data = [none] } if(path.startsWith(separator)) { path = path.substring(1); // depends on control dependency: [if], data = [none] } StringTokenizer baseTokenizer = new StringTokenizer(path, separator, true); while(baseTokenizer.hasMoreTokens()) { String basePart = baseTokenizer.nextToken(); if(baseTokenizer.hasMoreTokens()) { // Has a / after this folder name baseTokenizer.nextToken(); // return separator // depends on control dependency: [if], data = [none] if(!basePart.isEmpty()) { if(!basePart.equals(targetPart)) { rel.append(".."); // depends on control dependency: [if], data = [none] rel.append(separator); // depends on control dependency: [if], data = [none] } else if(tokenizer.hasMoreTokens()) { targetPart = tokenizer.nextToken(); // depends on control dependency: [if], data = [none] } } } } // Add part of target path that is not in base path rel.append(targetPart); while (tokenizer.hasMoreTokens()) { targetPart = tokenizer.nextToken(); // depends on control dependency: [while], data = [none] rel.append(separator); // depends on control dependency: [while], data = [none] rel.append(targetPart); // depends on control dependency: [while], data = [none] } try { return new URI(null, null, rel.toString(), null, null); // depends on control dependency: [try], data = [none] } catch (URISyntaxException ex) { throw new IllegalArgumentException("Illegal URI provided:\n"+base.toString()+"\n"+target.toString()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static final int nextPrime8191(final int desiredCapacity) { if (desiredCapacity < 0) return 1; if (desiredCapacity <= 8191) { final int i = Arrays.binarySearch(primeCapacities8191, (short) desiredCapacity); return primeCapacities8191[((i < 0) ? ((-i) - 1) : i)]; } return nextPrime(desiredCapacity); } }
public class class_name { public static final int nextPrime8191(final int desiredCapacity) { if (desiredCapacity < 0) return 1; if (desiredCapacity <= 8191) { final int i = Arrays.binarySearch(primeCapacities8191, (short) desiredCapacity); return primeCapacities8191[((i < 0) ? ((-i) - 1) : i)]; // depends on control dependency: [if], data = [none] } return nextPrime(desiredCapacity); } }
public class class_name { public static void rotateCCW( GrayS64 input , GrayS64 output ) { if( input.width != output.height || input.height != output.width ) throw new IllegalArgumentException("Incompatible shapes"); int w = input.width-1; for( int y = 0; y < input.height; y++ ) { int indexIn = input.startIndex + y*input.stride; for (int x = 0; x < input.width; x++) { output.unsafe_set(y,w-x,input.data[indexIn++]); } } } }
public class class_name { public static void rotateCCW( GrayS64 input , GrayS64 output ) { if( input.width != output.height || input.height != output.width ) throw new IllegalArgumentException("Incompatible shapes"); int w = input.width-1; for( int y = 0; y < input.height; y++ ) { int indexIn = input.startIndex + y*input.stride; for (int x = 0; x < input.width; x++) { output.unsafe_set(y,w-x,input.data[indexIn++]); // depends on control dependency: [for], data = [x] } } } }
public class class_name { protected Object setAssemblageValue(Class assemblageType, Object assemblage, Object index, Object value) { if (assemblageType.isArray()) { int i = ((Integer) index).intValue(); if (Array.getLength(assemblage) <= i) { Object newAssemblage = Array.newInstance(assemblageType.getComponentType(), i + 1); System.arraycopy(assemblage, 0, newAssemblage, 0, Array.getLength(assemblage)); assemblage = newAssemblage; } Array.set(assemblage, i, value); } else if (List.class.isAssignableFrom(assemblageType)) { int i = ((Integer) index).intValue(); List list = (List) assemblage; if (list.size() > i) { list.set(i, value); } else { while (list.size() < i) { list.add(null); } list.add(value); } } else if (Map.class.isAssignableFrom(assemblageType)) { ((Map) assemblage).put(index, value); } else if (assemblage instanceof Collection) { ((Collection) assemblage).add(value); } else { throw new IllegalArgumentException("assemblage must be of type array, collection or map."); } return assemblage; } }
public class class_name { protected Object setAssemblageValue(Class assemblageType, Object assemblage, Object index, Object value) { if (assemblageType.isArray()) { int i = ((Integer) index).intValue(); if (Array.getLength(assemblage) <= i) { Object newAssemblage = Array.newInstance(assemblageType.getComponentType(), i + 1); System.arraycopy(assemblage, 0, newAssemblage, 0, Array.getLength(assemblage)); // depends on control dependency: [if], data = [none] assemblage = newAssemblage; // depends on control dependency: [if], data = [none] } Array.set(assemblage, i, value); // depends on control dependency: [if], data = [none] } else if (List.class.isAssignableFrom(assemblageType)) { int i = ((Integer) index).intValue(); List list = (List) assemblage; if (list.size() > i) { list.set(i, value); // depends on control dependency: [if], data = [none] } else { while (list.size() < i) { list.add(null); // depends on control dependency: [while], data = [none] } list.add(value); // depends on control dependency: [if], data = [none] } } else if (Map.class.isAssignableFrom(assemblageType)) { ((Map) assemblage).put(index, value); // depends on control dependency: [if], data = [none] } else if (assemblage instanceof Collection) { ((Collection) assemblage).add(value); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("assemblage must be of type array, collection or map."); } return assemblage; } }
public class class_name { public EClass getGCBOX() { if (gcboxEClass == null) { gcboxEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(442); } return gcboxEClass; } }
public class class_name { public EClass getGCBOX() { if (gcboxEClass == null) { gcboxEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(442); // depends on control dependency: [if], data = [none] } return gcboxEClass; } }
public class class_name { boolean isGroupIdSuffixedWithArtifactId() { String grpId = getJavaGroupId(); String artId = getJavaArtifactId(); // Return false if one of them are null... if (grpId == null || artId == null) { return false; } int grpIdLen = grpId.length(); int artIdLen = artId.length(); // Return false if artId is longer then grpId if (artIdLen > grpIdLen) { return false; } grpId = grpId.toLowerCase(); artId = artId.toLowerCase(); int artIdInGrpIdLastPosition = grpId.lastIndexOf(artId); // Return false if artId is not found in grpId if (artIdInGrpIdLastPosition == -1) { return false; } // Return false if the last position of artId is not in the end of the grpId if (grpIdLen != artIdInGrpIdLastPosition + artIdLen) { return false; } // Ok, the grpId is really suffixed with the artifactId, let's return true :-) return true; } }
public class class_name { boolean isGroupIdSuffixedWithArtifactId() { String grpId = getJavaGroupId(); String artId = getJavaArtifactId(); // Return false if one of them are null... if (grpId == null || artId == null) { return false; // depends on control dependency: [if], data = [none] } int grpIdLen = grpId.length(); int artIdLen = artId.length(); // Return false if artId is longer then grpId if (artIdLen > grpIdLen) { return false; // depends on control dependency: [if], data = [none] } grpId = grpId.toLowerCase(); artId = artId.toLowerCase(); int artIdInGrpIdLastPosition = grpId.lastIndexOf(artId); // Return false if artId is not found in grpId if (artIdInGrpIdLastPosition == -1) { return false; // depends on control dependency: [if], data = [none] } // Return false if the last position of artId is not in the end of the grpId if (grpIdLen != artIdInGrpIdLastPosition + artIdLen) { return false; // depends on control dependency: [if], data = [none] } // Ok, the grpId is really suffixed with the artifactId, let's return true :-) return true; } }
public class class_name { @Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WLink link = (WLink) component; XmlStringBuilder xml = renderContext.getWriter(); String text = link.getText(); String targetWindowName = link.getOpenNewWindow() ? link.getTargetWindowName() : null; String imageUrl = link.getImageUrl(); xml.appendTagOpen("ui:link"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("disabled", link.isDisabled(), "true"); xml.appendOptionalAttribute("hidden", component.isHidden(), "true"); xml.appendOptionalAttribute("toolTip", link.getToolTip()); xml.appendOptionalAttribute("accessibleText", link.getAccessibleText()); xml.appendUrlAttribute("url", link.getUrl()); xml.appendOptionalAttribute("rel", link.getRel()); xml.appendOptionalAttribute("accessKey", Util.upperCase(link.getAccessKeyAsString())); if (imageUrl != null) { xml.appendUrlAttribute("imageUrl", imageUrl); ImagePosition imagePosition = link.getImagePosition(); if (imagePosition != null) { switch (imagePosition) { case NORTH: xml.appendAttribute("imagePosition", "n"); break; case EAST: xml.appendAttribute("imagePosition", "e"); break; case SOUTH: xml.appendAttribute("imagePosition", "s"); break; case WEST: xml.appendAttribute("imagePosition", "w"); break; default: throw new SystemException("Unknown image position: " + imagePosition); } } // we have an image. We must have a text equivalent if (Util.empty(text) && Util.empty(link.getToolTip()) && Util.empty(link.getAccessibleText())) { // If the link has an umageUrl but no text equivalent get the text equivalent off of the image WImage linkImage = link.getImageHolder(); if (null != linkImage) { xml.appendOptionalAttribute("toolTip", linkImage.getAlternativeText()); } } } if (link.isRenderAsButton()) { xml.appendAttribute("type", "button"); } xml.appendClose(); if (targetWindowName != null) { xml.appendTagOpen("ui:windowAttributes"); xml.appendAttribute("name", targetWindowName); WLink.WindowAttributes attributes = link.getWindowAttrs(); if (attributes != null) { xml.appendOptionalAttribute("top", attributes.getTop() >= 0, attributes.getTop()); xml.appendOptionalAttribute("left", attributes.getLeft() >= 0, attributes.getLeft()); xml.appendOptionalAttribute("width", attributes.getWidth() > 0, attributes. getWidth()); xml.appendOptionalAttribute("height", attributes.getHeight() > 0, attributes. getHeight()); xml.appendOptionalAttribute("resizable", attributes.isResizable(), "true"); xml.appendOptionalAttribute("showMenubar", attributes.isMenubar(), "true"); xml.appendOptionalAttribute("showToolbar", attributes.isToolbars(), "true"); xml.appendOptionalAttribute("showLocation", attributes.isLocation(), "true"); xml.appendOptionalAttribute("showStatus", attributes.isStatus(), "true"); xml.appendOptionalAttribute("showScrollbars", attributes.isScrollbars(), "true"); xml.appendOptionalAttribute("showDirectories", attributes.isDirectories(), "true"); } xml.appendEnd(); } if (text != null) { xml.appendEscaped(text); } xml.appendEndTag("ui:link"); // Paint the AJAX trigger if the link has an action if (link.getAction() != null) { paintAjaxTrigger(link, xml); } } }
public class class_name { @Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WLink link = (WLink) component; XmlStringBuilder xml = renderContext.getWriter(); String text = link.getText(); String targetWindowName = link.getOpenNewWindow() ? link.getTargetWindowName() : null; String imageUrl = link.getImageUrl(); xml.appendTagOpen("ui:link"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("disabled", link.isDisabled(), "true"); xml.appendOptionalAttribute("hidden", component.isHidden(), "true"); xml.appendOptionalAttribute("toolTip", link.getToolTip()); xml.appendOptionalAttribute("accessibleText", link.getAccessibleText()); xml.appendUrlAttribute("url", link.getUrl()); xml.appendOptionalAttribute("rel", link.getRel()); xml.appendOptionalAttribute("accessKey", Util.upperCase(link.getAccessKeyAsString())); if (imageUrl != null) { xml.appendUrlAttribute("imageUrl", imageUrl); // depends on control dependency: [if], data = [none] ImagePosition imagePosition = link.getImagePosition(); if (imagePosition != null) { switch (imagePosition) { case NORTH: xml.appendAttribute("imagePosition", "n"); break; case EAST: xml.appendAttribute("imagePosition", "e"); break; case SOUTH: xml.appendAttribute("imagePosition", "s"); break; case WEST: xml.appendAttribute("imagePosition", "w"); break; default: throw new SystemException("Unknown image position: " + imagePosition); } } // we have an image. We must have a text equivalent if (Util.empty(text) && Util.empty(link.getToolTip()) && Util.empty(link.getAccessibleText())) { // If the link has an umageUrl but no text equivalent get the text equivalent off of the image WImage linkImage = link.getImageHolder(); if (null != linkImage) { xml.appendOptionalAttribute("toolTip", linkImage.getAlternativeText()); // depends on control dependency: [if], data = [none] } } } if (link.isRenderAsButton()) { xml.appendAttribute("type", "button"); // depends on control dependency: [if], data = [none] } xml.appendClose(); if (targetWindowName != null) { xml.appendTagOpen("ui:windowAttributes"); // depends on control dependency: [if], data = [none] xml.appendAttribute("name", targetWindowName); // depends on control dependency: [if], data = [none] WLink.WindowAttributes attributes = link.getWindowAttrs(); if (attributes != null) { xml.appendOptionalAttribute("top", attributes.getTop() >= 0, attributes.getTop()); // depends on control dependency: [if], data = [none] xml.appendOptionalAttribute("left", attributes.getLeft() >= 0, attributes.getLeft()); // depends on control dependency: [if], data = [none] xml.appendOptionalAttribute("width", attributes.getWidth() > 0, attributes. getWidth()); // depends on control dependency: [if], data = [none] xml.appendOptionalAttribute("height", attributes.getHeight() > 0, attributes. getHeight()); // depends on control dependency: [if], data = [none] xml.appendOptionalAttribute("resizable", attributes.isResizable(), "true"); // depends on control dependency: [if], data = [none] xml.appendOptionalAttribute("showMenubar", attributes.isMenubar(), "true"); // depends on control dependency: [if], data = [none] xml.appendOptionalAttribute("showToolbar", attributes.isToolbars(), "true"); // depends on control dependency: [if], data = [none] xml.appendOptionalAttribute("showLocation", attributes.isLocation(), "true"); // depends on control dependency: [if], data = [none] xml.appendOptionalAttribute("showStatus", attributes.isStatus(), "true"); // depends on control dependency: [if], data = [none] xml.appendOptionalAttribute("showScrollbars", attributes.isScrollbars(), "true"); // depends on control dependency: [if], data = [none] xml.appendOptionalAttribute("showDirectories", attributes.isDirectories(), "true"); // depends on control dependency: [if], data = [none] } xml.appendEnd(); // depends on control dependency: [if], data = [none] } if (text != null) { xml.appendEscaped(text); // depends on control dependency: [if], data = [(text] } xml.appendEndTag("ui:link"); // Paint the AJAX trigger if the link has an action if (link.getAction() != null) { paintAjaxTrigger(link, xml); // depends on control dependency: [if], data = [none] } } }
public class class_name { public IoBuffer encodePacket(Packet packet) { IoBuffer out = null; Header header = packet.getHeader(); int channelId = header.getChannelId(); //log.trace("Channel id: {}", channelId); IRTMPEvent message = packet.getMessage(); if (message instanceof ChunkSize) { ChunkSize chunkSizeMsg = (ChunkSize) message; ((RTMPConnection) Red5.getConnectionLocal()).getState().setWriteChunkSize(chunkSizeMsg.getSize()); } // normally the message is expected not to be dropped if (!dropMessage(channelId, message)) { //log.trace("Header time: {} message timestamp: {}", header.getTimer(), message.getTimestamp()); IoBuffer data = encodeMessage(header, message); if (data != null) { RTMP rtmp = ((RTMPConnection) Red5.getConnectionLocal()).getState(); // set last write packet rtmp.setLastWritePacket(channelId, packet); // ensure we're at the beginning if (data.position() != 0) { data.flip(); } else { data.rewind(); } // length of the data to be chunked int dataLen = data.limit(); header.setSize(dataLen); //if (log.isTraceEnabled()) { //log.trace("Message: {}", data); //} // chunk size for writing int chunkSize = rtmp.getWriteChunkSize(); // number of chunks to write int numChunks = (int) Math.ceil(dataLen / (float) chunkSize); // get last header Header lastHeader = rtmp.getLastWriteHeader(channelId); if (log.isTraceEnabled()) { log.trace("Channel id: {} chunkSize: {}", channelId, chunkSize); } // attempt to properly guess the size of the buffer we'll need int bufSize = dataLen + 18 + (numChunks * 2); //log.trace("Allocated buffer size: {}", bufSize); out = IoBuffer.allocate(bufSize, false); out.setAutoExpand(true); do { // encode the header encodeHeader(header, lastHeader, out); // write a chunk byte[] buf = new byte[Math.min(chunkSize, data.remaining())]; data.get(buf); //log.trace("Buffer: {}", Hex.encodeHexString(buf)); out.put(buf); // move header over to last header lastHeader = header.clone(); } while (data.hasRemaining()); // collapse the time stamps on the last header after decode is complete lastHeader.setTimerBase(lastHeader.getTimer()); // clear the delta lastHeader.setTimerDelta(0); // set last write header rtmp.setLastWriteHeader(channelId, lastHeader); data.free(); out.flip(); data = null; } } message.release(); return out; } }
public class class_name { public IoBuffer encodePacket(Packet packet) { IoBuffer out = null; Header header = packet.getHeader(); int channelId = header.getChannelId(); //log.trace("Channel id: {}", channelId); IRTMPEvent message = packet.getMessage(); if (message instanceof ChunkSize) { ChunkSize chunkSizeMsg = (ChunkSize) message; ((RTMPConnection) Red5.getConnectionLocal()).getState().setWriteChunkSize(chunkSizeMsg.getSize()); // depends on control dependency: [if], data = [none] } // normally the message is expected not to be dropped if (!dropMessage(channelId, message)) { //log.trace("Header time: {} message timestamp: {}", header.getTimer(), message.getTimestamp()); IoBuffer data = encodeMessage(header, message); if (data != null) { RTMP rtmp = ((RTMPConnection) Red5.getConnectionLocal()).getState(); // set last write packet rtmp.setLastWritePacket(channelId, packet); // depends on control dependency: [if], data = [none] // ensure we're at the beginning if (data.position() != 0) { data.flip(); // depends on control dependency: [if], data = [none] } else { data.rewind(); // depends on control dependency: [if], data = [none] } // length of the data to be chunked int dataLen = data.limit(); header.setSize(dataLen); // depends on control dependency: [if], data = [(data] //if (log.isTraceEnabled()) { //log.trace("Message: {}", data); //} // chunk size for writing int chunkSize = rtmp.getWriteChunkSize(); // number of chunks to write int numChunks = (int) Math.ceil(dataLen / (float) chunkSize); // get last header Header lastHeader = rtmp.getLastWriteHeader(channelId); if (log.isTraceEnabled()) { log.trace("Channel id: {} chunkSize: {}", channelId, chunkSize); // depends on control dependency: [if], data = [none] } // attempt to properly guess the size of the buffer we'll need int bufSize = dataLen + 18 + (numChunks * 2); //log.trace("Allocated buffer size: {}", bufSize); out = IoBuffer.allocate(bufSize, false); // depends on control dependency: [if], data = [none] out.setAutoExpand(true); // depends on control dependency: [if], data = [none] do { // encode the header encodeHeader(header, lastHeader, out); // write a chunk byte[] buf = new byte[Math.min(chunkSize, data.remaining())]; data.get(buf); //log.trace("Buffer: {}", Hex.encodeHexString(buf)); out.put(buf); // move header over to last header lastHeader = header.clone(); } while (data.hasRemaining()); // collapse the time stamps on the last header after decode is complete lastHeader.setTimerBase(lastHeader.getTimer()); // depends on control dependency: [if], data = [none] // clear the delta lastHeader.setTimerDelta(0); // depends on control dependency: [if], data = [none] // set last write header rtmp.setLastWriteHeader(channelId, lastHeader); // depends on control dependency: [if], data = [none] data.free(); // depends on control dependency: [if], data = [none] out.flip(); // depends on control dependency: [if], data = [none] data = null; // depends on control dependency: [if], data = [none] } } message.release(); return out; } }
public class class_name { private static double distance(double[] p1, double[] p2) { switch (p1.length) { case 2: return Math.sqrt((p1[0] - p2[0]) * (p1[0] - p2[0]) + (p1[1] - p2[1]) * (p1[1] - p2[1])); case 3: return Math.sqrt((p1[0] - p2[0]) * (p1[0] - p2[0]) + (p1[1] - p2[1]) * (p1[1] - p2[1]) + (p1[2] - p2[2]) * (p1[2] - p2[2])); default: { double dist = 0; for (int i = p1.length - 1; i >= 0; i--) { final double d = (p1[i] - p2[i]); dist += d * d; } return Math.sqrt(dist); } } } }
public class class_name { private static double distance(double[] p1, double[] p2) { switch (p1.length) { case 2: return Math.sqrt((p1[0] - p2[0]) * (p1[0] - p2[0]) + (p1[1] - p2[1]) * (p1[1] - p2[1])); case 3: return Math.sqrt((p1[0] - p2[0]) * (p1[0] - p2[0]) + (p1[1] - p2[1]) * (p1[1] - p2[1]) + (p1[2] - p2[2]) * (p1[2] - p2[2])); default: { double dist = 0; for (int i = p1.length - 1; i >= 0; i--) { final double d = (p1[i] - p2[i]); dist += d * d; // depends on control dependency: [for], data = [none] } return Math.sqrt(dist); } } } }
public class class_name { public PropertyDataReader forProperty(InternalQName name, int type) { if (nodePropertyReader == null) { nodePropertyReader = new PropertyDataReader(parent, dataManager); } return nodePropertyReader.forProperty(name, type); } }
public class class_name { public PropertyDataReader forProperty(InternalQName name, int type) { if (nodePropertyReader == null) { nodePropertyReader = new PropertyDataReader(parent, dataManager); // depends on control dependency: [if], data = [none] } return nodePropertyReader.forProperty(name, type); } }
public class class_name { public void align(Object... o) { int i = 0; String s[] = new String[o.length]; for (int ii = 0; ii < o.length; ii++) { if (o[ii] != null) { s[ii] = o[ii].toString(); } } while (i < s.length && i < maxColumnLength.size()) { int l = (s[i] == null ? 0 : s[i].length()); if (maxColumnLength.get(i) < l) { maxColumnLength.set(i, l); } i++; } while (i < s.length) { maxColumnLength.add((s[i] == null ? 0 : s[i].length())); i++; } rows.add(s); } }
public class class_name { public void align(Object... o) { int i = 0; String s[] = new String[o.length]; for (int ii = 0; ii < o.length; ii++) { if (o[ii] != null) { s[ii] = o[ii].toString(); } } // depends on control dependency: [if], data = [none] while (i < s.length && i < maxColumnLength.size()) { int l = (s[i] == null ? 0 : s[i].length()); if (maxColumnLength.get(i) < l) { maxColumnLength.set(i, l); // depends on control dependency: [if], data = [l)] } i++; // depends on control dependency: [while], data = [none] } while (i < s.length) { maxColumnLength.add((s[i] == null ? 0 : s[i].length())); // depends on control dependency: [while], data = [none] i++; // depends on control dependency: [while], data = [none] } rows.add(s); } }
public class class_name { public static String getEmailDomain(final String email) { if (email == null || email.isEmpty()) { return null; } final int atSignIndex = email.indexOf('@'); if (atSignIndex != -1) { return email.substring(atSignIndex + 1); } return null; } }
public class class_name { public static String getEmailDomain(final String email) { if (email == null || email.isEmpty()) { return null; // depends on control dependency: [if], data = [none] } final int atSignIndex = email.indexOf('@'); if (atSignIndex != -1) { return email.substring(atSignIndex + 1); // depends on control dependency: [if], data = [(atSignIndex] } return null; } }
public class class_name { private static Throwable getLastArgumentIfThrowable(Object... arguments) { if (ArrayUtil.isNotEmpty(arguments) && arguments[arguments.length - 1] instanceof Throwable) { return (Throwable) arguments[arguments.length - 1]; } else { return null; } } }
public class class_name { private static Throwable getLastArgumentIfThrowable(Object... arguments) { if (ArrayUtil.isNotEmpty(arguments) && arguments[arguments.length - 1] instanceof Throwable) { return (Throwable) arguments[arguments.length - 1]; // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void addResponse(RecordResponse response) { if (response.getResponseSize() + getResponseSize() > 248) { throw new IllegalArgumentException(); } if (records == null) { records = new RecordResponse[1]; } else { RecordResponse old[] = records; records = new RecordResponse[old.length + 1]; System.arraycopy(old, 0, records, 0, old.length); } records[records.length - 1] = response; setDataLength(getResponseSize()); } }
public class class_name { public void addResponse(RecordResponse response) { if (response.getResponseSize() + getResponseSize() > 248) { throw new IllegalArgumentException(); } if (records == null) { records = new RecordResponse[1]; // depends on control dependency: [if], data = [none] } else { RecordResponse old[] = records; records = new RecordResponse[old.length + 1]; // depends on control dependency: [if], data = [none] System.arraycopy(old, 0, records, 0, old.length); // depends on control dependency: [if], data = [none] } records[records.length - 1] = response; setDataLength(getResponseSize()); } }
public class class_name { @SuppressWarnings("unused") // used by parser public static void removeDuplicatesAndReportErrors( Iterable<CommandTagAttribute> attrs, ErrorReporter errorReporter) { Set<String> seenAttributes = new HashSet<>(); for (Iterator<CommandTagAttribute> iterator = attrs.iterator(); iterator.hasNext(); ) { CommandTagAttribute attr = iterator.next(); Identifier name = attr.getName(); if (!seenAttributes.add(name.identifier())) { errorReporter.report(name.location(), DUPLICATE_ATTRIBUTE, name.identifier()); iterator.remove(); } } } }
public class class_name { @SuppressWarnings("unused") // used by parser public static void removeDuplicatesAndReportErrors( Iterable<CommandTagAttribute> attrs, ErrorReporter errorReporter) { Set<String> seenAttributes = new HashSet<>(); for (Iterator<CommandTagAttribute> iterator = attrs.iterator(); iterator.hasNext(); ) { CommandTagAttribute attr = iterator.next(); Identifier name = attr.getName(); if (!seenAttributes.add(name.identifier())) { errorReporter.report(name.location(), DUPLICATE_ATTRIBUTE, name.identifier()); // depends on control dependency: [if], data = [none] iterator.remove(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static long bytesToLong(byte[] bytes) { assert bytes != null && bytes.length <= 8; final int BYTE_SIZE = 8; long value = 0; for (int i = 0; i < bytes.length; i++) { // shift byte i times, so it gets the correct significance int shift = BYTE_SIZE * i; // (b & 0xff) treats b as unsigned byte // calculate the value to add by performing the shift value += (long) (bytes[i] & 0xff) << shift; } return value; } }
public class class_name { public static long bytesToLong(byte[] bytes) { assert bytes != null && bytes.length <= 8; final int BYTE_SIZE = 8; long value = 0; for (int i = 0; i < bytes.length; i++) { // shift byte i times, so it gets the correct significance int shift = BYTE_SIZE * i; // (b & 0xff) treats b as unsigned byte // calculate the value to add by performing the shift value += (long) (bytes[i] & 0xff) << shift; // depends on control dependency: [for], data = [i] } return value; } }
public class class_name { void checkNeedsPropertiesReloading(long now) { if (CACHING_VALIDITY_MS > 0 && now - lastCachedTime > CACHING_VALIDITY_MS) { this.rampUp = owner.getRampUpSeconds(); this.hold = owner.getHoldSeconds(); this.steps = owner.getStepsAsLong(); this.maxConcurr = owner.getTargetLevelAsDouble(); this.defaultShiftRampup = JMeterUtils.getPropDefault("dynamic_tg.shift_rampup_start", 0L); this.lastCachedTime = System.currentTimeMillis(); } } }
public class class_name { void checkNeedsPropertiesReloading(long now) { if (CACHING_VALIDITY_MS > 0 && now - lastCachedTime > CACHING_VALIDITY_MS) { this.rampUp = owner.getRampUpSeconds(); // depends on control dependency: [if], data = [none] this.hold = owner.getHoldSeconds(); // depends on control dependency: [if], data = [none] this.steps = owner.getStepsAsLong(); // depends on control dependency: [if], data = [none] this.maxConcurr = owner.getTargetLevelAsDouble(); // depends on control dependency: [if], data = [none] this.defaultShiftRampup = JMeterUtils.getPropDefault("dynamic_tg.shift_rampup_start", 0L); // depends on control dependency: [if], data = [none] this.lastCachedTime = System.currentTimeMillis(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public <E extends Enum> E getEnum(HazelcastProperty property, Class<E> enumClazz) { String value = getString(property); for (E enumConstant : enumClazz.getEnumConstants()) { if (enumConstant.name().equalsIgnoreCase(value)) { return enumConstant; } } throw new IllegalArgumentException(format("value '%s' for property '%s' is not a valid %s value", value, property.getName(), enumClazz.getName())); } }
public class class_name { public <E extends Enum> E getEnum(HazelcastProperty property, Class<E> enumClazz) { String value = getString(property); for (E enumConstant : enumClazz.getEnumConstants()) { if (enumConstant.name().equalsIgnoreCase(value)) { return enumConstant; // depends on control dependency: [if], data = [none] } } throw new IllegalArgumentException(format("value '%s' for property '%s' is not a valid %s value", value, property.getName(), enumClazz.getName())); } }
public class class_name { public static String deidentifyRight(String str, int size) { int end = str.length(); int repeat; if (size > str.length()) { repeat = str.length(); } else { repeat = size; } return StringUtils.overlay(str, StringUtils.repeat('*', repeat), end - size, end); } }
public class class_name { public static String deidentifyRight(String str, int size) { int end = str.length(); int repeat; if (size > str.length()) { repeat = str.length(); // depends on control dependency: [if], data = [none] } else { repeat = size; // depends on control dependency: [if], data = [none] } return StringUtils.overlay(str, StringUtils.repeat('*', repeat), end - size, end); } }
public class class_name { public static String quote(String str) { int len = str.length(); StringBuffer buf = new StringBuffer(len+2); buf.append("\""); char c; for (int i=0;i<len;i++) { c = str.charAt(i); if (c == '"' || c == '\\') { buf.append("\\"); } buf.append(c); } buf.append("\""); return buf.toString(); } }
public class class_name { public static String quote(String str) { int len = str.length(); StringBuffer buf = new StringBuffer(len+2); buf.append("\""); char c; for (int i=0;i<len;i++) { c = str.charAt(i); // depends on control dependency: [for], data = [i] if (c == '"' || c == '\\') { buf.append("\\"); // depends on control dependency: [if], data = [none] } buf.append(c); // depends on control dependency: [for], data = [none] } buf.append("\""); return buf.toString(); } }
public class class_name { public OkRequest<T> send(final CharSequence value) { openOutput(); try { mOutput.write(value.toString()); } catch (IOException e) { deliverError(new ParseError(e)); } return this; } }
public class class_name { public OkRequest<T> send(final CharSequence value) { openOutput(); try { mOutput.write(value.toString()); // depends on control dependency: [try], data = [none] } catch (IOException e) { deliverError(new ParseError(e)); } // depends on control dependency: [catch], data = [none] return this; } }
public class class_name { @Override protected void _fit(Dataframe trainingData) { AbstractModelParameters modelParameters = knowledgeBase.getModelParameters(); int n = trainingData.size(); int d = trainingData.xColumnSize(); Map<List<Object>, Double> logLikelihoods = modelParameters.getLogLikelihoods(); Map<Object, Double> logPriors = modelParameters.getLogPriors(); Set<Object> classesSet = modelParameters.getClasses(); boolean isBinarized = isBinarized(); //calculate first statistics about the classes Map<Object, Double> totalFeatureOccurrencesForEachClass = new HashMap<>(); for(Record r : trainingData) { Object theClass=r.getY(); if(classesSet.add(theClass)) { //is it new class? add it logPriors.put(theClass, 1.0); totalFeatureOccurrencesForEachClass.put(theClass, 0.0); } else { //already exists? increase counter logPriors.put(theClass,logPriors.get(theClass)+1.0); } } //Loop through all the classes to ensure that the feature-class combination is initialized for ALL the classes //The math REQUIRE us to have scores for all classes to make the probabilities comparable. /* Implementation note: The code below uses the metadata from the Dataframe to avoid looping through all the data. This means that if the metadata are stale (contain more columns than the actual data due to updates/removes) we will initialize more parameters here. Nevertheless this should not have any effects on the results of the algorithm since the scores will be the same in all classes and it will be taken care by the normalization. */ streamExecutor.forEach(StreamMethods.stream(trainingData.getXDataTypes().keySet().stream(), isParallelized()), feature -> { for(Object theClass : classesSet) { List<Object> featureClassTuple = Arrays.asList(feature, theClass); logLikelihoods.put(featureClassTuple, 0.0); //the key is unique across threads and the map is concurrent } }); //now calculate the statistics of features streamExecutor.forEach(StreamMethods.stream(trainingData.stream(), isParallelized()), r -> { Object theClass = r.getY(); //store the occurrances of the features double sumOfOccurrences = 0.0; for(Map.Entry<Object, Object> entry : r.getX().entrySet()) { Object feature = entry.getKey(); Double occurrences=TypeInference.toDouble(entry.getValue()); if(occurrences!= null && occurrences>0.0) { if(isBinarized) { occurrences=1.0; } List<Object> featureClassTuple = Arrays.asList(feature, theClass); logLikelihoods.put(featureClassTuple, logLikelihoods.get(featureClassTuple)+occurrences); //each thread updates a unique key and the map is cuncurrent sumOfOccurrences+=occurrences; } } synchronized(totalFeatureOccurrencesForEachClass) { totalFeatureOccurrencesForEachClass.put(theClass,totalFeatureOccurrencesForEachClass.get(theClass)+sumOfOccurrences); } }); //calculate prior log probabilities for(Map.Entry<Object, Double> entry : logPriors.entrySet()) { Object theClass = entry.getKey(); Double count = entry.getValue(); //updated log priors logPriors.put(theClass, Math.log(count/n)); } //update log likelihood streamExecutor.forEach(StreamMethods.stream(logLikelihoods.entrySet().stream(), isParallelized()), featureClassCounts -> { List<Object> featureClassTuple = featureClassCounts.getKey(); Object theClass = featureClassTuple.get(1); Double occurrences = featureClassCounts.getValue(); if(occurrences==null) { occurrences=0.0; } //We perform laplace smoothing (also known as add-1) Double smoothedProbability = (occurrences+1.0)/(totalFeatureOccurrencesForEachClass.get(theClass)+d); // the d is also known in NLP problems as the Vocabulary size. logLikelihoods.put(featureClassTuple, Math.log( smoothedProbability )); //calculate the logScore }); } }
public class class_name { @Override protected void _fit(Dataframe trainingData) { AbstractModelParameters modelParameters = knowledgeBase.getModelParameters(); int n = trainingData.size(); int d = trainingData.xColumnSize(); Map<List<Object>, Double> logLikelihoods = modelParameters.getLogLikelihoods(); Map<Object, Double> logPriors = modelParameters.getLogPriors(); Set<Object> classesSet = modelParameters.getClasses(); boolean isBinarized = isBinarized(); //calculate first statistics about the classes Map<Object, Double> totalFeatureOccurrencesForEachClass = new HashMap<>(); for(Record r : trainingData) { Object theClass=r.getY(); if(classesSet.add(theClass)) { //is it new class? add it logPriors.put(theClass, 1.0); // depends on control dependency: [if], data = [none] totalFeatureOccurrencesForEachClass.put(theClass, 0.0); // depends on control dependency: [if], data = [none] } else { //already exists? increase counter logPriors.put(theClass,logPriors.get(theClass)+1.0); // depends on control dependency: [if], data = [none] } } //Loop through all the classes to ensure that the feature-class combination is initialized for ALL the classes //The math REQUIRE us to have scores for all classes to make the probabilities comparable. /* Implementation note: The code below uses the metadata from the Dataframe to avoid looping through all the data. This means that if the metadata are stale (contain more columns than the actual data due to updates/removes) we will initialize more parameters here. Nevertheless this should not have any effects on the results of the algorithm since the scores will be the same in all classes and it will be taken care by the normalization. */ streamExecutor.forEach(StreamMethods.stream(trainingData.getXDataTypes().keySet().stream(), isParallelized()), feature -> { for(Object theClass : classesSet) { List<Object> featureClassTuple = Arrays.asList(feature, theClass); logLikelihoods.put(featureClassTuple, 0.0); //the key is unique across threads and the map is concurrent } }); //now calculate the statistics of features streamExecutor.forEach(StreamMethods.stream(trainingData.stream(), isParallelized()), r -> { Object theClass = r.getY(); //store the occurrances of the features double sumOfOccurrences = 0.0; for(Map.Entry<Object, Object> entry : r.getX().entrySet()) { Object feature = entry.getKey(); Double occurrences=TypeInference.toDouble(entry.getValue()); if(occurrences!= null && occurrences>0.0) { if(isBinarized) { occurrences=1.0; } List<Object> featureClassTuple = Arrays.asList(feature, theClass); logLikelihoods.put(featureClassTuple, logLikelihoods.get(featureClassTuple)+occurrences); //each thread updates a unique key and the map is cuncurrent sumOfOccurrences+=occurrences; } } synchronized(totalFeatureOccurrencesForEachClass) { totalFeatureOccurrencesForEachClass.put(theClass,totalFeatureOccurrencesForEachClass.get(theClass)+sumOfOccurrences); } }); //calculate prior log probabilities for(Map.Entry<Object, Double> entry : logPriors.entrySet()) { Object theClass = entry.getKey(); Double count = entry.getValue(); //updated log priors logPriors.put(theClass, Math.log(count/n)); } //update log likelihood streamExecutor.forEach(StreamMethods.stream(logLikelihoods.entrySet().stream(), isParallelized()), featureClassCounts -> { List<Object> featureClassTuple = featureClassCounts.getKey(); Object theClass = featureClassTuple.get(1); Double occurrences = featureClassCounts.getValue(); if(occurrences==null) { occurrences=0.0; } //We perform laplace smoothing (also known as add-1) Double smoothedProbability = (occurrences+1.0)/(totalFeatureOccurrencesForEachClass.get(theClass)+d); // the d is also known in NLP problems as the Vocabulary size. logLikelihoods.put(featureClassTuple, Math.log( smoothedProbability )); //calculate the logScore }); } }
public class class_name { public void extract(@NotNull final SequentialReader reader, @NotNull final Metadata metadata, long length, @Nullable Directory parentDirectory) { IptcDirectory directory = new IptcDirectory(); metadata.addDirectory(directory); if (parentDirectory != null) directory.setParent(parentDirectory); int offset = 0; // for each tag while (offset < length) { // identifies start of a tag short startByte; try { startByte = reader.getUInt8(); offset++; } catch (IOException e) { directory.addError("Unable to read starting byte of IPTC tag"); return; } if (startByte != IptcMarkerByte) { // NOTE have seen images where there was one extra byte at the end, giving // offset==length at this point, which is not worth logging as an error. if (offset != length) directory.addError("Invalid IPTC tag marker at offset " + (offset - 1) + ". Expected '0x" + Integer.toHexString(IptcMarkerByte) + "' but got '0x" + Integer.toHexString(startByte) + "'."); return; } // we need at least four bytes left to read a tag if (offset + 4 > length) { directory.addError("Too few bytes remain for a valid IPTC tag"); return; } int directoryType; int tagType; int tagByteCount; try { directoryType = reader.getUInt8(); tagType = reader.getUInt8(); tagByteCount = reader.getUInt16(); if (tagByteCount > 32767) { // Extended DataSet Tag (see 1.5(c), p14, IPTC-IIMV4.2.pdf) tagByteCount = ((tagByteCount & 0x7FFF) << 16) | reader.getUInt16(); offset += 2; } offset += 4; } catch (IOException e) { directory.addError("IPTC data segment ended mid-way through tag descriptor"); return; } if (offset + tagByteCount > length) { directory.addError("Data for tag extends beyond end of IPTC segment"); return; } try { processTag(reader, directory, directoryType, tagType, tagByteCount); } catch (IOException e) { directory.addError("Error processing IPTC tag"); return; } offset += tagByteCount; } } }
public class class_name { public void extract(@NotNull final SequentialReader reader, @NotNull final Metadata metadata, long length, @Nullable Directory parentDirectory) { IptcDirectory directory = new IptcDirectory(); metadata.addDirectory(directory); if (parentDirectory != null) directory.setParent(parentDirectory); int offset = 0; // for each tag while (offset < length) { // identifies start of a tag short startByte; try { startByte = reader.getUInt8(); // depends on control dependency: [try], data = [none] offset++; // depends on control dependency: [try], data = [none] } catch (IOException e) { directory.addError("Unable to read starting byte of IPTC tag"); return; } // depends on control dependency: [catch], data = [none] if (startByte != IptcMarkerByte) { // NOTE have seen images where there was one extra byte at the end, giving // offset==length at this point, which is not worth logging as an error. if (offset != length) directory.addError("Invalid IPTC tag marker at offset " + (offset - 1) + ". Expected '0x" + Integer.toHexString(IptcMarkerByte) + "' but got '0x" + Integer.toHexString(startByte) + "'."); return; // depends on control dependency: [if], data = [none] } // we need at least four bytes left to read a tag if (offset + 4 > length) { directory.addError("Too few bytes remain for a valid IPTC tag"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } int directoryType; int tagType; int tagByteCount; try { directoryType = reader.getUInt8(); // depends on control dependency: [try], data = [none] tagType = reader.getUInt8(); // depends on control dependency: [try], data = [none] tagByteCount = reader.getUInt16(); // depends on control dependency: [try], data = [none] if (tagByteCount > 32767) { // Extended DataSet Tag (see 1.5(c), p14, IPTC-IIMV4.2.pdf) tagByteCount = ((tagByteCount & 0x7FFF) << 16) | reader.getUInt16(); // depends on control dependency: [if], data = [(tagByteCount] offset += 2; // depends on control dependency: [if], data = [none] } offset += 4; // depends on control dependency: [try], data = [none] } catch (IOException e) { directory.addError("IPTC data segment ended mid-way through tag descriptor"); return; } // depends on control dependency: [catch], data = [none] if (offset + tagByteCount > length) { directory.addError("Data for tag extends beyond end of IPTC segment"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } try { processTag(reader, directory, directoryType, tagType, tagByteCount); // depends on control dependency: [try], data = [none] } catch (IOException e) { directory.addError("Error processing IPTC tag"); return; } // depends on control dependency: [catch], data = [none] offset += tagByteCount; // depends on control dependency: [while], data = [none] } } }
public class class_name { public boolean shouldSelectProperty(String property) { // no restriction if (getRoot().eagerLoad || restrictedProperties == null) { return true; } // explicit restriction if (getRoot().eagerLoad || restrictedProperties.contains(property)) { return true; } return false; } }
public class class_name { public boolean shouldSelectProperty(String property) { // no restriction if (getRoot().eagerLoad || restrictedProperties == null) { return true; // depends on control dependency: [if], data = [none] } // explicit restriction if (getRoot().eagerLoad || restrictedProperties.contains(property)) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public EList<Short> getValues() { if (values == null) { values = new EDataTypeEList<Short>(Short.class, this, TypesPackage.JVM_SHORT_ANNOTATION_VALUE__VALUES); } return values; } }
public class class_name { public EList<Short> getValues() { if (values == null) { values = new EDataTypeEList<Short>(Short.class, this, TypesPackage.JVM_SHORT_ANNOTATION_VALUE__VALUES); // depends on control dependency: [if], data = [none] } return values; } }
public class class_name { public static double length3D(Geometry geom) { double sum = 0; for (int i = 0; i < geom.getNumGeometries(); i++) { sum += length3D((LineString) geom.getGeometryN(i)); } return sum; } }
public class class_name { public static double length3D(Geometry geom) { double sum = 0; for (int i = 0; i < geom.getNumGeometries(); i++) { sum += length3D((LineString) geom.getGeometryN(i)); // depends on control dependency: [for], data = [i] } return sum; } }
public class class_name { public GetRequestValidatorsResult withItems(RequestValidator... items) { if (this.items == null) { setItems(new java.util.ArrayList<RequestValidator>(items.length)); } for (RequestValidator ele : items) { this.items.add(ele); } return this; } }
public class class_name { public GetRequestValidatorsResult withItems(RequestValidator... items) { if (this.items == null) { setItems(new java.util.ArrayList<RequestValidator>(items.length)); // depends on control dependency: [if], data = [none] } for (RequestValidator ele : items) { this.items.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { @Override public void deleteOrReleaseReadLock(final String filename) { if (isMultiChunked(filename)) { int newValue = 0; FileReadLockKey readLockKey = new FileReadLockKey(indexName, filename, affinitySegmentId); boolean done = false; Object lockValue = locksCache.get(readLockKey); while (!done) { if (lockValue == null) { lockValue = locksCache.putIfAbsent(readLockKey, 0); done = (null == lockValue); } else { Integer refCountObject = (Integer) lockValue; int refCount = refCountObject.intValue(); newValue = refCount - 1; done = locksCache.replace(readLockKey, refCountObject, newValue); if (!done) { lockValue = locksCache.get(readLockKey); } } } if (newValue == 0) { realFileDelete(indexName, filename, locksCache, chunksCache, metadataCache, forceSynchronousDeletes, affinitySegmentId); } } else { realFileDelete(indexName, filename, locksCache, chunksCache, metadataCache, forceSynchronousDeletes, affinitySegmentId); } } }
public class class_name { @Override public void deleteOrReleaseReadLock(final String filename) { if (isMultiChunked(filename)) { int newValue = 0; FileReadLockKey readLockKey = new FileReadLockKey(indexName, filename, affinitySegmentId); boolean done = false; Object lockValue = locksCache.get(readLockKey); while (!done) { if (lockValue == null) { lockValue = locksCache.putIfAbsent(readLockKey, 0); // depends on control dependency: [if], data = [none] done = (null == lockValue); // depends on control dependency: [if], data = [none] } else { Integer refCountObject = (Integer) lockValue; int refCount = refCountObject.intValue(); newValue = refCount - 1; // depends on control dependency: [if], data = [none] done = locksCache.replace(readLockKey, refCountObject, newValue); // depends on control dependency: [if], data = [none] if (!done) { lockValue = locksCache.get(readLockKey); // depends on control dependency: [if], data = [none] } } } if (newValue == 0) { realFileDelete(indexName, filename, locksCache, chunksCache, metadataCache, forceSynchronousDeletes, affinitySegmentId); // depends on control dependency: [if], data = [none] } } else { realFileDelete(indexName, filename, locksCache, chunksCache, metadataCache, forceSynchronousDeletes, affinitySegmentId); // depends on control dependency: [if], data = [none] } } }
public class class_name { private int classifyTags(IFD ifd, ArrayList<TagValue> oversized, ArrayList<TagValue> undersized) { int tagValueSize = 4; int n = 0; for (TagValue tag : ifd.getMetadata().getTags()) { int tagsize = getTagSize(tag); if (tagsize > tagValueSize) { oversized.add(tag); } else { undersized.add(tag); } n++; } return n; } }
public class class_name { private int classifyTags(IFD ifd, ArrayList<TagValue> oversized, ArrayList<TagValue> undersized) { int tagValueSize = 4; int n = 0; for (TagValue tag : ifd.getMetadata().getTags()) { int tagsize = getTagSize(tag); if (tagsize > tagValueSize) { oversized.add(tag); // depends on control dependency: [if], data = [none] } else { undersized.add(tag); // depends on control dependency: [if], data = [none] } n++; // depends on control dependency: [for], data = [none] } return n; } }
public class class_name { void waitForReady() { if (!ready) { writeLock(); try { while (!ready) { try { cond.await(5000, TimeUnit.MILLISECONDS); } catch (InterruptedException ie) { } } } finally { writeUnlock(); } } } }
public class class_name { void waitForReady() { if (!ready) { writeLock(); // depends on control dependency: [if], data = [none] try { while (!ready) { try { cond.await(5000, TimeUnit.MILLISECONDS); // depends on control dependency: [try], data = [none] } catch (InterruptedException ie) { } // depends on control dependency: [catch], data = [none] } } finally { writeUnlock(); } } } }
public class class_name { private static Throwable getInnerException(Throwable exception) {// NOPMD final Throwable tmpException = exception; exception = getExceptionCauseUsingWellKnownTypes(tmpException); if (exception == null) { for (CauseMethodName methodName : CauseMethodName.values()) { exception = getExceptionCauseUsingMethodName(tmpException, methodName); if (exception != null) { break; } } } return exception; } }
public class class_name { private static Throwable getInnerException(Throwable exception) {// NOPMD final Throwable tmpException = exception; exception = getExceptionCauseUsingWellKnownTypes(tmpException); if (exception == null) { for (CauseMethodName methodName : CauseMethodName.values()) { exception = getExceptionCauseUsingMethodName(tmpException, methodName); // depends on control dependency: [for], data = [methodName] if (exception != null) { break; } } } return exception; } }
public class class_name { protected TypeData findSubclassTypeData(final Class type) { final Class<? extends Annotation> defaultAnnotation = jsonAnnotation; if (type.getAnnotation(defaultAnnotation) != null) { // current type has annotation, don't find anything, let type data be created return null; } ClassDescriptor cd = ClassIntrospector.get().lookup(type); // lookup superclasses Class[] superClasses = cd.getAllSuperclasses(); for (Class superClass : superClasses) { if (superClass.getAnnotation(defaultAnnotation) != null) { // annotated subclass founded! return _lookupTypeData(superClass); } } Class[] interfaces = cd.getAllInterfaces(); for (Class interfaze : interfaces) { if (interfaze.getAnnotation(defaultAnnotation) != null) { // annotated subclass founded! return _lookupTypeData(interfaze); } } return null; } }
public class class_name { protected TypeData findSubclassTypeData(final Class type) { final Class<? extends Annotation> defaultAnnotation = jsonAnnotation; if (type.getAnnotation(defaultAnnotation) != null) { // current type has annotation, don't find anything, let type data be created return null; // depends on control dependency: [if], data = [none] } ClassDescriptor cd = ClassIntrospector.get().lookup(type); // lookup superclasses Class[] superClasses = cd.getAllSuperclasses(); for (Class superClass : superClasses) { if (superClass.getAnnotation(defaultAnnotation) != null) { // annotated subclass founded! return _lookupTypeData(superClass); // depends on control dependency: [if], data = [none] } } Class[] interfaces = cd.getAllInterfaces(); for (Class interfaze : interfaces) { if (interfaze.getAnnotation(defaultAnnotation) != null) { // annotated subclass founded! return _lookupTypeData(interfaze); // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { static void closeStream(BufferedReader br, FileReader fr) { try { if (br != null) br.close(); if (fr != null) fr.close(); } catch (IOException ex) { logger.error(ex.getMessage()); logger.debug("{}", ex.getStackTrace()); } } }
public class class_name { static void closeStream(BufferedReader br, FileReader fr) { try { if (br != null) br.close(); if (fr != null) fr.close(); } catch (IOException ex) { logger.error(ex.getMessage()); logger.debug("{}", ex.getStackTrace()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void selectValue(String value) { String action = SELECTING + value + " in " + prettyOutput(); String expected = prettyOutputStart() + PRESENT_DISPLAYED_AND_ENABLED + value + SELECTED; try { if (isNotPresentDisplayedEnabledSelect(action, expected)) { return; } // ensure the value exists if (!Arrays.asList(get.selectValues()).contains(value)) { reporter.fail(action, expected, CANT_SELECT + value + " in " + prettyOutput() + " as that value isn't present. Available values are:<i><br/>&nbsp;&nbsp;&nbsp;" + String.join("<br/>&nbsp;&nbsp;&nbsp;", get.selectValues()) + "</i>"); return; } // do the select WebElement webElement = getWebElement(); Select dropdown = new Select(webElement); dropdown.selectByValue(value); } catch (Exception e) { log.warn(e); reporter.fail(action, expected, CANT_SELECT + prettyOutputEnd() + e.getMessage()); return; } reporter.pass(action, expected, "Selected <b>" + value + INN + prettyOutputEnd().trim()); } }
public class class_name { public void selectValue(String value) { String action = SELECTING + value + " in " + prettyOutput(); String expected = prettyOutputStart() + PRESENT_DISPLAYED_AND_ENABLED + value + SELECTED; try { if (isNotPresentDisplayedEnabledSelect(action, expected)) { return; // depends on control dependency: [if], data = [none] } // ensure the value exists if (!Arrays.asList(get.selectValues()).contains(value)) { reporter.fail(action, expected, CANT_SELECT + value + " in " + prettyOutput() + " as that value isn't present. Available values are:<i><br/>&nbsp;&nbsp;&nbsp;" + String.join("<br/>&nbsp;&nbsp;&nbsp;", get.selectValues()) + "</i>"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // do the select WebElement webElement = getWebElement(); Select dropdown = new Select(webElement); dropdown.selectByValue(value); // depends on control dependency: [try], data = [none] } catch (Exception e) { log.warn(e); reporter.fail(action, expected, CANT_SELECT + prettyOutputEnd() + e.getMessage()); return; } // depends on control dependency: [catch], data = [none] reporter.pass(action, expected, "Selected <b>" + value + INN + prettyOutputEnd().trim()); } }
public class class_name { public static Document toDocument(String xml) { try { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory .newInstance(); documentBuilderFactory.setNamespaceAware(true); documentBuilderFactory.setIgnoringElementContentWhitespace(true); documentBuilderFactory.isIgnoringComments(); documentBuilderFactory.setCoalescing(true); DocumentBuilder documentBuilder = documentBuilderFactory .newDocumentBuilder(); InputSource inputSource = new InputSource(); inputSource.setCharacterStream(new StringReader(xml)); Document document = documentBuilder.parse(inputSource); removeUnusedNamespaces(document); return document; } catch (ParserConfigurationException e) { throw new RuntimeException(e); } catch (SAXException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } } }
public class class_name { public static Document toDocument(String xml) { try { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory .newInstance(); documentBuilderFactory.setNamespaceAware(true); // depends on control dependency: [try], data = [none] documentBuilderFactory.setIgnoringElementContentWhitespace(true); // depends on control dependency: [try], data = [none] documentBuilderFactory.isIgnoringComments(); // depends on control dependency: [try], data = [none] documentBuilderFactory.setCoalescing(true); // depends on control dependency: [try], data = [none] DocumentBuilder documentBuilder = documentBuilderFactory .newDocumentBuilder(); InputSource inputSource = new InputSource(); inputSource.setCharacterStream(new StringReader(xml)); // depends on control dependency: [try], data = [none] Document document = documentBuilder.parse(inputSource); removeUnusedNamespaces(document); // depends on control dependency: [try], data = [none] return document; // depends on control dependency: [try], data = [none] } catch (ParserConfigurationException e) { throw new RuntimeException(e); } catch (SAXException e) { // depends on control dependency: [catch], data = [none] throw new RuntimeException(e); } catch (IOException e) { // depends on control dependency: [catch], data = [none] throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void start() throws SlickException { SwingUtilities.invokeLater(new Runnable() { public void run() { try { Input.disableControllers(); try { Display.setParent(CanvasGameContainer.this); } catch (LWJGLException e) { throw new SlickException("Failed to setParent of canvas", e); } container.setup(); scheduleUpdate(); } catch (SlickException e) { e.printStackTrace(); System.exit(0); } } }); } }
public class class_name { public void start() throws SlickException { SwingUtilities.invokeLater(new Runnable() { public void run() { try { Input.disableControllers(); // depends on control dependency: [try], data = [none] try { Display.setParent(CanvasGameContainer.this); // depends on control dependency: [try], data = [none] } catch (LWJGLException e) { throw new SlickException("Failed to setParent of canvas", e); } // depends on control dependency: [catch], data = [none] container.setup(); // depends on control dependency: [try], data = [none] scheduleUpdate(); // depends on control dependency: [try], data = [none] } catch (SlickException e) { e.printStackTrace(); System.exit(0); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { private static boolean load(String name, boolean mustSucceed, boolean useJavaLib) { if (s_loadedLibs.contains(name)) { return true; } if (! VoltDB.getLoadLibVOLTDB()) { return false; } test64bit(); StringBuilder msgBuilder = new StringBuilder("Loading VoltDB native library "); String fullLibName = name; try { String versionString = VoltDB.instance().getEELibraryVersionString(); // This fallback is for test code only. if (versionString == null) { versionString = VoltDB.instance().getVersionString(); } assert(versionString != null); fullLibName = name + "-" + versionString; msgBuilder.append(fullLibName); File libFile = null; if (useJavaLib) { msgBuilder.append(" from the system library location. "); } else { libFile = getNativeLibraryFile(fullLibName); msgBuilder.append(" from file "); msgBuilder.append(libFile.getAbsolutePath()); msgBuilder.append(". "); } msgBuilder.append("A confirmation message will follow if the loading is successful."); s_hostLog.info(msgBuilder.toString()); if (useJavaLib) { System.loadLibrary(fullLibName); } else { System.load(libFile.getAbsolutePath()); } s_loadedLibs.add(name); s_hostLog.info("Successfully loaded VoltDB native library " + fullLibName + "."); return true; } catch (Throwable e) { if (s_hostLog.isDebugEnabled()) { s_hostLog.debug("Error loading VoltDB JNI shared library", e); } if (useJavaLib) { s_hostLog.info("Retry loading from file."); return load(name, mustSucceed, false); } if (mustSucceed) { msgBuilder.setLength(0); msgBuilder.append("Failed to load shared library ").append(fullLibName).append(": "); msgBuilder.append(e.getMessage()).append('\n'); msgBuilder.append("Library path: ").append(System.getProperty("java.library.path")).append('\n'); msgBuilder.append("The library may have failed to load because it cannot be found in your "); msgBuilder.append("load library path, or because it is not compatible with the current platform.\n"); msgBuilder.append("VoltDB provides builds on our website for 64-bit OS X systems >= 10.6, "); msgBuilder.append("and 64-bit Linux systems with kernels >= 2.6.18."); if (e instanceof UnsatisfiedLinkError) { msgBuilder.append("\nOr the library may have failed to load because java.io.tmpdir should be set "); msgBuilder.append("to a different directory. Use VOLTDB_OPTS='-Djava.io.tmpdir=<dirpath>' to set it."); } VoltDB.crashLocalVoltDB(msgBuilder.toString(), false, null); } else { s_hostLog.info("Failed to load shared library " + fullLibName + "\nLibrary path: " + System.getProperty("java.library.path")); } return false; } } }
public class class_name { private static boolean load(String name, boolean mustSucceed, boolean useJavaLib) { if (s_loadedLibs.contains(name)) { return true; // depends on control dependency: [if], data = [none] } if (! VoltDB.getLoadLibVOLTDB()) { return false; // depends on control dependency: [if], data = [none] } test64bit(); StringBuilder msgBuilder = new StringBuilder("Loading VoltDB native library "); String fullLibName = name; try { String versionString = VoltDB.instance().getEELibraryVersionString(); // This fallback is for test code only. if (versionString == null) { versionString = VoltDB.instance().getVersionString(); // depends on control dependency: [if], data = [none] } assert(versionString != null); fullLibName = name + "-" + versionString; msgBuilder.append(fullLibName); File libFile = null; if (useJavaLib) { msgBuilder.append(" from the system library location. "); // depends on control dependency: [if], data = [none] } else { libFile = getNativeLibraryFile(fullLibName); // depends on control dependency: [if], data = [none] msgBuilder.append(" from file "); // depends on control dependency: [if], data = [none] msgBuilder.append(libFile.getAbsolutePath()); // depends on control dependency: [if], data = [none] msgBuilder.append(". "); // depends on control dependency: [if], data = [none] } msgBuilder.append("A confirmation message will follow if the loading is successful."); s_hostLog.info(msgBuilder.toString()); if (useJavaLib) { System.loadLibrary(fullLibName); // depends on control dependency: [if], data = [none] } else { System.load(libFile.getAbsolutePath()); // depends on control dependency: [if], data = [none] } s_loadedLibs.add(name); s_hostLog.info("Successfully loaded VoltDB native library " + fullLibName + "."); return true; } catch (Throwable e) { if (s_hostLog.isDebugEnabled()) { s_hostLog.debug("Error loading VoltDB JNI shared library", e); // depends on control dependency: [if], data = [none] } if (useJavaLib) { s_hostLog.info("Retry loading from file."); // depends on control dependency: [if], data = [none] return load(name, mustSucceed, false); // depends on control dependency: [if], data = [none] } if (mustSucceed) { msgBuilder.setLength(0); msgBuilder.append("Failed to load shared library ").append(fullLibName).append(": "); msgBuilder.append(e.getMessage()).append('\n'); msgBuilder.append("Library path: ").append(System.getProperty("java.library.path")).append('\n'); msgBuilder.append("The library may have failed to load because it cannot be found in your "); msgBuilder.append("load library path, or because it is not compatible with the current platform.\n"); msgBuilder.append("VoltDB provides builds on our website for 64-bit OS X systems >= 10.6, "); msgBuilder.append("and 64-bit Linux systems with kernels >= 2.6.18."); if (e instanceof UnsatisfiedLinkError) { msgBuilder.append("\nOr the library may have failed to load because java.io.tmpdir should be set "); msgBuilder.append("to a different directory. Use VOLTDB_OPTS='-Djava.io.tmpdir=<dirpath>' to set it."); } VoltDB.crashLocalVoltDB(msgBuilder.toString(), false, null); } else { s_hostLog.info("Failed to load shared library " + fullLibName + "\nLibrary path: " + System.getProperty("java.library.path")); } return false; } } }
public class class_name { public FacesMessage getFacesMessage() { FacesMessage result = this.message; if (null == result && null != this.messages && !this.messages.isEmpty()) { result = messages.iterator().next(); } return result; } }
public class class_name { public FacesMessage getFacesMessage() { FacesMessage result = this.message; if (null == result && null != this.messages && !this.messages.isEmpty()) { result = messages.iterator().next(); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public void update(int delta) { if ((sprite == null) && (defaultImageName != null)) { loadSystemParticleImage(); } removeMe.clear(); ArrayList emitters = new ArrayList(this.emitters); for (int i=0;i<emitters.size();i++) { ParticleEmitter emitter = (ParticleEmitter) emitters.get(i); if (emitter.isEnabled()) { emitter.update(this, delta); if (removeCompletedEmitters) { if (emitter.completed()) { removeMe.add(emitter); particlesByEmitter.remove(emitter); } } } } this.emitters.removeAll(removeMe); pCount = 0; if (!particlesByEmitter.isEmpty()) { Iterator it= particlesByEmitter.keySet().iterator(); while (it.hasNext()) { ParticleEmitter emitter = (ParticleEmitter) it.next(); if (emitter.isEnabled()) { ParticlePool pool = (ParticlePool) particlesByEmitter.get(emitter); for (int i=0;i<pool.particles.length;i++) { if (pool.particles[i].life > 0) { pool.particles[i].update(delta); pCount++; } } } } } } }
public class class_name { public void update(int delta) { if ((sprite == null) && (defaultImageName != null)) { loadSystemParticleImage(); // depends on control dependency: [if], data = [none] } removeMe.clear(); ArrayList emitters = new ArrayList(this.emitters); for (int i=0;i<emitters.size();i++) { ParticleEmitter emitter = (ParticleEmitter) emitters.get(i); if (emitter.isEnabled()) { emitter.update(this, delta); // depends on control dependency: [if], data = [none] if (removeCompletedEmitters) { if (emitter.completed()) { removeMe.add(emitter); // depends on control dependency: [if], data = [none] particlesByEmitter.remove(emitter); // depends on control dependency: [if], data = [none] } } } } this.emitters.removeAll(removeMe); pCount = 0; if (!particlesByEmitter.isEmpty()) { Iterator it= particlesByEmitter.keySet().iterator(); while (it.hasNext()) { ParticleEmitter emitter = (ParticleEmitter) it.next(); if (emitter.isEnabled()) { ParticlePool pool = (ParticlePool) particlesByEmitter.get(emitter); for (int i=0;i<pool.particles.length;i++) { if (pool.particles[i].life > 0) { pool.particles[i].update(delta); // depends on control dependency: [if], data = [none] pCount++; // depends on control dependency: [if], data = [none] } } } } } } }
public class class_name { protected void putAdviceResult(AspectAdviceRule aspectAdviceRule, Object adviceActionResult) { if (aspectAdviceResult == null) { aspectAdviceResult = new AspectAdviceResult(); } aspectAdviceResult.putAdviceResult(aspectAdviceRule, adviceActionResult); } }
public class class_name { protected void putAdviceResult(AspectAdviceRule aspectAdviceRule, Object adviceActionResult) { if (aspectAdviceResult == null) { aspectAdviceResult = new AspectAdviceResult(); // depends on control dependency: [if], data = [none] } aspectAdviceResult.putAdviceResult(aspectAdviceRule, adviceActionResult); } }
public class class_name { @Override public final Scene moveToTop(final Layer layer) { if ((null != layer) && (LienzoCore.IS_CANVAS_SUPPORTED)) { final int size = getElement().getChildCount(); if (size < 2) { return this; } final DivElement element = layer.getElement(); getElement().removeChild(element); getElement().appendChild(element); final NFastArrayList<Layer> layers = getChildNodes(); if (null != layers) { layers.moveToTop(layer); } } return this; } }
public class class_name { @Override public final Scene moveToTop(final Layer layer) { if ((null != layer) && (LienzoCore.IS_CANVAS_SUPPORTED)) { final int size = getElement().getChildCount(); if (size < 2) { return this; // depends on control dependency: [if], data = [none] } final DivElement element = layer.getElement(); getElement().removeChild(element); // depends on control dependency: [if], data = [none] getElement().appendChild(element); // depends on control dependency: [if], data = [none] final NFastArrayList<Layer> layers = getChildNodes(); if (null != layers) { layers.moveToTop(layer); // depends on control dependency: [if], data = [none] } } return this; } }
public class class_name { public static String unescape(String theValue) { if (theValue == null) { return null; } if (theValue.indexOf('\\') == -1) { return theValue; } StringBuilder b = new StringBuilder(); for (int i = 0; i < theValue.length(); i++) { char next = theValue.charAt(i); if (next == '\\') { if (i == theValue.length() - 1) { b.append(next); } else { switch (theValue.charAt(i + 1)) { case '$': case ',': case '|': case '\\': continue; default: b.append(next); } } } else { b.append(next); } } return b.toString(); } }
public class class_name { public static String unescape(String theValue) { if (theValue == null) { return null; // depends on control dependency: [if], data = [none] } if (theValue.indexOf('\\') == -1) { return theValue; // depends on control dependency: [if], data = [none] } StringBuilder b = new StringBuilder(); for (int i = 0; i < theValue.length(); i++) { char next = theValue.charAt(i); if (next == '\\') { if (i == theValue.length() - 1) { b.append(next); // depends on control dependency: [if], data = [none] } else { switch (theValue.charAt(i + 1)) { case '$': case ',': case '|': case '\\': continue; default: b.append(next); } } } else { b.append(next); // depends on control dependency: [if], data = [(next] } } return b.toString(); } }
public class class_name { public List<String> getSupportedProperties(LdapEntity ldapEntity, List<String> propNames) { List<String> prop = new ArrayList<String>(); for (String propName : propNames) { if (propName.equals(SchemaConstants.VALUE_ALL_PROPERTIES)) { prop.add(propName); continue; } // call the getAttribute method to see if its supported by LDAP String attrName = ldapEntity.getAttribute(propName); if (attrName == null) { // check the property to attribute map to see if the property defined // in data object is mapped to a different ldap attribute attrName = iPropToAttrMap.get(propName); } if (attrName != null) { prop.add(propName); } } return prop; } }
public class class_name { public List<String> getSupportedProperties(LdapEntity ldapEntity, List<String> propNames) { List<String> prop = new ArrayList<String>(); for (String propName : propNames) { if (propName.equals(SchemaConstants.VALUE_ALL_PROPERTIES)) { prop.add(propName); // depends on control dependency: [if], data = [none] continue; } // call the getAttribute method to see if its supported by LDAP String attrName = ldapEntity.getAttribute(propName); if (attrName == null) { // check the property to attribute map to see if the property defined // in data object is mapped to a different ldap attribute attrName = iPropToAttrMap.get(propName); // depends on control dependency: [if], data = [none] } if (attrName != null) { prop.add(propName); // depends on control dependency: [if], data = [none] } } return prop; } }
public class class_name { public MessageBean setLocation(final Element elem) { final MessageBean ret = new MessageBean(this); final String xtrf = elem.getAttribute(ATTRIBUTE_NAME_XTRF); if (!xtrf.isEmpty()) { ret.srcFile = toURI(xtrf); } final String xtrc = elem.getAttribute(ATTRIBUTE_NAME_XTRC); if (!xtrc.isEmpty()) { final int sep = xtrc.indexOf(';'); if (sep != -1) { final int delim = xtrc.indexOf(COLON, sep + 1); if (delim != -1) { ret.srcLine = Integer.parseInt(xtrc.substring(sep + 1, delim)); ret.srcColumn = Integer.parseInt(xtrc.substring(delim + 1)); } } } return ret; } }
public class class_name { public MessageBean setLocation(final Element elem) { final MessageBean ret = new MessageBean(this); final String xtrf = elem.getAttribute(ATTRIBUTE_NAME_XTRF); if (!xtrf.isEmpty()) { ret.srcFile = toURI(xtrf); // depends on control dependency: [if], data = [none] } final String xtrc = elem.getAttribute(ATTRIBUTE_NAME_XTRC); if (!xtrc.isEmpty()) { final int sep = xtrc.indexOf(';'); if (sep != -1) { final int delim = xtrc.indexOf(COLON, sep + 1); if (delim != -1) { ret.srcLine = Integer.parseInt(xtrc.substring(sep + 1, delim)); // depends on control dependency: [if], data = [none] ret.srcColumn = Integer.parseInt(xtrc.substring(delim + 1)); // depends on control dependency: [if], data = [(delim] } } } return ret; } }
public class class_name { private static String createIfNeeded(String dir) { File f = new File(dir); if (f.exists()) { return dir; } else { boolean success = f.mkdirs(); if (success) return dir; else return null; } } }
public class class_name { private static String createIfNeeded(String dir) { File f = new File(dir); if (f.exists()) { return dir; // depends on control dependency: [if], data = [none] } else { boolean success = f.mkdirs(); if (success) return dir; else return null; } } }
public class class_name { private void copyPropertiesOverParameters(Map<String, String> parameters) { Properties properties = System.getProperties(); for (Object object : properties.keySet()) { String key = (String) object; if (key.startsWith(SYSTEM_PROPERTY_PREFIX)) { parameters.put(key.substring(SYSTEM_PROPERTY_PREFIX.length()), properties.getProperty(key)); } } } }
public class class_name { private void copyPropertiesOverParameters(Map<String, String> parameters) { Properties properties = System.getProperties(); for (Object object : properties.keySet()) { String key = (String) object; if (key.startsWith(SYSTEM_PROPERTY_PREFIX)) { parameters.put(key.substring(SYSTEM_PROPERTY_PREFIX.length()), properties.getProperty(key)); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static ValueMatcher makeValueMatcherGeneric(DimensionSelector selector, Predicate<String> predicate) { int cardinality = selector.getValueCardinality(); if (cardinality >= 0 && selector.nameLookupPossibleInAdvance()) { return makeDictionaryEncodedValueMatcherGeneric(selector, predicate); } else { return makeNonDictionaryEncodedValueMatcherGeneric(selector, predicate); } } }
public class class_name { public static ValueMatcher makeValueMatcherGeneric(DimensionSelector selector, Predicate<String> predicate) { int cardinality = selector.getValueCardinality(); if (cardinality >= 0 && selector.nameLookupPossibleInAdvance()) { return makeDictionaryEncodedValueMatcherGeneric(selector, predicate); // depends on control dependency: [if], data = [none] } else { return makeNonDictionaryEncodedValueMatcherGeneric(selector, predicate); // depends on control dependency: [if], data = [none] } } }
public class class_name { public IAtomContainer generate(IAtomContainerSet atomContainers) throws CDKException { int iteration = 0; boolean structureFound = false; do { iteration++; boolean bondFormed; do { bondFormed = false; for (IAtomContainer ac : atomContainers.atomContainers()) { for (IAtom atom : AtomContainerManipulator.getAtomArray(ac)) { if (!satCheck.isSaturated(atom, ac)) { IAtom partner = getAnotherUnsaturatedNode(atom, ac, atomContainers); if (partner != null) { IAtomContainer toadd = AtomContainerSetManipulator.getRelevantAtomContainer( atomContainers, partner); double cmax1 = satCheck.getCurrentMaxBondOrder(atom, ac); double cmax2 = satCheck.getCurrentMaxBondOrder(partner, toadd); double max = Math.min(cmax1, cmax2); double order = Math.min(Math.max(1.0, max), 3.0);//(double)Math.round(Math.random() * max) logger.debug("cmax1, cmax2, max, order: " + cmax1 + ", " + cmax2 + ", " + max + ", " + order); if (toadd != ac) { atomContainers.removeAtomContainer(toadd); ac.add(toadd); } ac.addBond(ac.getBuilder().newInstance(IBond.class, atom, partner, BondManipulator.createBondOrder(order))); bondFormed = true; } } } } } while (bondFormed); if (atomContainers.getAtomContainerCount() == 1 && satCheck.allSaturated(atomContainers.getAtomContainer(0))) { structureFound = true; } } while (!structureFound && iteration < 5); if (atomContainers.getAtomContainerCount() == 1 && satCheck.allSaturated(atomContainers.getAtomContainer(0))) { structureFound = true; } if (!structureFound) throw new CDKException("Could not combine the fragments to combine a valid, satured structure"); return atomContainers.getAtomContainer(0); } }
public class class_name { public IAtomContainer generate(IAtomContainerSet atomContainers) throws CDKException { int iteration = 0; boolean structureFound = false; do { iteration++; boolean bondFormed; do { bondFormed = false; for (IAtomContainer ac : atomContainers.atomContainers()) { for (IAtom atom : AtomContainerManipulator.getAtomArray(ac)) { if (!satCheck.isSaturated(atom, ac)) { IAtom partner = getAnotherUnsaturatedNode(atom, ac, atomContainers); if (partner != null) { IAtomContainer toadd = AtomContainerSetManipulator.getRelevantAtomContainer( atomContainers, partner); double cmax1 = satCheck.getCurrentMaxBondOrder(atom, ac); double cmax2 = satCheck.getCurrentMaxBondOrder(partner, toadd); double max = Math.min(cmax1, cmax2); double order = Math.min(Math.max(1.0, max), 3.0);//(double)Math.round(Math.random() * max) logger.debug("cmax1, cmax2, max, order: " + cmax1 + ", " + cmax2 + ", " + max + ", " + order); // depends on control dependency: [if], data = [none] if (toadd != ac) { atomContainers.removeAtomContainer(toadd); // depends on control dependency: [if], data = [(toadd] ac.add(toadd); // depends on control dependency: [if], data = [(toadd] } ac.addBond(ac.getBuilder().newInstance(IBond.class, atom, partner, BondManipulator.createBondOrder(order))); // depends on control dependency: [if], data = [none] bondFormed = true; // depends on control dependency: [if], data = [none] } } } } } while (bondFormed); if (atomContainers.getAtomContainerCount() == 1 && satCheck.allSaturated(atomContainers.getAtomContainer(0))) { structureFound = true; // depends on control dependency: [if], data = [none] } } while (!structureFound && iteration < 5); if (atomContainers.getAtomContainerCount() == 1 && satCheck.allSaturated(atomContainers.getAtomContainer(0))) { structureFound = true; } if (!structureFound) throw new CDKException("Could not combine the fragments to combine a valid, satured structure"); return atomContainers.getAtomContainer(0); } }
public class class_name { public HttpResponse syncRequest(String host,int port,HttpRequest request,long waiteTimeMills) { HttpResponse response=null; synchronized (request) { if(response==null) { HttpListener listener=new HttpListener(request); NettyClient client=new NettyClient(config,new InetSocketAddress(host, port),new HttpClientInitHandler(listener)); client.start(); response=listener.waitResponse(waiteTimeMills);//阻塞等待结果 client.stop(); } } return response; } }
public class class_name { public HttpResponse syncRequest(String host,int port,HttpRequest request,long waiteTimeMills) { HttpResponse response=null; synchronized (request) { if(response==null) { HttpListener listener=new HttpListener(request); NettyClient client=new NettyClient(config,new InetSocketAddress(host, port),new HttpClientInitHandler(listener)); client.start(); // depends on control dependency: [if], data = [none] response=listener.waitResponse(waiteTimeMills);//阻塞等待结果 // depends on control dependency: [if], data = [none] client.stop(); // depends on control dependency: [if], data = [none] } } return response; } }
public class class_name { @Nonnull public static final <T extends AbstractSingleton> T getSingleton (@Nonnull final IScope aScope, @Nonnull final Class <T> aClass) { ValueEnforcer.notNull (aScope, "aScope"); ValueEnforcer.notNull (aClass, "Class"); final String sSingletonScopeKey = getSingletonScopeKey (aClass); // check if already contained in passed scope T aInstance = s_aRWLock.readLocked ( () -> aScope.attrs ().getCastedValue (sSingletonScopeKey)); if (aInstance == null || aInstance.isInInstantiation ()) { // Not yet present or just in instantiation // Safe instantiation check in write lock s_aRWLock.writeLock ().lock (); try { // Check again in write lock aInstance = aScope.attrs ().getCastedValue (sSingletonScopeKey); if (aInstance == null) { // Main instantiation aInstance = _instantiateSingleton (aClass, aScope); // Set in scope so that recursive calls to the same singleton are // caught appropriately aScope.attrs ().putIn (sSingletonScopeKey, aInstance); // Start the initialization process // Do this after the instance was added to the scope aInstance.setInInstantiation (true); try { // Invoke callback method aInstance.onAfterInstantiation (aScope); // Set "instantiated" only if no exception was thrown aInstance.setInstantiated (true); } finally { // Ensure field is reset even in case of an exception aInstance.setInInstantiation (false); } // And some statistics s_aStatsCounterInstantiate.increment (sSingletonScopeKey); } else { // May not be instantiated if this method is called from the same // thread as the original instantiation } // We have the instance - maybe from re-querying the scope, maybe from // instantiation } finally { s_aRWLock.writeLock ().unlock (); } } // This happens too often in practice, therefore this is disabled if (SingletonHelper.isDebugConsistency ()) { // Just a small note in case we're returning an unusable object if (!aInstance.isUsableObject ()) if (LOGGER.isWarnEnabled ()) LOGGER.warn ("Singleton '" + aClass.getName () + "' is not usable - please check your calling order: " + aInstance.toString (), SingletonHelper.getDebugStackTrace ()); } return aInstance; } }
public class class_name { @Nonnull public static final <T extends AbstractSingleton> T getSingleton (@Nonnull final IScope aScope, @Nonnull final Class <T> aClass) { ValueEnforcer.notNull (aScope, "aScope"); ValueEnforcer.notNull (aClass, "Class"); final String sSingletonScopeKey = getSingletonScopeKey (aClass); // check if already contained in passed scope T aInstance = s_aRWLock.readLocked ( () -> aScope.attrs ().getCastedValue (sSingletonScopeKey)); if (aInstance == null || aInstance.isInInstantiation ()) { // Not yet present or just in instantiation // Safe instantiation check in write lock s_aRWLock.writeLock ().lock (); // depends on control dependency: [if], data = [none] try { // Check again in write lock aInstance = aScope.attrs ().getCastedValue (sSingletonScopeKey); // depends on control dependency: [try], data = [none] if (aInstance == null) { // Main instantiation aInstance = _instantiateSingleton (aClass, aScope); // depends on control dependency: [if], data = [none] // Set in scope so that recursive calls to the same singleton are // caught appropriately aScope.attrs ().putIn (sSingletonScopeKey, aInstance); // depends on control dependency: [if], data = [none] // Start the initialization process // Do this after the instance was added to the scope aInstance.setInInstantiation (true); // depends on control dependency: [if], data = [none] try { // Invoke callback method aInstance.onAfterInstantiation (aScope); // depends on control dependency: [try], data = [none] // Set "instantiated" only if no exception was thrown aInstance.setInstantiated (true); // depends on control dependency: [try], data = [none] } finally { // Ensure field is reset even in case of an exception aInstance.setInInstantiation (false); } // And some statistics s_aStatsCounterInstantiate.increment (sSingletonScopeKey); // depends on control dependency: [if], data = [none] } else { // May not be instantiated if this method is called from the same // thread as the original instantiation } // We have the instance - maybe from re-querying the scope, maybe from // instantiation } finally { s_aRWLock.writeLock ().unlock (); } } // This happens too often in practice, therefore this is disabled if (SingletonHelper.isDebugConsistency ()) { // Just a small note in case we're returning an unusable object if (!aInstance.isUsableObject ()) if (LOGGER.isWarnEnabled ()) LOGGER.warn ("Singleton '" + aClass.getName () + "' is not usable - please check your calling order: " + aInstance.toString (), SingletonHelper.getDebugStackTrace ()); } return aInstance; } }
public class class_name { public boolean intersectsCuboid(Vector3f[] vertices, float x, float y, float z) { if (vertices.length != 8) { throw new IllegalArgumentException("A cuboid has 8 vertices, not " + vertices.length); } planes: for (int i = 0; i < 6; i++) { for (Vector3f vertex : vertices) { if (distance(i, vertex.getX() + x, vertex.getY() + y, vertex.getZ() + z) > 0) { continue planes; } } return false; } return true; } }
public class class_name { public boolean intersectsCuboid(Vector3f[] vertices, float x, float y, float z) { if (vertices.length != 8) { throw new IllegalArgumentException("A cuboid has 8 vertices, not " + vertices.length); } planes: for (int i = 0; i < 6; i++) { for (Vector3f vertex : vertices) { if (distance(i, vertex.getX() + x, vertex.getY() + y, vertex.getZ() + z) > 0) { continue planes; } } return false; // depends on control dependency: [for], data = [none] } return true; } }
public class class_name { public static void carryWithRequest(RpcInvokeContext context, SofaRequest request) { if (context != null) { Map<String, String> requestBaggage = context.getAllRequestBaggage(); if (CommonUtils.isNotEmpty(requestBaggage)) { // 需要透传 request.addRequestProp(RemotingConstants.RPC_REQUEST_BAGGAGE, requestBaggage); } } } }
public class class_name { public static void carryWithRequest(RpcInvokeContext context, SofaRequest request) { if (context != null) { Map<String, String> requestBaggage = context.getAllRequestBaggage(); if (CommonUtils.isNotEmpty(requestBaggage)) { // 需要透传 request.addRequestProp(RemotingConstants.RPC_REQUEST_BAGGAGE, requestBaggage); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private static Class<?> loadFinalizer(FinalizerLoader... loaders) { for (FinalizerLoader loader : loaders) { Class<?> finalizer = loader.loadFinalizer(); if (finalizer != null) { return finalizer; } } throw new AssertionError(); } }
public class class_name { private static Class<?> loadFinalizer(FinalizerLoader... loaders) { for (FinalizerLoader loader : loaders) { Class<?> finalizer = loader.loadFinalizer(); if (finalizer != null) { return finalizer; // depends on control dependency: [if], data = [none] } } throw new AssertionError(); } }
public class class_name { public BigDecimal negate() { if (intCompact == INFLATED) { return new BigDecimal(intVal.negate(), INFLATED, scale, precision); } else { return valueOf(-intCompact, scale, precision); } } }
public class class_name { public BigDecimal negate() { if (intCompact == INFLATED) { return new BigDecimal(intVal.negate(), INFLATED, scale, precision); // depends on control dependency: [if], data = [none] } else { return valueOf(-intCompact, scale, precision); // depends on control dependency: [if], data = [none] } } }
public class class_name { private Set<String> getConditionsSet(List<Function> atoms, AliasIndex index, boolean processShared) { Set<String> conditions = new LinkedHashSet<>(); if (processShared) { // guohui: After normalization, do we have shared variables? // TODO: should we remove this ?? Set<Variable> currentLevelVariables = new LinkedHashSet<>(); for (Function atom : atoms) { // assume that no variables are shared across deeper levels of // nesting (through Join or LeftJoin atoms), it will not call itself // recursively. Nor across upper levels. collectVariableReferencesWithLeftJoin(currentLevelVariables, atom); } Set<String> conditionsSharedVariables = getConditionsSharedVariables(currentLevelVariables, index); conditions.addAll(conditionsSharedVariables); } Set<String> eqConstants = getEqConditionsForConstants(atoms, index); conditions.addAll(eqConstants); Set<String> booleanConditions = getBooleanConditions(atoms, index); conditions.addAll(booleanConditions); return conditions; } }
public class class_name { private Set<String> getConditionsSet(List<Function> atoms, AliasIndex index, boolean processShared) { Set<String> conditions = new LinkedHashSet<>(); if (processShared) { // guohui: After normalization, do we have shared variables? // TODO: should we remove this ?? Set<Variable> currentLevelVariables = new LinkedHashSet<>(); for (Function atom : atoms) { // assume that no variables are shared across deeper levels of // nesting (through Join or LeftJoin atoms), it will not call itself // recursively. Nor across upper levels. collectVariableReferencesWithLeftJoin(currentLevelVariables, atom); // depends on control dependency: [for], data = [atom] } Set<String> conditionsSharedVariables = getConditionsSharedVariables(currentLevelVariables, index); conditions.addAll(conditionsSharedVariables); // depends on control dependency: [if], data = [none] } Set<String> eqConstants = getEqConditionsForConstants(atoms, index); conditions.addAll(eqConstants); Set<String> booleanConditions = getBooleanConditions(atoms, index); conditions.addAll(booleanConditions); return conditions; } }
public class class_name { public boolean assignParsedElement(Concept parsedConcept, String syntaxElementName, ISyntaxElement syntaxElement) throws ModelException { if (syntaxElementName.equalsIgnoreCase(XMLSyntax.URI()) && syntaxElement instanceof SemanticIdentifier) { parsedConcept.setSemanticIdentifier((SemanticIdentifier) syntaxElement); return true; } if (syntaxElementName.equalsIgnoreCase(XMLSyntax.ONTOLOGY())) { if (syntaxElement instanceof SemanticIdentifier) { parsedConcept.setOntology(bsdlRegistry, (SemanticIdentifier) syntaxElement); } return true; } if (syntaxElementName.equalsIgnoreCase(XMLSyntax.SUPERCONCEPT())) { if (syntaxElement instanceof SemanticIdentifier) { parsedConcept.superconcepts().add( new ReferenceToSemanticAxiom<Concept>( bsdlRegistry, (SemanticIdentifier) syntaxElement, Concept.class )); return true; } if (syntaxElement instanceof Concept) { parsedConcept.superconcepts().add( new ReferenceToSemanticAxiom<Concept>((Concept) syntaxElement)); return true; } } if (syntaxElementName.equalsIgnoreCase(XMLSyntax.PROPERTY())) { parsedConcept.addProperty(((Property) syntaxElement)); return true; } return false; } }
public class class_name { public boolean assignParsedElement(Concept parsedConcept, String syntaxElementName, ISyntaxElement syntaxElement) throws ModelException { if (syntaxElementName.equalsIgnoreCase(XMLSyntax.URI()) && syntaxElement instanceof SemanticIdentifier) { parsedConcept.setSemanticIdentifier((SemanticIdentifier) syntaxElement); return true; } if (syntaxElementName.equalsIgnoreCase(XMLSyntax.ONTOLOGY())) { if (syntaxElement instanceof SemanticIdentifier) { parsedConcept.setOntology(bsdlRegistry, (SemanticIdentifier) syntaxElement); // depends on control dependency: [if], data = [none] } return true; } if (syntaxElementName.equalsIgnoreCase(XMLSyntax.SUPERCONCEPT())) { if (syntaxElement instanceof SemanticIdentifier) { parsedConcept.superconcepts().add( new ReferenceToSemanticAxiom<Concept>( bsdlRegistry, (SemanticIdentifier) syntaxElement, Concept.class )); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } if (syntaxElement instanceof Concept) { parsedConcept.superconcepts().add( new ReferenceToSemanticAxiom<Concept>((Concept) syntaxElement)); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } } if (syntaxElementName.equalsIgnoreCase(XMLSyntax.PROPERTY())) { parsedConcept.addProperty(((Property) syntaxElement)); return true; } return false; } }
public class class_name { private static Map<Locale, String> getAllPageDocs(IAnnotationBinding[] annotations) { // all @PageDoc or @Page annotations including annotations contained in @PageDocs or @Page List<IAnnotationBinding> allPageAnnotations = new ArrayList<>(2); List<Class<?>> singlePageAnnotationClasses = new ArrayList<>(2); singlePageAnnotationClasses.add(PageDoc.class); singlePageAnnotationClasses.add(Page.class); for (Class<?> annotationClass : singlePageAnnotationClasses) { IAnnotationBinding annotation = getAnnotationBinding(annotations, annotationClass); if (annotation == null) { continue; // annotation is not found } if (allPageAnnotations.size() > 0) { // TODO throw IllegalTestScriptException throw new RuntimeException("don't use multiple page annoations at the same place"); } allPageAnnotations.add(annotation); } List<Class<?>> multiplePageAnnotationClasses = new ArrayList<>(2); multiplePageAnnotationClasses.add(PageDocs.class); multiplePageAnnotationClasses.add(Pages.class); for (Class<?> annotationClass : multiplePageAnnotationClasses) { IAnnotationBinding annotation = getAnnotationBinding(annotations, annotationClass); if (annotation == null) { continue; // annotation is not found } if (allPageAnnotations.size() > 0) { // TODO throw IllegalTestScriptException throw new RuntimeException("don't use multiple page annoations at the same place"); } // get @PageDoc or @Page from @PageDocs or @Pages Object value = getAnnotationValue(annotation, "value"); Object[] values = (Object[]) value; for (Object element : values) { allPageAnnotations.add((IAnnotationBinding) element); } } // get resultPageMap Map<Locale, String> resultPageMap = new HashMap<>(allPageAnnotations.size()); for (IAnnotationBinding eachPageAnnotation : allPageAnnotations) { Object value = getAnnotationValue(eachPageAnnotation, "value"); Locale locale = getAnnotationLocaleValue(eachPageAnnotation, "locale"); resultPageMap.put(locale, (String) value); } return resultPageMap; } }
public class class_name { private static Map<Locale, String> getAllPageDocs(IAnnotationBinding[] annotations) { // all @PageDoc or @Page annotations including annotations contained in @PageDocs or @Page List<IAnnotationBinding> allPageAnnotations = new ArrayList<>(2); List<Class<?>> singlePageAnnotationClasses = new ArrayList<>(2); singlePageAnnotationClasses.add(PageDoc.class); singlePageAnnotationClasses.add(Page.class); for (Class<?> annotationClass : singlePageAnnotationClasses) { IAnnotationBinding annotation = getAnnotationBinding(annotations, annotationClass); if (annotation == null) { continue; // annotation is not found } if (allPageAnnotations.size() > 0) { // TODO throw IllegalTestScriptException throw new RuntimeException("don't use multiple page annoations at the same place"); } allPageAnnotations.add(annotation); } List<Class<?>> multiplePageAnnotationClasses = new ArrayList<>(2); multiplePageAnnotationClasses.add(PageDocs.class); multiplePageAnnotationClasses.add(Pages.class); for (Class<?> annotationClass : multiplePageAnnotationClasses) { IAnnotationBinding annotation = getAnnotationBinding(annotations, annotationClass); if (annotation == null) { continue; // annotation is not found } if (allPageAnnotations.size() > 0) { // TODO throw IllegalTestScriptException throw new RuntimeException("don't use multiple page annoations at the same place"); } // get @PageDoc or @Page from @PageDocs or @Pages Object value = getAnnotationValue(annotation, "value"); Object[] values = (Object[]) value; for (Object element : values) { allPageAnnotations.add((IAnnotationBinding) element); // depends on control dependency: [for], data = [element] } } // get resultPageMap Map<Locale, String> resultPageMap = new HashMap<>(allPageAnnotations.size()); for (IAnnotationBinding eachPageAnnotation : allPageAnnotations) { Object value = getAnnotationValue(eachPageAnnotation, "value"); Locale locale = getAnnotationLocaleValue(eachPageAnnotation, "locale"); resultPageMap.put(locale, (String) value); // depends on control dependency: [for], data = [none] } return resultPageMap; } }
public class class_name { public CreateInstanceResponse createInstance(CreateInstanceRequest request) throws BceClientException { checkNotNull(request, "request should not be null."); if (Strings.isNullOrEmpty(request.getClientToken())) { request.setClientToken(this.generateClientToken()); } if (null == request.getBilling()) { request.setBilling(generateDefaultBilling()); } checkStringNotEmpty(request.getImageId(), "imageId should not be empty"); InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, INSTANCE_PREFIX); internalRequest.addParameter("clientToken", request.getClientToken()); if (!Strings.isNullOrEmpty(request.getAdminPass())) { BceCredentials credentials = config.getCredentials(); if (internalRequest.getCredentials() != null) { credentials = internalRequest.getCredentials(); } try { request.setAdminPass(this.aes128WithFirst16Char(request.getAdminPass(), credentials.getSecretKey())); } catch (GeneralSecurityException e) { throw new BceClientException("Encryption procedure exception", e); } } fillPayload(internalRequest, request); return invokeHttpClient(internalRequest, CreateInstanceResponse.class); } }
public class class_name { public CreateInstanceResponse createInstance(CreateInstanceRequest request) throws BceClientException { checkNotNull(request, "request should not be null."); if (Strings.isNullOrEmpty(request.getClientToken())) { request.setClientToken(this.generateClientToken()); } if (null == request.getBilling()) { request.setBilling(generateDefaultBilling()); } checkStringNotEmpty(request.getImageId(), "imageId should not be empty"); InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, INSTANCE_PREFIX); internalRequest.addParameter("clientToken", request.getClientToken()); if (!Strings.isNullOrEmpty(request.getAdminPass())) { BceCredentials credentials = config.getCredentials(); if (internalRequest.getCredentials() != null) { credentials = internalRequest.getCredentials(); // depends on control dependency: [if], data = [none] } try { request.setAdminPass(this.aes128WithFirst16Char(request.getAdminPass(), credentials.getSecretKey())); } catch (GeneralSecurityException e) { throw new BceClientException("Encryption procedure exception", e); } } fillPayload(internalRequest, request); return invokeHttpClient(internalRequest, CreateInstanceResponse.class); } }
public class class_name { @Override public final List<CTDPt> getDPtListFromCTSer(final Object ctObjSer) { if (ctObjSer instanceof CTPieSer) { List<CTDPt> dptList = ((CTPieSer) ctObjSer).getDPtList(); if (dptList == null) { // return empty list instead of null for pie. // this will ensure pie create valueColorList in serial object. dptList = new ArrayList<>(); } return dptList; } return this.getEmptyDptlist(); } }
public class class_name { @Override public final List<CTDPt> getDPtListFromCTSer(final Object ctObjSer) { if (ctObjSer instanceof CTPieSer) { List<CTDPt> dptList = ((CTPieSer) ctObjSer).getDPtList(); if (dptList == null) { // return empty list instead of null for pie. // this will ensure pie create valueColorList in serial object. dptList = new ArrayList<>(); // depends on control dependency: [if], data = [none] } return dptList; // depends on control dependency: [if], data = [none] } return this.getEmptyDptlist(); } }
public class class_name { @Override protected ResolutionResult resolveDependencies(String projectFolder, String topLevelFolder, Set<String> csprojFiles) { if (this.nugetRestoreDependencies) { this.resolveCollector.executeRestore(projectFolder, csprojFiles); Collection<AgentProjectInfo> projects = this.resolveCollector.collectDependencies(projectFolder); Collection<DependencyInfo> dependencies = projects.stream().flatMap(project -> project.getDependencies().stream()).collect(Collectors.toList()); dependencies.addAll(parseNugetPackageFiles(csprojFiles, true)); return new ResolutionResult(dependencies, new LinkedList<>(), getDependencyType(), topLevelFolder); } else { return getResolutionResultFromParsing(topLevelFolder, csprojFiles, false); } } }
public class class_name { @Override protected ResolutionResult resolveDependencies(String projectFolder, String topLevelFolder, Set<String> csprojFiles) { if (this.nugetRestoreDependencies) { this.resolveCollector.executeRestore(projectFolder, csprojFiles); // depends on control dependency: [if], data = [none] Collection<AgentProjectInfo> projects = this.resolveCollector.collectDependencies(projectFolder); Collection<DependencyInfo> dependencies = projects.stream().flatMap(project -> project.getDependencies().stream()).collect(Collectors.toList()); dependencies.addAll(parseNugetPackageFiles(csprojFiles, true)); // depends on control dependency: [if], data = [none] return new ResolutionResult(dependencies, new LinkedList<>(), getDependencyType(), topLevelFolder); // depends on control dependency: [if], data = [none] } else { return getResolutionResultFromParsing(topLevelFolder, csprojFiles, false); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setTaskFailureException(Throwable taskFailureException) { if (!this.contains(ConfigurationKeys.TASK_FAILURE_EXCEPTION_KEY)) { this.setProp(ConfigurationKeys.TASK_FAILURE_EXCEPTION_KEY, Throwables.getStackTraceAsString(taskFailureException)); } } }
public class class_name { public void setTaskFailureException(Throwable taskFailureException) { if (!this.contains(ConfigurationKeys.TASK_FAILURE_EXCEPTION_KEY)) { this.setProp(ConfigurationKeys.TASK_FAILURE_EXCEPTION_KEY, Throwables.getStackTraceAsString(taskFailureException)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public ReservedInstancesModification withModificationResults(ReservedInstancesModificationResult... modificationResults) { if (this.modificationResults == null) { setModificationResults(new com.amazonaws.internal.SdkInternalList<ReservedInstancesModificationResult>(modificationResults.length)); } for (ReservedInstancesModificationResult ele : modificationResults) { this.modificationResults.add(ele); } return this; } }
public class class_name { public ReservedInstancesModification withModificationResults(ReservedInstancesModificationResult... modificationResults) { if (this.modificationResults == null) { setModificationResults(new com.amazonaws.internal.SdkInternalList<ReservedInstancesModificationResult>(modificationResults.length)); // depends on control dependency: [if], data = [none] } for (ReservedInstancesModificationResult ele : modificationResults) { this.modificationResults.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public Xml read(String xmlPathQuery, boolean captureContent) { XmlPath xmlPath = XmlPathParser.parse(xmlPathQuery); Xml doc = new Xml(); boolean record = false; int levelIndex = 0; XmlNode node; while((node = pullXmlNode()) != null) { if(node instanceof XmlStartElement) { XmlStartElement startElement = (XmlStartElement) node; Element element = new Element(startElement.getLocalName()); element.addAttributes(startElement.getAttributes()); currentPath.addLast(element); if(xmlPath.matches(currentPath)) { if(!captureContent) { // capture single element only doc.addElement(element); return doc; } // turn on document builder record = true; } if(record) { // build document doc.addElement(element); levelIndex += 1; } } else if(node instanceof XmlEndElement) { if(xmlPath.isSimplePattern() && levelIndex == 0) { // a simple pattern query can not read further up nodeQueue.push(node); return null; } if(currentPath.getLast() instanceof Content) { currentPath.removeLast(); } currentPath.removeLast(); if(record) { // build document doc.endElement(); levelIndex -= 1; if(levelIndex == 0) { return doc; } } } else if(node instanceof XmlContent) { XmlContent content = (XmlContent) node; if(currentPath.getLast() instanceof Content) { currentPath.removeLast(); } currentPath.addLast(new Content(content.getText())); if(record) { // build document doc.addContent(new Content(content.getText())); } } else { // don't know how to handle this type, internal error throw new XmlReaderException("Unknown XmlNode type: " + node); } } // no element was found matching the query return null; } }
public class class_name { public Xml read(String xmlPathQuery, boolean captureContent) { XmlPath xmlPath = XmlPathParser.parse(xmlPathQuery); Xml doc = new Xml(); boolean record = false; int levelIndex = 0; XmlNode node; while((node = pullXmlNode()) != null) { if(node instanceof XmlStartElement) { XmlStartElement startElement = (XmlStartElement) node; Element element = new Element(startElement.getLocalName()); element.addAttributes(startElement.getAttributes()); // depends on control dependency: [if], data = [none] currentPath.addLast(element); // depends on control dependency: [if], data = [none] if(xmlPath.matches(currentPath)) { if(!captureContent) { // capture single element only doc.addElement(element); // depends on control dependency: [if], data = [none] return doc; // depends on control dependency: [if], data = [none] } // turn on document builder record = true; // depends on control dependency: [if], data = [none] } if(record) { // build document doc.addElement(element); // depends on control dependency: [if], data = [none] levelIndex += 1; // depends on control dependency: [if], data = [none] } } else if(node instanceof XmlEndElement) { if(xmlPath.isSimplePattern() && levelIndex == 0) { // a simple pattern query can not read further up nodeQueue.push(node); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } if(currentPath.getLast() instanceof Content) { currentPath.removeLast(); // depends on control dependency: [if], data = [none] } currentPath.removeLast(); // depends on control dependency: [if], data = [none] if(record) { // build document doc.endElement(); // depends on control dependency: [if], data = [none] levelIndex -= 1; // depends on control dependency: [if], data = [none] if(levelIndex == 0) { return doc; // depends on control dependency: [if], data = [none] } } } else if(node instanceof XmlContent) { XmlContent content = (XmlContent) node; if(currentPath.getLast() instanceof Content) { currentPath.removeLast(); // depends on control dependency: [if], data = [none] } currentPath.addLast(new Content(content.getText())); // depends on control dependency: [if], data = [none] if(record) { // build document doc.addContent(new Content(content.getText())); // depends on control dependency: [if], data = [none] } } else { // don't know how to handle this type, internal error throw new XmlReaderException("Unknown XmlNode type: " + node); } } // no element was found matching the query return null; } }
public class class_name { private static String[] getPathStrings(String commaSeparatedPaths) { int length = commaSeparatedPaths.length(); int curlyOpen = 0; int pathStart = 0; boolean globPattern = false; List<String> pathStrings = new ArrayList<String>(); for (int i=0; i<length; i++) { char ch = commaSeparatedPaths.charAt(i); switch(ch) { case '{' : { curlyOpen++; if (!globPattern) { globPattern = true; } break; } case '}' : { curlyOpen--; if (curlyOpen == 0 && globPattern) { globPattern = false; } break; } case ',' : { if (!globPattern) { pathStrings.add(commaSeparatedPaths.substring(pathStart, i)); pathStart = i + 1 ; } break; } } } pathStrings.add(commaSeparatedPaths.substring(pathStart, length)); return pathStrings.toArray(new String[0]); } }
public class class_name { private static String[] getPathStrings(String commaSeparatedPaths) { int length = commaSeparatedPaths.length(); int curlyOpen = 0; int pathStart = 0; boolean globPattern = false; List<String> pathStrings = new ArrayList<String>(); for (int i=0; i<length; i++) { char ch = commaSeparatedPaths.charAt(i); switch(ch) { case '{' : { curlyOpen++; if (!globPattern) { globPattern = true; // depends on control dependency: [if], data = [none] } break; } case '}' : { curlyOpen--; if (curlyOpen == 0 && globPattern) { globPattern = false; // depends on control dependency: [if], data = [none] } break; } case ',' : { if (!globPattern) { pathStrings.add(commaSeparatedPaths.substring(pathStart, i)); // depends on control dependency: [if], data = [none] pathStart = i + 1 ; // depends on control dependency: [if], data = [none] } break; } } } pathStrings.add(commaSeparatedPaths.substring(pathStart, length)); return pathStrings.toArray(new String[0]); } }
public class class_name { private ResultPoint[] detectSolid1(ResultPoint[] cornerPoints) { // 0 2 // 1 3 ResultPoint pointA = cornerPoints[0]; ResultPoint pointB = cornerPoints[1]; ResultPoint pointC = cornerPoints[3]; ResultPoint pointD = cornerPoints[2]; int trAB = transitionsBetween(pointA, pointB); int trBC = transitionsBetween(pointB, pointC); int trCD = transitionsBetween(pointC, pointD); int trDA = transitionsBetween(pointD, pointA); // 0..3 // : : // 1--2 int min = trAB; ResultPoint[] points = {pointD, pointA, pointB, pointC}; if (min > trBC) { min = trBC; points[0] = pointA; points[1] = pointB; points[2] = pointC; points[3] = pointD; } if (min > trCD) { min = trCD; points[0] = pointB; points[1] = pointC; points[2] = pointD; points[3] = pointA; } if (min > trDA) { points[0] = pointC; points[1] = pointD; points[2] = pointA; points[3] = pointB; } return points; } }
public class class_name { private ResultPoint[] detectSolid1(ResultPoint[] cornerPoints) { // 0 2 // 1 3 ResultPoint pointA = cornerPoints[0]; ResultPoint pointB = cornerPoints[1]; ResultPoint pointC = cornerPoints[3]; ResultPoint pointD = cornerPoints[2]; int trAB = transitionsBetween(pointA, pointB); int trBC = transitionsBetween(pointB, pointC); int trCD = transitionsBetween(pointC, pointD); int trDA = transitionsBetween(pointD, pointA); // 0..3 // : : // 1--2 int min = trAB; ResultPoint[] points = {pointD, pointA, pointB, pointC}; if (min > trBC) { min = trBC; // depends on control dependency: [if], data = [none] points[0] = pointA; // depends on control dependency: [if], data = [none] points[1] = pointB; // depends on control dependency: [if], data = [none] points[2] = pointC; // depends on control dependency: [if], data = [none] points[3] = pointD; // depends on control dependency: [if], data = [none] } if (min > trCD) { min = trCD; // depends on control dependency: [if], data = [none] points[0] = pointB; // depends on control dependency: [if], data = [none] points[1] = pointC; // depends on control dependency: [if], data = [none] points[2] = pointD; // depends on control dependency: [if], data = [none] points[3] = pointA; // depends on control dependency: [if], data = [none] } if (min > trDA) { points[0] = pointC; // depends on control dependency: [if], data = [none] points[1] = pointD; // depends on control dependency: [if], data = [none] points[2] = pointA; // depends on control dependency: [if], data = [none] points[3] = pointB; // depends on control dependency: [if], data = [none] } return points; } }
public class class_name { public static DataSource create(DataSource ds, Log log) { if (ds == null) { throw new IllegalArgumentException(); } if (log == null) { log = LogFactory.getLog(LoggingDataSource.class); } if (!log.isDebugEnabled()) { return ds; } return new LoggingDataSource(log, ds); } }
public class class_name { public static DataSource create(DataSource ds, Log log) { if (ds == null) { throw new IllegalArgumentException(); } if (log == null) { log = LogFactory.getLog(LoggingDataSource.class); // depends on control dependency: [if], data = [none] } if (!log.isDebugEnabled()) { return ds; // depends on control dependency: [if], data = [none] } return new LoggingDataSource(log, ds); } }
public class class_name { public static void main(String args[]) { // Associate a new Context with this thread Context cx = Context.enter(); try { // Initialize the standard objects (Object, Function, etc.) // This must be done before scripts can be executed. Shell shell = new Shell(); cx.initStandardObjects(shell); // Define some global functions particular to the shell. Note // that these functions are not part of ECMA. String[] names = { "print", "quit", "version", "load", "help" }; shell.defineFunctionProperties(names, Shell.class, ScriptableObject.DONTENUM); args = processOptions(cx, args); // Set up "arguments" in the global scope to contain the command // line arguments after the name of the script to execute Object[] array; if (args.length == 0) { array = new Object[0]; } else { int length = args.length - 1; array = new Object[length]; System.arraycopy(args, 1, array, 0, length); } Scriptable argsObj = cx.newArray(shell, array); shell.defineProperty("arguments", argsObj, ScriptableObject.DONTENUM); shell.processSource(cx, args.length == 0 ? null : args[0]); } finally { Context.exit(); } } }
public class class_name { public static void main(String args[]) { // Associate a new Context with this thread Context cx = Context.enter(); try { // Initialize the standard objects (Object, Function, etc.) // This must be done before scripts can be executed. Shell shell = new Shell(); cx.initStandardObjects(shell); // depends on control dependency: [try], data = [none] // Define some global functions particular to the shell. Note // that these functions are not part of ECMA. String[] names = { "print", "quit", "version", "load", "help" }; shell.defineFunctionProperties(names, Shell.class, ScriptableObject.DONTENUM); // depends on control dependency: [try], data = [none] args = processOptions(cx, args); // depends on control dependency: [try], data = [none] // Set up "arguments" in the global scope to contain the command // line arguments after the name of the script to execute Object[] array; if (args.length == 0) { array = new Object[0]; // depends on control dependency: [if], data = [none] } else { int length = args.length - 1; array = new Object[length]; // depends on control dependency: [if], data = [none] System.arraycopy(args, 1, array, 0, length); // depends on control dependency: [if], data = [none] } Scriptable argsObj = cx.newArray(shell, array); shell.defineProperty("arguments", argsObj, ScriptableObject.DONTENUM); // depends on control dependency: [try], data = [none] shell.processSource(cx, args.length == 0 ? null : args[0]); // depends on control dependency: [try], data = [none] } finally { Context.exit(); } } }
public class class_name { public static boolean isCompressed(byte[] bytes) { if ((bytes == null) || (bytes.length < 2)) { return false; } else { return ((bytes[0] == (byte) (GZIPInputStream.GZIP_MAGIC)) && (bytes[1] == (byte) (GZIPInputStream.GZIP_MAGIC >> 8))); } } }
public class class_name { public static boolean isCompressed(byte[] bytes) { if ((bytes == null) || (bytes.length < 2)) { return false; // depends on control dependency: [if], data = [none] } else { return ((bytes[0] == (byte) (GZIPInputStream.GZIP_MAGIC)) && (bytes[1] == (byte) (GZIPInputStream.GZIP_MAGIC >> 8))); // depends on control dependency: [if], data = [((bytes] } } }
public class class_name { public void updateVariableName(String varName, String withName) { SDVariable oldVarNameRef = getVariable(varName); variableMap.remove(oldVarNameRef.getVarName()); val oldVarName = varName; oldVarNameRef.setVarName(withName); variableMap.put(withName, oldVarNameRef); for (val reverseValues : outgoingArgsReverse.entrySet()) { for (int i = 0; i < reverseValues.getValue().length; i++) { if (reverseValues.getValue()[i].equals(oldVarName)) { reverseValues.getValue()[i] = withName; } } } for (val reverseValues : incomingArgsReverse.entrySet()) { for (int i = 0; i < reverseValues.getValue().length; i++) { if (reverseValues.getValue()[i].equals(oldVarName)) { reverseValues.getValue()[i] = withName; } } } if (variableNameToArr.containsKey(oldVarName)) { val arr = variableNameToArr.remove(oldVarName); variableNameToArr.put(withName, arr); } if (variableNameToShape.containsKey(oldVarName)) { val shape = variableNameToShape.remove(oldVarName); variableNameToShape.put(withName, shape); } if (gradients.containsKey(oldVarName)) { val grad = gradients.remove(oldVarName); gradients.put(withName, grad); } if (forwardVarForGrad.containsKey(oldVarName)) { val forwardGrad = forwardVarForGrad.remove(oldVarName); forwardVarForGrad.put(withName, forwardGrad); } if (placeHolderMap.containsKey(oldVarName)) { val placeholders = placeHolderMap.remove(oldVarName); placeHolderMap.put(withName, placeholders); } if (functionsArgsFor.containsKey(oldVarName)) { val funcs = functionsArgsFor.remove(oldVarName); for (val func : funcs) { if (func instanceof BaseOp) { BaseOp baseOp = (BaseOp) func; if (baseOp.getXVertexId() != null && baseOp.getXVertexId().equals(oldVarName)) { baseOp.setXVertexId(withName); } if (baseOp.getYVertexId() != null && baseOp.getYVertexId().equals(oldVarName)) { baseOp.setYVertexId(withName); } if (baseOp.getZVertexId() != null && baseOp.getZVertexId().equals(oldVarName)) { baseOp.setZVertexId(withName); } } } functionsArgsFor.put(withName, funcs); } if (functionOutputFor.containsKey(oldVarName)) { val funcs = functionOutputFor.remove(oldVarName); for (val func : funcs) { if (func instanceof BaseOp) { BaseOp baseOp = (BaseOp) func; if (baseOp.getXVertexId() != null && baseOp.getXVertexId().equals(oldVarName)) { baseOp.setXVertexId(withName); } if (baseOp.getYVertexId() != null && baseOp.getYVertexId().equals(oldVarName)) { baseOp.setYVertexId(withName); } if (baseOp.getZVertexId() != null && baseOp.getZVertexId().equals(oldVarName)) { baseOp.setZVertexId(withName); } } } functionOutputFor.put(withName, funcs); } variableMap.remove(oldVarName); } }
public class class_name { public void updateVariableName(String varName, String withName) { SDVariable oldVarNameRef = getVariable(varName); variableMap.remove(oldVarNameRef.getVarName()); val oldVarName = varName; oldVarNameRef.setVarName(withName); variableMap.put(withName, oldVarNameRef); for (val reverseValues : outgoingArgsReverse.entrySet()) { for (int i = 0; i < reverseValues.getValue().length; i++) { if (reverseValues.getValue()[i].equals(oldVarName)) { reverseValues.getValue()[i] = withName; // depends on control dependency: [if], data = [none] } } } for (val reverseValues : incomingArgsReverse.entrySet()) { for (int i = 0; i < reverseValues.getValue().length; i++) { if (reverseValues.getValue()[i].equals(oldVarName)) { reverseValues.getValue()[i] = withName; // depends on control dependency: [if], data = [none] } } } if (variableNameToArr.containsKey(oldVarName)) { val arr = variableNameToArr.remove(oldVarName); variableNameToArr.put(withName, arr); // depends on control dependency: [if], data = [none] } if (variableNameToShape.containsKey(oldVarName)) { val shape = variableNameToShape.remove(oldVarName); variableNameToShape.put(withName, shape); // depends on control dependency: [if], data = [none] } if (gradients.containsKey(oldVarName)) { val grad = gradients.remove(oldVarName); gradients.put(withName, grad); // depends on control dependency: [if], data = [none] } if (forwardVarForGrad.containsKey(oldVarName)) { val forwardGrad = forwardVarForGrad.remove(oldVarName); forwardVarForGrad.put(withName, forwardGrad); // depends on control dependency: [if], data = [none] } if (placeHolderMap.containsKey(oldVarName)) { val placeholders = placeHolderMap.remove(oldVarName); placeHolderMap.put(withName, placeholders); // depends on control dependency: [if], data = [none] } if (functionsArgsFor.containsKey(oldVarName)) { val funcs = functionsArgsFor.remove(oldVarName); for (val func : funcs) { if (func instanceof BaseOp) { BaseOp baseOp = (BaseOp) func; if (baseOp.getXVertexId() != null && baseOp.getXVertexId().equals(oldVarName)) { baseOp.setXVertexId(withName); // depends on control dependency: [if], data = [none] } if (baseOp.getYVertexId() != null && baseOp.getYVertexId().equals(oldVarName)) { baseOp.setYVertexId(withName); // depends on control dependency: [if], data = [none] } if (baseOp.getZVertexId() != null && baseOp.getZVertexId().equals(oldVarName)) { baseOp.setZVertexId(withName); // depends on control dependency: [if], data = [none] } } } functionsArgsFor.put(withName, funcs); // depends on control dependency: [if], data = [none] } if (functionOutputFor.containsKey(oldVarName)) { val funcs = functionOutputFor.remove(oldVarName); for (val func : funcs) { if (func instanceof BaseOp) { BaseOp baseOp = (BaseOp) func; if (baseOp.getXVertexId() != null && baseOp.getXVertexId().equals(oldVarName)) { baseOp.setXVertexId(withName); // depends on control dependency: [if], data = [none] } if (baseOp.getYVertexId() != null && baseOp.getYVertexId().equals(oldVarName)) { baseOp.setYVertexId(withName); // depends on control dependency: [if], data = [none] } if (baseOp.getZVertexId() != null && baseOp.getZVertexId().equals(oldVarName)) { baseOp.setZVertexId(withName); // depends on control dependency: [if], data = [none] } } } functionOutputFor.put(withName, funcs); // depends on control dependency: [if], data = [none] } variableMap.remove(oldVarName); } }
public class class_name { protected boolean load(URI itemToLoad, boolean fallbackLoad) { InputStream is = null; ByteArrayOutputStream stream = new ByteArrayOutputStream(); try { URLConnection conn; String proxyPort = this.properties.get("proxy.port"); String proxyHost = this.properties.get("proxy.host"); String proxyType = this.properties.get("procy.type"); if(proxyType!=null){ Proxy proxy = new Proxy(Proxy.Type.valueOf(proxyType.toUpperCase()), InetSocketAddress.createUnresolved(proxyHost, Integer.parseInt(proxyPort))); conn = itemToLoad.toURL().openConnection(proxy); }else{ conn = itemToLoad.toURL().openConnection(); } String timeout = this.properties.get("connection.connect.timeout"); if(timeout!=null){ int seconds = Integer.parseInt(timeout); conn.setConnectTimeout(seconds*1000); }else{ conn.setConnectTimeout(10000); } timeout = this.properties.get("connection.read.timeout"); if(timeout!=null){ int seconds = Integer.parseInt(timeout); conn.setReadTimeout(seconds*1000); }else{ conn.setReadTimeout(10000); } byte[] cachedData = new byte[4096]; is = conn.getInputStream(); int read = is.read(cachedData); while (read > 0) { stream.write(cachedData, 0, read); read = is.read(cachedData); } setData(stream.toByteArray()); if (!fallbackLoad) { writeCache(); lastLoaded = System.currentTimeMillis(); loadCount.incrementAndGet(); } return true; } catch (Exception e) { LOG.log(Level.INFO, "Failed to load resource input for " + resourceId + " from " + itemToLoad, e); return false; } finally { if (is!=null) { try { is.close(); } catch (Exception e) { LOG.log(Level.INFO, "Error closing resource input for " + resourceId, e); } } try { stream.close(); } catch (IOException e) { LOG.log(Level.INFO, "Error closing resource input for " + resourceId, e); } } } }
public class class_name { protected boolean load(URI itemToLoad, boolean fallbackLoad) { InputStream is = null; ByteArrayOutputStream stream = new ByteArrayOutputStream(); try { URLConnection conn; String proxyPort = this.properties.get("proxy.port"); String proxyHost = this.properties.get("proxy.host"); String proxyType = this.properties.get("procy.type"); if(proxyType!=null){ Proxy proxy = new Proxy(Proxy.Type.valueOf(proxyType.toUpperCase()), InetSocketAddress.createUnresolved(proxyHost, Integer.parseInt(proxyPort))); conn = itemToLoad.toURL().openConnection(proxy); // depends on control dependency: [if], data = [none] }else{ conn = itemToLoad.toURL().openConnection(); // depends on control dependency: [if], data = [none] } String timeout = this.properties.get("connection.connect.timeout"); if(timeout!=null){ int seconds = Integer.parseInt(timeout); conn.setConnectTimeout(seconds*1000); // depends on control dependency: [if], data = [none] }else{ conn.setConnectTimeout(10000); // depends on control dependency: [if], data = [none] } timeout = this.properties.get("connection.read.timeout"); // depends on control dependency: [try], data = [none] if(timeout!=null){ int seconds = Integer.parseInt(timeout); conn.setReadTimeout(seconds*1000); // depends on control dependency: [if], data = [none] }else{ conn.setReadTimeout(10000); // depends on control dependency: [if], data = [none] } byte[] cachedData = new byte[4096]; is = conn.getInputStream(); // depends on control dependency: [try], data = [none] int read = is.read(cachedData); while (read > 0) { stream.write(cachedData, 0, read); // depends on control dependency: [while], data = [none] read = is.read(cachedData); // depends on control dependency: [while], data = [none] } setData(stream.toByteArray()); // depends on control dependency: [try], data = [none] if (!fallbackLoad) { writeCache(); // depends on control dependency: [if], data = [none] lastLoaded = System.currentTimeMillis(); // depends on control dependency: [if], data = [none] loadCount.incrementAndGet(); // depends on control dependency: [if], data = [none] } return true; // depends on control dependency: [try], data = [none] } catch (Exception e) { LOG.log(Level.INFO, "Failed to load resource input for " + resourceId + " from " + itemToLoad, e); return false; } finally { // depends on control dependency: [catch], data = [none] if (is!=null) { try { is.close(); // depends on control dependency: [try], data = [none] } catch (Exception e) { LOG.log(Level.INFO, "Error closing resource input for " + resourceId, e); } // depends on control dependency: [catch], data = [none] } try { stream.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { LOG.log(Level.INFO, "Error closing resource input for " + resourceId, e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public void adjustChildren(int widthMeasureSpec, int heightMeasureSpec) { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "adjustChildren: " + mHost + " widthMeasureSpec: " + View.MeasureSpec.toString(widthMeasureSpec) + " heightMeasureSpec: " + View.MeasureSpec.toString(heightMeasureSpec)); } int widthHint = View.MeasureSpec.getSize(widthMeasureSpec); int heightHint = View.MeasureSpec.getSize(heightMeasureSpec); for (int i = 0, N = mHost.getChildCount(); i < N; i++) { View view = mHost.getChildAt(i); ViewGroup.LayoutParams params = view.getLayoutParams(); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "should adjust " + view + " " + params); } if (params instanceof PercentLayoutParams) { PercentLayoutInfo info = ((PercentLayoutParams) params).getPercentLayoutInfo(); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "using " + info); } if (info != null) { if (params instanceof ViewGroup.MarginLayoutParams) { info.fillMarginLayoutParams((ViewGroup.MarginLayoutParams) params, widthHint, heightHint); } else { info.fillLayoutParams(params, widthHint, heightHint); } } } } } }
public class class_name { public void adjustChildren(int widthMeasureSpec, int heightMeasureSpec) { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "adjustChildren: " + mHost + " widthMeasureSpec: " + View.MeasureSpec.toString(widthMeasureSpec) + " heightMeasureSpec: " + View.MeasureSpec.toString(heightMeasureSpec)); // depends on control dependency: [if], data = [none] } int widthHint = View.MeasureSpec.getSize(widthMeasureSpec); int heightHint = View.MeasureSpec.getSize(heightMeasureSpec); for (int i = 0, N = mHost.getChildCount(); i < N; i++) { View view = mHost.getChildAt(i); ViewGroup.LayoutParams params = view.getLayoutParams(); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "should adjust " + view + " " + params); // depends on control dependency: [if], data = [none] } if (params instanceof PercentLayoutParams) { PercentLayoutInfo info = ((PercentLayoutParams) params).getPercentLayoutInfo(); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "using " + info); // depends on control dependency: [if], data = [none] } if (info != null) { if (params instanceof ViewGroup.MarginLayoutParams) { info.fillMarginLayoutParams((ViewGroup.MarginLayoutParams) params, widthHint, heightHint); // depends on control dependency: [if], data = [none] } else { info.fillLayoutParams(params, widthHint, heightHint); // depends on control dependency: [if], data = [none] } } } } } }
public class class_name { public int compareTo(Object object) { if (object == null || !(object instanceof Named)) { return -1; } else { Named vo = (Named) object; return getName().compareTo(vo.getName()); } } }
public class class_name { public int compareTo(Object object) { if (object == null || !(object instanceof Named)) { return -1; // depends on control dependency: [if], data = [none] } else { Named vo = (Named) object; return getName().compareTo(vo.getName()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static MultiLineString fromLineStrings(@NonNull List<LineString> lineStrings, @Nullable BoundingBox bbox) { List<List<Point>> coordinates = new ArrayList<>(lineStrings.size()); for (LineString lineString : lineStrings) { coordinates.add(lineString.coordinates()); } return new MultiLineString(TYPE, bbox, coordinates); } }
public class class_name { public static MultiLineString fromLineStrings(@NonNull List<LineString> lineStrings, @Nullable BoundingBox bbox) { List<List<Point>> coordinates = new ArrayList<>(lineStrings.size()); for (LineString lineString : lineStrings) { coordinates.add(lineString.coordinates()); // depends on control dependency: [for], data = [lineString] } return new MultiLineString(TYPE, bbox, coordinates); } }
public class class_name { public void removeTrailingEmptyLines () { Line aLine = m_aLineTail; while (aLine != null && aLine.m_bIsEmpty) { removeLine (aLine); aLine = m_aLineTail; } } }
public class class_name { public void removeTrailingEmptyLines () { Line aLine = m_aLineTail; while (aLine != null && aLine.m_bIsEmpty) { removeLine (aLine); // depends on control dependency: [while], data = [(aLine] aLine = m_aLineTail; // depends on control dependency: [while], data = [none] } } }
public class class_name { public List<String> getEffectiveAccountLineage() { if (accountLineage == null) { if (effectiveAccount != null) { try { accountLineage = accountsDao.getAccountLineage(effectiveAccount); } catch (AccountHierarchyDepthCrossed e) { throw new RuntimeException("Logged account has a very big line of ancestors. Something seems wrong. Account sid: " + effectiveAccount.getSid().toString(), e); } } } return accountLineage; } }
public class class_name { public List<String> getEffectiveAccountLineage() { if (accountLineage == null) { if (effectiveAccount != null) { try { accountLineage = accountsDao.getAccountLineage(effectiveAccount); // depends on control dependency: [try], data = [none] } catch (AccountHierarchyDepthCrossed e) { throw new RuntimeException("Logged account has a very big line of ancestors. Something seems wrong. Account sid: " + effectiveAccount.getSid().toString(), e); } // depends on control dependency: [catch], data = [none] } } return accountLineage; } }
public class class_name { private void addPredicates(List<Predicate> newPredicates) { for(Predicate newPredicate : newPredicates) { if(this.predicates == null) { this.predicates = newPredicate; } else { this.predicates = new And(this.predicates, newPredicate); } } } }
public class class_name { private void addPredicates(List<Predicate> newPredicates) { for(Predicate newPredicate : newPredicates) { if(this.predicates == null) { this.predicates = newPredicate; // depends on control dependency: [if], data = [none] } else { this.predicates = new And(this.predicates, newPredicate); // depends on control dependency: [if], data = [(this.predicates] } } } }
public class class_name { public static String read(Reader reader) { StringWriter writer = new StringWriter(); try { char[] buffer = new char[DEFAULT_BUFFER_SIZE]; int n; while (-1 != (n = reader.read(buffer))) { writer.write(buffer, 0, n); } return writer.toString(); } catch (IOException ex) { throw new IllegalStateException("read error", ex); } } }
public class class_name { public static String read(Reader reader) { StringWriter writer = new StringWriter(); try { char[] buffer = new char[DEFAULT_BUFFER_SIZE]; int n; while (-1 != (n = reader.read(buffer))) { writer.write(buffer, 0, n); // depends on control dependency: [while], data = [none] } return writer.toString(); // depends on control dependency: [try], data = [none] } catch (IOException ex) { throw new IllegalStateException("read error", ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private String formatPriority(Priority value) { String result = null; if (value != null) { String[] priorityTypes = LocaleData.getStringArray(m_locale, LocaleData.PRIORITY_TYPES); int priority = value.getValue(); if (priority < Priority.LOWEST) { priority = Priority.LOWEST; } else { if (priority > Priority.DO_NOT_LEVEL) { priority = Priority.DO_NOT_LEVEL; } } priority /= 100; result = priorityTypes[priority - 1]; } return (result); } }
public class class_name { private String formatPriority(Priority value) { String result = null; if (value != null) { String[] priorityTypes = LocaleData.getStringArray(m_locale, LocaleData.PRIORITY_TYPES); int priority = value.getValue(); if (priority < Priority.LOWEST) { priority = Priority.LOWEST; // depends on control dependency: [if], data = [none] } else { if (priority > Priority.DO_NOT_LEVEL) { priority = Priority.DO_NOT_LEVEL; // depends on control dependency: [if], data = [none] } } priority /= 100; // depends on control dependency: [if], data = [none] result = priorityTypes[priority - 1]; // depends on control dependency: [if], data = [none] } return (result); } }
public class class_name { public static Duration getAdjustedDuration(ProjectFile file, int duration, TimeUnit timeUnit) { Duration result; switch (timeUnit) { case MINUTES: case ELAPSED_MINUTES: { double totalMinutes = duration / 10d; result = Duration.getInstance(totalMinutes, timeUnit); break; } case HOURS: case ELAPSED_HOURS: { double totalHours = duration / 600d; result = Duration.getInstance(totalHours, timeUnit); break; } case DAYS: { double unitsPerDay = file.getProjectProperties().getMinutesPerDay().doubleValue() * 10d; double totalDays = 0; if (unitsPerDay != 0) { totalDays = duration / unitsPerDay; } result = Duration.getInstance(totalDays, timeUnit); break; } case ELAPSED_DAYS: { double unitsPerDay = 24d * 600d; double totalDays = duration / unitsPerDay; result = Duration.getInstance(totalDays, timeUnit); break; } case WEEKS: { double unitsPerWeek = file.getProjectProperties().getMinutesPerWeek().doubleValue() * 10d; double totalWeeks = 0; if (unitsPerWeek != 0) { totalWeeks = duration / unitsPerWeek; } result = Duration.getInstance(totalWeeks, timeUnit); break; } case ELAPSED_WEEKS: { double unitsPerWeek = (60 * 24 * 7 * 10); double totalWeeks = duration / unitsPerWeek; result = Duration.getInstance(totalWeeks, timeUnit); break; } case ELAPSED_MONTHS: { double unitsPerMonth = (60 * 24 * 30 * 10); double totalMonths = duration / unitsPerMonth; result = Duration.getInstance(totalMonths, timeUnit); break; } case MONTHS: { double totalMonths = duration / 96000d; result = Duration.getInstance(totalMonths, timeUnit); break; } default: { result = Duration.getInstance(duration, timeUnit); break; } } return (result); } }
public class class_name { public static Duration getAdjustedDuration(ProjectFile file, int duration, TimeUnit timeUnit) { Duration result; switch (timeUnit) { case MINUTES: case ELAPSED_MINUTES: { double totalMinutes = duration / 10d; result = Duration.getInstance(totalMinutes, timeUnit); break; } case HOURS: case ELAPSED_HOURS: { double totalHours = duration / 600d; result = Duration.getInstance(totalHours, timeUnit); break; } case DAYS: { double unitsPerDay = file.getProjectProperties().getMinutesPerDay().doubleValue() * 10d; double totalDays = 0; if (unitsPerDay != 0) { totalDays = duration / unitsPerDay; // depends on control dependency: [if], data = [none] } result = Duration.getInstance(totalDays, timeUnit); break; } case ELAPSED_DAYS: { double unitsPerDay = 24d * 600d; double totalDays = duration / unitsPerDay; result = Duration.getInstance(totalDays, timeUnit); break; } case WEEKS: { double unitsPerWeek = file.getProjectProperties().getMinutesPerWeek().doubleValue() * 10d; double totalWeeks = 0; if (unitsPerWeek != 0) { totalWeeks = duration / unitsPerWeek; } result = Duration.getInstance(totalWeeks, timeUnit); break; } case ELAPSED_WEEKS: { double unitsPerWeek = (60 * 24 * 7 * 10); double totalWeeks = duration / unitsPerWeek; result = Duration.getInstance(totalWeeks, timeUnit); break; } case ELAPSED_MONTHS: { double unitsPerMonth = (60 * 24 * 30 * 10); double totalMonths = duration / unitsPerMonth; result = Duration.getInstance(totalMonths, timeUnit); break; } case MONTHS: { double totalMonths = duration / 96000d; result = Duration.getInstance(totalMonths, timeUnit); break; } default: { result = Duration.getInstance(duration, timeUnit); break; } } return (result); } }
public class class_name { @Override public void handleRequest(final Request request) { super.handleRequest(request); if (isPresent(request)) { if (getExpandMode() != ExpandMode.NONE) { handleExpansionRequest(request); } if (getSelectMode() != SelectMode.NONE) { handleSelectionRequest(request); } if (getPaginationMode() != PaginationMode.NONE) { handlePaginationRequest(request); } if (isFilterable()) { handleFilterRequest(request); } if (isSortable()) { handleSortRequest(request); } } } }
public class class_name { @Override public void handleRequest(final Request request) { super.handleRequest(request); if (isPresent(request)) { if (getExpandMode() != ExpandMode.NONE) { handleExpansionRequest(request); // depends on control dependency: [if], data = [none] } if (getSelectMode() != SelectMode.NONE) { handleSelectionRequest(request); // depends on control dependency: [if], data = [none] } if (getPaginationMode() != PaginationMode.NONE) { handlePaginationRequest(request); // depends on control dependency: [if], data = [none] } if (isFilterable()) { handleFilterRequest(request); // depends on control dependency: [if], data = [none] } if (isSortable()) { handleSortRequest(request); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public String[] removeFromStringArray(String[] strArray, String str) { String[] result = null; if (strArray != null && strArray.length > 0) { List<String> list = new ArrayList<String>(); for (int i=0; i < strArray.length; i++) { if (!strArray[i].equals(str)) { list.add(strArray[i]); } } int size = list.size(); if (size > 0) { result = list.toArray(new String[size]); } } return result; } }
public class class_name { public String[] removeFromStringArray(String[] strArray, String str) { String[] result = null; if (strArray != null && strArray.length > 0) { List<String> list = new ArrayList<String>(); for (int i=0; i < strArray.length; i++) { if (!strArray[i].equals(str)) { list.add(strArray[i]); // depends on control dependency: [if], data = [none] } } int size = list.size(); if (size > 0) { result = list.toArray(new String[size]); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { public void setSupportedLocales(java.util.Collection<String> supportedLocales) { if (supportedLocales == null) { this.supportedLocales = null; return; } this.supportedLocales = new java.util.ArrayList<String>(supportedLocales); } }
public class class_name { public void setSupportedLocales(java.util.Collection<String> supportedLocales) { if (supportedLocales == null) { this.supportedLocales = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.supportedLocales = new java.util.ArrayList<String>(supportedLocales); } }
public class class_name { public static synchronized CatalogResolver getCatalogResolver() { if (catalogResolver == null) { final CatalogManager manager = new CatalogManager(); manager.setIgnoreMissingProperties(true); manager.setUseStaticCatalog(false); // We'll use a private catalog. manager.setPreferPublic(true); final File catalogFilePath = new File(ditaDir, Configuration.pluginResourceDirs.get("org.dita.base") + File.separator + FILE_NAME_CATALOG); manager.setCatalogFiles(catalogFilePath.toURI().toASCIIString()); //manager.setVerbosity(10); catalogResolver = new CatalogResolver(manager); } return catalogResolver; } }
public class class_name { public static synchronized CatalogResolver getCatalogResolver() { if (catalogResolver == null) { final CatalogManager manager = new CatalogManager(); manager.setIgnoreMissingProperties(true); // depends on control dependency: [if], data = [none] manager.setUseStaticCatalog(false); // We'll use a private catalog. // depends on control dependency: [if], data = [none] manager.setPreferPublic(true); // depends on control dependency: [if], data = [none] final File catalogFilePath = new File(ditaDir, Configuration.pluginResourceDirs.get("org.dita.base") + File.separator + FILE_NAME_CATALOG); manager.setCatalogFiles(catalogFilePath.toURI().toASCIIString()); // depends on control dependency: [if], data = [none] //manager.setVerbosity(10); catalogResolver = new CatalogResolver(manager); // depends on control dependency: [if], data = [none] } return catalogResolver; } }
public class class_name { @Override public List<String> toMessageList(Locale locale, UserMessages messages) { assertArgumentNotNull("locale", locale); assertArgumentNotNull("errors", messages); if (messages.isEmpty()) { return Collections.emptyList(); } final List<String> messageList = new ArrayList<String>(); final Iterator<UserMessage> ite = messages.accessByFlatIterator(); while (ite.hasNext()) { messageList.add(resolveMessageText(locale, ite.next())); } return Collections.unmodifiableList(messageList); } }
public class class_name { @Override public List<String> toMessageList(Locale locale, UserMessages messages) { assertArgumentNotNull("locale", locale); assertArgumentNotNull("errors", messages); if (messages.isEmpty()) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } final List<String> messageList = new ArrayList<String>(); final Iterator<UserMessage> ite = messages.accessByFlatIterator(); while (ite.hasNext()) { messageList.add(resolveMessageText(locale, ite.next())); // depends on control dependency: [while], data = [none] } return Collections.unmodifiableList(messageList); } }
public class class_name { public static BigDecimal atan2(BigDecimal y, BigDecimal x, MathContext mathContext) { checkMathContext(mathContext); MathContext mc = new MathContext(mathContext.getPrecision() + 3, mathContext.getRoundingMode()); if (x.signum() > 0) { // x > 0 return atan(y.divide(x, mc), mathContext); } else if (x.signum() < 0) { if (y.signum() > 0) { // x < 0 && y > 0 return atan(y.divide(x, mc), mc).add(pi(mc), mathContext); } else if (y.signum() < 0) { // x < 0 && y < 0 return atan(y.divide(x, mc), mc).subtract(pi(mc), mathContext); } else { // x < 0 && y = 0 return pi(mathContext); } } else { if (y.signum() > 0) { // x == 0 && y > 0 return pi(mc).divide(TWO, mathContext); } else if (y.signum() < 0) { // x == 0 && y < 0 return pi(mc).divide(TWO, mathContext).negate(); } else { throw new ArithmeticException("Illegal atan2(y, x) for x = 0; y = 0"); } } } }
public class class_name { public static BigDecimal atan2(BigDecimal y, BigDecimal x, MathContext mathContext) { checkMathContext(mathContext); MathContext mc = new MathContext(mathContext.getPrecision() + 3, mathContext.getRoundingMode()); if (x.signum() > 0) { // x > 0 return atan(y.divide(x, mc), mathContext); // depends on control dependency: [if], data = [none] } else if (x.signum() < 0) { if (y.signum() > 0) { // x < 0 && y > 0 return atan(y.divide(x, mc), mc).add(pi(mc), mathContext); // depends on control dependency: [if], data = [none] } else if (y.signum() < 0) { // x < 0 && y < 0 return atan(y.divide(x, mc), mc).subtract(pi(mc), mathContext); // depends on control dependency: [if], data = [none] } else { // x < 0 && y = 0 return pi(mathContext); // depends on control dependency: [if], data = [none] } } else { if (y.signum() > 0) { // x == 0 && y > 0 return pi(mc).divide(TWO, mathContext); // depends on control dependency: [if], data = [none] } else if (y.signum() < 0) { // x == 0 && y < 0 return pi(mc).divide(TWO, mathContext).negate(); // depends on control dependency: [if], data = [none] } else { throw new ArithmeticException("Illegal atan2(y, x) for x = 0; y = 0"); } } } }
public class class_name { public PoolStopResizeOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { if (ifUnmodifiedSince == null) { this.ifUnmodifiedSince = null; } else { this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); } return this; } }
public class class_name { public PoolStopResizeOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { if (ifUnmodifiedSince == null) { this.ifUnmodifiedSince = null; // depends on control dependency: [if], data = [none] } else { this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); // depends on control dependency: [if], data = [(ifUnmodifiedSince] } return this; } }
public class class_name { @Override public void deFilter(byte[] line, byte[] previousLine, int sampleBitCount) throws PngException { PngFilterType filterType = PngFilterType.forValue(line[0]); line[0] = 0; PngFilterType previousFilterType = PngFilterType.forValue(previousLine[0]); previousLine[0] = 0; switch (filterType) { case SUB: { int previous = -(Math.max(1, sampleBitCount / 8) - 1); for (int x = 1, a = previous; x < line.length; x++, a++) { line[x] = (byte) (line[x] + ((a < 0) ? 0 : line[a])); } break; } case UP: { for (int x = 1; x < line.length; x++) { line[x] = (byte) (line[x] + previousLine[x]); } break; } case AVERAGE: { int previous = -(Math.max(1, sampleBitCount / 8) - 1); for (int x = 1, a = previous; x < line.length; x++, a++) { line[x] = (byte) (line[x] + ((0xFF & ((a < 0) ? 0 : line[a])) + (0xFF & previousLine[x])) / 2); } break; } case PAETH: { int previous = -(Math.max(1, sampleBitCount / 8) - 1); for (int x = 1, xp = previous; x < line.length; x++, xp++) { int result = this.paethPredictor(line, previousLine, x, xp); line[x] = (byte) (line[x] + result); } break; } } line[0] = filterType.getValue(); previousLine[0] = previousFilterType.getValue(); } }
public class class_name { @Override public void deFilter(byte[] line, byte[] previousLine, int sampleBitCount) throws PngException { PngFilterType filterType = PngFilterType.forValue(line[0]); line[0] = 0; PngFilterType previousFilterType = PngFilterType.forValue(previousLine[0]); previousLine[0] = 0; switch (filterType) { case SUB: { int previous = -(Math.max(1, sampleBitCount / 8) - 1); for (int x = 1, a = previous; x < line.length; x++, a++) { line[x] = (byte) (line[x] + ((a < 0) ? 0 : line[a])); // depends on control dependency: [for], data = [x] } break; } case UP: { for (int x = 1; x < line.length; x++) { line[x] = (byte) (line[x] + previousLine[x]); } break; } case AVERAGE: { int previous = -(Math.max(1, sampleBitCount / 8) - 1); for (int x = 1, a = previous; x < line.length; x++, a++) { line[x] = (byte) (line[x] + ((0xFF & ((a < 0) ? 0 : line[a])) + (0xFF & previousLine[x])) / 2); // depends on control dependency: [for], data = [x] } break; } case PAETH: { int previous = -(Math.max(1, sampleBitCount / 8) - 1); for (int x = 1, xp = previous; x < line.length; x++, xp++) { int result = this.paethPredictor(line, previousLine, x, xp); line[x] = (byte) (line[x] + result); } break; } } line[0] = filterType.getValue(); previousLine[0] = previousFilterType.getValue(); } }
public class class_name { @Override public Map<Integer, Integer> pPredecessors(int partition) { Map<Integer, Integer> predecessors = new TreeMap<Integer, Integer>(); UnmodifiableIterator<Map.Entry<Integer,Integer>> iter = m_tokensMap.get().entrySet().iterator(); Set<Integer> pTokens = new HashSet<Integer>(); while (iter.hasNext()) { Map.Entry<Integer, Integer> next = iter.next(); if (next.getValue() == partition) { pTokens.add(next.getKey()); } } for (Integer token : pTokens) { Map.Entry<Integer, Integer> predecessor = null; if (token != null) { predecessor = m_tokensMap.get().headMap(token).lastEntry(); // If null, it means partition is the first one on the ring, so predecessor // should be the last entry on the ring because it wraps around. if (predecessor == null) { predecessor = m_tokensMap.get().lastEntry(); } } if (predecessor != null && predecessor.getValue() != partition) { predecessors.put(predecessor.getKey(), predecessor.getValue()); } } return predecessors; } }
public class class_name { @Override public Map<Integer, Integer> pPredecessors(int partition) { Map<Integer, Integer> predecessors = new TreeMap<Integer, Integer>(); UnmodifiableIterator<Map.Entry<Integer,Integer>> iter = m_tokensMap.get().entrySet().iterator(); Set<Integer> pTokens = new HashSet<Integer>(); while (iter.hasNext()) { Map.Entry<Integer, Integer> next = iter.next(); if (next.getValue() == partition) { pTokens.add(next.getKey()); // depends on control dependency: [if], data = [none] } } for (Integer token : pTokens) { Map.Entry<Integer, Integer> predecessor = null; if (token != null) { predecessor = m_tokensMap.get().headMap(token).lastEntry(); // depends on control dependency: [if], data = [(token] // If null, it means partition is the first one on the ring, so predecessor // should be the last entry on the ring because it wraps around. if (predecessor == null) { predecessor = m_tokensMap.get().lastEntry(); // depends on control dependency: [if], data = [none] } } if (predecessor != null && predecessor.getValue() != partition) { predecessors.put(predecessor.getKey(), predecessor.getValue()); // depends on control dependency: [if], data = [(predecessor] } } return predecessors; } }
public class class_name { private InsnList getReturnTraceInstructions() { InsnList il = new InsnList(); int retunedVariablePosition = getFistAvailablePosition(); il.add(TreeInstructions.getStoreInst(this.methodReturnType, retunedVariablePosition)); this.variableCreated(this.methodReturnType); // Actualizamos el offset addGetCallback(il); il.add(new VarInsnNode(Opcodes.ALOAD, this.methodVarIndex)); il.add(TreeInstructions.getLoadInst(this.methodReturnType, retunedVariablePosition)); MethodInsnNode mNode = TreeInstructions.getWrapperContructionInst(this.methodReturnType); if (mNode != null) { il.add(mNode); } il.add(new VarInsnNode(Opcodes.ALOAD, this.executionIdIndex)); il.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "org/brutusin/instrumentation/Callback", "onFinish", "(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/String;)V", false)); il.add(TreeInstructions.getLoadInst(this.methodReturnType, retunedVariablePosition)); return il; } }
public class class_name { private InsnList getReturnTraceInstructions() { InsnList il = new InsnList(); int retunedVariablePosition = getFistAvailablePosition(); il.add(TreeInstructions.getStoreInst(this.methodReturnType, retunedVariablePosition)); this.variableCreated(this.methodReturnType); // Actualizamos el offset addGetCallback(il); il.add(new VarInsnNode(Opcodes.ALOAD, this.methodVarIndex)); il.add(TreeInstructions.getLoadInst(this.methodReturnType, retunedVariablePosition)); MethodInsnNode mNode = TreeInstructions.getWrapperContructionInst(this.methodReturnType); if (mNode != null) { il.add(mNode); // depends on control dependency: [if], data = [(mNode] } il.add(new VarInsnNode(Opcodes.ALOAD, this.executionIdIndex)); il.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "org/brutusin/instrumentation/Callback", "onFinish", "(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/String;)V", false)); il.add(TreeInstructions.getLoadInst(this.methodReturnType, retunedVariablePosition)); return il; } }
public class class_name { public static boolean isvalidCard15(String idCard) { if (CHINA_ID_MIN_LENGTH != idCard.length()) { return false; } if (Validator.isNumber(idCard)) { // 省份 String proCode = idCard.substring(0, 2); if (null == cityCodes.get(proCode)) { return false; } //校验生日(两位年份,补充为19XX) if(false == Validator.isBirthday("19" + idCard.substring(6, 12))) { return false; } } else { return false; } return true; } }
public class class_name { public static boolean isvalidCard15(String idCard) { if (CHINA_ID_MIN_LENGTH != idCard.length()) { return false; // depends on control dependency: [if], data = [none] } if (Validator.isNumber(idCard)) { // 省份 String proCode = idCard.substring(0, 2); if (null == cityCodes.get(proCode)) { return false; // depends on control dependency: [if], data = [none] } //校验生日(两位年份,补充为19XX) if(false == Validator.isBirthday("19" + idCard.substring(6, 12))) { return false; // depends on control dependency: [if], data = [none] } } else { return false; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { private static int getYIndex(PatternFinderUser def, int y, Segment<PrimitiveParameter> lastMatch) { int skipEnd = def.getSkipEnd(); if (lastMatch != null && skipEnd > 0) { return Math.max(y, lastMatch.getLastIndex() + skipEnd); } else if (lastMatch != null && def.getSkip() > 0) { return Math.max(y, lastMatch.getLastIndex() + def.getSkip()); } else { return y; } } }
public class class_name { private static int getYIndex(PatternFinderUser def, int y, Segment<PrimitiveParameter> lastMatch) { int skipEnd = def.getSkipEnd(); if (lastMatch != null && skipEnd > 0) { return Math.max(y, lastMatch.getLastIndex() + skipEnd); // depends on control dependency: [if], data = [none] } else if (lastMatch != null && def.getSkip() > 0) { return Math.max(y, lastMatch.getLastIndex() + def.getSkip()); // depends on control dependency: [if], data = [none] } else { return y; // depends on control dependency: [if], data = [none] } } }
public class class_name { private static void logVersionWarnings(String label1, String version1, String label2, String version2) { if (version1 == null) { if (version2 != null) { warning(null, "Unknown version", " for {}, version for {} is '{}'", new Object[] { label1, label2, version2 }); } } else { if (version2 == null) { warning(null, "Unknown version", " for {}, version for {} is '{}'", new Object[] { label2, label1, version1 }); } else if (!version1.equals(version2)) { warning(null, "Mismatched versions", ": {} is '{}', while {} is '{}'", new Object[] { label1, version1, label2, version2 }); } } } }
public class class_name { private static void logVersionWarnings(String label1, String version1, String label2, String version2) { if (version1 == null) { if (version2 != null) { warning(null, "Unknown version", " for {}, version for {} is '{}'", new Object[] { label1, label2, version2 }); } } else { if (version2 == null) { warning(null, "Unknown version", " for {}, version for {} is '{}'", new Object[] { label2, label1, // depends on control dependency: [if], data = [none] version1 }); } else if (!version1.equals(version2)) { warning(null, "Mismatched versions", ": {} is '{}', while {} is '{}'", new Object[] { label1, version1, // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] label2, version2 }); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private int findElementOrEmpty(int element) { assert element >= 0; int index = toIndex(IntHashCode.hashCode(element)); int offset = 1; while (cells[index] != EMPTY) { // element found! if (cells[index] == element) { return index; } // compute the next index to check index = toIndex(index + offset); offset <<= 1; offset++; if (offset < 0) { offset = 2; } } // element not found! return -(index + 1); } }
public class class_name { private int findElementOrEmpty(int element) { assert element >= 0; int index = toIndex(IntHashCode.hashCode(element)); int offset = 1; while (cells[index] != EMPTY) { // element found! if (cells[index] == element) { return index; // depends on control dependency: [if], data = [none] } // compute the next index to check index = toIndex(index + offset); // depends on control dependency: [while], data = [none] offset <<= 1; // depends on control dependency: [while], data = [none] offset++; // depends on control dependency: [while], data = [none] if (offset < 0) { offset = 2; // depends on control dependency: [if], data = [none] } } // element not found! return -(index + 1); } }
public class class_name { public SIBusMessage next() throws SISessionUnavailableException, SISessionDroppedException, SIResourceException, SIConnectionLostException, SIErrorException { if (TraceComponent.isAnyTracingEnabled() && CoreSPIBrowserSession.tc.isEntryEnabled()) SibTr.entry(CoreSPIBrowserSession.tc, "next", this); JsMessage msg = null; synchronized(this) { //Check that the session is not closed, if it is throw an exception checkNotClosed(); //if the browse cursor is null - it was pub sub - this //session will never return any messages if (_browseCursor != null) { try { //Get the next item from the browseCursor and cast it //to a SIMPMessage msg = _browseCursor.next(); } catch (SISessionDroppedException e) { // MessageStoreException shouldn't occur so FFDC. FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.BrowserSessionImpl.next", "1:265:1.78.1.7", this); close(); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.impl.BrowserSessionImpl", "1:274:1.78.1.7", e }); if (TraceComponent.isAnyTracingEnabled() && CoreSPIBrowserSession.tc.isEntryEnabled()) SibTr.exit(CoreSPIBrowserSession.tc, "next", e); throw e; } catch (SIResourceException e) { // MessageStoreException shouldn't occur so FFDC. FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.BrowserSessionImpl.next", "1:287:1.78.1.7", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.impl.BrowserSessionImpl", "1:294:1.78.1.7", e }); if (TraceComponent.isAnyTracingEnabled() && CoreSPIBrowserSession.tc.isEntryEnabled()) SibTr.exit(CoreSPIBrowserSession.tc, "next", e); throw e; } }//end if }//end sync if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(CoreSPIBrowserSession.tc, "next", msg); return msg; } }
public class class_name { public SIBusMessage next() throws SISessionUnavailableException, SISessionDroppedException, SIResourceException, SIConnectionLostException, SIErrorException { if (TraceComponent.isAnyTracingEnabled() && CoreSPIBrowserSession.tc.isEntryEnabled()) SibTr.entry(CoreSPIBrowserSession.tc, "next", this); JsMessage msg = null; synchronized(this) { //Check that the session is not closed, if it is throw an exception checkNotClosed(); //if the browse cursor is null - it was pub sub - this //session will never return any messages if (_browseCursor != null) { try { //Get the next item from the browseCursor and cast it //to a SIMPMessage msg = _browseCursor.next(); // depends on control dependency: [try], data = [none] } catch (SISessionDroppedException e) { // MessageStoreException shouldn't occur so FFDC. FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.BrowserSessionImpl.next", "1:265:1.78.1.7", this); close(); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.impl.BrowserSessionImpl", "1:274:1.78.1.7", e }); if (TraceComponent.isAnyTracingEnabled() && CoreSPIBrowserSession.tc.isEntryEnabled()) SibTr.exit(CoreSPIBrowserSession.tc, "next", e); throw e; } // depends on control dependency: [catch], data = [none] catch (SIResourceException e) { // MessageStoreException shouldn't occur so FFDC. FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.BrowserSessionImpl.next", "1:287:1.78.1.7", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.impl.BrowserSessionImpl", "1:294:1.78.1.7", e }); if (TraceComponent.isAnyTracingEnabled() && CoreSPIBrowserSession.tc.isEntryEnabled()) SibTr.exit(CoreSPIBrowserSession.tc, "next", e); throw e; } // depends on control dependency: [catch], data = [none] }//end if }//end sync if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(CoreSPIBrowserSession.tc, "next", msg); return msg; } }
public class class_name { private void uninstall(EJBModuleMetaDataImpl mmd, boolean unbindNow) throws RuntimeWarning //d210058 {//d130898 final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "uninstall", mmd.getJ2EEName()); RuntimeWarning warning = null; EJBApplicationMetaData ejbAMD = mmd.getEJBApplicationMetaData(); String appName = mmd.ivAppName; //497716.5.1 NameSpaceBinder<?> binder = createNameSpaceBinder(mmd); // F69147.2 try { binder.beginUnbind(unbindNow); // F69147.2 try { deregisterMBeans(mmd); } catch (Throwable t) { // 210058 FFDCFilter.processException(t, CLASS_NAME + ".uninstall", "2623", this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Exception caught during uninstall (deregisterMBeans). Uninstall continues: ", t); if (warning == null) { warning = new RuntimeWarning(t); // 210058 set warning to last exception } } for (BeanMetaData bmd : mmd.ivBeanMetaDatas.values()) { J2EEName j2eeName = bmd.j2eeName; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "stopping bean " + j2eeName); try { stopBean(bmd); // F743-26072 if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Bean stopped; no exceptions thrown"); } } catch (Throwable e) { FFDCFilter.processException(e, CLASS_NAME + ".uninstall", "1039", this); Throwable nestedExc = getNestedException(e); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Exception:", e); if (warning == null) { warning = new RuntimeWarning(nestedExc); // 210058 set warning to last exception } } HomeRecord hr = bmd.homeRecord; if (hr.ivJavaGlobalBindings != null) { try { binder.unbindJavaGlobal(hr.ivJavaGlobalBindings); // F743-26137, F69147.2 } catch (NamingException ex) { FFDCFilter.processException(ex, CLASS_NAME + ".uninstall", "1006", this); if (warning == null) { warning = new RuntimeWarning(ex); } } } // Unbind from java:global. If the app is stopping anyway, // then don't bother since the namespace will be destroyed. if (hr.ivJavaAppBindings != null && !ejbAMD.isStopping()) { try { binder.unbindJavaApp(hr.ivJavaAppBindings); // F743-26137, F69147.2 } catch (NamingException ex) { FFDCFilter.processException(ex, CLASS_NAME + ".uninstall", "1066", this); if (warning == null) { warning = new RuntimeWarning(ex); } } } // No need to unbind from java:module since that namespace // will be destroyed. try { binder.unbindBindings(hr); // F69147.2 } catch (NamingException ex) { FFDCFilter.processException(ex, CLASS_NAME + ".uninstall", "2613", this); if (warning == null) { warning = new RuntimeWarning(ex); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Bean uninstall sequence ending for: ", j2eeName); } } // d465081 start // d510405 // Remove the module map from the application map in the full set of MessageDestinationLinks Map<String, Map<String, String>> appMap = InjectionEngineAccessor.getMessageDestinationLinkInstance().getMessageDestinationLinks().get(appName); //d49167 if (appMap != null) { //d475701 String moduleName = mmd.getJ2EEName().getModule(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Remove module from appMap of MessageDestinationLinks : " + mmd.getJ2EEName()); appMap.remove(moduleName); // d462512 if (appMap.size() == 0) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Remove appMap from MessageDestinationLinks : " + appName); InjectionEngineAccessor.getMessageDestinationLinkInstance().getMessageDestinationLinks().remove(appName); //d493167 } //d465081 end } // Unbind any EJBFactories that may have been bound during start. // There may be one per app, and one per module. d440604 try { binder.unbindEJBFactory(); // F69147.2 } catch (NamingException ex) { if (warning == null) { warning = new RuntimeWarning(ex); } } try { postInvokeStopModule(mmd); } catch (Throwable t) { // 210058 FFDCFilter.processException(t, CLASS_NAME + ".uninstall", "2730", this); Throwable t2 = getNestedException(t); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Exception caught during uninstall (moduleUninstalPostInvoke). Uninstall continues: ", t2); if (warning == null) { warning = new RuntimeWarning(t2); // 210058 set warning to last exception } } } catch (Throwable t) { FFDCFilter.processException(t, CLASS_NAME + ".uninstall", "1069", this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Exception:", t); warning = new RuntimeWarning(t); // 210058 set warning to last exception } finally { try { binder.end(); // F69147.2 } catch (NamingException ex) { if (warning == null) { warning = new RuntimeWarning(ex); } } } if (warning != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "uninstall: " + warning); throw warning; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "uninstall"); } }
public class class_name { private void uninstall(EJBModuleMetaDataImpl mmd, boolean unbindNow) throws RuntimeWarning //d210058 {//d130898 final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "uninstall", mmd.getJ2EEName()); RuntimeWarning warning = null; EJBApplicationMetaData ejbAMD = mmd.getEJBApplicationMetaData(); String appName = mmd.ivAppName; //497716.5.1 NameSpaceBinder<?> binder = createNameSpaceBinder(mmd); // F69147.2 try { binder.beginUnbind(unbindNow); // F69147.2 try { deregisterMBeans(mmd); // depends on control dependency: [try], data = [none] } catch (Throwable t) { // 210058 FFDCFilter.processException(t, CLASS_NAME + ".uninstall", "2623", this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Exception caught during uninstall (deregisterMBeans). Uninstall continues: ", t); if (warning == null) { warning = new RuntimeWarning(t); // 210058 set warning to last exception // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] for (BeanMetaData bmd : mmd.ivBeanMetaDatas.values()) { J2EEName j2eeName = bmd.j2eeName; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "stopping bean " + j2eeName); try { stopBean(bmd); // F743-26072 // depends on control dependency: [try], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Bean stopped; no exceptions thrown"); // depends on control dependency: [if], data = [none] } } catch (Throwable e) { FFDCFilter.processException(e, CLASS_NAME + ".uninstall", "1039", this); Throwable nestedExc = getNestedException(e); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Exception:", e); if (warning == null) { warning = new RuntimeWarning(nestedExc); // 210058 set warning to last exception // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] HomeRecord hr = bmd.homeRecord; if (hr.ivJavaGlobalBindings != null) { try { binder.unbindJavaGlobal(hr.ivJavaGlobalBindings); // F743-26137, F69147.2 // depends on control dependency: [try], data = [none] } catch (NamingException ex) { FFDCFilter.processException(ex, CLASS_NAME + ".uninstall", "1006", this); if (warning == null) { warning = new RuntimeWarning(ex); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } // Unbind from java:global. If the app is stopping anyway, // then don't bother since the namespace will be destroyed. if (hr.ivJavaAppBindings != null && !ejbAMD.isStopping()) { try { binder.unbindJavaApp(hr.ivJavaAppBindings); // F743-26137, F69147.2 // depends on control dependency: [try], data = [none] } catch (NamingException ex) { FFDCFilter.processException(ex, CLASS_NAME + ".uninstall", "1066", this); if (warning == null) { warning = new RuntimeWarning(ex); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } // No need to unbind from java:module since that namespace // will be destroyed. try { binder.unbindBindings(hr); // F69147.2 // depends on control dependency: [try], data = [none] } catch (NamingException ex) { FFDCFilter.processException(ex, CLASS_NAME + ".uninstall", "2613", this); if (warning == null) { warning = new RuntimeWarning(ex); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Bean uninstall sequence ending for: ", j2eeName); // depends on control dependency: [if], data = [none] } } // d465081 start // d510405 // Remove the module map from the application map in the full set of MessageDestinationLinks Map<String, Map<String, String>> appMap = InjectionEngineAccessor.getMessageDestinationLinkInstance().getMessageDestinationLinks().get(appName); //d49167 if (appMap != null) { //d475701 String moduleName = mmd.getJ2EEName().getModule(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Remove module from appMap of MessageDestinationLinks : " + mmd.getJ2EEName()); appMap.remove(moduleName); // d462512 // depends on control dependency: [if], data = [none] if (appMap.size() == 0) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Remove appMap from MessageDestinationLinks : " + appName); InjectionEngineAccessor.getMessageDestinationLinkInstance().getMessageDestinationLinks().remove(appName); //d493167 // depends on control dependency: [if], data = [none] } //d465081 end } // Unbind any EJBFactories that may have been bound during start. // There may be one per app, and one per module. d440604 try { binder.unbindEJBFactory(); // F69147.2 // depends on control dependency: [try], data = [none] } catch (NamingException ex) { if (warning == null) { warning = new RuntimeWarning(ex); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] try { postInvokeStopModule(mmd); // depends on control dependency: [try], data = [none] } catch (Throwable t) { // 210058 FFDCFilter.processException(t, CLASS_NAME + ".uninstall", "2730", this); Throwable t2 = getNestedException(t); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Exception caught during uninstall (moduleUninstalPostInvoke). Uninstall continues: ", t2); if (warning == null) { warning = new RuntimeWarning(t2); // 210058 set warning to last exception // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } catch (Throwable t) { FFDCFilter.processException(t, CLASS_NAME + ".uninstall", "1069", this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Exception:", t); warning = new RuntimeWarning(t); // 210058 set warning to last exception } finally { try { binder.end(); // F69147.2 // depends on control dependency: [try], data = [none] } catch (NamingException ex) { if (warning == null) { warning = new RuntimeWarning(ex); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } if (warning != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "uninstall: " + warning); throw warning; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "uninstall"); } }
public class class_name { final void close(boolean allMenusAreClosing) { if (mIsClosing) return; mIsClosing = true; for (WeakReference<MenuPresenter> ref : mPresenters) { final MenuPresenter presenter = ref.get(); if (presenter == null) { mPresenters.remove(ref); } else { presenter.onCloseMenu(this, allMenusAreClosing); } } mIsClosing = false; } }
public class class_name { final void close(boolean allMenusAreClosing) { if (mIsClosing) return; mIsClosing = true; for (WeakReference<MenuPresenter> ref : mPresenters) { final MenuPresenter presenter = ref.get(); if (presenter == null) { mPresenters.remove(ref); // depends on control dependency: [if], data = [none] } else { presenter.onCloseMenu(this, allMenusAreClosing); // depends on control dependency: [if], data = [none] } } mIsClosing = false; } }
public class class_name { @Nonnull public static InputStreamAndCharset getInputStreamAndCharsetFromBOM (@Nonnull @WillNotClose final InputStream aIS) { ValueEnforcer.notNull (aIS, "InputStream"); // Check for BOM final int nMaxBOMBytes = EUnicodeBOM.getMaximumByteCount (); @WillNotClose final NonBlockingPushbackInputStream aPIS = new NonBlockingPushbackInputStream (StreamHelper.getBuffered (aIS), nMaxBOMBytes); try { // Try to read as many bytes as necessary to determine all supported BOMs final byte [] aBOM = new byte [nMaxBOMBytes]; final int nReadBOMBytes = aPIS.read (aBOM); EUnicodeBOM eBOM = null; Charset aDeterminedCharset = null; if (nReadBOMBytes > 0) { // Some byte BOMs were read - determine eBOM = EUnicodeBOM.getFromBytesOrNull (ArrayHelper.getCopy (aBOM, 0, nReadBOMBytes)); if (eBOM == null) { // Unread the whole BOM aPIS.unread (aBOM, 0, nReadBOMBytes); // aDeterminedCharset stays null } else { if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Found " + eBOM + " on " + aIS.getClass ().getName ()); // Unread the unnecessary parts of the BOM final int nBOMBytes = eBOM.getByteCount (); if (nBOMBytes < nReadBOMBytes) aPIS.unread (aBOM, nBOMBytes, nReadBOMBytes - nBOMBytes); // Use the Charset of the BOM - maybe null! aDeterminedCharset = eBOM.getCharset (); } } return new InputStreamAndCharset (aPIS, eBOM, aDeterminedCharset); } catch (final IOException ex) { LOGGER.error ("Failed to determine BOM", ex); StreamHelper.close (aPIS); throw new UncheckedIOException (ex); } } }
public class class_name { @Nonnull public static InputStreamAndCharset getInputStreamAndCharsetFromBOM (@Nonnull @WillNotClose final InputStream aIS) { ValueEnforcer.notNull (aIS, "InputStream"); // Check for BOM final int nMaxBOMBytes = EUnicodeBOM.getMaximumByteCount (); @WillNotClose final NonBlockingPushbackInputStream aPIS = new NonBlockingPushbackInputStream (StreamHelper.getBuffered (aIS), nMaxBOMBytes); try { // Try to read as many bytes as necessary to determine all supported BOMs final byte [] aBOM = new byte [nMaxBOMBytes]; final int nReadBOMBytes = aPIS.read (aBOM); EUnicodeBOM eBOM = null; Charset aDeterminedCharset = null; if (nReadBOMBytes > 0) { // Some byte BOMs were read - determine eBOM = EUnicodeBOM.getFromBytesOrNull (ArrayHelper.getCopy (aBOM, 0, nReadBOMBytes)); // depends on control dependency: [if], data = [none] if (eBOM == null) { // Unread the whole BOM aPIS.unread (aBOM, 0, nReadBOMBytes); // depends on control dependency: [if], data = [none] // aDeterminedCharset stays null } else { if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Found " + eBOM + " on " + aIS.getClass ().getName ()); // Unread the unnecessary parts of the BOM final int nBOMBytes = eBOM.getByteCount (); if (nBOMBytes < nReadBOMBytes) aPIS.unread (aBOM, nBOMBytes, nReadBOMBytes - nBOMBytes); // Use the Charset of the BOM - maybe null! aDeterminedCharset = eBOM.getCharset (); // depends on control dependency: [if], data = [none] } } return new InputStreamAndCharset (aPIS, eBOM, aDeterminedCharset); // depends on control dependency: [try], data = [none] } catch (final IOException ex) { LOGGER.error ("Failed to determine BOM", ex); StreamHelper.close (aPIS); throw new UncheckedIOException (ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static void inlineImgNodes(final Document doc, final String basePath) { // handle null inputs if (doc == null) return; final String fixedBasePath = basePath == null ? "" : basePath; final List<Node> imageNodes = XMLUtilities.getChildNodes(doc.getDocumentElement(), "img"); for (final Node node : imageNodes) { final NamedNodeMap attributes = node.getAttributes(); final Node srcAttribute = attributes.getNamedItem("src"); if (srcAttribute != null) { final String src = srcAttribute.getTextContent(); final File srcFile = new File(fixedBasePath + "/" + src); if (srcFile.exists()) { final byte[] srcFileByteArray = FileUtilities.readFileContentsAsByteArray(srcFile); if (srcFileByteArray != null) { // get the file extension of the original image final int extensionStringLocation = src.lastIndexOf("."); // make sure we have an extension if (extensionStringLocation != -1 && extensionStringLocation != src.length() - 1) { final String extension = src.substring(extensionStringLocation + 1); // encode the image final byte[] srcFileEncodedByteArray = Base64.encodeBase64(srcFileByteArray); final String srcFileEncodedString = new String(srcFileEncodedByteArray); final Node parent = node.getParentNode(); if (parent != null) { final Element newImgNode = doc.createElement("img"); newImgNode.setAttribute("src", "data:image/" + extension + ";base64," + srcFileEncodedString); parent.replaceChild(newImgNode, node); } } } } } } } }
public class class_name { private static void inlineImgNodes(final Document doc, final String basePath) { // handle null inputs if (doc == null) return; final String fixedBasePath = basePath == null ? "" : basePath; final List<Node> imageNodes = XMLUtilities.getChildNodes(doc.getDocumentElement(), "img"); for (final Node node : imageNodes) { final NamedNodeMap attributes = node.getAttributes(); final Node srcAttribute = attributes.getNamedItem("src"); if (srcAttribute != null) { final String src = srcAttribute.getTextContent(); final File srcFile = new File(fixedBasePath + "/" + src); if (srcFile.exists()) { final byte[] srcFileByteArray = FileUtilities.readFileContentsAsByteArray(srcFile); if (srcFileByteArray != null) { // get the file extension of the original image final int extensionStringLocation = src.lastIndexOf("."); // make sure we have an extension if (extensionStringLocation != -1 && extensionStringLocation != src.length() - 1) { final String extension = src.substring(extensionStringLocation + 1); // encode the image final byte[] srcFileEncodedByteArray = Base64.encodeBase64(srcFileByteArray); final String srcFileEncodedString = new String(srcFileEncodedByteArray); final Node parent = node.getParentNode(); if (parent != null) { final Element newImgNode = doc.createElement("img"); newImgNode.setAttribute("src", "data:image/" + extension + ";base64," + srcFileEncodedString); // depends on control dependency: [if], data = [none] parent.replaceChild(newImgNode, node); // depends on control dependency: [if], data = [none] } } } } } } } }
public class class_name { public static void log(@Nonnull Logger logger, @Nonnull LogLevel level, @Nonnull String format, @Nullable Object arg) { if (logger instanceof LocationAwareLogger) { log((LocationAwareLogger) logger, level, FQCN, null, format, new Object[]{arg}, null); } else if (trace.equals(level)) { logger.trace(format, arg); } else if (debug.equals(level)) { logger.debug(format, arg); } else if (info.equals(level)) { logger.info(format, arg); } else if (warning.equals(level)) { logger.warn(format, arg); } else if (error.equals(level) || fatal.equals(level)) { logger.error(format, arg); } else { log(logger, normalize(level), format, arg); } } }
public class class_name { public static void log(@Nonnull Logger logger, @Nonnull LogLevel level, @Nonnull String format, @Nullable Object arg) { if (logger instanceof LocationAwareLogger) { log((LocationAwareLogger) logger, level, FQCN, null, format, new Object[]{arg}, null); // depends on control dependency: [if], data = [none] } else if (trace.equals(level)) { logger.trace(format, arg); // depends on control dependency: [if], data = [none] } else if (debug.equals(level)) { logger.debug(format, arg); // depends on control dependency: [if], data = [none] } else if (info.equals(level)) { logger.info(format, arg); // depends on control dependency: [if], data = [none] } else if (warning.equals(level)) { logger.warn(format, arg); // depends on control dependency: [if], data = [none] } else if (error.equals(level) || fatal.equals(level)) { logger.error(format, arg); // depends on control dependency: [if], data = [none] } else { log(logger, normalize(level), format, arg); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(UpdateAccountRequest updateAccountRequest, ProtocolMarshaller protocolMarshaller) { if (updateAccountRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateAccountRequest.getAccountId(), ACCOUNTID_BINDING); protocolMarshaller.marshall(updateAccountRequest.getName(), NAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(UpdateAccountRequest updateAccountRequest, ProtocolMarshaller protocolMarshaller) { if (updateAccountRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateAccountRequest.getAccountId(), ACCOUNTID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateAccountRequest.getName(), NAME_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] } }