code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { protected String findCertInfo(X509Certificate[] x509certificates) throws NamingException { if (x509certificates != null && x509certificates.length != 0) { // Only ever use the first certificate, as this si the client supplied one. // Further ones are trust stores and CAs that have signed the first cert. Principal subject = x509certificates[0].getSubjectDN(); if (subject != null && subject.getName() != null) { List<Rdn> rdns; try { rdns = new LdapName(subject.getName()).getRdns(); } catch (InvalidNameException ine) { return null; } return certInfoExtractor.extractCertInfo(rdns); } } return null; } }
public class class_name { protected String findCertInfo(X509Certificate[] x509certificates) throws NamingException { if (x509certificates != null && x509certificates.length != 0) { // Only ever use the first certificate, as this si the client supplied one. // Further ones are trust stores and CAs that have signed the first cert. Principal subject = x509certificates[0].getSubjectDN(); if (subject != null && subject.getName() != null) { List<Rdn> rdns; try { rdns = new LdapName(subject.getName()).getRdns(); // depends on control dependency: [try], data = [none] } catch (InvalidNameException ine) { return null; } // depends on control dependency: [catch], data = [none] return certInfoExtractor.extractCertInfo(rdns); // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { private TypeName getExpressionReturnTypeForAttribute(Attribute attribute, Map<String, Class<?>> propertiesTypes) { String attributeName = attribute.getKey().toLowerCase(); if (attributeName.indexOf("@") == 0 || attributeName.indexOf("v-on:") == 0) { return TypeName.VOID; } if ("v-if".equals(attributeName) || "v-show".equals(attributeName)) { return TypeName.BOOLEAN; } if (isBoundedAttribute(attributeName)) { String unboundedAttributeName = boundedAttributeToAttributeName(attributeName); if (unboundedAttributeName.equals("class") || unboundedAttributeName.equals("style")) { return TypeName.get(Any.class); } if (propertiesTypes.containsKey(unboundedAttributeName)) { return TypeName.get(propertiesTypes.get(unboundedAttributeName)); } } if (currentProp != null) { return currentProp.getType(); } return TypeName.get(Any.class); } }
public class class_name { private TypeName getExpressionReturnTypeForAttribute(Attribute attribute, Map<String, Class<?>> propertiesTypes) { String attributeName = attribute.getKey().toLowerCase(); if (attributeName.indexOf("@") == 0 || attributeName.indexOf("v-on:") == 0) { return TypeName.VOID; } if ("v-if".equals(attributeName) || "v-show".equals(attributeName)) { return TypeName.BOOLEAN; } if (isBoundedAttribute(attributeName)) { String unboundedAttributeName = boundedAttributeToAttributeName(attributeName); if (unboundedAttributeName.equals("class") || unboundedAttributeName.equals("style")) { return TypeName.get(Any.class); // depends on control dependency: [if], data = [none] } if (propertiesTypes.containsKey(unboundedAttributeName)) { return TypeName.get(propertiesTypes.get(unboundedAttributeName)); // depends on control dependency: [if], data = [none] } } if (currentProp != null) { return currentProp.getType(); } return TypeName.get(Any.class); } }
public class class_name { public void marshall(ListTagsOfResourceRequest listTagsOfResourceRequest, ProtocolMarshaller protocolMarshaller) { if (listTagsOfResourceRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listTagsOfResourceRequest.getResourceArn(), RESOURCEARN_BINDING); protocolMarshaller.marshall(listTagsOfResourceRequest.getNextToken(), NEXTTOKEN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ListTagsOfResourceRequest listTagsOfResourceRequest, ProtocolMarshaller protocolMarshaller) { if (listTagsOfResourceRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listTagsOfResourceRequest.getResourceArn(), RESOURCEARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listTagsOfResourceRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private Object writeMapComplex(SerIterator itemIterator) { Map<String, Object> result = new LinkedHashMap<>(); while (itemIterator.hasNext()) { itemIterator.next(); Object key = itemIterator.key(); if (key == null) { throw new IllegalArgumentException("Unable to write map key as it cannot be null"); } String str = settings.getConverter().convertToString(itemIterator.key()); if (str == null) { throw new IllegalArgumentException("Unable to write map key as it cannot be a null string"); } result.put(str, writeObject(itemIterator.valueType(), itemIterator.value(), itemIterator)); } return result; } }
public class class_name { private Object writeMapComplex(SerIterator itemIterator) { Map<String, Object> result = new LinkedHashMap<>(); while (itemIterator.hasNext()) { itemIterator.next(); // depends on control dependency: [while], data = [none] Object key = itemIterator.key(); if (key == null) { throw new IllegalArgumentException("Unable to write map key as it cannot be null"); } String str = settings.getConverter().convertToString(itemIterator.key()); if (str == null) { throw new IllegalArgumentException("Unable to write map key as it cannot be a null string"); } result.put(str, writeObject(itemIterator.valueType(), itemIterator.value(), itemIterator)); // depends on control dependency: [while], data = [none] } return result; } }
public class class_name { private Double getDouble(String number) { try { return Double.parseDouble(number); } catch (NumberFormatException e) { return null; } } }
public class class_name { private Double getDouble(String number) { try { return Double.parseDouble(number); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void add(IWord word) { Item item = trie.get(word.getValue()); if (item == null) { item = new Item(word.getValue(), word.getLabel()); trie.put(item.key, item); } else { item.addLabel(word.getLabel()); } } }
public class class_name { public void add(IWord word) { Item item = trie.get(word.getValue()); if (item == null) { item = new Item(word.getValue(), word.getLabel()); // depends on control dependency: [if], data = [none] trie.put(item.key, item); // depends on control dependency: [if], data = [(item] } else { item.addLabel(word.getLabel()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public int currentElement() { int value = offset; // NB: dont have to check each index again for (int ii = 0; ii < rank; ii++) { // general rank if (shape[ii] < 0) break;//vlen value += current[ii] * stride[ii]; } return value; } }
public class class_name { public int currentElement() { int value = offset; // NB: dont have to check each index again for (int ii = 0; ii < rank; ii++) { // general rank if (shape[ii] < 0) break;//vlen value += current[ii] * stride[ii]; // depends on control dependency: [for], data = [ii] } return value; } }
public class class_name { public void marshall(Ac3Settings ac3Settings, ProtocolMarshaller protocolMarshaller) { if (ac3Settings == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(ac3Settings.getBitrate(), BITRATE_BINDING); protocolMarshaller.marshall(ac3Settings.getBitstreamMode(), BITSTREAMMODE_BINDING); protocolMarshaller.marshall(ac3Settings.getCodingMode(), CODINGMODE_BINDING); protocolMarshaller.marshall(ac3Settings.getDialnorm(), DIALNORM_BINDING); protocolMarshaller.marshall(ac3Settings.getDrcProfile(), DRCPROFILE_BINDING); protocolMarshaller.marshall(ac3Settings.getLfeFilter(), LFEFILTER_BINDING); protocolMarshaller.marshall(ac3Settings.getMetadataControl(), METADATACONTROL_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(Ac3Settings ac3Settings, ProtocolMarshaller protocolMarshaller) { if (ac3Settings == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(ac3Settings.getBitrate(), BITRATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(ac3Settings.getBitstreamMode(), BITSTREAMMODE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(ac3Settings.getCodingMode(), CODINGMODE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(ac3Settings.getDialnorm(), DIALNORM_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(ac3Settings.getDrcProfile(), DRCPROFILE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(ac3Settings.getLfeFilter(), LFEFILTER_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(ac3Settings.getMetadataControl(), METADATACONTROL_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static boolean isEmpty(File pFile) { if (pFile.isDirectory()) { return (pFile.list().length == 0); } return (pFile.length() == 0); } }
public class class_name { public static boolean isEmpty(File pFile) { if (pFile.isDirectory()) { return (pFile.list().length == 0); // depends on control dependency: [if], data = [none] } return (pFile.length() == 0); } }
public class class_name { public static byte[] hex2bin(final String s) { String m = s; if (s == null) { // Allow empty input string. m = ""; } else if (s.length() % 2 != 0) { // Assume leading zero for odd string length m = "0" + s; } byte r[] = new byte[m.length() / 2]; for (int i = 0, n = 0; i < m.length(); n++) { char h = m.charAt(i++); char l = m.charAt(i++); r[n] = (byte) (hex2bin(h) * 16 + hex2bin(l)); } return r; } }
public class class_name { public static byte[] hex2bin(final String s) { String m = s; if (s == null) { // Allow empty input string. m = ""; // depends on control dependency: [if], data = [none] } else if (s.length() % 2 != 0) { // Assume leading zero for odd string length m = "0" + s; // depends on control dependency: [if], data = [none] } byte r[] = new byte[m.length() / 2]; for (int i = 0, n = 0; i < m.length(); n++) { char h = m.charAt(i++); char l = m.charAt(i++); r[n] = (byte) (hex2bin(h) * 16 + hex2bin(l)); // depends on control dependency: [for], data = [none] } return r; } }
public class class_name { public void addExtension(String extension) { if (filters == null) { filters = new Hashtable<>(5); } filters.put(extension.toLowerCase(), this); fullDescription = null; } }
public class class_name { public void addExtension(String extension) { if (filters == null) { filters = new Hashtable<>(5); // depends on control dependency: [if], data = [none] } filters.put(extension.toLowerCase(), this); fullDescription = null; } }
public class class_name { private ManagedChannel createManagedChannel(ChannelKey channelKey) { NettyChannelBuilder channelBuilder = NettyChannelBuilder.forAddress(channelKey.mAddress); if (channelKey.mKeepAliveTime.isPresent()) { channelBuilder.keepAliveTime(channelKey.mKeepAliveTime.get().getFirst(), channelKey.mKeepAliveTime.get().getSecond()); } if (channelKey.mKeepAliveTimeout.isPresent()) { channelBuilder.keepAliveTimeout(channelKey.mKeepAliveTimeout.get().getFirst(), channelKey.mKeepAliveTimeout.get().getSecond()); } if (channelKey.mMaxInboundMessageSize.isPresent()) { channelBuilder.maxInboundMessageSize(channelKey.mMaxInboundMessageSize.get()); } if (channelKey.mFlowControlWindow.isPresent()) { channelBuilder.flowControlWindow(channelKey.mFlowControlWindow.get()); } if (channelKey.mChannelType.isPresent()) { channelBuilder.channelType(channelKey.mChannelType.get()); } if (channelKey.mEventLoopGroup.isPresent()) { channelBuilder.eventLoopGroup(channelKey.mEventLoopGroup.get()); } channelBuilder.usePlaintext(); return channelBuilder.build(); } }
public class class_name { private ManagedChannel createManagedChannel(ChannelKey channelKey) { NettyChannelBuilder channelBuilder = NettyChannelBuilder.forAddress(channelKey.mAddress); if (channelKey.mKeepAliveTime.isPresent()) { channelBuilder.keepAliveTime(channelKey.mKeepAliveTime.get().getFirst(), channelKey.mKeepAliveTime.get().getSecond()); // depends on control dependency: [if], data = [none] } if (channelKey.mKeepAliveTimeout.isPresent()) { channelBuilder.keepAliveTimeout(channelKey.mKeepAliveTimeout.get().getFirst(), channelKey.mKeepAliveTimeout.get().getSecond()); // depends on control dependency: [if], data = [none] } if (channelKey.mMaxInboundMessageSize.isPresent()) { channelBuilder.maxInboundMessageSize(channelKey.mMaxInboundMessageSize.get()); // depends on control dependency: [if], data = [none] } if (channelKey.mFlowControlWindow.isPresent()) { channelBuilder.flowControlWindow(channelKey.mFlowControlWindow.get()); // depends on control dependency: [if], data = [none] } if (channelKey.mChannelType.isPresent()) { channelBuilder.channelType(channelKey.mChannelType.get()); // depends on control dependency: [if], data = [none] } if (channelKey.mEventLoopGroup.isPresent()) { channelBuilder.eventLoopGroup(channelKey.mEventLoopGroup.get()); // depends on control dependency: [if], data = [none] } channelBuilder.usePlaintext(); return channelBuilder.build(); } }
public class class_name { public boolean distribute(@NonNull File reportFile) { ACRA.log.i(LOG_TAG, "Sending report " + reportFile); try { final CrashReportPersister persister = new CrashReportPersister(); final CrashReportData previousCrashReport = persister.load(reportFile); sendCrashReport(previousCrashReport); IOUtils.deleteFile(reportFile); return true; } catch (RuntimeException e) { ACRA.log.e(LOG_TAG, "Failed to send crash reports for " + reportFile, e); IOUtils.deleteFile(reportFile); } catch (IOException e) { ACRA.log.e(LOG_TAG, "Failed to load crash report for " + reportFile, e); IOUtils.deleteFile(reportFile); } catch (JSONException e) { ACRA.log.e(LOG_TAG, "Failed to load crash report for " + reportFile, e); IOUtils.deleteFile(reportFile); } catch (ReportSenderException e) { ACRA.log.e(LOG_TAG, "Failed to send crash report for " + reportFile, e); // An issue occurred while sending this report but we can still try to // send other reports. Report sending is limited by ACRAConstants.MAX_SEND_REPORTS // so there's not much to fear about overloading a failing server. } return false; } }
public class class_name { public boolean distribute(@NonNull File reportFile) { ACRA.log.i(LOG_TAG, "Sending report " + reportFile); try { final CrashReportPersister persister = new CrashReportPersister(); final CrashReportData previousCrashReport = persister.load(reportFile); sendCrashReport(previousCrashReport); // depends on control dependency: [try], data = [none] IOUtils.deleteFile(reportFile); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (RuntimeException e) { ACRA.log.e(LOG_TAG, "Failed to send crash reports for " + reportFile, e); IOUtils.deleteFile(reportFile); } catch (IOException e) { // depends on control dependency: [catch], data = [none] ACRA.log.e(LOG_TAG, "Failed to load crash report for " + reportFile, e); IOUtils.deleteFile(reportFile); } catch (JSONException e) { // depends on control dependency: [catch], data = [none] ACRA.log.e(LOG_TAG, "Failed to load crash report for " + reportFile, e); IOUtils.deleteFile(reportFile); } catch (ReportSenderException e) { // depends on control dependency: [catch], data = [none] ACRA.log.e(LOG_TAG, "Failed to send crash report for " + reportFile, e); // An issue occurred while sending this report but we can still try to // send other reports. Report sending is limited by ACRAConstants.MAX_SEND_REPORTS // so there's not much to fear about overloading a failing server. } // depends on control dependency: [catch], data = [none] return false; } }
public class class_name { public void processResponse(ResponseEvent response) { ClientTransaction trans = response.getClientTransaction(); if (trans == null) { return; } SipTransaction sip_trans = null; synchronized (respTransactions) { sip_trans = (SipTransaction) respTransactions.get(trans); } if (sip_trans == null) { return; } if (response.getResponse().getStatusCode() > 199) { synchronized (respTransactions) { respTransactions.remove(trans); } } // check for listener handling MessageListener listener = sip_trans.getClientListener(); if (listener != null) { listener.processEvent(response); return; } // if no listener, use the default blocking mechanism synchronized (sip_trans.getBlock()) { sip_trans.getEvents().addLast(response); sip_trans.getBlock().notifyEvent(); } } }
public class class_name { public void processResponse(ResponseEvent response) { ClientTransaction trans = response.getClientTransaction(); if (trans == null) { return; // depends on control dependency: [if], data = [none] } SipTransaction sip_trans = null; synchronized (respTransactions) { sip_trans = (SipTransaction) respTransactions.get(trans); } if (sip_trans == null) { return; // depends on control dependency: [if], data = [none] } if (response.getResponse().getStatusCode() > 199) { synchronized (respTransactions) { // depends on control dependency: [if], data = [none] respTransactions.remove(trans); } } // check for listener handling MessageListener listener = sip_trans.getClientListener(); if (listener != null) { listener.processEvent(response); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // if no listener, use the default blocking mechanism synchronized (sip_trans.getBlock()) { sip_trans.getEvents().addLast(response); sip_trans.getBlock().notifyEvent(); } } }
public class class_name { void rot(int n, int[] xy, int rx, int ry) { if (ry == 0) { if (rx == 1) { xy[0] = n - 1 - xy[0]; xy[1] = n - 1 - xy[1]; } int t = xy[0]; xy[0] = xy[1]; xy[1] = t; } } }
public class class_name { void rot(int n, int[] xy, int rx, int ry) { if (ry == 0) { if (rx == 1) { xy[0] = n - 1 - xy[0]; // depends on control dependency: [if], data = [none] xy[1] = n - 1 - xy[1]; // depends on control dependency: [if], data = [none] } int t = xy[0]; xy[0] = xy[1]; // depends on control dependency: [if], data = [none] xy[1] = t; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void advance() { try { // loop until we find a word in the reader, or there are no more // words while (true) { // if we haven't looked at any lines yet, or if the index into // the current line is already at the end if (curLine == null || !matcher.find()) { String line = br.readLine(); // if there aren't any more lines in the reader, then mark // next as null to indicate that there are no more words if (line == null) { next = null; br.close(); return; } // create a new matcher to find all the tokens in this line matcher = notWhiteSpace.matcher(line); curLine = line; // skip lines with no matches if (!matcher.find()) continue; } next = curLine.substring(matcher.start(), matcher.end()); break; } } catch (IOException ioe) { throw new IOError(ioe); } } }
public class class_name { private void advance() { try { // loop until we find a word in the reader, or there are no more // words while (true) { // if we haven't looked at any lines yet, or if the index into // the current line is already at the end if (curLine == null || !matcher.find()) { String line = br.readLine(); // if there aren't any more lines in the reader, then mark // next as null to indicate that there are no more words if (line == null) { next = null; // depends on control dependency: [if], data = [none] br.close(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // create a new matcher to find all the tokens in this line matcher = notWhiteSpace.matcher(line); // depends on control dependency: [if], data = [none] curLine = line; // depends on control dependency: [if], data = [none] // skip lines with no matches if (!matcher.find()) continue; } next = curLine.substring(matcher.start(), matcher.end()); // depends on control dependency: [while], data = [none] break; } } catch (IOException ioe) { throw new IOError(ioe); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public TraceStep getLastStep() { TraceStep result = this; while (true) { if (result.children == null || result.children.size() == 0) return result; result = result.children.get(result.children.size() - 1); } } }
public class class_name { public TraceStep getLastStep() { TraceStep result = this; while (true) { if (result.children == null || result.children.size() == 0) return result; result = result.children.get(result.children.size() - 1); // depends on control dependency: [while], data = [none] } } }
public class class_name { public static List<String[]> convertSentenceToNER(Sentence sentence, NERTagSet tagSet) { List<String[]> collector = new LinkedList<String[]>(); Set<String> nerLabels = tagSet.nerLabels; for (IWord word : sentence.wordList) { if (word instanceof CompoundWord) { List<Word> wordList = ((CompoundWord) word).innerList; Word[] words = wordList.toArray(new Word[0]); if (nerLabels.contains(word.getLabel())) { collector.add(new String[]{words[0].value, words[0].label, tagSet.B_TAG_PREFIX + word.getLabel()}); for (int i = 1; i < words.length - 1; i++) { collector.add(new String[]{words[i].value, words[i].label, tagSet.M_TAG_PREFIX + word.getLabel()}); } collector.add(new String[]{words[words.length - 1].value, words[words.length - 1].label, tagSet.E_TAG_PREFIX + word.getLabel()}); } else { for (Word w : words) { collector.add(new String[]{w.value, w.label, tagSet.O_TAG}); } } } else { if (nerLabels.contains(word.getLabel())) { // 单个实体 collector.add(new String[]{word.getValue(), word.getLabel(), tagSet.S_TAG}); } else { collector.add(new String[]{word.getValue(), word.getLabel(), tagSet.O_TAG}); } } } return collector; } }
public class class_name { public static List<String[]> convertSentenceToNER(Sentence sentence, NERTagSet tagSet) { List<String[]> collector = new LinkedList<String[]>(); Set<String> nerLabels = tagSet.nerLabels; for (IWord word : sentence.wordList) { if (word instanceof CompoundWord) { List<Word> wordList = ((CompoundWord) word).innerList; Word[] words = wordList.toArray(new Word[0]); if (nerLabels.contains(word.getLabel())) { collector.add(new String[]{words[0].value, words[0].label, tagSet.B_TAG_PREFIX + word.getLabel()}); // depends on control dependency: [if], data = [none] for (int i = 1; i < words.length - 1; i++) { collector.add(new String[]{words[i].value, words[i].label, tagSet.M_TAG_PREFIX + word.getLabel()}); // depends on control dependency: [for], data = [i] } collector.add(new String[]{words[words.length - 1].value, words[words.length - 1].label, tagSet.E_TAG_PREFIX + word.getLabel()}); // depends on control dependency: [if], data = [none] } else { for (Word w : words) { collector.add(new String[]{w.value, w.label, tagSet.O_TAG}); // depends on control dependency: [for], data = [w] } } } else { if (nerLabels.contains(word.getLabel())) { // 单个实体 collector.add(new String[]{word.getValue(), word.getLabel(), tagSet.S_TAG}); // depends on control dependency: [if], data = [none] } else { collector.add(new String[]{word.getValue(), word.getLabel(), tagSet.O_TAG}); // depends on control dependency: [if], data = [none] } } } return collector; } }
public class class_name { public DetectEntitiesResult withUnmappedAttributes(UnmappedAttribute... unmappedAttributes) { if (this.unmappedAttributes == null) { setUnmappedAttributes(new java.util.ArrayList<UnmappedAttribute>(unmappedAttributes.length)); } for (UnmappedAttribute ele : unmappedAttributes) { this.unmappedAttributes.add(ele); } return this; } }
public class class_name { public DetectEntitiesResult withUnmappedAttributes(UnmappedAttribute... unmappedAttributes) { if (this.unmappedAttributes == null) { setUnmappedAttributes(new java.util.ArrayList<UnmappedAttribute>(unmappedAttributes.length)); // depends on control dependency: [if], data = [none] } for (UnmappedAttribute ele : unmappedAttributes) { this.unmappedAttributes.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private boolean getGoodNode( HashMap<String, HashSet<Node>> candidateNodesByRacks, boolean considerLoad, long blockSize, List<DatanodeDescriptor> results) { List<Map.Entry<String, HashSet<Node>>> sorted = new ArrayList<Map.Entry<String, HashSet<Node>>>(); for (Map.Entry<String, HashSet<Node>> entry : candidateNodesByRacks.entrySet()) { sorted.add(entry); } Collections.sort(sorted, new RackComparator(blockSize)); int count = sorted.size() / 4; Collections.shuffle(sorted.subList(0, count)); for (Map.Entry<String, HashSet<Node>> e : sorted) { if (getGoodNode(e.getValue(), considerLoad, blockSize, results)) { return true; } } return false; } }
public class class_name { private boolean getGoodNode( HashMap<String, HashSet<Node>> candidateNodesByRacks, boolean considerLoad, long blockSize, List<DatanodeDescriptor> results) { List<Map.Entry<String, HashSet<Node>>> sorted = new ArrayList<Map.Entry<String, HashSet<Node>>>(); for (Map.Entry<String, HashSet<Node>> entry : candidateNodesByRacks.entrySet()) { sorted.add(entry); // depends on control dependency: [for], data = [entry] } Collections.sort(sorted, new RackComparator(blockSize)); int count = sorted.size() / 4; Collections.shuffle(sorted.subList(0, count)); for (Map.Entry<String, HashSet<Node>> e : sorted) { if (getGoodNode(e.getValue(), considerLoad, blockSize, results)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public ResponseBuilder withReprompt(String text, com.amazon.ask.model.ui.PlayBehavior playBehavior) { this.reprompt = Reprompt.builder() .withOutputSpeech(SsmlOutputSpeech.builder() .withSsml("<speak>" + trimOutputSpeech(text) + "</speak>") .withPlayBehavior(playBehavior) .build()) .build(); if (!this.isVideoAppLaunchDirectivePresent()) { this.shouldEndSession = false; } return this; } }
public class class_name { public ResponseBuilder withReprompt(String text, com.amazon.ask.model.ui.PlayBehavior playBehavior) { this.reprompt = Reprompt.builder() .withOutputSpeech(SsmlOutputSpeech.builder() .withSsml("<speak>" + trimOutputSpeech(text) + "</speak>") .withPlayBehavior(playBehavior) .build()) .build(); if (!this.isVideoAppLaunchDirectivePresent()) { this.shouldEndSession = false; // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { public Parse adjoin(final Parse sister, final HeadRules rules) { final Parse lastChild = this.parts.get(this.parts.size() - 1); final Parse adjNode = new Parse(this.text, new Span(lastChild.getSpan().getStart(), sister.getSpan().getEnd()), lastChild.getType(), 1, rules.getHead(new Parse[] { lastChild, sister }, lastChild.getType())); adjNode.parts.add(lastChild); if (sister.prevPunctSet != null) { adjNode.parts.addAll(sister.prevPunctSet); } adjNode.parts.add(sister); this.parts.set(this.parts.size() - 1, adjNode); this.span = new Span(this.span.getStart(), sister.getSpan().getEnd()); this.head = rules.getHead(getChildren(), this.type); this.headIndex = this.head.headIndex; return adjNode; } }
public class class_name { public Parse adjoin(final Parse sister, final HeadRules rules) { final Parse lastChild = this.parts.get(this.parts.size() - 1); final Parse adjNode = new Parse(this.text, new Span(lastChild.getSpan().getStart(), sister.getSpan().getEnd()), lastChild.getType(), 1, rules.getHead(new Parse[] { lastChild, sister }, lastChild.getType())); adjNode.parts.add(lastChild); if (sister.prevPunctSet != null) { adjNode.parts.addAll(sister.prevPunctSet); // depends on control dependency: [if], data = [(sister.prevPunctSet] } adjNode.parts.add(sister); this.parts.set(this.parts.size() - 1, adjNode); this.span = new Span(this.span.getStart(), sister.getSpan().getEnd()); this.head = rules.getHead(getChildren(), this.type); this.headIndex = this.head.headIndex; return adjNode; } }
public class class_name { private void parseViewRows(boolean last) { while (true) { int openBracketPos = responseContent.bytesBefore((byte) '{'); int errorBlockPosition = findErrorBlockPosition(openBracketPos); if (errorBlockPosition > 0 && errorBlockPosition < openBracketPos) { responseContent.readerIndex(errorBlockPosition + responseContent.readerIndex()); viewRowObservable.onCompleted(); viewParsingState = QUERY_STATE_ERROR; return; } int closeBracketPos = findSectionClosingPosition(responseContent, '{', '}'); if (closeBracketPos == -1) { break; } int from = responseContent.readerIndex() + openBracketPos; int to = closeBracketPos - openBracketPos - responseContent.readerIndex() + 1; viewRowObservable.onNext(responseContent.slice(from, to).copy()); responseContent.readerIndex(closeBracketPos); responseContent.discardReadBytes(); } if (last) { viewRowObservable.onCompleted(); viewErrorObservable.onCompleted(); viewParsingState = QUERY_STATE_DONE; } } }
public class class_name { private void parseViewRows(boolean last) { while (true) { int openBracketPos = responseContent.bytesBefore((byte) '{'); int errorBlockPosition = findErrorBlockPosition(openBracketPos); if (errorBlockPosition > 0 && errorBlockPosition < openBracketPos) { responseContent.readerIndex(errorBlockPosition + responseContent.readerIndex()); // depends on control dependency: [if], data = [(errorBlockPosition] viewRowObservable.onCompleted(); // depends on control dependency: [if], data = [none] viewParsingState = QUERY_STATE_ERROR; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } int closeBracketPos = findSectionClosingPosition(responseContent, '{', '}'); if (closeBracketPos == -1) { break; } int from = responseContent.readerIndex() + openBracketPos; int to = closeBracketPos - openBracketPos - responseContent.readerIndex() + 1; viewRowObservable.onNext(responseContent.slice(from, to).copy()); // depends on control dependency: [while], data = [none] responseContent.readerIndex(closeBracketPos); // depends on control dependency: [while], data = [none] responseContent.discardReadBytes(); // depends on control dependency: [while], data = [none] } if (last) { viewRowObservable.onCompleted(); // depends on control dependency: [if], data = [none] viewErrorObservable.onCompleted(); // depends on control dependency: [if], data = [none] viewParsingState = QUERY_STATE_DONE; // depends on control dependency: [if], data = [none] } } }
public class class_name { protected RefProperty registerErrorModel(Swagger swagger) { String ref = Error.class.getSimpleName(); if (swagger.getDefinitions() != null && swagger.getDefinitions().containsKey(ref)) { // model already registered return new RefProperty(ref); } ModelImpl model = new ModelImpl(); swagger.addDefinition(ref, model); model.setDescription("an error message"); model.addProperty("statusCode", new IntegerProperty().readOnly().description("http status code")); model.addProperty("statusMessage", new StringProperty().readOnly().description("description of the http status code")); model.addProperty("requestMethod", new StringProperty().readOnly().description("http request method")); model.addProperty("requestUri", new StringProperty().readOnly().description("http request path")); model.addProperty("message", new StringProperty().readOnly().description("application message")); if (settings.isDev()) { // in DEV mode the stacktrace is returned in the error message model.addProperty("stacktrace", new StringProperty().readOnly().description("application stacktrace")); } return new RefProperty(ref); } }
public class class_name { protected RefProperty registerErrorModel(Swagger swagger) { String ref = Error.class.getSimpleName(); if (swagger.getDefinitions() != null && swagger.getDefinitions().containsKey(ref)) { // model already registered return new RefProperty(ref); // depends on control dependency: [if], data = [none] } ModelImpl model = new ModelImpl(); swagger.addDefinition(ref, model); model.setDescription("an error message"); model.addProperty("statusCode", new IntegerProperty().readOnly().description("http status code")); model.addProperty("statusMessage", new StringProperty().readOnly().description("description of the http status code")); model.addProperty("requestMethod", new StringProperty().readOnly().description("http request method")); model.addProperty("requestUri", new StringProperty().readOnly().description("http request path")); model.addProperty("message", new StringProperty().readOnly().description("application message")); if (settings.isDev()) { // in DEV mode the stacktrace is returned in the error message model.addProperty("stacktrace", new StringProperty().readOnly().description("application stacktrace")); // depends on control dependency: [if], data = [none] } return new RefProperty(ref); } }
public class class_name { public boolean isOlderThan(Value other) { if (other == null) { return true; } return this.timestamp.isOlderThan(other.timestamp); } }
public class class_name { public boolean isOlderThan(Value other) { if (other == null) { return true; // depends on control dependency: [if], data = [none] } return this.timestamp.isOlderThan(other.timestamp); } }
public class class_name { public static TypedProperties load(String file, FileLocation location) { // If file is null. if (file == null) { // file must be specified. throw new IllegalArgumentException("file is null."); } // If location is null. if (location == null) { // location must be specified. throw new IllegalArgumentException("location is null."); } InputStream in = null; try { // Open the file. in = open(file, location); if (in == null) { // Failed to open the file. return null; } // Build Properties from the input stream. Properties properties = load(in); // Wrap the properties. return new PropertiesWrapper(properties); } catch (IOException e) { // Failed to open the file, or Properties.load() failed. return null; } finally { // Close the input stream silently. close(in); } } }
public class class_name { public static TypedProperties load(String file, FileLocation location) { // If file is null. if (file == null) { // file must be specified. throw new IllegalArgumentException("file is null."); } // If location is null. if (location == null) { // location must be specified. throw new IllegalArgumentException("location is null."); } InputStream in = null; try { // Open the file. in = open(file, location); // depends on control dependency: [try], data = [none] if (in == null) { // Failed to open the file. return null; // depends on control dependency: [if], data = [none] } // Build Properties from the input stream. Properties properties = load(in); // Wrap the properties. return new PropertiesWrapper(properties); // depends on control dependency: [try], data = [none] } catch (IOException e) { // Failed to open the file, or Properties.load() failed. return null; } // depends on control dependency: [catch], data = [none] finally { // Close the input stream silently. close(in); } } }
public class class_name { public void setErrors(java.util.Collection<RenderingError> errors) { if (errors == null) { this.errors = null; return; } this.errors = new java.util.ArrayList<RenderingError>(errors); } }
public class class_name { public void setErrors(java.util.Collection<RenderingError> errors) { if (errors == null) { this.errors = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.errors = new java.util.ArrayList<RenderingError>(errors); } }
public class class_name { @Override protected UIContext getUIContext() { HttpSession session = getBackingRequest().getSession(false); if (session == null) { return null; } UIContext uic = (UIContext) session.getAttribute(getUiContextSessionKey()); return uic; } }
public class class_name { @Override protected UIContext getUIContext() { HttpSession session = getBackingRequest().getSession(false); if (session == null) { return null; // depends on control dependency: [if], data = [none] } UIContext uic = (UIContext) session.getAttribute(getUiContextSessionKey()); return uic; } }
public class class_name { public void warning(String msg) { if (Level.WARNING.intValue() < levelValue) { return; } log(Level.WARNING, msg); } }
public class class_name { public void warning(String msg) { if (Level.WARNING.intValue() < levelValue) { return; // depends on control dependency: [if], data = [none] } log(Level.WARNING, msg); } }
public class class_name { public static int getIpAsInt(final String ipAddress) { int ipIntValue = 0; String[] tokens = StringUtil.splitc(ipAddress, '.'); for (String token : tokens) { if (ipIntValue > 0) { ipIntValue <<= 8; } ipIntValue += Integer.parseInt(token); } return ipIntValue; } }
public class class_name { public static int getIpAsInt(final String ipAddress) { int ipIntValue = 0; String[] tokens = StringUtil.splitc(ipAddress, '.'); for (String token : tokens) { if (ipIntValue > 0) { ipIntValue <<= 8; // depends on control dependency: [if], data = [none] } ipIntValue += Integer.parseInt(token); // depends on control dependency: [for], data = [token] } return ipIntValue; } }
public class class_name { private Map<String, Map<String, List<String>>> transformHighlighting() { Map<String, Map<String, List<String>>> result = new HashMap<String, Map<String, List<String>>>(); if (m_queryResponse.getHighlighting() != null) { for (String key : m_queryResponse.getHighlighting().keySet()) { Map<String, ?> value = m_queryResponse.getHighlighting().get(key); Map<String, List<String>> innerResult = new HashMap<String, List<String>>(); for (String innerKey : value.keySet()) { Object entry = value.get(innerKey); List<String> innerList = new ArrayList<String>(); if (entry instanceof String) { innerResult.put(innerKey, Collections.singletonList((String)entry)); } else if (entry instanceof String[]) { String[] li = (String[])entry; for (Object lo : li) { String s = (String)lo; innerList.add(s); } innerResult.put(innerKey, innerList); } else if (entry instanceof List<?>) { List<?> li = (List<?>)entry; for (Object lo : li) { String s = (String)lo; innerList.add(s); } innerResult.put(innerKey, innerList); } } result.put(key, innerResult); } } return result; } }
public class class_name { private Map<String, Map<String, List<String>>> transformHighlighting() { Map<String, Map<String, List<String>>> result = new HashMap<String, Map<String, List<String>>>(); if (m_queryResponse.getHighlighting() != null) { for (String key : m_queryResponse.getHighlighting().keySet()) { Map<String, ?> value = m_queryResponse.getHighlighting().get(key); Map<String, List<String>> innerResult = new HashMap<String, List<String>>(); for (String innerKey : value.keySet()) { Object entry = value.get(innerKey); List<String> innerList = new ArrayList<String>(); if (entry instanceof String) { innerResult.put(innerKey, Collections.singletonList((String)entry)); // depends on control dependency: [if], data = [none] } else if (entry instanceof String[]) { String[] li = (String[])entry; for (Object lo : li) { String s = (String)lo; innerList.add(s); // depends on control dependency: [for], data = [none] } innerResult.put(innerKey, innerList); // depends on control dependency: [if], data = [none] } else if (entry instanceof List<?>) { List<?> li = (List<?>)entry; for (Object lo : li) { String s = (String)lo; innerList.add(s); // depends on control dependency: [for], data = [none] } innerResult.put(innerKey, innerList); // depends on control dependency: [if], data = [)] } } result.put(key, innerResult); // depends on control dependency: [for], data = [key] } } return result; } }
public class class_name { public boolean offer(E o) { /*log.fine("public boolean offer(E o): called");*/ /*log.fine("o = " + o);*/ // Ensure that the item to add is not null. if (o == null) { throw new IllegalArgumentException("The 'o' parameter may not be null."); } // Derive the integer priority of the element using the priority function, shift it into this queues range if // necessary and adjust it to any offset caused by lowest priority not equal to zero. int level = priorityToLevel(p.apply(o)); /*log.fine("offer level = " + level);*/ // Create a new node to hold the new data element. Node<E> newNode = new DataNode<E>(o, markers[level + 1]); // Add the element to the tail of the queue with matching level, looping until this can complete as an atomic // operation. while (true) { // Get tail and next ref. Would expect next ref to be null, but other thread may update it. Node<E> t = markers[level + 1].getTail(); Node<E> s = t.getNext(); /*log.fine("t = " + t);*/ /*log.fine("s = " + s);*/ // Recheck the tail ref, to ensure other thread has not already moved it. This can potentially prevent // a relatively expensive compare and set from failing later on, if another thread has already shited // the tail. if (t == markers[level + 1].getTail()) { /*log.fine("t is still the tail.");*/ // Check that the next element reference on the tail is the tail marker, to confirm that another thread // has not updated it. Again, this may prevent a cas from failing later. if (s == markers[level + 1]) { /*log.fine("s is the tail marker.");*/ // Try to join the new tail onto the old one. if (t.casNext(s, newNode)) { // The tail join was succesfull, so now update the queues tail reference. No conflict should // occurr here as the tail join was succesfull, so its just a question of updating the tail // reference. A compare and set is still used because ... markers[level + 1].casTail(t, newNode); // Increment the queue size count. count.incrementAndGet(); return true; } } // Update the tail reference, other thread may also be doing the same. else { // Why bother doing this at all? I suppose, because another thread may be stalled and doing this // will enable this one to keep running. // Update the tail reference for the queue because another thread has already added a new tail // but not yet managed to update the tail reference. markers[level + 1].casTail(t, s); } } } } }
public class class_name { public boolean offer(E o) { /*log.fine("public boolean offer(E o): called");*/ /*log.fine("o = " + o);*/ // Ensure that the item to add is not null. if (o == null) { throw new IllegalArgumentException("The 'o' parameter may not be null."); } // Derive the integer priority of the element using the priority function, shift it into this queues range if // necessary and adjust it to any offset caused by lowest priority not equal to zero. int level = priorityToLevel(p.apply(o)); /*log.fine("offer level = " + level);*/ // Create a new node to hold the new data element. Node<E> newNode = new DataNode<E>(o, markers[level + 1]); // Add the element to the tail of the queue with matching level, looping until this can complete as an atomic // operation. while (true) { // Get tail and next ref. Would expect next ref to be null, but other thread may update it. Node<E> t = markers[level + 1].getTail(); Node<E> s = t.getNext(); /*log.fine("t = " + t);*/ /*log.fine("s = " + s);*/ // Recheck the tail ref, to ensure other thread has not already moved it. This can potentially prevent // a relatively expensive compare and set from failing later on, if another thread has already shited // the tail. if (t == markers[level + 1].getTail()) { /*log.fine("t is still the tail.");*/ // Check that the next element reference on the tail is the tail marker, to confirm that another thread // has not updated it. Again, this may prevent a cas from failing later. if (s == markers[level + 1]) { /*log.fine("s is the tail marker.");*/ // Try to join the new tail onto the old one. if (t.casNext(s, newNode)) { // The tail join was succesfull, so now update the queues tail reference. No conflict should // occurr here as the tail join was succesfull, so its just a question of updating the tail // reference. A compare and set is still used because ... markers[level + 1].casTail(t, newNode); // depends on control dependency: [if], data = [none] // Increment the queue size count. count.incrementAndGet(); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } } // Update the tail reference, other thread may also be doing the same. else { // Why bother doing this at all? I suppose, because another thread may be stalled and doing this // will enable this one to keep running. // Update the tail reference for the queue because another thread has already added a new tail // but not yet managed to update the tail reference. markers[level + 1].casTail(t, s); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { @SuppressWarnings({ "unchecked", "rawtypes" }) @Pure protected GP newPath(PT startPoint, ST segment) { if (this.pathFactory != null) { return this.pathFactory.newPath(startPoint, segment); } try { return (GP) new GraphPath(segment, startPoint); } catch (Throwable e) { throw new IllegalStateException(Locale.getString("E2"), e); //$NON-NLS-1$ } } }
public class class_name { @SuppressWarnings({ "unchecked", "rawtypes" }) @Pure protected GP newPath(PT startPoint, ST segment) { if (this.pathFactory != null) { return this.pathFactory.newPath(startPoint, segment); // depends on control dependency: [if], data = [none] } try { return (GP) new GraphPath(segment, startPoint); // depends on control dependency: [try], data = [none] } catch (Throwable e) { throw new IllegalStateException(Locale.getString("E2"), e); //$NON-NLS-1$ } // depends on control dependency: [catch], data = [none] } }
public class class_name { public <T> BackedAnnotatedType<T> getBackedAnnotatedType(final Class<T> rawType, final Type baseType, final String bdaId, final String suffix) { try { return backedAnnotatedTypes.getCastValue(new TypeHolder<T>(rawType, baseType, bdaId, suffix)); } catch (RuntimeException e) { if (e instanceof TypeNotPresentException || e instanceof ResourceLoadingException) { BootstrapLogger.LOG.exceptionWhileLoadingClass(rawType.getName(), e); throw new ResourceLoadingException("Exception while loading class " + rawType.getName(), e); } throw e; } catch (Error e) { if(e instanceof NoClassDefFoundError || e instanceof LinkageError) { throw new ResourceLoadingException("Error while loading class " + rawType.getName(), e); } BootstrapLogger.LOG.errorWhileLoadingClass(rawType.getName(), e); throw e; } } }
public class class_name { public <T> BackedAnnotatedType<T> getBackedAnnotatedType(final Class<T> rawType, final Type baseType, final String bdaId, final String suffix) { try { return backedAnnotatedTypes.getCastValue(new TypeHolder<T>(rawType, baseType, bdaId, suffix)); // depends on control dependency: [try], data = [none] } catch (RuntimeException e) { if (e instanceof TypeNotPresentException || e instanceof ResourceLoadingException) { BootstrapLogger.LOG.exceptionWhileLoadingClass(rawType.getName(), e); // depends on control dependency: [if], data = [none] throw new ResourceLoadingException("Exception while loading class " + rawType.getName(), e); } throw e; } catch (Error e) { // depends on control dependency: [catch], data = [none] if(e instanceof NoClassDefFoundError || e instanceof LinkageError) { throw new ResourceLoadingException("Error while loading class " + rawType.getName(), e); } BootstrapLogger.LOG.errorWhileLoadingClass(rawType.getName(), e); throw e; } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public DataSourceHolder getHolder(StatementMetaData metaData, Map<String, Object> runtime) { String daoName = metaData.getDAOMetaData().getDAOClass().getName(); String name = daoName; DataSourceHolder dataSource = dataSources.get(name); if (dataSource != null) { return dataSource; } while (true) { int index = name.lastIndexOf('.'); if (index == -1) { dataSources.putIfAbsent(daoName, defaultDataSource); return defaultDataSource; } name = name.substring(0, index); dataSource = dataSources.get(name); if (dataSource != null) { dataSources.putIfAbsent(daoName, dataSource); return dataSource; } } } }
public class class_name { @Override public DataSourceHolder getHolder(StatementMetaData metaData, Map<String, Object> runtime) { String daoName = metaData.getDAOMetaData().getDAOClass().getName(); String name = daoName; DataSourceHolder dataSource = dataSources.get(name); if (dataSource != null) { return dataSource; // depends on control dependency: [if], data = [none] } while (true) { int index = name.lastIndexOf('.'); if (index == -1) { dataSources.putIfAbsent(daoName, defaultDataSource); // depends on control dependency: [if], data = [none] return defaultDataSource; // depends on control dependency: [if], data = [none] } name = name.substring(0, index); // depends on control dependency: [while], data = [none] dataSource = dataSources.get(name); // depends on control dependency: [while], data = [none] if (dataSource != null) { dataSources.putIfAbsent(daoName, dataSource); // depends on control dependency: [if], data = [none] return dataSource; // depends on control dependency: [if], data = [none] } } } }
public class class_name { private boolean setToKeywordStart() { for (int i = index; i < id.length; ++i) { if (id[i] == KEYWORD_SEPARATOR) { if (canonicalize) { for (int j = ++i; j < id.length; ++j) { // increment i past separator for return if (id[j] == KEYWORD_ASSIGN) { index = i; return true; } } } else { if (++i < id.length) { index = i; return true; } } break; } } return false; } }
public class class_name { private boolean setToKeywordStart() { for (int i = index; i < id.length; ++i) { if (id[i] == KEYWORD_SEPARATOR) { if (canonicalize) { for (int j = ++i; j < id.length; ++j) { // increment i past separator for return if (id[j] == KEYWORD_ASSIGN) { index = i; // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } } } else { if (++i < id.length) { index = i; // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } } break; } } return false; } }
public class class_name { public String status(final DeviceProxy deviceProxy, final boolean src) throws DevFailed { build_connection(deviceProxy); if (deviceProxy.url.protocol == TANGO) { String status = "Unknown"; final int retries = deviceProxy.transparent_reconnection ? 2 : 1; boolean done = false; for (int i = 0; i < retries && !done; i++) { try { //noinspection PointlessBooleanExpression if (src == ApiDefs.FROM_ATTR) { status = deviceProxy.device.status(); } else { final DeviceData argout = deviceProxy.command_inout("Status"); status = argout.extractString(); } done = true; } catch (final Exception e) { manageExceptionReconnection(deviceProxy, retries, i, e, this.getClass() + ".status"); } } return status; } else { return command_inout(deviceProxy, "DevStatus").extractString(); } } }
public class class_name { public String status(final DeviceProxy deviceProxy, final boolean src) throws DevFailed { build_connection(deviceProxy); if (deviceProxy.url.protocol == TANGO) { String status = "Unknown"; final int retries = deviceProxy.transparent_reconnection ? 2 : 1; boolean done = false; for (int i = 0; i < retries && !done; i++) { try { //noinspection PointlessBooleanExpression if (src == ApiDefs.FROM_ATTR) { status = deviceProxy.device.status(); // depends on control dependency: [if], data = [none] } else { final DeviceData argout = deviceProxy.command_inout("Status"); status = argout.extractString(); // depends on control dependency: [if], data = [none] } done = true; // depends on control dependency: [try], data = [none] } catch (final Exception e) { manageExceptionReconnection(deviceProxy, retries, i, e, this.getClass() + ".status"); } // depends on control dependency: [catch], data = [none] } return status; } else { return command_inout(deviceProxy, "DevStatus").extractString(); } } }
public class class_name { protected int getDigestOffset1(byte[] handshake, int bufferOffset) { bufferOffset += 8; int offset = handshake[bufferOffset] & 0xff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; int res = (offset % 728) + 12; if (res + DIGEST_LENGTH > 771) { log.error("Invalid digest offset calc: {}", res); } return res; } }
public class class_name { protected int getDigestOffset1(byte[] handshake, int bufferOffset) { bufferOffset += 8; int offset = handshake[bufferOffset] & 0xff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; int res = (offset % 728) + 12; if (res + DIGEST_LENGTH > 771) { log.error("Invalid digest offset calc: {}", res); // depends on control dependency: [if], data = [none] } return res; } }
public class class_name { public static NotificationManager getInstance(Context context) { if (sInstance == null) { sInstance = new NotificationManager(context); } return sInstance; } }
public class class_name { public static NotificationManager getInstance(Context context) { if (sInstance == null) { sInstance = new NotificationManager(context); // depends on control dependency: [if], data = [none] } return sInstance; } }
public class class_name { public static IAtomContainer getRelevantAtomContainer(IChemModel chemModel, IAtom atom) { IAtomContainer result = null; if (chemModel.getMoleculeSet() != null) { IAtomContainerSet moleculeSet = chemModel.getMoleculeSet(); result = MoleculeSetManipulator.getRelevantAtomContainer(moleculeSet, atom); if (result != null) { return result; } } if (chemModel.getReactionSet() != null) { IReactionSet reactionSet = chemModel.getReactionSet(); return ReactionSetManipulator.getRelevantAtomContainer(reactionSet, atom); } if (chemModel.getCrystal() != null && chemModel.getCrystal().contains(atom)) { return chemModel.getCrystal(); } if (chemModel.getRingSet() != null) { return AtomContainerSetManipulator.getRelevantAtomContainer(chemModel.getRingSet(), atom); } throw new IllegalArgumentException("The provided atom is not part of this IChemModel."); } }
public class class_name { public static IAtomContainer getRelevantAtomContainer(IChemModel chemModel, IAtom atom) { IAtomContainer result = null; if (chemModel.getMoleculeSet() != null) { IAtomContainerSet moleculeSet = chemModel.getMoleculeSet(); result = MoleculeSetManipulator.getRelevantAtomContainer(moleculeSet, atom); // depends on control dependency: [if], data = [none] if (result != null) { return result; // depends on control dependency: [if], data = [none] } } if (chemModel.getReactionSet() != null) { IReactionSet reactionSet = chemModel.getReactionSet(); return ReactionSetManipulator.getRelevantAtomContainer(reactionSet, atom); // depends on control dependency: [if], data = [none] } if (chemModel.getCrystal() != null && chemModel.getCrystal().contains(atom)) { return chemModel.getCrystal(); // depends on control dependency: [if], data = [none] } if (chemModel.getRingSet() != null) { return AtomContainerSetManipulator.getRelevantAtomContainer(chemModel.getRingSet(), atom); // depends on control dependency: [if], data = [(chemModel.getRingSet()] } throw new IllegalArgumentException("The provided atom is not part of this IChemModel."); } }
public class class_name { public static EcKey fromJsonWebKey(JsonWebKey jwk, boolean includePrivateParameters, Provider provider) { try { if (jwk.kid() != null) { return new EcKey(jwk.kid(), jwk.toEC(includePrivateParameters, provider)); } else { throw new IllegalArgumentException("Json Web Key should have a kid"); } } catch (GeneralSecurityException e) { throw new IllegalStateException(e); } } }
public class class_name { public static EcKey fromJsonWebKey(JsonWebKey jwk, boolean includePrivateParameters, Provider provider) { try { if (jwk.kid() != null) { return new EcKey(jwk.kid(), jwk.toEC(includePrivateParameters, provider)); // depends on control dependency: [if], data = [(jwk.kid()] } else { throw new IllegalArgumentException("Json Web Key should have a kid"); } } catch (GeneralSecurityException e) { throw new IllegalStateException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected final void paintChildren(final Container container, final WebXmlRenderContext renderContext) { final int size = container.getChildCount(); for (int i = 0; i < size; i++) { WComponent child = container.getChildAt(i); child.paint(renderContext); } } }
public class class_name { protected final void paintChildren(final Container container, final WebXmlRenderContext renderContext) { final int size = container.getChildCount(); for (int i = 0; i < size; i++) { WComponent child = container.getChildAt(i); child.paint(renderContext); // depends on control dependency: [for], data = [none] } } }
public class class_name { public <V extends ViewGroup> void setTypeface(V viewGroup, String typefaceName, int style) { int count = viewGroup.getChildCount(); for (int i = 0; i < count; i++) { View child = viewGroup.getChildAt(i); if (child instanceof ViewGroup) { setTypeface((ViewGroup) child, typefaceName, style); continue; } if (!(child instanceof TextView)) { continue; } setTypeface((TextView) child, typefaceName, style); } } }
public class class_name { public <V extends ViewGroup> void setTypeface(V viewGroup, String typefaceName, int style) { int count = viewGroup.getChildCount(); for (int i = 0; i < count; i++) { View child = viewGroup.getChildAt(i); if (child instanceof ViewGroup) { setTypeface((ViewGroup) child, typefaceName, style); // depends on control dependency: [if], data = [none] continue; } if (!(child instanceof TextView)) { continue; } setTypeface((TextView) child, typefaceName, style); // depends on control dependency: [for], data = [none] } } }
public class class_name { public Crossfader withPanelSlideListener(SlidingPaneLayout.PanelSlideListener panelSlideListener) { this.mPanelSlideListener = panelSlideListener; if (mCrossFadeSlidingPaneLayout != null) { mCrossFadeSlidingPaneLayout.setPanelSlideListener(mPanelSlideListener); } return this; } }
public class class_name { public Crossfader withPanelSlideListener(SlidingPaneLayout.PanelSlideListener panelSlideListener) { this.mPanelSlideListener = panelSlideListener; if (mCrossFadeSlidingPaneLayout != null) { mCrossFadeSlidingPaneLayout.setPanelSlideListener(mPanelSlideListener); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { private void setSelectedNavDrawerItem(int itemId) { for(DrawerItem item: mDrawerItems){ formatNavDrawerItem(item, itemId == item.getId()); } } }
public class class_name { private void setSelectedNavDrawerItem(int itemId) { for(DrawerItem item: mDrawerItems){ formatNavDrawerItem(item, itemId == item.getId()); // depends on control dependency: [for], data = [item] } } }
public class class_name { private long readLines(final RandomAccessFile reader) throws IOException { final ByteArrayOutputStream lineBuf = new ByteArrayOutputStream(64); long pos = reader.getFilePointer(); long rePos = pos; // position to re-read int num; boolean seenCR = false; // FIXME replace -1 with EOF when we're merging back into commons-io while ((num = reader.read(this.inbuf)) != -1) { for (int i = 0; i < num; i++) { final byte ch = this.inbuf[i]; switch (ch) { case '\n': seenCR = false; // swallow CR before LF this.listener.handle(new String(lineBuf.toByteArray(), this.cset)); lineBuf.reset(); rePos = pos + i + 1; break; case '\r': if (seenCR) { lineBuf.write('\r'); } seenCR = true; break; default: if (seenCR) { seenCR = false; // swallow final CR this.listener.handle(new String(lineBuf.toByteArray(), this.cset)); lineBuf.reset(); rePos = pos + i + 1; } lineBuf.write(ch); } } pos = reader.getFilePointer(); } IOUtils.closeQuietly(lineBuf); // not strictly necessary reader.seek(rePos); // Ensure we can re-read if necessary return rePos; } }
public class class_name { private long readLines(final RandomAccessFile reader) throws IOException { final ByteArrayOutputStream lineBuf = new ByteArrayOutputStream(64); long pos = reader.getFilePointer(); long rePos = pos; // position to re-read int num; boolean seenCR = false; // FIXME replace -1 with EOF when we're merging back into commons-io while ((num = reader.read(this.inbuf)) != -1) { for (int i = 0; i < num; i++) { final byte ch = this.inbuf[i]; switch (ch) { case '\n': seenCR = false; // swallow CR before LF this.listener.handle(new String(lineBuf.toByteArray(), this.cset)); lineBuf.reset(); rePos = pos + i + 1; break; case '\r': if (seenCR) { lineBuf.write('\r'); // depends on control dependency: [if], data = [none] } seenCR = true; break; default: if (seenCR) { seenCR = false; // swallow final CR // depends on control dependency: [if], data = [none] this.listener.handle(new String(lineBuf.toByteArray(), this.cset)); // depends on control dependency: [if], data = [none] lineBuf.reset(); // depends on control dependency: [if], data = [none] rePos = pos + i + 1; // depends on control dependency: [if], data = [none] } lineBuf.write(ch); } } pos = reader.getFilePointer(); } IOUtils.closeQuietly(lineBuf); // not strictly necessary reader.seek(rePos); // Ensure we can re-read if necessary return rePos; } }
public class class_name { protected void completeOAuthParameters(HttpParameters out) { if (!out.containsKey(OAuth.OAUTH_CONSUMER_KEY)) { out.put(OAuth.OAUTH_CONSUMER_KEY, consumerKey, true); } if (!out.containsKey(OAuth.OAUTH_SIGNATURE_METHOD)) { out.put(OAuth.OAUTH_SIGNATURE_METHOD, messageSigner.getSignatureMethod(), true); } if (!out.containsKey(OAuth.OAUTH_TIMESTAMP)) { out.put(OAuth.OAUTH_TIMESTAMP, generateTimestamp(), true); } if (!out.containsKey(OAuth.OAUTH_NONCE)) { out.put(OAuth.OAUTH_NONCE, generateNonce(), true); } if (!out.containsKey(OAuth.OAUTH_VERSION)) { out.put(OAuth.OAUTH_VERSION, OAuth.VERSION_1_0, true); } if (!out.containsKey(OAuth.OAUTH_TOKEN)) { if (token != null && !token.equals("") || sendEmptyTokens) { out.put(OAuth.OAUTH_TOKEN, token, true); } } } }
public class class_name { protected void completeOAuthParameters(HttpParameters out) { if (!out.containsKey(OAuth.OAUTH_CONSUMER_KEY)) { out.put(OAuth.OAUTH_CONSUMER_KEY, consumerKey, true); // depends on control dependency: [if], data = [none] } if (!out.containsKey(OAuth.OAUTH_SIGNATURE_METHOD)) { out.put(OAuth.OAUTH_SIGNATURE_METHOD, messageSigner.getSignatureMethod(), true); // depends on control dependency: [if], data = [none] } if (!out.containsKey(OAuth.OAUTH_TIMESTAMP)) { out.put(OAuth.OAUTH_TIMESTAMP, generateTimestamp(), true); // depends on control dependency: [if], data = [none] } if (!out.containsKey(OAuth.OAUTH_NONCE)) { out.put(OAuth.OAUTH_NONCE, generateNonce(), true); // depends on control dependency: [if], data = [none] } if (!out.containsKey(OAuth.OAUTH_VERSION)) { out.put(OAuth.OAUTH_VERSION, OAuth.VERSION_1_0, true); // depends on control dependency: [if], data = [none] } if (!out.containsKey(OAuth.OAUTH_TOKEN)) { if (token != null && !token.equals("") || sendEmptyTokens) { out.put(OAuth.OAUTH_TOKEN, token, true); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public String getScript(ClientBehaviorContext behaviorContext) { if (null == behaviorContext) { throw new NullPointerException(); } ClientBehaviorRenderer renderer = getRenderer(behaviorContext.getFacesContext()); String script = null; if (null != renderer){ script = renderer.getScript(behaviorContext, this); } return script; } }
public class class_name { public String getScript(ClientBehaviorContext behaviorContext) { if (null == behaviorContext) { throw new NullPointerException(); } ClientBehaviorRenderer renderer = getRenderer(behaviorContext.getFacesContext()); String script = null; if (null != renderer){ script = renderer.getScript(behaviorContext, this); // depends on control dependency: [if], data = [none] } return script; } }
public class class_name { protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { // First, check if the class has already been loaded Class<?> c = findLoadedClass(name); if (c == null) { try { if (parent != null) { c = parent.loadClass(name, false); } else { c = findBootstrapClassOrNull(name); } } catch (ClassNotFoundException e) { // ClassNotFoundException thrown if class not found // from the non-null parent class loader } if (c == null) { // If still not found, then invoke findClass in order // to find the class. c = findClass(name); } } return c; } }
public class class_name { protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { // First, check if the class has already been loaded Class<?> c = findLoadedClass(name); if (c == null) { try { if (parent != null) { c = parent.loadClass(name, false); // depends on control dependency: [if], data = [none] } else { c = findBootstrapClassOrNull(name); // depends on control dependency: [if], data = [none] } } catch (ClassNotFoundException e) { // ClassNotFoundException thrown if class not found // from the non-null parent class loader } if (c == null) { // If still not found, then invoke findClass in order // to find the class. c = findClass(name); } } return c; } }
public class class_name { public void marshall(FrameCaptureOutputSettings frameCaptureOutputSettings, ProtocolMarshaller protocolMarshaller) { if (frameCaptureOutputSettings == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(frameCaptureOutputSettings.getNameModifier(), NAMEMODIFIER_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(FrameCaptureOutputSettings frameCaptureOutputSettings, ProtocolMarshaller protocolMarshaller) { if (frameCaptureOutputSettings == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(frameCaptureOutputSettings.getNameModifier(), NAMEMODIFIER_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(RedshiftDestinationUpdate redshiftDestinationUpdate, ProtocolMarshaller protocolMarshaller) { if (redshiftDestinationUpdate == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(redshiftDestinationUpdate.getRoleARN(), ROLEARN_BINDING); protocolMarshaller.marshall(redshiftDestinationUpdate.getClusterJDBCURL(), CLUSTERJDBCURL_BINDING); protocolMarshaller.marshall(redshiftDestinationUpdate.getCopyCommand(), COPYCOMMAND_BINDING); protocolMarshaller.marshall(redshiftDestinationUpdate.getUsername(), USERNAME_BINDING); protocolMarshaller.marshall(redshiftDestinationUpdate.getPassword(), PASSWORD_BINDING); protocolMarshaller.marshall(redshiftDestinationUpdate.getRetryOptions(), RETRYOPTIONS_BINDING); protocolMarshaller.marshall(redshiftDestinationUpdate.getS3Update(), S3UPDATE_BINDING); protocolMarshaller.marshall(redshiftDestinationUpdate.getProcessingConfiguration(), PROCESSINGCONFIGURATION_BINDING); protocolMarshaller.marshall(redshiftDestinationUpdate.getS3BackupMode(), S3BACKUPMODE_BINDING); protocolMarshaller.marshall(redshiftDestinationUpdate.getS3BackupUpdate(), S3BACKUPUPDATE_BINDING); protocolMarshaller.marshall(redshiftDestinationUpdate.getCloudWatchLoggingOptions(), CLOUDWATCHLOGGINGOPTIONS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(RedshiftDestinationUpdate redshiftDestinationUpdate, ProtocolMarshaller protocolMarshaller) { if (redshiftDestinationUpdate == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(redshiftDestinationUpdate.getRoleARN(), ROLEARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(redshiftDestinationUpdate.getClusterJDBCURL(), CLUSTERJDBCURL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(redshiftDestinationUpdate.getCopyCommand(), COPYCOMMAND_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(redshiftDestinationUpdate.getUsername(), USERNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(redshiftDestinationUpdate.getPassword(), PASSWORD_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(redshiftDestinationUpdate.getRetryOptions(), RETRYOPTIONS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(redshiftDestinationUpdate.getS3Update(), S3UPDATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(redshiftDestinationUpdate.getProcessingConfiguration(), PROCESSINGCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(redshiftDestinationUpdate.getS3BackupMode(), S3BACKUPMODE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(redshiftDestinationUpdate.getS3BackupUpdate(), S3BACKUPUPDATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(redshiftDestinationUpdate.getCloudWatchLoggingOptions(), CLOUDWATCHLOGGINGOPTIONS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Collection<Location> orderedLocations() { TreeSet<Location> tree = new TreeSet<>(); for (Iterator<Location> locs = locationIterator(); locs.hasNext();) { Location loc = locs.next(); tree.add(loc); } return tree; } }
public class class_name { public Collection<Location> orderedLocations() { TreeSet<Location> tree = new TreeSet<>(); for (Iterator<Location> locs = locationIterator(); locs.hasNext();) { Location loc = locs.next(); tree.add(loc); // depends on control dependency: [for], data = [none] } return tree; } }
public class class_name { public void fillDefault(List<CmsSitemapEntryBean> entries) { if (!m_disableFillDefault) { fill(entries); selectSite(m_handler.getDefaultSelectedSiteRoot()); } } }
public class class_name { public void fillDefault(List<CmsSitemapEntryBean> entries) { if (!m_disableFillDefault) { fill(entries); // depends on control dependency: [if], data = [none] selectSite(m_handler.getDefaultSelectedSiteRoot()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void set(int x, int y, short... value) { if (!isInBounds(x, y)) throw new ImageAccessException("Requested pixel is out of bounds"); int index = getIndex(x, y, 0); for (int i = 0; i < numBands; i++, index++) { data[index] = value[i]; } } }
public class class_name { public void set(int x, int y, short... value) { if (!isInBounds(x, y)) throw new ImageAccessException("Requested pixel is out of bounds"); int index = getIndex(x, y, 0); for (int i = 0; i < numBands; i++, index++) { data[index] = value[i]; // depends on control dependency: [for], data = [i] } } }
public class class_name { public TokenLengthAnalyzer getAnalyzer(String fieldName) { if (StringUtils.isBlank(fieldName)) { throw new IllegalArgumentException("Not empty analyzer name required"); } String name = Column.parseMapperName(fieldName); TokenLengthAnalyzer analyzer = fieldAnalyzers.get(name); if (analyzer != null) { return analyzer; } else { for (Map.Entry<String, TokenLengthAnalyzer> entry : fieldAnalyzers.entrySet()) { if (name.startsWith(entry.getKey() + ".")) { return entry.getValue(); } } return defaultAnalyzer; } } }
public class class_name { public TokenLengthAnalyzer getAnalyzer(String fieldName) { if (StringUtils.isBlank(fieldName)) { throw new IllegalArgumentException("Not empty analyzer name required"); } String name = Column.parseMapperName(fieldName); TokenLengthAnalyzer analyzer = fieldAnalyzers.get(name); if (analyzer != null) { return analyzer; // depends on control dependency: [if], data = [none] } else { for (Map.Entry<String, TokenLengthAnalyzer> entry : fieldAnalyzers.entrySet()) { if (name.startsWith(entry.getKey() + ".")) { return entry.getValue(); // depends on control dependency: [if], data = [none] } } return defaultAnalyzer; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void prepare(Properties p, Connection cnx) { this.tablePrefix = p.getProperty("com.enioka.jqm.jdbc.tablePrefix", ""); queries.putAll(DbImplBase.queries); for (Map.Entry<String, String> entry : DbImplBase.queries.entrySet()) { queries.put(entry.getKey(), this.adaptSql(entry.getValue())); } } }
public class class_name { public void prepare(Properties p, Connection cnx) { this.tablePrefix = p.getProperty("com.enioka.jqm.jdbc.tablePrefix", ""); queries.putAll(DbImplBase.queries); for (Map.Entry<String, String> entry : DbImplBase.queries.entrySet()) { queries.put(entry.getKey(), this.adaptSql(entry.getValue())); // depends on control dependency: [for], data = [entry] } } }
public class class_name { public Metric normalizePredictions(Metric predictions) { Map<Long, Double> metricData = predictions.getDatapoints(); Map<String, Double> minMax = getMinMax(metricData); double min = minMax.get("min"); double max = minMax.get("max"); Metric predictionsNormalized = new Metric(getResultScopeName(), getResultMetricName()); Map<Long, Double> metricDataNormalized = new HashMap<>(); if (max - min == 0.0) { /** * If (max - min) == 0.0, all data points in the predictions metric * have the same value. So, all data points in the normalized metric * will have value 0. This avoids divide by zero operations later on. */ for (Long timestamp : metricData.keySet()) { metricDataNormalized.put(timestamp, 0.0); } } else { double normalizationConstant = 100.0 / (max - min); for (Entry<Long, Double> entry : metricData.entrySet()) { Long timestamp = entry.getKey(); Double value = entry.getValue(); // Formula: normalizedValue = (rawValue - min) * (100 / (max - min)) Double valueNormalized = (value - min) * normalizationConstant; metricDataNormalized.put(timestamp, valueNormalized); } } predictionsNormalized.setDatapoints(metricDataNormalized); return predictionsNormalized; } }
public class class_name { public Metric normalizePredictions(Metric predictions) { Map<Long, Double> metricData = predictions.getDatapoints(); Map<String, Double> minMax = getMinMax(metricData); double min = minMax.get("min"); double max = minMax.get("max"); Metric predictionsNormalized = new Metric(getResultScopeName(), getResultMetricName()); Map<Long, Double> metricDataNormalized = new HashMap<>(); if (max - min == 0.0) { /** * If (max - min) == 0.0, all data points in the predictions metric * have the same value. So, all data points in the normalized metric * will have value 0. This avoids divide by zero operations later on. */ for (Long timestamp : metricData.keySet()) { metricDataNormalized.put(timestamp, 0.0); // depends on control dependency: [for], data = [timestamp] } } else { double normalizationConstant = 100.0 / (max - min); for (Entry<Long, Double> entry : metricData.entrySet()) { Long timestamp = entry.getKey(); Double value = entry.getValue(); // Formula: normalizedValue = (rawValue - min) * (100 / (max - min)) Double valueNormalized = (value - min) * normalizationConstant; metricDataNormalized.put(timestamp, valueNormalized); // depends on control dependency: [for], data = [none] } } predictionsNormalized.setDatapoints(metricDataNormalized); return predictionsNormalized; } }
public class class_name { public static float getScore(String first, String second) { int frequency = getFrequency(first, second); float score = frequency/(float)maxFrequency; if(LOGGER.isDebugEnabled()) { if(score>0) { LOGGER.debug("二元模型 " + first + ":" + second + " 获得分值:" + score); } } return score; } }
public class class_name { public static float getScore(String first, String second) { int frequency = getFrequency(first, second); float score = frequency/(float)maxFrequency; if(LOGGER.isDebugEnabled()) { if(score>0) { LOGGER.debug("二元模型 " + first + ":" + second + " 获得分值:" + score); // depends on control dependency: [if], data = [none] } } return score; } }
public class class_name { private static long getVersionId(String versionDir) { try { return Long.parseLong(versionDir.replace("version-", "")); } catch(NumberFormatException e) { logger.trace("Cannot parse version directory to obtain id " + versionDir); return -1; } } }
public class class_name { private static long getVersionId(String versionDir) { try { return Long.parseLong(versionDir.replace("version-", "")); // depends on control dependency: [try], data = [none] } catch(NumberFormatException e) { logger.trace("Cannot parse version directory to obtain id " + versionDir); return -1; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static void navigateUp(Activity activity, Bundle extras) { Intent upIntent = NavUtils.getParentActivityIntent(activity); if (upIntent != null) { if (extras != null) { upIntent.putExtras(extras); } if (NavUtils.shouldUpRecreateTask(activity, upIntent)) { // This activity is NOT part of this app's task, so create a new task // when navigating up, with a synthesized back stack. TaskStackBuilder.create(activity) // Add all of this activity's parents to the back stack. .addNextIntentWithParentStack(upIntent) // Navigate up to the closest parent. .startActivities(); } else { // This activity is part of this app's task, so simply // navigate up to the logical parent activity. // According to http://stackoverflow.com/a/14792752/2420519 //NavUtils.navigateUpTo(activity, upIntent); upIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); activity.startActivity(upIntent); } } activity.finish(); } }
public class class_name { public static void navigateUp(Activity activity, Bundle extras) { Intent upIntent = NavUtils.getParentActivityIntent(activity); if (upIntent != null) { if (extras != null) { upIntent.putExtras(extras); // depends on control dependency: [if], data = [(extras] } if (NavUtils.shouldUpRecreateTask(activity, upIntent)) { // This activity is NOT part of this app's task, so create a new task // when navigating up, with a synthesized back stack. TaskStackBuilder.create(activity) // Add all of this activity's parents to the back stack. .addNextIntentWithParentStack(upIntent) // Navigate up to the closest parent. .startActivities(); // depends on control dependency: [if], data = [none] } else { // This activity is part of this app's task, so simply // navigate up to the logical parent activity. // According to http://stackoverflow.com/a/14792752/2420519 //NavUtils.navigateUpTo(activity, upIntent); upIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // depends on control dependency: [if], data = [none] activity.startActivity(upIntent); // depends on control dependency: [if], data = [none] } } activity.finish(); } }
public class class_name { private void updateSliderState(int touchX, int touchY) { int distanceX = touchX - mCircleCenterX; int distanceY = mCircleCenterY - touchY; //noinspection SuspiciousNameCombination double c = Math.sqrt(Math.pow(distanceX, 2) + Math.pow(distanceY, 2)); mAngle = Math.acos(distanceX / c); if (distanceY < 0) { mAngle = -mAngle; } if (mListener != null) { // notify slider moved listener of the new position which should be in [0..1] range mListener.onSliderMoved((mAngle - mStartAngle) / (2 * Math.PI)); } } }
public class class_name { private void updateSliderState(int touchX, int touchY) { int distanceX = touchX - mCircleCenterX; int distanceY = mCircleCenterY - touchY; //noinspection SuspiciousNameCombination double c = Math.sqrt(Math.pow(distanceX, 2) + Math.pow(distanceY, 2)); mAngle = Math.acos(distanceX / c); if (distanceY < 0) { mAngle = -mAngle; // depends on control dependency: [if], data = [none] } if (mListener != null) { // notify slider moved listener of the new position which should be in [0..1] range mListener.onSliderMoved((mAngle - mStartAngle) / (2 * Math.PI)); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public XBELDocument convert(Document source) { if (source == null) return null; XBELDocument xd = new XBELDocument(); List<StatementGroup> stmtGroups = source.getStatementGroups(); List<XBELStatementGroup> xstmtGroups = xd.getStatementGroup(); StatementGroupConverter sgConverter = new StatementGroupConverter(); for (final StatementGroup sg : stmtGroups) { // Defer to StatementGroupConverter xstmtGroups.add(sgConverter.convert(sg)); } List<AnnotationDefinition> definitions = source.getDefinitions(); if (hasItems(definitions)) { XBELAnnotationDefinitionGroup xadGroup = new XBELAnnotationDefinitionGroup(); List<XBELInternalAnnotationDefinition> internals = xadGroup.getInternalAnnotationDefinition(); List<XBELExternalAnnotationDefinition> externals = xadGroup.getExternalAnnotationDefinition(); InternalAnnotationDefinitionConverter iConverter = new InternalAnnotationDefinitionConverter(); ExternalAnnotationDefinitionConverter eConverter = new ExternalAnnotationDefinitionConverter(); for (final AnnotationDefinition ad : definitions) { XBELInternalAnnotationDefinition iad = iConverter.convert(ad); if (iad != null) { internals.add(iad); continue; } XBELExternalAnnotationDefinition ead = eConverter.convert(ad); if (ead != null) { externals.add(ead); } } xd.setAnnotationDefinitionGroup(xadGroup); } Header header = source.getHeader(); HeaderConverter hConverter = new HeaderConverter(); // Defer to HeaderConverter xd.setHeader(hConverter.convert(header)); NamespaceGroup nsGroup = source.getNamespaceGroup(); if (nsGroup != null) { NamespaceGroupConverter ngConverter = new NamespaceGroupConverter(); // Defer to NamespaceGroupConverter xd.setNamespaceGroup(ngConverter.convert(nsGroup)); } return xd; } }
public class class_name { @Override public XBELDocument convert(Document source) { if (source == null) return null; XBELDocument xd = new XBELDocument(); List<StatementGroup> stmtGroups = source.getStatementGroups(); List<XBELStatementGroup> xstmtGroups = xd.getStatementGroup(); StatementGroupConverter sgConverter = new StatementGroupConverter(); for (final StatementGroup sg : stmtGroups) { // Defer to StatementGroupConverter xstmtGroups.add(sgConverter.convert(sg)); // depends on control dependency: [for], data = [sg] } List<AnnotationDefinition> definitions = source.getDefinitions(); if (hasItems(definitions)) { XBELAnnotationDefinitionGroup xadGroup = new XBELAnnotationDefinitionGroup(); List<XBELInternalAnnotationDefinition> internals = xadGroup.getInternalAnnotationDefinition(); List<XBELExternalAnnotationDefinition> externals = xadGroup.getExternalAnnotationDefinition(); InternalAnnotationDefinitionConverter iConverter = new InternalAnnotationDefinitionConverter(); ExternalAnnotationDefinitionConverter eConverter = new ExternalAnnotationDefinitionConverter(); for (final AnnotationDefinition ad : definitions) { XBELInternalAnnotationDefinition iad = iConverter.convert(ad); if (iad != null) { internals.add(iad); // depends on control dependency: [if], data = [(iad] continue; } XBELExternalAnnotationDefinition ead = eConverter.convert(ad); if (ead != null) { externals.add(ead); // depends on control dependency: [if], data = [(ead] } } xd.setAnnotationDefinitionGroup(xadGroup); // depends on control dependency: [if], data = [none] } Header header = source.getHeader(); HeaderConverter hConverter = new HeaderConverter(); // Defer to HeaderConverter xd.setHeader(hConverter.convert(header)); NamespaceGroup nsGroup = source.getNamespaceGroup(); if (nsGroup != null) { NamespaceGroupConverter ngConverter = new NamespaceGroupConverter(); // Defer to NamespaceGroupConverter xd.setNamespaceGroup(ngConverter.convert(nsGroup)); // depends on control dependency: [if], data = [(nsGroup] } return xd; } }
public class class_name { public String getDelegateName() { javax.swing.text.Element data = getElement(); if (data instanceof DelegateElement) { return ((DelegateElement) data) .getDelegateName(); } return null; } }
public class class_name { public String getDelegateName() { javax.swing.text.Element data = getElement(); if (data instanceof DelegateElement) { return ((DelegateElement) data) .getDelegateName(); } // depends on control dependency: [if], data = [none] return null; } }
public class class_name { private ExtremumType extremumType(int n, double[] alpha_extreme, HyperBoundingBox interval) { // return the type of the global extremum if(n == alpha_extreme.length - 1) { return extremumType; } // create random alpha values double[] alpha_extreme_l = new double[alpha_extreme.length]; double[] alpha_extreme_r = new double[alpha_extreme.length]; double[] alpha_extreme_c = new double[alpha_extreme.length]; System.arraycopy(alpha_extreme, 0, alpha_extreme_l, 0, alpha_extreme.length); System.arraycopy(alpha_extreme, 0, alpha_extreme_r, 0, alpha_extreme.length); System.arraycopy(alpha_extreme, 0, alpha_extreme_c, 0, alpha_extreme.length); double[] centroid = SpatialUtil.centroid(interval); for(int i = 0; i < n; i++) { alpha_extreme_l[i] = centroid[i]; alpha_extreme_r[i] = centroid[i]; alpha_extreme_c[i] = centroid[i]; } double intervalLength = interval.getMax(n) - interval.getMin(n); alpha_extreme_l[n] = Math.random() * intervalLength + interval.getMin(n); alpha_extreme_r[n] = Math.random() * intervalLength + interval.getMin(n); double f_c = function(alpha_extreme_c); double f_l = function(alpha_extreme_l); double f_r = function(alpha_extreme_r); if(f_l < f_c) { if(f_r < f_c || Math.abs(f_r - f_c) < DELTA) { return ExtremumType.MAXIMUM; } } if(f_r < f_c) { if(f_l < f_c || Math.abs(f_l - f_c) < DELTA) { return ExtremumType.MAXIMUM; } } if(f_l > f_c) { if(f_r > f_c || Math.abs(f_r - f_c) < DELTA) { return ExtremumType.MINIMUM; } } if(f_r > f_c) { if(f_l > f_c || Math.abs(f_l - f_c) < DELTA) { return ExtremumType.MINIMUM; } } if(Math.abs(f_l - f_c) < DELTA && Math.abs(f_r - f_c) < DELTA) { return ExtremumType.CONSTANT; } throw new IllegalArgumentException("Houston, we have a problem!\n" + this + // "\nf_l " + f_l + "\nf_c " + f_c + "\nf_r " + f_r + "\np " + vec + // "\nalpha " + FormatUtil.format(alpha_extreme_c) + // "\nalpha_l " + FormatUtil.format(alpha_extreme_l) + // "\nalpha_r " + FormatUtil.format(alpha_extreme_r) + "\nn " + n); // + "box min " + FormatUtil.format(interval.getMin()) + "\n" // + "box max " + FormatUtil.format(interval.getMax()) + "\n" } }
public class class_name { private ExtremumType extremumType(int n, double[] alpha_extreme, HyperBoundingBox interval) { // return the type of the global extremum if(n == alpha_extreme.length - 1) { return extremumType; // depends on control dependency: [if], data = [none] } // create random alpha values double[] alpha_extreme_l = new double[alpha_extreme.length]; double[] alpha_extreme_r = new double[alpha_extreme.length]; double[] alpha_extreme_c = new double[alpha_extreme.length]; System.arraycopy(alpha_extreme, 0, alpha_extreme_l, 0, alpha_extreme.length); System.arraycopy(alpha_extreme, 0, alpha_extreme_r, 0, alpha_extreme.length); System.arraycopy(alpha_extreme, 0, alpha_extreme_c, 0, alpha_extreme.length); double[] centroid = SpatialUtil.centroid(interval); for(int i = 0; i < n; i++) { alpha_extreme_l[i] = centroid[i]; // depends on control dependency: [for], data = [i] alpha_extreme_r[i] = centroid[i]; // depends on control dependency: [for], data = [i] alpha_extreme_c[i] = centroid[i]; // depends on control dependency: [for], data = [i] } double intervalLength = interval.getMax(n) - interval.getMin(n); alpha_extreme_l[n] = Math.random() * intervalLength + interval.getMin(n); alpha_extreme_r[n] = Math.random() * intervalLength + interval.getMin(n); double f_c = function(alpha_extreme_c); double f_l = function(alpha_extreme_l); double f_r = function(alpha_extreme_r); if(f_l < f_c) { if(f_r < f_c || Math.abs(f_r - f_c) < DELTA) { return ExtremumType.MAXIMUM; // depends on control dependency: [if], data = [none] } } if(f_r < f_c) { if(f_l < f_c || Math.abs(f_l - f_c) < DELTA) { return ExtremumType.MAXIMUM; // depends on control dependency: [if], data = [none] } } if(f_l > f_c) { if(f_r > f_c || Math.abs(f_r - f_c) < DELTA) { return ExtremumType.MINIMUM; // depends on control dependency: [if], data = [none] } } if(f_r > f_c) { if(f_l > f_c || Math.abs(f_l - f_c) < DELTA) { return ExtremumType.MINIMUM; // depends on control dependency: [if], data = [none] } } if(Math.abs(f_l - f_c) < DELTA && Math.abs(f_r - f_c) < DELTA) { return ExtremumType.CONSTANT; // depends on control dependency: [if], data = [none] } throw new IllegalArgumentException("Houston, we have a problem!\n" + this + // "\nf_l " + f_l + "\nf_c " + f_c + "\nf_r " + f_r + "\np " + vec + // "\nalpha " + FormatUtil.format(alpha_extreme_c) + // "\nalpha_l " + FormatUtil.format(alpha_extreme_l) + // "\nalpha_r " + FormatUtil.format(alpha_extreme_r) + "\nn " + n); // + "box min " + FormatUtil.format(interval.getMin()) + "\n" // + "box max " + FormatUtil.format(interval.getMax()) + "\n" } }
public class class_name { protected File exportParametersToXml() throws Exception { PluginConfigXmlDocument configDocument = PluginConfigXmlDocument.newInstance("liberty-plugin-config"); List<Profile> profiles = project.getActiveProfiles(); configDocument.createActiveBuildProfilesElement("activeBuildProfiles", profiles); configDocument.createElement("installDirectory", installDirectory); configDocument.createElement("serverDirectory", serverDirectory); configDocument.createElement("userDirectory", userDirectory); configDocument.createElement("serverOutputDirectory", new File(outputDirectory, serverName)); configDocument.createElement("serverName", serverName); configDocument.createElement("configDirectory", configDirectory); if (getFileFromConfigDirectory("server.xml", configFile) != null) { configDocument.createElement("configFile", getFileFromConfigDirectory("server.xml", configFile)); } if (bootstrapProperties != null && getFileFromConfigDirectory("bootstrap.properties") == null) { configDocument.createElement("bootstrapProperties", bootstrapProperties); } else { configDocument.createElement("bootstrapPropertiesFile", getFileFromConfigDirectory("bootstrap.properties", bootstrapPropertiesFile)); } if (jvmOptions != null && getFileFromConfigDirectory("jvm.options") == null) { configDocument.createElement("jvmOptions", jvmOptions); } else { configDocument.createElement("jvmOptionsFile", getFileFromConfigDirectory("jvm.options", jvmOptionsFile)); } if (getFileFromConfigDirectory("server.env", serverEnv) != null) { configDocument.createElement("serverEnv", getFileFromConfigDirectory("server.env", serverEnv)); } configDocument.createElement("appsDirectory", getAppsDirectory()); configDocument.createElement("looseApplication", looseApplication); configDocument.createElement("stripVersion", stripVersion); configDocument.createElement("installAppPackages", getInstallAppPackages()); configDocument.createElement("applicationFilename", getApplicationFilename()); configDocument.createElement("assemblyArtifact", assemblyArtifact); configDocument.createElement("assemblyArchive", assemblyArchive); configDocument.createElement("assemblyInstallDirectory", assemblyInstallDirectory); configDocument.createElement("refresh", refresh); configDocument.createElement("install", install); configDocument.createElement("installAppsConfigDropins", ApplicationXmlDocument.getApplicationXmlFile(serverDirectory)); configDocument.createElement("projectType", project.getPackaging()); if (project.getParent() != null && !project.getParent().getModules().isEmpty()) { configDocument.createElement("aggregatorParentId", project.getParent().getArtifactId()); configDocument.createElement("aggregatorParentBasedir", project.getParent().getBasedir()); } // returns all current project compile dependencies, including // transitive dependencies // if Mojo required dependencyScope is set to COMPILE Set<Artifact> artifacts = project.getArtifacts(); for (Artifact artifact : artifacts) { if ("compile".equals(artifact.getScope()) || "runtime".equals(artifact.getScope())) { configDocument.createElement("projectCompileDependency", artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion()); } } // include warSourceDirectory for liberty-assembly project with source configDocument.createElement("warSourceDirectory", getLibertyAssemblyWarSourceDirectory(project)); // write XML document to file File f = new File(project.getBuild().getDirectory() + File.separator + PLUGIN_CONFIG_XML); configDocument.writeXMLDocument(f); return f; } }
public class class_name { protected File exportParametersToXml() throws Exception { PluginConfigXmlDocument configDocument = PluginConfigXmlDocument.newInstance("liberty-plugin-config"); List<Profile> profiles = project.getActiveProfiles(); configDocument.createActiveBuildProfilesElement("activeBuildProfiles", profiles); configDocument.createElement("installDirectory", installDirectory); configDocument.createElement("serverDirectory", serverDirectory); configDocument.createElement("userDirectory", userDirectory); configDocument.createElement("serverOutputDirectory", new File(outputDirectory, serverName)); configDocument.createElement("serverName", serverName); configDocument.createElement("configDirectory", configDirectory); if (getFileFromConfigDirectory("server.xml", configFile) != null) { configDocument.createElement("configFile", getFileFromConfigDirectory("server.xml", configFile)); } if (bootstrapProperties != null && getFileFromConfigDirectory("bootstrap.properties") == null) { configDocument.createElement("bootstrapProperties", bootstrapProperties); } else { configDocument.createElement("bootstrapPropertiesFile", getFileFromConfigDirectory("bootstrap.properties", bootstrapPropertiesFile)); } if (jvmOptions != null && getFileFromConfigDirectory("jvm.options") == null) { configDocument.createElement("jvmOptions", jvmOptions); } else { configDocument.createElement("jvmOptionsFile", getFileFromConfigDirectory("jvm.options", jvmOptionsFile)); } if (getFileFromConfigDirectory("server.env", serverEnv) != null) { configDocument.createElement("serverEnv", getFileFromConfigDirectory("server.env", serverEnv)); } configDocument.createElement("appsDirectory", getAppsDirectory()); configDocument.createElement("looseApplication", looseApplication); configDocument.createElement("stripVersion", stripVersion); configDocument.createElement("installAppPackages", getInstallAppPackages()); configDocument.createElement("applicationFilename", getApplicationFilename()); configDocument.createElement("assemblyArtifact", assemblyArtifact); configDocument.createElement("assemblyArchive", assemblyArchive); configDocument.createElement("assemblyInstallDirectory", assemblyInstallDirectory); configDocument.createElement("refresh", refresh); configDocument.createElement("install", install); configDocument.createElement("installAppsConfigDropins", ApplicationXmlDocument.getApplicationXmlFile(serverDirectory)); configDocument.createElement("projectType", project.getPackaging()); if (project.getParent() != null && !project.getParent().getModules().isEmpty()) { configDocument.createElement("aggregatorParentId", project.getParent().getArtifactId()); configDocument.createElement("aggregatorParentBasedir", project.getParent().getBasedir()); } // returns all current project compile dependencies, including // transitive dependencies // if Mojo required dependencyScope is set to COMPILE Set<Artifact> artifacts = project.getArtifacts(); for (Artifact artifact : artifacts) { if ("compile".equals(artifact.getScope()) || "runtime".equals(artifact.getScope())) { configDocument.createElement("projectCompileDependency", artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion()); // depends on control dependency: [if], data = [none] } } // include warSourceDirectory for liberty-assembly project with source configDocument.createElement("warSourceDirectory", getLibertyAssemblyWarSourceDirectory(project)); // write XML document to file File f = new File(project.getBuild().getDirectory() + File.separator + PLUGIN_CONFIG_XML); configDocument.writeXMLDocument(f); return f; } }
public class class_name { private MBeanAttributeConfig makeConfigMBeanAttribute(ObjectName mBeanName, MBeanAttributeInfo attributeInfo) { // type determines if this should be composite Object attr; try { attr = mBeanServer.getAttribute(mBeanName, attributeInfo.getName()); MBeanAttributeConfig config = new MBeanAttributeConfig(); config.addField("name", attributeInfo.getName()); if (attr == null) { return null; } else if (attr instanceof CompositeData) { addComposites(config, (CompositeData) attr); } else { config.addField("type", translateDataType(attributeInfo.getType())); } return config; } catch (RuntimeMBeanException e) { System.err.println(e.getMessage()); } catch (AttributeNotFoundException e) { System.err.println(e.getMessage()); } catch (InstanceNotFoundException e) { System.err.println(e.getMessage()); } catch (MBeanException e) { System.err.println(e.getMessage()); } catch (ReflectionException e) { System.err.println(e.getMessage()); } return null; } }
public class class_name { private MBeanAttributeConfig makeConfigMBeanAttribute(ObjectName mBeanName, MBeanAttributeInfo attributeInfo) { // type determines if this should be composite Object attr; try { attr = mBeanServer.getAttribute(mBeanName, attributeInfo.getName()); // depends on control dependency: [try], data = [none] MBeanAttributeConfig config = new MBeanAttributeConfig(); config.addField("name", attributeInfo.getName()); // depends on control dependency: [try], data = [none] if (attr == null) { return null; // depends on control dependency: [if], data = [none] } else if (attr instanceof CompositeData) { addComposites(config, (CompositeData) attr); // depends on control dependency: [if], data = [none] } else { config.addField("type", translateDataType(attributeInfo.getType())); // depends on control dependency: [if], data = [none] } return config; // depends on control dependency: [try], data = [none] } catch (RuntimeMBeanException e) { System.err.println(e.getMessage()); } catch (AttributeNotFoundException e) { // depends on control dependency: [catch], data = [none] System.err.println(e.getMessage()); } catch (InstanceNotFoundException e) { // depends on control dependency: [catch], data = [none] System.err.println(e.getMessage()); } catch (MBeanException e) { // depends on control dependency: [catch], data = [none] System.err.println(e.getMessage()); } catch (ReflectionException e) { // depends on control dependency: [catch], data = [none] System.err.println(e.getMessage()); } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { private boolean rewriteAllSubclassInheritedAccesses( Name superclassNameObj, Ref superclassRef, Name prop, GlobalNamespace namespace) { if (!prop.canCollapse()) { return false; // inlining is a) unnecessary if there is @nocollapse and b) might break // usages of `this` in the method } Node subclass = getSubclassForEs6Superclass(superclassRef.getNode()); if (subclass == null || !subclass.isQualifiedName()) { return false; } String subclassName = subclass.getQualifiedName(); String subclassQualifiedPropName = subclassName + "." + prop.getBaseName(); Name subclassPropNameObj = namespace.getOwnSlot(subclassQualifiedPropName); // Don't rewrite if the subclass ever shadows the parent static property. // This may also back off on cases where the subclass first accesses the parent property, then // shadows it. if (subclassPropNameObj != null && (subclassPropNameObj.getLocalSets() > 0 || subclassPropNameObj.getGlobalSets() > 0)) { return false; } // Recurse to find potential sub-subclass accesses of the superclass property. Name subclassNameObj = namespace.getOwnSlot(subclassName); if (subclassNameObj != null && subclassNameObj.subclassingGets > 0) { for (Ref ref : subclassNameObj.getRefs()) { if (ref.type == Type.SUBCLASSING_GET) { rewriteAllSubclassInheritedAccesses(superclassNameObj, ref, prop, namespace); } } } if (subclassPropNameObj != null) { Set<AstChange> newNodes = new LinkedHashSet<>(); // Use this node as a template for rewriteNestedAliasReference. Node superclassNameNode = superclassNameObj.getDeclaration().getNode(); if (superclassNameNode.isName()) { superclassNameNode = superclassNameNode.cloneNode(); } else if (superclassNameNode.isGetProp()) { superclassNameNode = superclassNameNode.cloneTree(); } else { return false; } rewriteNestedAliasReference(superclassNameNode, 0, newNodes, subclassPropNameObj); namespace.scanNewNodes(newNodes); } return true; } }
public class class_name { private boolean rewriteAllSubclassInheritedAccesses( Name superclassNameObj, Ref superclassRef, Name prop, GlobalNamespace namespace) { if (!prop.canCollapse()) { return false; // inlining is a) unnecessary if there is @nocollapse and b) might break // depends on control dependency: [if], data = [none] // usages of `this` in the method } Node subclass = getSubclassForEs6Superclass(superclassRef.getNode()); if (subclass == null || !subclass.isQualifiedName()) { return false; // depends on control dependency: [if], data = [none] } String subclassName = subclass.getQualifiedName(); String subclassQualifiedPropName = subclassName + "." + prop.getBaseName(); Name subclassPropNameObj = namespace.getOwnSlot(subclassQualifiedPropName); // Don't rewrite if the subclass ever shadows the parent static property. // This may also back off on cases where the subclass first accesses the parent property, then // shadows it. if (subclassPropNameObj != null && (subclassPropNameObj.getLocalSets() > 0 || subclassPropNameObj.getGlobalSets() > 0)) { return false; // depends on control dependency: [if], data = [none] } // Recurse to find potential sub-subclass accesses of the superclass property. Name subclassNameObj = namespace.getOwnSlot(subclassName); if (subclassNameObj != null && subclassNameObj.subclassingGets > 0) { for (Ref ref : subclassNameObj.getRefs()) { if (ref.type == Type.SUBCLASSING_GET) { rewriteAllSubclassInheritedAccesses(superclassNameObj, ref, prop, namespace); // depends on control dependency: [if], data = [none] } } } if (subclassPropNameObj != null) { Set<AstChange> newNodes = new LinkedHashSet<>(); // Use this node as a template for rewriteNestedAliasReference. Node superclassNameNode = superclassNameObj.getDeclaration().getNode(); if (superclassNameNode.isName()) { superclassNameNode = superclassNameNode.cloneNode(); // depends on control dependency: [if], data = [none] } else if (superclassNameNode.isGetProp()) { superclassNameNode = superclassNameNode.cloneTree(); // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } rewriteNestedAliasReference(superclassNameNode, 0, newNodes, subclassPropNameObj); // depends on control dependency: [if], data = [none] namespace.scanNewNodes(newNodes); // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { private void flattenPrefixes(String alias, Name n, int depth) { // Only flatten the prefix of a name declaration if the name being // initialized is fully qualified (i.e. not an object literal key). String originalName = n.getFullName(); Ref decl = n.getDeclaration(); if (decl != null && decl.getNode() != null && decl.getNode().isGetProp()) { flattenNameRefAtDepth(alias, decl.getNode(), depth, originalName); } for (Ref r : n.getRefs()) { if (r == decl) { // Declarations are handled separately. continue; } // References inside a complex assign (a = x.y = 0) // have twins. We should only flatten one of the twins. if (r.getTwin() == null || r.isSet()) { flattenNameRefAtDepth(alias, r.getNode(), depth, originalName); } } if (n.props != null) { for (Name p : n.props) { flattenPrefixes(alias, p, depth + 1); } } } }
public class class_name { private void flattenPrefixes(String alias, Name n, int depth) { // Only flatten the prefix of a name declaration if the name being // initialized is fully qualified (i.e. not an object literal key). String originalName = n.getFullName(); Ref decl = n.getDeclaration(); if (decl != null && decl.getNode() != null && decl.getNode().isGetProp()) { flattenNameRefAtDepth(alias, decl.getNode(), depth, originalName); // depends on control dependency: [if], data = [none] } for (Ref r : n.getRefs()) { if (r == decl) { // Declarations are handled separately. continue; } // References inside a complex assign (a = x.y = 0) // have twins. We should only flatten one of the twins. if (r.getTwin() == null || r.isSet()) { flattenNameRefAtDepth(alias, r.getNode(), depth, originalName); // depends on control dependency: [if], data = [none] } } if (n.props != null) { for (Name p : n.props) { flattenPrefixes(alias, p, depth + 1); // depends on control dependency: [for], data = [p] } } } }
public class class_name { void clear() { // This is volatile, read once for performance. final String name = loggerName; if (name != null) { CHANGE_LOGGER_CONTEXT_LOCK.lock(); try { loggerContext.stop(); final Logger logger = loggerContext.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME); logger.detachAndStopAllAppenders(); // Additional cleanup/reset for this name configureLoggers(name); } finally { CHANGE_LOGGER_CONTEXT_LOCK.unlock(); } StatusPrinter.setPrintStream(System.out); } } }
public class class_name { void clear() { // This is volatile, read once for performance. final String name = loggerName; if (name != null) { CHANGE_LOGGER_CONTEXT_LOCK.lock(); // depends on control dependency: [if], data = [none] try { loggerContext.stop(); // depends on control dependency: [try], data = [none] final Logger logger = loggerContext.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME); logger.detachAndStopAllAppenders(); // depends on control dependency: [try], data = [none] // Additional cleanup/reset for this name configureLoggers(name); // depends on control dependency: [try], data = [none] } finally { CHANGE_LOGGER_CONTEXT_LOCK.unlock(); } StatusPrinter.setPrintStream(System.out); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void addListener(EventListener l) { if (l == null) { throw new NullPointerException(); } if (acceptsListener(l)) { synchronized (notifyLock) { if (listeners == null) { listeners = new ArrayList<EventListener>(); } else { // identity equality check for (EventListener ll : listeners) { if (ll == l) { return; } } } listeners.add(l); } } else { throw new IllegalStateException("Listener invalid for this notifier."); } } }
public class class_name { public void addListener(EventListener l) { if (l == null) { throw new NullPointerException(); } if (acceptsListener(l)) { synchronized (notifyLock) { // depends on control dependency: [if], data = [none] if (listeners == null) { listeners = new ArrayList<EventListener>(); // depends on control dependency: [if], data = [none] } else { // identity equality check for (EventListener ll : listeners) { if (ll == l) { return; // depends on control dependency: [if], data = [none] } } } listeners.add(l); } } else { throw new IllegalStateException("Listener invalid for this notifier."); } } }
public class class_name { @SuppressWarnings("unchecked") public T get(double coord) { if(coord == Double.NEGATIVE_INFINITY) { return getSpecial(0); } if(coord == Double.POSITIVE_INFINITY) { return getSpecial(1); } if(Double.isNaN(coord)) { return getSpecial(2); } int bin = getBinNr(coord); if(bin < 0) { if(size - bin > data.length) { // Reallocate. TODO: use an arraylist-like grow strategy! Object[] tmpdata = new Object[growSize(data.length, size - bin)]; System.arraycopy(data, 0, tmpdata, -bin, size); data = tmpdata; } else { // Shift in place System.arraycopy(data, 0, data, -bin, size); } for(int i = 0; i < -bin; i++) { data[i] = supplier.make(); } // Note that bin is negative, -bin is the shift offset! offset -= bin; size -= bin; // TODO: modCounter++; and have iterators fast-fail // Unset max value when resizing max = Double.MAX_VALUE; return (T) data[0]; } else if(bin >= size) { if(bin >= data.length) { Object[] tmpdata = new Object[growSize(data.length, bin + 1)]; System.arraycopy(data, 0, tmpdata, 0, size); data = tmpdata; } for(int i = size; i <= bin; i++) { data[i] = supplier.make(); } size = bin + 1; // TODO: modCounter++; and have iterators fast-fail // Unset max value when resizing max = Double.MAX_VALUE; return (T) data[bin]; } else { return (T) data[bin]; } } }
public class class_name { @SuppressWarnings("unchecked") public T get(double coord) { if(coord == Double.NEGATIVE_INFINITY) { return getSpecial(0); // depends on control dependency: [if], data = [none] } if(coord == Double.POSITIVE_INFINITY) { return getSpecial(1); // depends on control dependency: [if], data = [none] } if(Double.isNaN(coord)) { return getSpecial(2); // depends on control dependency: [if], data = [none] } int bin = getBinNr(coord); if(bin < 0) { if(size - bin > data.length) { // Reallocate. TODO: use an arraylist-like grow strategy! Object[] tmpdata = new Object[growSize(data.length, size - bin)]; System.arraycopy(data, 0, tmpdata, -bin, size); // depends on control dependency: [if], data = [none] data = tmpdata; // depends on control dependency: [if], data = [none] } else { // Shift in place System.arraycopy(data, 0, data, -bin, size); // depends on control dependency: [if], data = [none] } for(int i = 0; i < -bin; i++) { data[i] = supplier.make(); // depends on control dependency: [for], data = [i] } // Note that bin is negative, -bin is the shift offset! offset -= bin; // depends on control dependency: [if], data = [none] size -= bin; // depends on control dependency: [if], data = [none] // TODO: modCounter++; and have iterators fast-fail // Unset max value when resizing max = Double.MAX_VALUE; // depends on control dependency: [if], data = [none] return (T) data[0]; // depends on control dependency: [if], data = [none] } else if(bin >= size) { if(bin >= data.length) { Object[] tmpdata = new Object[growSize(data.length, bin + 1)]; System.arraycopy(data, 0, tmpdata, 0, size); // depends on control dependency: [if], data = [none] data = tmpdata; // depends on control dependency: [if], data = [none] } for(int i = size; i <= bin; i++) { data[i] = supplier.make(); // depends on control dependency: [for], data = [i] } size = bin + 1; // depends on control dependency: [if], data = [none] // TODO: modCounter++; and have iterators fast-fail // Unset max value when resizing max = Double.MAX_VALUE; // depends on control dependency: [if], data = [none] return (T) data[bin]; // depends on control dependency: [if], data = [none] } else { return (T) data[bin]; // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean getBoolean(String attribute) { String s = get(attribute); if ("true".equals(s) || "1".equals(s)) { return true; } else if ("false".equals(s) || "0".equals(s)) { return false; } throw new IllegalArgumentException("Attribute " + attribute + " is non-boolean"); } }
public class class_name { public boolean getBoolean(String attribute) { String s = get(attribute); if ("true".equals(s) || "1".equals(s)) { return true; // depends on control dependency: [if], data = [none] } else if ("false".equals(s) || "0".equals(s)) { return false; // depends on control dependency: [if], data = [none] } throw new IllegalArgumentException("Attribute " + attribute + " is non-boolean"); } }
public class class_name { @Override protected List<Pair<Integer, Integer>> doGenerateEdges() { final int edgesPerNewNode = getConfiguration().getEdgesPerNewNode(); final long numberOfNodes = getConfiguration().getNumberOfNodes(); // Create a completely connected network final List<Pair<Integer, Integer>> edges = new CompleteGraphRelationshipGenerator(new NumberOfNodesBasedConfig(edgesPerNewNode + 1)).doGenerateEdges(); // Preferentially attach other nodes final Set<Integer> omit = new HashSet<>(edgesPerNewNode); for (int source = edgesPerNewNode + 1; source < numberOfNodes; source++) { omit.clear(); for (int edge = 0; edge < edgesPerNewNode; edge++) { while (true) { Pair<Integer, Integer> randomEdge = edges.get(random.nextInt(edges.size())); int target = random.nextBoolean() ? randomEdge.first() : randomEdge.other(); if (omit.contains(target)) { continue; } omit.add(target); // to avoid multi-edges edges.add(Pair.of(target, source)); break; } } } return edges; } }
public class class_name { @Override protected List<Pair<Integer, Integer>> doGenerateEdges() { final int edgesPerNewNode = getConfiguration().getEdgesPerNewNode(); final long numberOfNodes = getConfiguration().getNumberOfNodes(); // Create a completely connected network final List<Pair<Integer, Integer>> edges = new CompleteGraphRelationshipGenerator(new NumberOfNodesBasedConfig(edgesPerNewNode + 1)).doGenerateEdges(); // Preferentially attach other nodes final Set<Integer> omit = new HashSet<>(edgesPerNewNode); for (int source = edgesPerNewNode + 1; source < numberOfNodes; source++) { omit.clear(); // depends on control dependency: [for], data = [none] for (int edge = 0; edge < edgesPerNewNode; edge++) { while (true) { Pair<Integer, Integer> randomEdge = edges.get(random.nextInt(edges.size())); int target = random.nextBoolean() ? randomEdge.first() : randomEdge.other(); if (omit.contains(target)) { continue; } omit.add(target); // to avoid multi-edges // depends on control dependency: [while], data = [none] edges.add(Pair.of(target, source)); // depends on control dependency: [while], data = [none] break; } } } return edges; } }
public class class_name { @Override public void ensureJvmMembersInitialized() { if (jvmMemberInitializers == null) return; Set<Runnable> localRunnables = null; synchronized(this) { localRunnables = jvmMemberInitializers; jvmMemberInitializers = null; hasJvmMemberInitializers = false; } if (localRunnables == null) return; boolean wasDeliver = eDeliver(); LinkedHashSet<Triple<EObject, EReference, INode>> before = resolving; try { eSetDeliver(false); if (!before.isEmpty()) { resolving = new LinkedHashSet<Triple<EObject, EReference, INode>>(); } if (isInitializingJvmMembers) { throw new IllegalStateException("Reentrant attempt to initialize JvmMembers"); } try { isInitializingJvmMembers = true; for (Runnable runnable : localRunnables) { runnable.run(); } } finally { isInitializingJvmMembers = false; } } catch (Exception e) { log.error(e.getMessage(), e); } finally { if (!before.isEmpty()) { resolving = before; } eSetDeliver(wasDeliver); } } }
public class class_name { @Override public void ensureJvmMembersInitialized() { if (jvmMemberInitializers == null) return; Set<Runnable> localRunnables = null; synchronized(this) { localRunnables = jvmMemberInitializers; jvmMemberInitializers = null; hasJvmMemberInitializers = false; } if (localRunnables == null) return; boolean wasDeliver = eDeliver(); LinkedHashSet<Triple<EObject, EReference, INode>> before = resolving; try { eSetDeliver(false); // depends on control dependency: [try], data = [none] if (!before.isEmpty()) { resolving = new LinkedHashSet<Triple<EObject, EReference, INode>>(); // depends on control dependency: [if], data = [none] } if (isInitializingJvmMembers) { throw new IllegalStateException("Reentrant attempt to initialize JvmMembers"); } try { isInitializingJvmMembers = true; // depends on control dependency: [try], data = [none] for (Runnable runnable : localRunnables) { runnable.run(); // depends on control dependency: [for], data = [runnable] } } finally { isInitializingJvmMembers = false; } } catch (Exception e) { log.error(e.getMessage(), e); } finally { // depends on control dependency: [catch], data = [none] if (!before.isEmpty()) { resolving = before; // depends on control dependency: [if], data = [none] } eSetDeliver(wasDeliver); } } }
public class class_name { private void start() { try { // Initialize filter. initializeFilter( getFilterInput(), getFilterOutput()); // Start filter thread. failure_ = null; thread_ = new Thread( this, String.valueOf( this)); thread_.start(); } catch( Exception e) { throw new RuntimeException( "Can't start filtering", e); } } }
public class class_name { private void start() { try { // Initialize filter. initializeFilter( getFilterInput(), getFilterOutput()); // depends on control dependency: [try], data = [none] // Start filter thread. failure_ = null; // depends on control dependency: [try], data = [none] thread_ = new Thread( this, String.valueOf( this)); // depends on control dependency: [try], data = [none] thread_.start(); // depends on control dependency: [try], data = [none] } catch( Exception e) { throw new RuntimeException( "Can't start filtering", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public String pageHtmlStyle(int segment, String title, String stylesheet) { if (segment == HTML_START) { StringBuffer result = new StringBuffer(512); result.append("<!DOCTYPE html>\n"); result.append("<html>\n<head>\n"); if (title != null) { result.append("<title>"); result.append(title); result.append("</title>\n"); } result.append("<meta HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset="); result.append(getEncoding()); result.append("\">\n"); result.append("<link rel=\"stylesheet\" type=\"text/css\" href=\""); result.append(getStyleUri(getJsp(), stylesheet == null ? "workplace.css" : stylesheet)); result.append("\">\n"); return result.toString(); } else { return "</html>"; } } }
public class class_name { public String pageHtmlStyle(int segment, String title, String stylesheet) { if (segment == HTML_START) { StringBuffer result = new StringBuffer(512); result.append("<!DOCTYPE html>\n"); // depends on control dependency: [if], data = [none] result.append("<html>\n<head>\n"); // depends on control dependency: [if], data = [none] if (title != null) { result.append("<title>"); // depends on control dependency: [if], data = [none] result.append(title); // depends on control dependency: [if], data = [(title] result.append("</title>\n"); // depends on control dependency: [if], data = [none] } result.append("<meta HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset="); // depends on control dependency: [if], data = [none] result.append(getEncoding()); // depends on control dependency: [if], data = [none] result.append("\">\n"); // depends on control dependency: [if], data = [none] result.append("<link rel=\"stylesheet\" type=\"text/css\" href=\""); // depends on control dependency: [if], data = [none] result.append(getStyleUri(getJsp(), stylesheet == null ? "workplace.css" : stylesheet)); // depends on control dependency: [if], data = [none] result.append("\">\n"); // depends on control dependency: [if], data = [none] return result.toString(); // depends on control dependency: [if], data = [none] } else { return "</html>"; // depends on control dependency: [if], data = [none] } } }
public class class_name { public AbstractRelationship getRelationship(final String id, final String nodeId) { if (id == null) { return null; } if (nodeId == null) { return getRelationship(id); } final SecurityContext securityContext = getWebSocket().getSecurityContext(); final App app = StructrApp.getInstance(securityContext); try (final Tx tx = app.tx()) { final AbstractNode node = (AbstractNode) app.getNodeById(nodeId); for (final AbstractRelationship rel : node.getRelationships()) { if (rel.getUuid().equals(id)) { return rel; } } tx.success(); } catch (FrameworkException fex) { logger.warn("Unable to get relationship", fex); } return null; } }
public class class_name { public AbstractRelationship getRelationship(final String id, final String nodeId) { if (id == null) { return null; // depends on control dependency: [if], data = [none] } if (nodeId == null) { return getRelationship(id); // depends on control dependency: [if], data = [none] } final SecurityContext securityContext = getWebSocket().getSecurityContext(); final App app = StructrApp.getInstance(securityContext); try (final Tx tx = app.tx()) { final AbstractNode node = (AbstractNode) app.getNodeById(nodeId); for (final AbstractRelationship rel : node.getRelationships()) { if (rel.getUuid().equals(id)) { return rel; // depends on control dependency: [if], data = [none] } } tx.success(); } catch (FrameworkException fex) { logger.warn("Unable to get relationship", fex); } return null; } }
public class class_name { @Override protected Type getReturnType(final int mOp1, final int mOp2) throws TTXPathException { Type type1; Type type2; try { type1 = Type.getType(mOp1).getPrimitiveBaseType(); type2 = Type.getType(mOp2).getPrimitiveBaseType(); } catch (final IllegalStateException e) { throw new XPathError(ErrorType.XPTY0004); } if (type1.isNumericType() && type2.isNumericType()) { // if both have the same numeric type, return it if (type1 == type2) { return type1; } if (type1 == Type.DOUBLE || type2 == Type.DOUBLE) { return Type.DOUBLE; } else if (type1 == Type.FLOAT || type2 == Type.FLOAT) { return Type.FLOAT; } else { assert (type1 == Type.DECIMAL || type2 == Type.DECIMAL); return Type.DECIMAL; } } else { switch (type1) { case DATE: if (type2 == Type.YEAR_MONTH_DURATION || type2 == Type.DAY_TIME_DURATION) { return type1; } else if (type2 == Type.DATE) { return Type.DAY_TIME_DURATION; } break; case TIME: if (type2 == Type.DAY_TIME_DURATION) { return type1; } else if (type2 == Type.TIME) { return Type.DAY_TIME_DURATION; } break; case DATE_TIME: if (type2 == Type.YEAR_MONTH_DURATION || type2 == Type.DAY_TIME_DURATION) { return type1; } else if (type2 == Type.DATE_TIME) { return Type.DAY_TIME_DURATION; } break; case YEAR_MONTH_DURATION: if (type2 == Type.YEAR_MONTH_DURATION) { return type2; } break; case DAY_TIME_DURATION: if (type2 == Type.DAY_TIME_DURATION) { return type2; } break; default: throw new XPathError(ErrorType.XPTY0004); } throw new XPathError(ErrorType.XPTY0004); } } }
public class class_name { @Override protected Type getReturnType(final int mOp1, final int mOp2) throws TTXPathException { Type type1; Type type2; try { type1 = Type.getType(mOp1).getPrimitiveBaseType(); type2 = Type.getType(mOp2).getPrimitiveBaseType(); } catch (final IllegalStateException e) { throw new XPathError(ErrorType.XPTY0004); } if (type1.isNumericType() && type2.isNumericType()) { // if both have the same numeric type, return it if (type1 == type2) { return type1; // depends on control dependency: [if], data = [none] } if (type1 == Type.DOUBLE || type2 == Type.DOUBLE) { return Type.DOUBLE; // depends on control dependency: [if], data = [none] } else if (type1 == Type.FLOAT || type2 == Type.FLOAT) { return Type.FLOAT; // depends on control dependency: [if], data = [none] } else { assert (type1 == Type.DECIMAL || type2 == Type.DECIMAL); // depends on control dependency: [if], data = [(type1] return Type.DECIMAL; // depends on control dependency: [if], data = [none] } } else { switch (type1) { case DATE: if (type2 == Type.YEAR_MONTH_DURATION || type2 == Type.DAY_TIME_DURATION) { return type1; // depends on control dependency: [if], data = [none] } else if (type2 == Type.DATE) { return Type.DAY_TIME_DURATION; // depends on control dependency: [if], data = [none] } break; case TIME: if (type2 == Type.DAY_TIME_DURATION) { return type1; // depends on control dependency: [if], data = [none] } else if (type2 == Type.TIME) { return Type.DAY_TIME_DURATION; // depends on control dependency: [if], data = [none] } break; case DATE_TIME: if (type2 == Type.YEAR_MONTH_DURATION || type2 == Type.DAY_TIME_DURATION) { return type1; // depends on control dependency: [if], data = [none] } else if (type2 == Type.DATE_TIME) { return Type.DAY_TIME_DURATION; // depends on control dependency: [if], data = [none] } break; case YEAR_MONTH_DURATION: if (type2 == Type.YEAR_MONTH_DURATION) { return type2; // depends on control dependency: [if], data = [none] } break; case DAY_TIME_DURATION: if (type2 == Type.DAY_TIME_DURATION) { return type2; // depends on control dependency: [if], data = [none] } break; default: throw new XPathError(ErrorType.XPTY0004); } throw new XPathError(ErrorType.XPTY0004); } } }
public class class_name { static public BigDecimal cosh(final BigDecimal x) { if (x.compareTo(BigDecimal.ZERO) < 0) { return cos(x.negate()); } else if (x.compareTo(BigDecimal.ZERO) == 0) { return BigDecimal.ONE; } else { if (x.doubleValue() > 1.5) { /* cosh^2(x) = 1+ sinh^2(x). */ return hypot(1, sinh(x)); } else { BigDecimal xhighpr = scalePrec(x, 2); /* Simple Taylor expansion, sum_{0=1..infinity} x^(2i)/(2i)! */ BigDecimal resul = BigDecimal.ONE; /* x^i */ BigDecimal xpowi = BigDecimal.ONE; /* 2i factorial */ BigInteger ifac = BigInteger.ONE; /* The absolute error in the result is the error in x^2/2 which is x times the error in x. */ double xUlpDbl = 0.5 * x.ulp().doubleValue() * x.doubleValue(); /* The error in the result is set by the error in x^2/2 itself, xUlpDbl. * We need at most k terms to push x^(2k)/(2k)! below this value. * x^(2k) < xUlpDbl; (2k)*log(x) < log(xUlpDbl); */ int k = (int) (Math.log(xUlpDbl) / Math.log(x.doubleValue())) / 2; /* The individual terms are all smaller than 1, so an estimate of 1.0 for * the absolute value will give a safe relative error estimate for the indivdual terms */ MathContext mcTay = new MathContext(err2prec(1., xUlpDbl / k)); for (int i = 1;; i++) { /* TBD: at which precision will 2*i-1 or 2*i overflow? */ ifac = ifac.multiply(BigInteger.valueOf(2 * i - 1)); ifac = ifac.multiply(BigInteger.valueOf(2 * i)); xpowi = xpowi.multiply(xhighpr).multiply(xhighpr); BigDecimal corr = xpowi.divide(new BigDecimal(ifac), mcTay); resul = resul.add(corr); if (corr.abs().doubleValue() < 0.5 * xUlpDbl) { break; } } /* The error in the result is governed by the error in x itself. */ MathContext mc = new MathContext(err2prec(resul.doubleValue(), xUlpDbl)); return resul.round(mc); } } } }
public class class_name { static public BigDecimal cosh(final BigDecimal x) { if (x.compareTo(BigDecimal.ZERO) < 0) { return cos(x.negate()); // depends on control dependency: [if], data = [none] } else if (x.compareTo(BigDecimal.ZERO) == 0) { return BigDecimal.ONE; // depends on control dependency: [if], data = [none] } else { if (x.doubleValue() > 1.5) { /* cosh^2(x) = 1+ sinh^2(x). */ return hypot(1, sinh(x)); // depends on control dependency: [if], data = [none] } else { BigDecimal xhighpr = scalePrec(x, 2); /* Simple Taylor expansion, sum_{0=1..infinity} x^(2i)/(2i)! */ BigDecimal resul = BigDecimal.ONE; /* x^i */ BigDecimal xpowi = BigDecimal.ONE; /* 2i factorial */ BigInteger ifac = BigInteger.ONE; /* The absolute error in the result is the error in x^2/2 which is x times the error in x. */ double xUlpDbl = 0.5 * x.ulp().doubleValue() * x.doubleValue(); /* The error in the result is set by the error in x^2/2 itself, xUlpDbl. * We need at most k terms to push x^(2k)/(2k)! below this value. * x^(2k) < xUlpDbl; (2k)*log(x) < log(xUlpDbl); */ int k = (int) (Math.log(xUlpDbl) / Math.log(x.doubleValue())) / 2; /* The individual terms are all smaller than 1, so an estimate of 1.0 for * the absolute value will give a safe relative error estimate for the indivdual terms */ MathContext mcTay = new MathContext(err2prec(1., xUlpDbl / k)); for (int i = 1;; i++) { /* TBD: at which precision will 2*i-1 or 2*i overflow? */ ifac = ifac.multiply(BigInteger.valueOf(2 * i - 1)); // depends on control dependency: [for], data = [i] ifac = ifac.multiply(BigInteger.valueOf(2 * i)); // depends on control dependency: [for], data = [i] xpowi = xpowi.multiply(xhighpr).multiply(xhighpr); // depends on control dependency: [for], data = [none] BigDecimal corr = xpowi.divide(new BigDecimal(ifac), mcTay); resul = resul.add(corr); // depends on control dependency: [for], data = [none] if (corr.abs().doubleValue() < 0.5 * xUlpDbl) { break; } } /* The error in the result is governed by the error in x itself. */ MathContext mc = new MathContext(err2prec(resul.doubleValue(), xUlpDbl)); return resul.round(mc); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static void setVCConnectionType(VirtualConnection vc, ConnectionType connType) { if (vc == null || connType == null) { return; } Map<Object, Object> map = vc.getStateMap(); // Internal connections are both inbound and outbound (they're connections // to ourselves) // so while we prevent setting Outbound ConnTypes for inbound connections // and vice versa, // we don't prevent internal types from being set as either. if (vc instanceof InboundVirtualConnection && ConnectionType.isOutbound(connType.type)) { throw new IllegalStateException("Cannot set outbound ConnectionType on inbound VirtualConnection"); } else if (vc instanceof OutboundVirtualConnection && ConnectionType.isInbound(connType.type)) { throw new IllegalStateException("Cannot set inbound ConnectionType on outbound VirtualConnection"); } map.put(CONNECTION_TYPE_VC_KEY, connType); } }
public class class_name { public static void setVCConnectionType(VirtualConnection vc, ConnectionType connType) { if (vc == null || connType == null) { return; // depends on control dependency: [if], data = [none] } Map<Object, Object> map = vc.getStateMap(); // Internal connections are both inbound and outbound (they're connections // to ourselves) // so while we prevent setting Outbound ConnTypes for inbound connections // and vice versa, // we don't prevent internal types from being set as either. if (vc instanceof InboundVirtualConnection && ConnectionType.isOutbound(connType.type)) { throw new IllegalStateException("Cannot set outbound ConnectionType on inbound VirtualConnection"); } else if (vc instanceof OutboundVirtualConnection && ConnectionType.isInbound(connType.type)) { throw new IllegalStateException("Cannot set inbound ConnectionType on outbound VirtualConnection"); } map.put(CONNECTION_TYPE_VC_KEY, connType); } }
public class class_name { public boolean add(SpdData data) { if (data == null) return false; if (data instanceof SpdDouble) { return super.add(data); } else { return false; } } }
public class class_name { public boolean add(SpdData data) { if (data == null) return false; if (data instanceof SpdDouble) { return super.add(data); // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void buildIndex(CveDB cve) throws IndexException { try (Analyzer analyzer = createSearchingAnalyzer(); IndexWriter indexWriter = new IndexWriter(index, new IndexWriterConfig(analyzer))) { final FieldType ft = new FieldType(TextField.TYPE_STORED); //ignore term frequency ft.setIndexOptions(IndexOptions.DOCS); //ignore field length normalization ft.setOmitNorms(true); // Tip: reuse the Document and Fields for performance... // See "Re-use Document and Field instances" from // http://wiki.apache.org/lucene-java/ImproveIndexingSpeed final Document doc = new Document(); final Field v = new Field(Fields.VENDOR, Fields.VENDOR, ft); final Field p = new Field(Fields.PRODUCT, Fields.PRODUCT, ft); doc.add(v); doc.add(p); final Set<Pair<String, String>> data = cve.getVendorProductList(); for (Pair<String, String> pair : data) { if (pair.getLeft() != null && pair.getRight() != null) { v.setStringValue(pair.getLeft()); p.setStringValue(pair.getRight()); indexWriter.addDocument(doc); resetAnalyzers(); } } indexWriter.commit(); } catch (DatabaseException ex) { LOGGER.debug("", ex); throw new IndexException("Error reading CPE data", ex); } catch (IOException ex) { throw new IndexException("Unable to close an in-memory index", ex); } } }
public class class_name { private void buildIndex(CveDB cve) throws IndexException { try (Analyzer analyzer = createSearchingAnalyzer(); IndexWriter indexWriter = new IndexWriter(index, new IndexWriterConfig(analyzer))) { final FieldType ft = new FieldType(TextField.TYPE_STORED); //ignore term frequency ft.setIndexOptions(IndexOptions.DOCS); //ignore field length normalization ft.setOmitNorms(true); // Tip: reuse the Document and Fields for performance... // See "Re-use Document and Field instances" from // http://wiki.apache.org/lucene-java/ImproveIndexingSpeed final Document doc = new Document(); final Field v = new Field(Fields.VENDOR, Fields.VENDOR, ft); final Field p = new Field(Fields.PRODUCT, Fields.PRODUCT, ft); doc.add(v); doc.add(p); final Set<Pair<String, String>> data = cve.getVendorProductList(); for (Pair<String, String> pair : data) { if (pair.getLeft() != null && pair.getRight() != null) { v.setStringValue(pair.getLeft()); // depends on control dependency: [if], data = [(pair.getLeft()] p.setStringValue(pair.getRight()); // depends on control dependency: [if], data = [none] indexWriter.addDocument(doc); // depends on control dependency: [if], data = [none] resetAnalyzers(); // depends on control dependency: [if], data = [none] } } indexWriter.commit(); } catch (DatabaseException ex) { LOGGER.debug("", ex); throw new IndexException("Error reading CPE data", ex); } catch (IOException ex) { throw new IndexException("Unable to close an in-memory index", ex); } } }
public class class_name { void put( Conjunction selector, MatchTarget object, InternTable subExpr) throws MatchingException { SimpleTest test = Factory.findTest(ordinalPosition, selector); if (test == null) super.put(selector, object, subExpr); else { ContentMatcher next; if (test.getKind() == SimpleTest.NULL) next = nullChild = nextMatcher(selector, nullChild); else if (test.getKind() == SimpleTest.NOTNULL) next = notNullChild = nextMatcher(selector, notNullChild); else { handlePut(test, selector, object, subExpr); return; } next.put(selector, object, subExpr); } } }
public class class_name { void put( Conjunction selector, MatchTarget object, InternTable subExpr) throws MatchingException { SimpleTest test = Factory.findTest(ordinalPosition, selector); if (test == null) super.put(selector, object, subExpr); else { ContentMatcher next; if (test.getKind() == SimpleTest.NULL) next = nullChild = nextMatcher(selector, nullChild); else if (test.getKind() == SimpleTest.NOTNULL) next = notNullChild = nextMatcher(selector, notNullChild); else { handlePut(test, selector, object, subExpr); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } next.put(selector, object, subExpr); } } }
public class class_name { public static <D> SimpleExpression<D> as(Expression<D> source, Path<D> alias) { if (source == null) { return as(Expressions.<D>nullExpression(), alias); } else { return operation(alias.getType(), Ops.ALIAS, source, alias); } } }
public class class_name { public static <D> SimpleExpression<D> as(Expression<D> source, Path<D> alias) { if (source == null) { return as(Expressions.<D>nullExpression(), alias); // depends on control dependency: [if], data = [none] } else { return operation(alias.getType(), Ops.ALIAS, source, alias); // depends on control dependency: [if], data = [none] } } }
public class class_name { @FFDCIgnore(Throwable.class) void run() { final boolean trace = TraceComponent.isAnyTracingEnabled(); if (!state.setRunning()) { if (trace && tc.isDebugEnabled()) Tr.debug(this, tc, "unable to run", state.get()); nsRunEnd = System.nanoTime(); if (callback != null) callback.onEnd(task, this, null, true, 0, null); // aborted, queued task will never run return; } boolean aborted = true; Object callbackContext = null; thread = Thread.currentThread(); try { if (callback == null) aborted = false; else { callbackContext = callback.onStart(task, this); aborted = state.get() == CANCELED; } if (aborted) nsRunEnd = System.nanoTime(); else { T t; if (callable == null) { runnable.run(); t = predefinedResult; } else { t = callable.call(); } nsRunEnd = System.nanoTime(); if (result.compareAndSet(state, t)) { state.releaseShared(SUCCESSFUL); if (latch != null) latch.countDown(t); } else if (Integer.valueOf(CANCELED).equals(result.get())) { if (trace && tc.isDebugEnabled()) Tr.debug(this, tc, "canceled during/after run"); // Prevent dirty read of state during onEnd before the canceling thread transitions the state to CANCELING/CANCELED while (state.get() == RUNNING) Thread.yield(); } if (trace && tc.isDebugEnabled()) Tr.debug(this, tc, "run", t); } if (callback != null) try { callback.onEnd(task, this, callbackContext, aborted, 0, null); } catch (Throwable x) { } } catch (Throwable x) { if (trace && tc.isDebugEnabled()) Tr.debug(this, tc, "run", x); nsRunEnd = System.nanoTime(); if (result.compareAndSet(state, x)) { state.releaseShared(aborted ? ABORTED : FAILED); if (latch != null) latch.countDown(); } if (callback != null) callback.onEnd(task, this, callbackContext, aborted, 0, x); } finally { thread = null; // Prevent accidental interrupt of subsequent operations by awaiting the transition from CANCELING to CANCELED while (state.get() == CANCELING) Thread.yield(); } } }
public class class_name { @FFDCIgnore(Throwable.class) void run() { final boolean trace = TraceComponent.isAnyTracingEnabled(); if (!state.setRunning()) { if (trace && tc.isDebugEnabled()) Tr.debug(this, tc, "unable to run", state.get()); nsRunEnd = System.nanoTime(); // depends on control dependency: [if], data = [none] if (callback != null) callback.onEnd(task, this, null, true, 0, null); // aborted, queued task will never run return; // depends on control dependency: [if], data = [none] } boolean aborted = true; Object callbackContext = null; thread = Thread.currentThread(); try { if (callback == null) aborted = false; else { callbackContext = callback.onStart(task, this); // depends on control dependency: [if], data = [none] aborted = state.get() == CANCELED; // depends on control dependency: [if], data = [none] } if (aborted) nsRunEnd = System.nanoTime(); else { T t; if (callable == null) { runnable.run(); // depends on control dependency: [if], data = [none] t = predefinedResult; // depends on control dependency: [if], data = [none] } else { t = callable.call(); // depends on control dependency: [if], data = [none] } nsRunEnd = System.nanoTime(); // depends on control dependency: [if], data = [none] if (result.compareAndSet(state, t)) { state.releaseShared(SUCCESSFUL); // depends on control dependency: [if], data = [none] if (latch != null) latch.countDown(t); } else if (Integer.valueOf(CANCELED).equals(result.get())) { if (trace && tc.isDebugEnabled()) Tr.debug(this, tc, "canceled during/after run"); // Prevent dirty read of state during onEnd before the canceling thread transitions the state to CANCELING/CANCELED while (state.get() == RUNNING) Thread.yield(); } if (trace && tc.isDebugEnabled()) Tr.debug(this, tc, "run", t); } if (callback != null) try { callback.onEnd(task, this, callbackContext, aborted, 0, null); // depends on control dependency: [try], data = [none] } catch (Throwable x) { } // depends on control dependency: [catch], data = [none] } catch (Throwable x) { if (trace && tc.isDebugEnabled()) Tr.debug(this, tc, "run", x); nsRunEnd = System.nanoTime(); if (result.compareAndSet(state, x)) { state.releaseShared(aborted ? ABORTED : FAILED); // depends on control dependency: [if], data = [none] if (latch != null) latch.countDown(); } if (callback != null) callback.onEnd(task, this, callbackContext, aborted, 0, x); } finally { // depends on control dependency: [catch], data = [none] thread = null; // Prevent accidental interrupt of subsequent operations by awaiting the transition from CANCELING to CANCELED while (state.get() == CANCELING) Thread.yield(); } } }
public class class_name { public void record(long n) { values[Integer.remainderUnsigned(pos++, size)] = n; if (curSize < size) { ++curSize; } } }
public class class_name { public void record(long n) { values[Integer.remainderUnsigned(pos++, size)] = n; if (curSize < size) { ++curSize; // depends on control dependency: [if], data = [none] } } }
public class class_name { public String[] getAttributeKeys() { final List<String> list = new ArrayList<>(attributes.size()); for(AttributeInfo item : attributes) { list.add(item.name); } return list.toArray(new String[list.size()]); } }
public class class_name { public String[] getAttributeKeys() { final List<String> list = new ArrayList<>(attributes.size()); for(AttributeInfo item : attributes) { list.add(item.name); // depends on control dependency: [for], data = [item] } return list.toArray(new String[list.size()]); } }
public class class_name { public EList<VendorExtension> getVendorExtension() { if (vendorExtension == null) { vendorExtension = new EObjectContainmentEList<VendorExtension>(VendorExtension.class, this, BpsimPackage.SCENARIO__VENDOR_EXTENSION); } return vendorExtension; } }
public class class_name { public EList<VendorExtension> getVendorExtension() { if (vendorExtension == null) { vendorExtension = new EObjectContainmentEList<VendorExtension>(VendorExtension.class, this, BpsimPackage.SCENARIO__VENDOR_EXTENSION); // depends on control dependency: [if], data = [none] } return vendorExtension; } }
public class class_name { @Override public String getAsText() { if (text == null) { DateFormat df = formats[formats.length - 1]; Date date = (Date) getValue(); text = df.format(date); } return text; } }
public class class_name { @Override public String getAsText() { if (text == null) { DateFormat df = formats[formats.length - 1]; Date date = (Date) getValue(); text = df.format(date); // depends on control dependency: [if], data = [none] } return text; } }
public class class_name { public UpdateOpenIDConnectProviderThumbprintRequest withThumbprintList(String... thumbprintList) { if (this.thumbprintList == null) { setThumbprintList(new com.amazonaws.internal.SdkInternalList<String>(thumbprintList.length)); } for (String ele : thumbprintList) { this.thumbprintList.add(ele); } return this; } }
public class class_name { public UpdateOpenIDConnectProviderThumbprintRequest withThumbprintList(String... thumbprintList) { if (this.thumbprintList == null) { setThumbprintList(new com.amazonaws.internal.SdkInternalList<String>(thumbprintList.length)); // depends on control dependency: [if], data = [none] } for (String ele : thumbprintList) { this.thumbprintList.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public void setIdGenerators(Set<String> idGenerators) { RenamingMap gen = new UniqueRenamingToken(); ImmutableMap.Builder<String, RenamingMap> builder = ImmutableMap.builder(); for (String name : idGenerators) { builder.put(name, gen); } this.idGenerators = builder.build(); } }
public class class_name { public void setIdGenerators(Set<String> idGenerators) { RenamingMap gen = new UniqueRenamingToken(); ImmutableMap.Builder<String, RenamingMap> builder = ImmutableMap.builder(); for (String name : idGenerators) { builder.put(name, gen); // depends on control dependency: [for], data = [name] } this.idGenerators = builder.build(); } }
public class class_name { public void setTasks(java.util.Collection<TaskListEntry> tasks) { if (tasks == null) { this.tasks = null; return; } this.tasks = new java.util.ArrayList<TaskListEntry>(tasks); } }
public class class_name { public void setTasks(java.util.Collection<TaskListEntry> tasks) { if (tasks == null) { this.tasks = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.tasks = new java.util.ArrayList<TaskListEntry>(tasks); } }
public class class_name { public static <E extends Comparable<E>> int partition(InplaceList<E> array, int left, int right) { final int mid = left + ((right - left) / 2); E pivot = array.get(mid); // taking mid point as pivot E current = array.get(0); // get first element, just so we can create an instance while (left <= right) { //searching number which is greater than pivot, bottom up while (array.get(current, left).compareTo(pivot) < 0) { left++; } //searching number which is less than pivot, top down while (array.get(current, right).compareTo(pivot) > 0) { right--; } // swap the values if (left <= right) { // TODO This seems to be a bug why swap them if left == right? array.swap(left, right); //increment left index and decrement right index left++; right--; } } return left; } }
public class class_name { public static <E extends Comparable<E>> int partition(InplaceList<E> array, int left, int right) { final int mid = left + ((right - left) / 2); E pivot = array.get(mid); // taking mid point as pivot E current = array.get(0); // get first element, just so we can create an instance while (left <= right) { //searching number which is greater than pivot, bottom up while (array.get(current, left).compareTo(pivot) < 0) { left++; // depends on control dependency: [while], data = [none] } //searching number which is less than pivot, top down while (array.get(current, right).compareTo(pivot) > 0) { right--; // depends on control dependency: [while], data = [none] } // swap the values if (left <= right) { // TODO This seems to be a bug why swap them if left == right? array.swap(left, right); // depends on control dependency: [if], data = [(left] //increment left index and decrement right index left++; // depends on control dependency: [if], data = [none] right--; // depends on control dependency: [if], data = [none] } } return left; } }
public class class_name { public WebSocketProtocolHandshakeHandler addExtension(ExtensionHandshake extension) { if (extension != null) { for (Handshake handshake : handshakes) { handshake.addExtension(extension); } } return this; } }
public class class_name { public WebSocketProtocolHandshakeHandler addExtension(ExtensionHandshake extension) { if (extension != null) { for (Handshake handshake : handshakes) { handshake.addExtension(extension); // depends on control dependency: [for], data = [handshake] } } return this; } }
public class class_name { public ListStackSetsResult withSummaries(StackSetSummary... summaries) { if (this.summaries == null) { setSummaries(new com.amazonaws.internal.SdkInternalList<StackSetSummary>(summaries.length)); } for (StackSetSummary ele : summaries) { this.summaries.add(ele); } return this; } }
public class class_name { public ListStackSetsResult withSummaries(StackSetSummary... summaries) { if (this.summaries == null) { setSummaries(new com.amazonaws.internal.SdkInternalList<StackSetSummary>(summaries.length)); // depends on control dependency: [if], data = [none] } for (StackSetSummary ele : summaries) { this.summaries.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { protected void dataReady(FrameHeaderData headerData, PooledByteBuffer frameData) { if(anyAreSet(state, STATE_STREAM_BROKEN | STATE_CLOSED)) { frameData.close(); return; } synchronized (lock) { boolean newData = pendingFrameData.isEmpty(); this.pendingFrameData.add(new FrameData(headerData, frameData)); if (newData) { if (waiters > 0) { lock.notifyAll(); } } waitingForFrame = false; } if (anyAreSet(state, STATE_READS_RESUMED)) { resumeReadsInternal(true); } if(headerData != null) { currentStreamSize += headerData.getFrameLength(); if(maxStreamSize > 0 && currentStreamSize > maxStreamSize) { handleStreamTooLarge(); } } } }
public class class_name { protected void dataReady(FrameHeaderData headerData, PooledByteBuffer frameData) { if(anyAreSet(state, STATE_STREAM_BROKEN | STATE_CLOSED)) { frameData.close(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } synchronized (lock) { boolean newData = pendingFrameData.isEmpty(); this.pendingFrameData.add(new FrameData(headerData, frameData)); if (newData) { if (waiters > 0) { lock.notifyAll(); // depends on control dependency: [if], data = [none] } } waitingForFrame = false; } if (anyAreSet(state, STATE_READS_RESUMED)) { resumeReadsInternal(true); // depends on control dependency: [if], data = [none] } if(headerData != null) { currentStreamSize += headerData.getFrameLength(); // depends on control dependency: [if], data = [none] if(maxStreamSize > 0 && currentStreamSize > maxStreamSize) { handleStreamTooLarge(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public String doGetRunners() { if (!isServerReady()) { addActionError(ConfluenceGreenPepper.SERVER_NOCONFIGURATION); return SUCCESS; } try { envTypes = getService().getAllEnvironmentTypes(); runners = getService().getAllRunners(); if(!StringUtil.isEmpty(selectedRunnerName)) { for(Runner runner : runners) { if(runner.getName().equals(selectedRunnerName)) { selectedRunner = runner; return SUCCESS; } } } editPropertiesMode = false; editClasspathsMode = false; selectedRunnerName = NONE_SELECTED; } catch (GreenPepperServerException e) { addActionError(e.getId()); } return SUCCESS; } }
public class class_name { public String doGetRunners() { if (!isServerReady()) { addActionError(ConfluenceGreenPepper.SERVER_NOCONFIGURATION); // depends on control dependency: [if], data = [none] return SUCCESS; // depends on control dependency: [if], data = [none] } try { envTypes = getService().getAllEnvironmentTypes(); // depends on control dependency: [try], data = [none] runners = getService().getAllRunners(); // depends on control dependency: [try], data = [none] if(!StringUtil.isEmpty(selectedRunnerName)) { for(Runner runner : runners) { if(runner.getName().equals(selectedRunnerName)) { selectedRunner = runner; // depends on control dependency: [if], data = [none] return SUCCESS; // depends on control dependency: [if], data = [none] } } } editPropertiesMode = false; // depends on control dependency: [try], data = [none] editClasspathsMode = false; // depends on control dependency: [try], data = [none] selectedRunnerName = NONE_SELECTED; // depends on control dependency: [try], data = [none] } catch (GreenPepperServerException e) { addActionError(e.getId()); } // depends on control dependency: [catch], data = [none] return SUCCESS; } }
public class class_name { public static FileSystem newFileSystem(String name, Configuration configuration) { try { URI uri = new URI(URI_SCHEME, name, null, null); return newFileSystem(uri, configuration); } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } } }
public class class_name { public static FileSystem newFileSystem(String name, Configuration configuration) { try { URI uri = new URI(URI_SCHEME, name, null, null); return newFileSystem(uri, configuration); // depends on control dependency: [try], data = [none] } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static InetAddress parse(final String ip) { if (ip == null || ip.isEmpty()) throw new IllegalArgumentException("A null or empty string is not a valid IP address!"); try { return InetAddress.getByName(ip); } catch (Throwable t) { throw new IllegalArgumentException("Not a valid IP address: " + ip, t); } } }
public class class_name { public static InetAddress parse(final String ip) { if (ip == null || ip.isEmpty()) throw new IllegalArgumentException("A null or empty string is not a valid IP address!"); try { return InetAddress.getByName(ip); // depends on control dependency: [try], data = [none] } catch (Throwable t) { throw new IllegalArgumentException("Not a valid IP address: " + ip, t); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static ProxyClassLoader convertClassloader(ClassLoader loader) { if (loader == null) { return ProxyClient.DEFAULT_LOADER; } else if (loader instanceof ProxyClassLoader) { return (ProxyClassLoader) loader; } else { return new ProxyClassLoader(loader); } } }
public class class_name { public static ProxyClassLoader convertClassloader(ClassLoader loader) { if (loader == null) { return ProxyClient.DEFAULT_LOADER; // depends on control dependency: [if], data = [none] } else if (loader instanceof ProxyClassLoader) { return (ProxyClassLoader) loader; // depends on control dependency: [if], data = [none] } else { return new ProxyClassLoader(loader); // depends on control dependency: [if], data = [none] } } }