code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { private void removeMethodOCNI(MethodDeclaration method) { int methodStart = method.getStartPosition(); String src = unit.getSource().substring(methodStart, methodStart + method.getLength()); if (src.contains("/*-[")) { int ocniStart = methodStart + src.indexOf("/*-["); Iterator<Comment> commentsIter = unit.getCommentList().iterator(); while (commentsIter.hasNext()) { Comment comment = commentsIter.next(); if (comment.isBlockComment() && comment.getStartPosition() == ocniStart) { commentsIter.remove(); break; } } } } }
public class class_name { private void removeMethodOCNI(MethodDeclaration method) { int methodStart = method.getStartPosition(); String src = unit.getSource().substring(methodStart, methodStart + method.getLength()); if (src.contains("/*-[")) { int ocniStart = methodStart + src.indexOf("/*-["); Iterator<Comment> commentsIter = unit.getCommentList().iterator(); while (commentsIter.hasNext()) { Comment comment = commentsIter.next(); if (comment.isBlockComment() && comment.getStartPosition() == ocniStart) { commentsIter.remove(); // depends on control dependency: [if], data = [none] break; } } } } }
public class class_name { private void mergeFiles(List<File> inputFiles, OutputStream outputStream) throws IOException { long startTime = System.nanoTime(); //Merge files for (File f : inputFiles) { if (f.exists()) { FileInputStream fileInputStream = new FileInputStream(f); BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream); try { LOGGER.log(Level.INFO, "Merging {0} size={1}", new Object[]{f.getName(), f.length()}); byte[] buffer = new byte[8192]; int length; while ((length = bufferedInputStream.read(buffer)) > 0) { outputStream.write(buffer, 0, length); } } finally { bufferedInputStream.close(); fileInputStream.close(); } } else { LOGGER.log(Level.INFO, "Skip merging file {0} because it doesn't exist", f.getName()); } } LOGGER.log(Level.INFO, "Time to merge {0} s", ((System.nanoTime() - startTime) / 1000000000.0)); } }
public class class_name { private void mergeFiles(List<File> inputFiles, OutputStream outputStream) throws IOException { long startTime = System.nanoTime(); //Merge files for (File f : inputFiles) { if (f.exists()) { FileInputStream fileInputStream = new FileInputStream(f); BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream); try { LOGGER.log(Level.INFO, "Merging {0} size={1}", new Object[]{f.getName(), f.length()}); // depends on control dependency: [try], data = [none] byte[] buffer = new byte[8192]; int length; while ((length = bufferedInputStream.read(buffer)) > 0) { outputStream.write(buffer, 0, length); // depends on control dependency: [while], data = [none] } } finally { bufferedInputStream.close(); fileInputStream.close(); } } else { LOGGER.log(Level.INFO, "Skip merging file {0} because it doesn't exist", f.getName()); // depends on control dependency: [if], data = [none] } } LOGGER.log(Level.INFO, "Time to merge {0} s", ((System.nanoTime() - startTime) / 1000000000.0)); } }
public class class_name { public static String getDescription(String propertyName) { StringBuilder sb = new StringBuilder(); for (int i=0; i<propertyName.length(); i++) { char c = propertyName.charAt(i); if (Character.isUpperCase(c)) { sb.append(" "); } else if (i == 0) { c = Character.toUpperCase(c); } sb.append(c); } return sb.toString(); } }
public class class_name { public static String getDescription(String propertyName) { StringBuilder sb = new StringBuilder(); for (int i=0; i<propertyName.length(); i++) { char c = propertyName.charAt(i); if (Character.isUpperCase(c)) { sb.append(" "); // depends on control dependency: [if], data = [none] } else if (i == 0) { c = Character.toUpperCase(c); // depends on control dependency: [if], data = [none] } sb.append(c); // depends on control dependency: [for], data = [none] } return sb.toString(); } }
public class class_name { void parse( CharSequence text, ParseLog status, AttributeQuery attributes, ParsedEntity<?> parsedResult, boolean quickPath ) { AttributeQuery aq = (quickPath ? this.fullAttrs : this.getQuery(attributes)); if ( (this.padLeft == 0) && (this.padRight == 0) ) { // Optimierung this.doParse(text, status, aq, parsedResult, quickPath); return; } boolean strict = this.isStrict(aq); char padChar = this.getPadChar(aq); int start = status.getPosition(); int endPos = text.length(); int index = start; // linke Füllzeichen konsumieren while ( (index < endPos) && (text.charAt(index) == padChar) ) { index++; } int leftPadCount = index - start; if (strict && (leftPadCount > this.padLeft)) { status.setError(start, this.padExceeded()); return; } // Eigentliche Parser-Routine status.setPosition(index); this.doParse(text, status, aq, parsedResult, quickPath); if (status.isError()) { return; } index = status.getPosition(); int width = index - start - leftPadCount; if ( strict && (this.padLeft > 0) && ((width + leftPadCount) != this.padLeft) ) { status.setError(start, this.padMismatched()); return; } // rechte Füllzeichen konsumieren int rightPadCount = 0; while ( (index < endPos) && (!strict || (width + rightPadCount < this.padRight)) && (text.charAt(index) == padChar) ) { index++; rightPadCount++; } if ( strict && (this.padRight > 0) && ((width + rightPadCount) != this.padRight) ) { status.setError(index - rightPadCount, this.padMismatched()); return; } status.setPosition(index); } }
public class class_name { void parse( CharSequence text, ParseLog status, AttributeQuery attributes, ParsedEntity<?> parsedResult, boolean quickPath ) { AttributeQuery aq = (quickPath ? this.fullAttrs : this.getQuery(attributes)); if ( (this.padLeft == 0) && (this.padRight == 0) ) { // Optimierung this.doParse(text, status, aq, parsedResult, quickPath); // depends on control dependency: [if], data = [] return; // depends on control dependency: [if], data = [] } boolean strict = this.isStrict(aq); char padChar = this.getPadChar(aq); int start = status.getPosition(); int endPos = text.length(); int index = start; // linke Füllzeichen konsumieren while ( (index < endPos) && (text.charAt(index) == padChar) ) { index++; // depends on control dependency: [while], data = [] } int leftPadCount = index - start; if (strict && (leftPadCount > this.padLeft)) { status.setError(start, this.padExceeded()); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // Eigentliche Parser-Routine status.setPosition(index); this.doParse(text, status, aq, parsedResult, quickPath); if (status.isError()) { return; // depends on control dependency: [if], data = [none] } index = status.getPosition(); int width = index - start - leftPadCount; if ( strict && (this.padLeft > 0) && ((width + leftPadCount) != this.padLeft) ) { status.setError(start, this.padMismatched()); // depends on control dependency: [if], data = [] return; // depends on control dependency: [if], data = [] } // rechte Füllzeichen konsumieren int rightPadCount = 0; while ( (index < endPos) && (!strict || (width + rightPadCount < this.padRight)) && (text.charAt(index) == padChar) ) { index++; // depends on control dependency: [while], data = [] rightPadCount++; // depends on control dependency: [while], data = [] } if ( strict && (this.padRight > 0) && ((width + rightPadCount) != this.padRight) ) { status.setError(index - rightPadCount, this.padMismatched()); // depends on control dependency: [if], data = [] return; // depends on control dependency: [if], data = [] } status.setPosition(index); } }
public class class_name { private Observable<Indexable> invokeAfterPostRunAsync(final TaskGroupEntry<TaskItem> entry, final InvocationContext context) { return Observable.defer(new Func0<Observable<Indexable>>() { @Override public Observable<Indexable> call() { final ProxyTaskItem proxyTaskItem = (ProxyTaskItem) entry.data(); if (proxyTaskItem == null) { return Observable.empty(); } final boolean isFaulted = entry.hasFaultedDescentDependencyTasks() || isGroupCancelled.get(); Observable<Indexable> postRunObservable = proxyTaskItem.invokeAfterPostRunAsync(isFaulted).toObservable(); Func1<Throwable, Observable<Indexable>> onError = new Func1<Throwable, Observable<Indexable>>() { @Override public Observable<Indexable> call(final Throwable error) { return processFaultedTaskAsync(entry, error, context); } }; Func0<Observable<Indexable>> onComplete = new Func0<Observable<Indexable>>() { @Override public Observable<Indexable> call() { if (isFaulted) { if (entry.hasFaultedDescentDependencyTasks()) { return processFaultedTaskAsync(entry, new ErroredDependencyTaskException(), context); } else { return processFaultedTaskAsync(entry, taskCancelledException, context); } } else { return Observable.concat(Observable.just(proxyTaskItem.result()), processCompletedTaskAsync(entry, context)); } } }; return postRunObservable.flatMap(null, // no onNext call as stream is created from Completable. onError, onComplete); } }); } }
public class class_name { private Observable<Indexable> invokeAfterPostRunAsync(final TaskGroupEntry<TaskItem> entry, final InvocationContext context) { return Observable.defer(new Func0<Observable<Indexable>>() { @Override public Observable<Indexable> call() { final ProxyTaskItem proxyTaskItem = (ProxyTaskItem) entry.data(); if (proxyTaskItem == null) { return Observable.empty(); // depends on control dependency: [if], data = [none] } final boolean isFaulted = entry.hasFaultedDescentDependencyTasks() || isGroupCancelled.get(); Observable<Indexable> postRunObservable = proxyTaskItem.invokeAfterPostRunAsync(isFaulted).toObservable(); Func1<Throwable, Observable<Indexable>> onError = new Func1<Throwable, Observable<Indexable>>() { @Override public Observable<Indexable> call(final Throwable error) { return processFaultedTaskAsync(entry, error, context); } }; Func0<Observable<Indexable>> onComplete = new Func0<Observable<Indexable>>() { @Override public Observable<Indexable> call() { if (isFaulted) { if (entry.hasFaultedDescentDependencyTasks()) { return processFaultedTaskAsync(entry, new ErroredDependencyTaskException(), context); // depends on control dependency: [if], data = [none] } else { return processFaultedTaskAsync(entry, taskCancelledException, context); // depends on control dependency: [if], data = [none] } } else { return Observable.concat(Observable.just(proxyTaskItem.result()), processCompletedTaskAsync(entry, context)); // depends on control dependency: [if], data = [none] } } }; return postRunObservable.flatMap(null, // no onNext call as stream is created from Completable. onError, onComplete); } }); } }
public class class_name { @Override public int read(byte []buf, int offset, int length) throws IOException { TempBuffer cursor = _cursor; if (cursor == null) return -1; int sublen = Math.min(length, cursor.length() - _offset); System.arraycopy(cursor.buffer(), _offset, buf, offset, sublen); if (cursor.length() <= _offset + sublen) { _cursor = cursor.next(); if (_freeWhenDone) { cursor.next(null); TempBuffer.free(cursor); cursor = null; } _offset = 0; } else _offset += sublen; return sublen; } }
public class class_name { @Override public int read(byte []buf, int offset, int length) throws IOException { TempBuffer cursor = _cursor; if (cursor == null) return -1; int sublen = Math.min(length, cursor.length() - _offset); System.arraycopy(cursor.buffer(), _offset, buf, offset, sublen); if (cursor.length() <= _offset + sublen) { _cursor = cursor.next(); if (_freeWhenDone) { cursor.next(null); // depends on control dependency: [if], data = [none] TempBuffer.free(cursor); // depends on control dependency: [if], data = [none] cursor = null; // depends on control dependency: [if], data = [none] } _offset = 0; } else _offset += sublen; return sublen; } }
public class class_name { public int convertToSeq1Position(int seq2Position) { int seq1p, seq2p = 0, prevSeq1p = 0, prevSeq2p = 0; boolean onInsertion; for (int mut : mutations) { seq1p = getPosition(mut); onInsertion = false; switch (mut & MUTATION_TYPE_MASK) { case RAW_MUTATION_TYPE_DELETION: --seq2p; break; case RAW_MUTATION_TYPE_INSERTION: onInsertion = true; --seq1p; ++seq2p; break; } seq2p += seq1p - prevSeq1p; if (seq2p == seq2Position && onInsertion) return -1 - (seq2Position - prevSeq2p + prevSeq1p); if (seq2p >= seq2Position) { return seq2Position - prevSeq2p + prevSeq1p; } prevSeq1p = seq1p; prevSeq2p = seq2p; } return seq2Position - prevSeq2p + prevSeq1p; } }
public class class_name { public int convertToSeq1Position(int seq2Position) { int seq1p, seq2p = 0, prevSeq1p = 0, prevSeq2p = 0; boolean onInsertion; for (int mut : mutations) { seq1p = getPosition(mut); // depends on control dependency: [for], data = [mut] onInsertion = false; // depends on control dependency: [for], data = [none] switch (mut & MUTATION_TYPE_MASK) { case RAW_MUTATION_TYPE_DELETION: --seq2p; // depends on control dependency: [for], data = [none] break; case RAW_MUTATION_TYPE_INSERTION: onInsertion = true; --seq1p; // depends on control dependency: [for], data = [none] ++seq2p; // depends on control dependency: [for], data = [none] break; } seq2p += seq1p - prevSeq1p; if (seq2p == seq2Position && onInsertion) return -1 - (seq2Position - prevSeq2p + prevSeq1p); if (seq2p >= seq2Position) { return seq2Position - prevSeq2p + prevSeq1p; // depends on control dependency: [if], data = [none] } prevSeq1p = seq1p; prevSeq2p = seq2p; } return seq2Position - prevSeq2p + prevSeq1p; } }
public class class_name { public InputSource resolveEntity(String publicId, String systemId) { if (systemId != null && systemId.startsWith("file:")) { return null; } else { return new InputSource(); } } }
public class class_name { public InputSource resolveEntity(String publicId, String systemId) { if (systemId != null && systemId.startsWith("file:")) { return null; // depends on control dependency: [if], data = [none] } else { return new InputSource(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static byte[] encodeSourceData(DbFileSources.Data data) { ByteArrayOutputStream byteOutput = new ByteArrayOutputStream(); LZ4BlockOutputStream compressedOutput = new LZ4BlockOutputStream(byteOutput); try { data.writeTo(compressedOutput); compressedOutput.close(); return byteOutput.toByteArray(); } catch (IOException e) { throw new IllegalStateException("Fail to serialize and compress source data", e); } finally { IOUtils.closeQuietly(compressedOutput); } } }
public class class_name { public static byte[] encodeSourceData(DbFileSources.Data data) { ByteArrayOutputStream byteOutput = new ByteArrayOutputStream(); LZ4BlockOutputStream compressedOutput = new LZ4BlockOutputStream(byteOutput); try { data.writeTo(compressedOutput); // depends on control dependency: [try], data = [none] compressedOutput.close(); // depends on control dependency: [try], data = [none] return byteOutput.toByteArray(); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new IllegalStateException("Fail to serialize and compress source data", e); } finally { // depends on control dependency: [catch], data = [none] IOUtils.closeQuietly(compressedOutput); } } }
public class class_name { public static <T> void addAll(Collection<T> collection, Iterable<? extends T> items) { for (T item : items) { collection.add(item); } } }
public class class_name { public static <T> void addAll(Collection<T> collection, Iterable<? extends T> items) { for (T item : items) { collection.add(item); // depends on control dependency: [for], data = [item] } } }
public class class_name { public void setRestorableNodeTypes(java.util.Collection<String> restorableNodeTypes) { if (restorableNodeTypes == null) { this.restorableNodeTypes = null; return; } this.restorableNodeTypes = new com.amazonaws.internal.SdkInternalList<String>(restorableNodeTypes); } }
public class class_name { public void setRestorableNodeTypes(java.util.Collection<String> restorableNodeTypes) { if (restorableNodeTypes == null) { this.restorableNodeTypes = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.restorableNodeTypes = new com.amazonaws.internal.SdkInternalList<String>(restorableNodeTypes); } }
public class class_name { public static VAlarm email(Trigger trigger, String subject, String body, List<String> recipients) { VAlarm alarm = new VAlarm(Action.email(), trigger); alarm.setSummary(subject); alarm.setDescription(body); for (String recipient : recipients) { alarm.addAttendee(new Attendee(null, recipient)); } return alarm; } }
public class class_name { public static VAlarm email(Trigger trigger, String subject, String body, List<String> recipients) { VAlarm alarm = new VAlarm(Action.email(), trigger); alarm.setSummary(subject); alarm.setDescription(body); for (String recipient : recipients) { alarm.addAttendee(new Attendee(null, recipient)); // depends on control dependency: [for], data = [recipient] } return alarm; } }
public class class_name { private void init() throws ConfigFileIOException { this.props = new Properties(); log.info("Reading config file: {}", this.configFile); boolean ok = true; try { // El fichero esta en el CLASSPATH this.props.load(SystemConfig.class.getResourceAsStream(this.configFile)); } catch (Exception e) { log.warn("File not found in the Classpath"); try { this.props.load(new FileInputStream(this.configFile)); } catch (IOException ioe) { log.error("Can't open file: {}", ioe.getLocalizedMessage()); ok = false; ioe.printStackTrace(); throw new ConfigFileIOException(ioe.getLocalizedMessage()); } } if (ok) { log.info("Configuration loaded successfully"); if (log.isDebugEnabled()) { log.debug(this.toString()); } } } }
public class class_name { private void init() throws ConfigFileIOException { this.props = new Properties(); log.info("Reading config file: {}", this.configFile); boolean ok = true; try { // El fichero esta en el CLASSPATH this.props.load(SystemConfig.class.getResourceAsStream(this.configFile)); } catch (Exception e) { log.warn("File not found in the Classpath"); try { this.props.load(new FileInputStream(this.configFile)); // depends on control dependency: [try], data = [none] } catch (IOException ioe) { log.error("Can't open file: {}", ioe.getLocalizedMessage()); ok = false; ioe.printStackTrace(); throw new ConfigFileIOException(ioe.getLocalizedMessage()); } // depends on control dependency: [catch], data = [none] } if (ok) { log.info("Configuration loaded successfully"); if (log.isDebugEnabled()) { log.debug(this.toString()); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void pause() { if (mAudioListener != null) { int sourceId = getSourceId(); if (sourceId != GvrAudioEngine.INVALID_ID) { mAudioListener.getAudioEngine().pauseSound(sourceId); } } } }
public class class_name { public void pause() { if (mAudioListener != null) { int sourceId = getSourceId(); if (sourceId != GvrAudioEngine.INVALID_ID) { mAudioListener.getAudioEngine().pauseSound(sourceId); // depends on control dependency: [if], data = [(sourceId] } } } }
public class class_name { private static String encode(final String txt) { try { return URLEncoder.encode( txt, Charset.defaultCharset().name() ); } catch (final UnsupportedEncodingException ex) { throw new IllegalStateException(ex); } } }
public class class_name { private static String encode(final String txt) { try { return URLEncoder.encode( txt, Charset.defaultCharset().name() ); // depends on control dependency: [try], data = [none] } catch (final UnsupportedEncodingException ex) { throw new IllegalStateException(ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void addContent(String destSpaceId, String destContentId, String fileChecksum, long fileSize, InputStream stream, Map<String, String> properties) { try { doAddContent(destSpaceId, destContentId, fileChecksum, fileSize, getInputStream(stream), properties); } catch (NotFoundException e) { throw new DuraCloudRuntimeException(e); } } }
public class class_name { public void addContent(String destSpaceId, String destContentId, String fileChecksum, long fileSize, InputStream stream, Map<String, String> properties) { try { doAddContent(destSpaceId, destContentId, fileChecksum, fileSize, getInputStream(stream), properties); // depends on control dependency: [try], data = [none] } catch (NotFoundException e) { throw new DuraCloudRuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Map<String, List<CloudVolumeStorage>> getCloudVolumes(Map<String, String> instanceToAccountMap) { Map<String, List<CloudVolumeStorage>> returnMap = new HashMap<>(); DescribeVolumesResult volumeResult = ec2Client.describeVolumes(); for (Volume v : volumeResult.getVolumes()) { CloudVolumeStorage object = new CloudVolumeStorage(); for (VolumeAttachment va : v.getAttachments()) { object.getAttachInstances().add(va.getInstanceId()); } String account = NO_ACCOUNT; //Get any instance id if any and get corresponding account number if (!CollectionUtils.isEmpty(object.getAttachInstances()) && !StringUtils.isEmpty(instanceToAccountMap.get(object.getAttachInstances().get(0)))) { account = instanceToAccountMap.get(object.getAttachInstances().get(0)); } object.setAccountNumber(account); object.setZone(v.getAvailabilityZone()); object.setAccountNumber(account); object.setCreationDate(v.getCreateTime().getTime()); object.setEncrypted(v.isEncrypted()); object.setSize(v.getSize()); object.setStatus(v.getState()); object.setType(v.getVolumeType()); object.setVolumeId(v.getVolumeId()); List<Tag> tags = v.getTags(); if (!CollectionUtils.isEmpty(tags)) { for (Tag tag : tags) { NameValue nv = new NameValue(tag.getKey(), tag.getValue()); object.getTags().add(nv); } } if (CollectionUtils.isEmpty(returnMap.get(object.getAccountNumber()))) { List<CloudVolumeStorage> temp = new ArrayList<>(); temp.add(object); returnMap.put(account, temp); } else { returnMap.get(account).add(object); } } return returnMap; } }
public class class_name { public Map<String, List<CloudVolumeStorage>> getCloudVolumes(Map<String, String> instanceToAccountMap) { Map<String, List<CloudVolumeStorage>> returnMap = new HashMap<>(); DescribeVolumesResult volumeResult = ec2Client.describeVolumes(); for (Volume v : volumeResult.getVolumes()) { CloudVolumeStorage object = new CloudVolumeStorage(); for (VolumeAttachment va : v.getAttachments()) { object.getAttachInstances().add(va.getInstanceId()); // depends on control dependency: [for], data = [va] } String account = NO_ACCOUNT; //Get any instance id if any and get corresponding account number if (!CollectionUtils.isEmpty(object.getAttachInstances()) && !StringUtils.isEmpty(instanceToAccountMap.get(object.getAttachInstances().get(0)))) { account = instanceToAccountMap.get(object.getAttachInstances().get(0)); // depends on control dependency: [if], data = [none] } object.setAccountNumber(account); // depends on control dependency: [for], data = [none] object.setZone(v.getAvailabilityZone()); // depends on control dependency: [for], data = [v] object.setAccountNumber(account); // depends on control dependency: [for], data = [none] object.setCreationDate(v.getCreateTime().getTime()); // depends on control dependency: [for], data = [v] object.setEncrypted(v.isEncrypted()); // depends on control dependency: [for], data = [v] object.setSize(v.getSize()); // depends on control dependency: [for], data = [v] object.setStatus(v.getState()); // depends on control dependency: [for], data = [v] object.setType(v.getVolumeType()); // depends on control dependency: [for], data = [v] object.setVolumeId(v.getVolumeId()); // depends on control dependency: [for], data = [v] List<Tag> tags = v.getTags(); if (!CollectionUtils.isEmpty(tags)) { for (Tag tag : tags) { NameValue nv = new NameValue(tag.getKey(), tag.getValue()); object.getTags().add(nv); // depends on control dependency: [for], data = [none] } } if (CollectionUtils.isEmpty(returnMap.get(object.getAccountNumber()))) { List<CloudVolumeStorage> temp = new ArrayList<>(); temp.add(object); // depends on control dependency: [if], data = [none] returnMap.put(account, temp); // depends on control dependency: [if], data = [none] } else { returnMap.get(account).add(object); // depends on control dependency: [if], data = [none] } } return returnMap; } }
public class class_name { private boolean isContainedIn(BitSet A, BitSet B) { boolean result = false; if (A.isEmpty()) { return true; } BitSet setA = (BitSet) A.clone(); setA.and(B); if (setA.equals(A)) { result = true; } return result; } }
public class class_name { private boolean isContainedIn(BitSet A, BitSet B) { boolean result = false; if (A.isEmpty()) { return true; // depends on control dependency: [if], data = [none] } BitSet setA = (BitSet) A.clone(); setA.and(B); if (setA.equals(A)) { result = true; // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public static int commonOverlap(String text1, String text2) { // Cache the text lengths to prevent multiple calls. int text1_length = text1.length(); int text2_length = text2.length(); // Eliminate the null case. if (text1_length == 0 || text2_length == 0) { return 0; } // Truncate the longer string. if (text1_length > text2_length) { text1 = text1.substring(text1_length - text2_length); } else if (text1_length < text2_length) { text2 = text2.substring(0, text1_length); } int text_length = Math.min(text1_length, text2_length); // Quick check for the worst case. if (text1.equals(text2)) { return text_length; } // Start by looking for a single character match // and increase length until no match is found. // Performance analysis: http://neil.fraser.name/news/2010/11/04/ int best = 0; int length = 1; while (true) { String pattern = text1.substring(text_length - length); int found = text2.indexOf(pattern); if (found == -1) { return best; } length += found; if (found == 0 || text1.substring(text_length - length).equals( text2.substring(0, length))) { best = length; length++; } } } }
public class class_name { public static int commonOverlap(String text1, String text2) { // Cache the text lengths to prevent multiple calls. int text1_length = text1.length(); int text2_length = text2.length(); // Eliminate the null case. if (text1_length == 0 || text2_length == 0) { return 0; // depends on control dependency: [if], data = [none] } // Truncate the longer string. if (text1_length > text2_length) { text1 = text1.substring(text1_length - text2_length); // depends on control dependency: [if], data = [(text1_length] } else if (text1_length < text2_length) { text2 = text2.substring(0, text1_length); // depends on control dependency: [if], data = [none] } int text_length = Math.min(text1_length, text2_length); // Quick check for the worst case. if (text1.equals(text2)) { return text_length; // depends on control dependency: [if], data = [none] } // Start by looking for a single character match // and increase length until no match is found. // Performance analysis: http://neil.fraser.name/news/2010/11/04/ int best = 0; int length = 1; while (true) { String pattern = text1.substring(text_length - length); int found = text2.indexOf(pattern); if (found == -1) { return best; // depends on control dependency: [if], data = [none] } length += found; // depends on control dependency: [while], data = [none] if (found == 0 || text1.substring(text_length - length).equals( text2.substring(0, length))) { best = length; // depends on control dependency: [if], data = [none] length++; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public IConceptMap<IConceptSet> getNewSubsumptions() { IConceptMap<IConceptSet> res = new DenseConceptMap<IConceptSet>( newContexts.size()); // Collect subsumptions from new contexts for (Context ctx : newContexts) { res.put(ctx.getConcept(), ctx.getS()); } return res; } }
public class class_name { public IConceptMap<IConceptSet> getNewSubsumptions() { IConceptMap<IConceptSet> res = new DenseConceptMap<IConceptSet>( newContexts.size()); // Collect subsumptions from new contexts for (Context ctx : newContexts) { res.put(ctx.getConcept(), ctx.getS()); // depends on control dependency: [for], data = [ctx] } return res; } }
public class class_name { public void setConstantTypesClassesBlackList(final List<Class> constantTypesBlackList) { List<String> values = new LinkedList<String>(); for (Class aClass : constantTypesBlackList) { values.add(aClass.getName()); } setConstantTypesBlackList(values); } }
public class class_name { public void setConstantTypesClassesBlackList(final List<Class> constantTypesBlackList) { List<String> values = new LinkedList<String>(); for (Class aClass : constantTypesBlackList) { values.add(aClass.getName()); // depends on control dependency: [for], data = [aClass] } setConstantTypesBlackList(values); } }
public class class_name { public void setAvailabilityZones(java.util.Collection<String> availabilityZones) { if (availabilityZones == null) { this.availabilityZones = null; return; } this.availabilityZones = new java.util.ArrayList<String>(availabilityZones); } }
public class class_name { public void setAvailabilityZones(java.util.Collection<String> availabilityZones) { if (availabilityZones == null) { this.availabilityZones = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.availabilityZones = new java.util.ArrayList<String>(availabilityZones); } }
public class class_name { static Publisher<Object> computePublisherValue( final Object asyncObj, final ReactiveAdapterRegistry reactiveAdapterRegistry) { if (asyncObj instanceof Flux<?> || asyncObj instanceof Mono<?>) { // If the async object is a Flux or a Mono, we don't need the ReactiveAdapterRegistry (and we allow // initialization to happen without the registry, which is not possible with other Publisher<?> // implementations. return (Publisher<Object>) asyncObj; } if (reactiveAdapterRegistry == null) { throw new IllegalArgumentException( "Could not initialize lazy reactive context variable (data driver or explicitly-set " + "reactive wrapper): Value is of class " + asyncObj.getClass().getName() +", but no " + "ReactiveAdapterRegistry has been set. This can happen if this context variable is used " + "for rendering a template without going through a " + ThymeleafReactiveView.class.getSimpleName() + " or if there is no " + "ReactiveAdapterRegistry bean registered at the application context. In such cases, it is " + "required that the wrapped lazy variable values are instances of either " + Flux.class.getName() + " or " + Mono.class.getName() + "."); } final ReactiveAdapter adapter = reactiveAdapterRegistry.getAdapter(null, asyncObj); if (adapter != null) { final Publisher<Object> publisher = adapter.toPublisher(asyncObj); if (adapter.isMultiValue()) { return Flux.from(publisher); } else { return Mono.from(publisher); } } throw new IllegalArgumentException( "Reactive context variable (data driver or explicitly-set reactive wrapper) is of " + "class " + asyncObj.getClass().getName() +", but the ReactiveAdapterRegistry " + "does not contain a valid adapter able to convert it into a supported reactive data stream."); } }
public class class_name { static Publisher<Object> computePublisherValue( final Object asyncObj, final ReactiveAdapterRegistry reactiveAdapterRegistry) { if (asyncObj instanceof Flux<?> || asyncObj instanceof Mono<?>) { // If the async object is a Flux or a Mono, we don't need the ReactiveAdapterRegistry (and we allow // initialization to happen without the registry, which is not possible with other Publisher<?> // implementations. return (Publisher<Object>) asyncObj; // depends on control dependency: [if], data = [none] } if (reactiveAdapterRegistry == null) { throw new IllegalArgumentException( "Could not initialize lazy reactive context variable (data driver or explicitly-set " + "reactive wrapper): Value is of class " + asyncObj.getClass().getName() +", but no " + "ReactiveAdapterRegistry has been set. This can happen if this context variable is used " + "for rendering a template without going through a " + ThymeleafReactiveView.class.getSimpleName() + " or if there is no " + "ReactiveAdapterRegistry bean registered at the application context. In such cases, it is " + "required that the wrapped lazy variable values are instances of either " + Flux.class.getName() + " or " + Mono.class.getName() + "."); } final ReactiveAdapter adapter = reactiveAdapterRegistry.getAdapter(null, asyncObj); if (adapter != null) { final Publisher<Object> publisher = adapter.toPublisher(asyncObj); if (adapter.isMultiValue()) { return Flux.from(publisher); // depends on control dependency: [if], data = [none] } else { return Mono.from(publisher); // depends on control dependency: [if], data = [none] } } throw new IllegalArgumentException( "Reactive context variable (data driver or explicitly-set reactive wrapper) is of " + "class " + asyncObj.getClass().getName() +", but the ReactiveAdapterRegistry " + "does not contain a valid adapter able to convert it into a supported reactive data stream."); } }
public class class_name { public LeafNode<K, V> prevNode() { if (leftid == NULL_ID) { return null; } return (LeafNode<K, V>) tree.getNode(leftid); } }
public class class_name { public LeafNode<K, V> prevNode() { if (leftid == NULL_ID) { return null; // depends on control dependency: [if], data = [none] } return (LeafNode<K, V>) tree.getNode(leftid); } }
public class class_name { @Override public String getTagName(long jobExecutionId) { logger.entering(CLASSNAME, "getTagName", jobExecutionId); String apptag = null; Connection conn = null; PreparedStatement statement = null; ResultSet rs = null; String query = "SELECT A.apptag FROM jobinstancedata A INNER JOIN executioninstancedata B ON A.jobinstanceid = B.jobinstanceid" + " WHERE B.jobexecid = ?"; try { conn = getConnection(); statement = conn.prepareStatement(query); statement.setLong(1, jobExecutionId); rs = statement.executeQuery(); if(rs.next()) { apptag = rs.getString(1); } } catch (SQLException e) { throw new PersistenceException(e); } finally { cleanupConnection(conn, rs, statement); } logger.exiting(CLASSNAME, "getTagName"); return apptag; } }
public class class_name { @Override public String getTagName(long jobExecutionId) { logger.entering(CLASSNAME, "getTagName", jobExecutionId); String apptag = null; Connection conn = null; PreparedStatement statement = null; ResultSet rs = null; String query = "SELECT A.apptag FROM jobinstancedata A INNER JOIN executioninstancedata B ON A.jobinstanceid = B.jobinstanceid" + " WHERE B.jobexecid = ?"; try { conn = getConnection(); // depends on control dependency: [try], data = [none] statement = conn.prepareStatement(query); // depends on control dependency: [try], data = [none] statement.setLong(1, jobExecutionId); // depends on control dependency: [try], data = [none] rs = statement.executeQuery(); // depends on control dependency: [try], data = [none] if(rs.next()) { apptag = rs.getString(1); // depends on control dependency: [if], data = [none] } } catch (SQLException e) { throw new PersistenceException(e); } finally { // depends on control dependency: [catch], data = [none] cleanupConnection(conn, rs, statement); } logger.exiting(CLASSNAME, "getTagName"); return apptag; } }
public class class_name { public static VersionRange createFromVersionSpec( String spec ) throws InvalidVersionSpecificationException { if ( spec == null ) { return null; } List<Restriction> restrictions = new ArrayList<Restriction>(); String process = spec; ComponentVersion version = null; ComponentVersion upperBound = null; ComponentVersion lowerBound = null; while ( process.startsWith( "[" ) || process.startsWith( "(" ) ) { int index1 = process.indexOf( ")" ); int index2 = process.indexOf( "]" ); int index = index2; if ( index2 < 0 || index1 < index2 ) { if ( index1 >= 0 ) { index = index1; } } if ( index < 0 ) { throw new InvalidVersionSpecificationException( "Unbounded range: " + spec ); } Restriction restriction = parseRestriction( process.substring( 0, index + 1 ) ); if ( lowerBound == null ) { lowerBound = restriction.getLowerBound(); } if ( upperBound != null ) { if ( restriction.getLowerBound() == null || restriction.getLowerBound().compareTo( upperBound ) < 0 ) { throw new InvalidVersionSpecificationException( "Ranges overlap: " + spec ); } } restrictions.add( restriction ); upperBound = restriction.getUpperBound(); process = process.substring( index + 1 ).trim(); if ( process.length() > 0 && process.startsWith( "," ) ) { process = process.substring( 1 ).trim(); } } if ( process.length() > 0 ) { if ( restrictions.size() > 0 ) { throw new InvalidVersionSpecificationException( "Only fully-qualified sets allowed in multiple set scenario: " + spec ); } else { version = new ComponentVersion( process ); restrictions.add( Restriction.EVERYTHING ); } } return new VersionRange( version, restrictions ); } }
public class class_name { public static VersionRange createFromVersionSpec( String spec ) throws InvalidVersionSpecificationException { if ( spec == null ) { return null; } List<Restriction> restrictions = new ArrayList<Restriction>(); String process = spec; ComponentVersion version = null; ComponentVersion upperBound = null; ComponentVersion lowerBound = null; while ( process.startsWith( "[" ) || process.startsWith( "(" ) ) { int index1 = process.indexOf( ")" ); int index2 = process.indexOf( "]" ); int index = index2; if ( index2 < 0 || index1 < index2 ) { if ( index1 >= 0 ) { index = index1; // depends on control dependency: [if], data = [none] } } if ( index < 0 ) { throw new InvalidVersionSpecificationException( "Unbounded range: " + spec ); } Restriction restriction = parseRestriction( process.substring( 0, index + 1 ) ); if ( lowerBound == null ) { lowerBound = restriction.getLowerBound(); // depends on control dependency: [if], data = [none] } if ( upperBound != null ) { if ( restriction.getLowerBound() == null || restriction.getLowerBound().compareTo( upperBound ) < 0 ) { throw new InvalidVersionSpecificationException( "Ranges overlap: " + spec ); } } restrictions.add( restriction ); upperBound = restriction.getUpperBound(); process = process.substring( index + 1 ).trim(); if ( process.length() > 0 && process.startsWith( "," ) ) { process = process.substring( 1 ).trim(); // depends on control dependency: [if], data = [none] } } if ( process.length() > 0 ) { if ( restrictions.size() > 0 ) { throw new InvalidVersionSpecificationException( "Only fully-qualified sets allowed in multiple set scenario: " + spec ); } else { version = new ComponentVersion( process ); // depends on control dependency: [if], data = [none] restrictions.add( Restriction.EVERYTHING ); // depends on control dependency: [if], data = [none] } } return new VersionRange( version, restrictions ); } }
public class class_name { public ServiceCall<Void> deleteClassifier(DeleteClassifierOptions deleteClassifierOptions) { Validator.notNull(deleteClassifierOptions, "deleteClassifierOptions cannot be null"); String[] pathSegments = { "v3/classifiers" }; String[] pathParameters = { deleteClassifierOptions.classifierId() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters)); builder.query("version", versionDate); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("watson_vision_combined", "v3", "deleteClassifier"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); return createServiceCall(builder.build(), ResponseConverterUtils.getVoid()); } }
public class class_name { public ServiceCall<Void> deleteClassifier(DeleteClassifierOptions deleteClassifierOptions) { Validator.notNull(deleteClassifierOptions, "deleteClassifierOptions cannot be null"); String[] pathSegments = { "v3/classifiers" }; String[] pathParameters = { deleteClassifierOptions.classifierId() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters)); builder.query("version", versionDate); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("watson_vision_combined", "v3", "deleteClassifier"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header] } builder.header("Accept", "application/json"); return createServiceCall(builder.build(), ResponseConverterUtils.getVoid()); } }
public class class_name { public Locale getLocale() { Enumeration enm = _httpRequest.getFieldValues(HttpFields.__AcceptLanguage, HttpFields.__separators); // handle no locale if (enm == null || !enm.hasMoreElements()) return Locale.getDefault(); // sort the list in quality order List acceptLanguage = HttpFields.qualityList(enm); if (acceptLanguage.size()==0) return Locale.getDefault(); int size=acceptLanguage.size(); // convert to locals for (int i=0; i<size; i++) { String language = (String)acceptLanguage.get(i); language=HttpFields.valueParameters(language,null); String country = ""; int dash = language.indexOf('-'); if (dash > -1) { country = language.substring(dash + 1).trim(); language = language.substring(0,dash).trim(); } return new Locale(language,country); } return Locale.getDefault(); } }
public class class_name { public Locale getLocale() { Enumeration enm = _httpRequest.getFieldValues(HttpFields.__AcceptLanguage, HttpFields.__separators); // handle no locale if (enm == null || !enm.hasMoreElements()) return Locale.getDefault(); // sort the list in quality order List acceptLanguage = HttpFields.qualityList(enm); if (acceptLanguage.size()==0) return Locale.getDefault(); int size=acceptLanguage.size(); // convert to locals for (int i=0; i<size; i++) { String language = (String)acceptLanguage.get(i); language=HttpFields.valueParameters(language,null); // depends on control dependency: [for], data = [none] String country = ""; int dash = language.indexOf('-'); if (dash > -1) { country = language.substring(dash + 1).trim(); // depends on control dependency: [if], data = [(dash] language = language.substring(0,dash).trim(); // depends on control dependency: [if], data = [none] } return new Locale(language,country); // depends on control dependency: [for], data = [none] } return Locale.getDefault(); } }
public class class_name { public ServiceCall<QueryNoticesResponse> queryNotices(QueryNoticesOptions queryNoticesOptions) { Validator.notNull(queryNoticesOptions, "queryNoticesOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "notices" }; String[] pathParameters = { queryNoticesOptions.environmentId(), queryNoticesOptions.collectionId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters)); builder.query("version", versionDate); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "queryNotices"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); if (queryNoticesOptions.filter() != null) { builder.query("filter", queryNoticesOptions.filter()); } if (queryNoticesOptions.query() != null) { builder.query("query", queryNoticesOptions.query()); } if (queryNoticesOptions.naturalLanguageQuery() != null) { builder.query("natural_language_query", queryNoticesOptions.naturalLanguageQuery()); } if (queryNoticesOptions.passages() != null) { builder.query("passages", String.valueOf(queryNoticesOptions.passages())); } if (queryNoticesOptions.aggregation() != null) { builder.query("aggregation", queryNoticesOptions.aggregation()); } if (queryNoticesOptions.count() != null) { builder.query("count", String.valueOf(queryNoticesOptions.count())); } if (queryNoticesOptions.returnFields() != null) { builder.query("return", RequestUtils.join(queryNoticesOptions.returnFields(), ",")); } if (queryNoticesOptions.offset() != null) { builder.query("offset", String.valueOf(queryNoticesOptions.offset())); } if (queryNoticesOptions.sort() != null) { builder.query("sort", RequestUtils.join(queryNoticesOptions.sort(), ",")); } if (queryNoticesOptions.highlight() != null) { builder.query("highlight", String.valueOf(queryNoticesOptions.highlight())); } if (queryNoticesOptions.passagesFields() != null) { builder.query("passages.fields", RequestUtils.join(queryNoticesOptions.passagesFields(), ",")); } if (queryNoticesOptions.passagesCount() != null) { builder.query("passages.count", String.valueOf(queryNoticesOptions.passagesCount())); } if (queryNoticesOptions.passagesCharacters() != null) { builder.query("passages.characters", String.valueOf(queryNoticesOptions.passagesCharacters())); } if (queryNoticesOptions.deduplicateField() != null) { builder.query("deduplicate.field", queryNoticesOptions.deduplicateField()); } if (queryNoticesOptions.similar() != null) { builder.query("similar", String.valueOf(queryNoticesOptions.similar())); } if (queryNoticesOptions.similarDocumentIds() != null) { builder.query("similar.document_ids", RequestUtils.join(queryNoticesOptions.similarDocumentIds(), ",")); } if (queryNoticesOptions.similarFields() != null) { builder.query("similar.fields", RequestUtils.join(queryNoticesOptions.similarFields(), ",")); } return createServiceCall(builder.build(), ResponseConverterUtils.getObject(QueryNoticesResponse.class)); } }
public class class_name { public ServiceCall<QueryNoticesResponse> queryNotices(QueryNoticesOptions queryNoticesOptions) { Validator.notNull(queryNoticesOptions, "queryNoticesOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections", "notices" }; String[] pathParameters = { queryNoticesOptions.environmentId(), queryNoticesOptions.collectionId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters)); builder.query("version", versionDate); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "queryNotices"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header] } builder.header("Accept", "application/json"); if (queryNoticesOptions.filter() != null) { builder.query("filter", queryNoticesOptions.filter()); // depends on control dependency: [if], data = [none] } if (queryNoticesOptions.query() != null) { builder.query("query", queryNoticesOptions.query()); // depends on control dependency: [if], data = [none] } if (queryNoticesOptions.naturalLanguageQuery() != null) { builder.query("natural_language_query", queryNoticesOptions.naturalLanguageQuery()); // depends on control dependency: [if], data = [none] } if (queryNoticesOptions.passages() != null) { builder.query("passages", String.valueOf(queryNoticesOptions.passages())); // depends on control dependency: [if], data = [(queryNoticesOptions.passages()] } if (queryNoticesOptions.aggregation() != null) { builder.query("aggregation", queryNoticesOptions.aggregation()); // depends on control dependency: [if], data = [none] } if (queryNoticesOptions.count() != null) { builder.query("count", String.valueOf(queryNoticesOptions.count())); // depends on control dependency: [if], data = [(queryNoticesOptions.count()] } if (queryNoticesOptions.returnFields() != null) { builder.query("return", RequestUtils.join(queryNoticesOptions.returnFields(), ",")); // depends on control dependency: [if], data = [(queryNoticesOptions.returnFields()] } if (queryNoticesOptions.offset() != null) { builder.query("offset", String.valueOf(queryNoticesOptions.offset())); // depends on control dependency: [if], data = [(queryNoticesOptions.offset()] } if (queryNoticesOptions.sort() != null) { builder.query("sort", RequestUtils.join(queryNoticesOptions.sort(), ",")); // depends on control dependency: [if], data = [(queryNoticesOptions.sort()] } if (queryNoticesOptions.highlight() != null) { builder.query("highlight", String.valueOf(queryNoticesOptions.highlight())); // depends on control dependency: [if], data = [(queryNoticesOptions.highlight()] } if (queryNoticesOptions.passagesFields() != null) { builder.query("passages.fields", RequestUtils.join(queryNoticesOptions.passagesFields(), ",")); // depends on control dependency: [if], data = [(queryNoticesOptions.passagesFields()] } if (queryNoticesOptions.passagesCount() != null) { builder.query("passages.count", String.valueOf(queryNoticesOptions.passagesCount())); // depends on control dependency: [if], data = [(queryNoticesOptions.passagesCount()] } if (queryNoticesOptions.passagesCharacters() != null) { builder.query("passages.characters", String.valueOf(queryNoticesOptions.passagesCharacters())); // depends on control dependency: [if], data = [(queryNoticesOptions.passagesCharacters()] } if (queryNoticesOptions.deduplicateField() != null) { builder.query("deduplicate.field", queryNoticesOptions.deduplicateField()); // depends on control dependency: [if], data = [none] } if (queryNoticesOptions.similar() != null) { builder.query("similar", String.valueOf(queryNoticesOptions.similar())); // depends on control dependency: [if], data = [(queryNoticesOptions.similar()] } if (queryNoticesOptions.similarDocumentIds() != null) { builder.query("similar.document_ids", RequestUtils.join(queryNoticesOptions.similarDocumentIds(), ",")); // depends on control dependency: [if], data = [(queryNoticesOptions.similarDocumentIds()] } if (queryNoticesOptions.similarFields() != null) { builder.query("similar.fields", RequestUtils.join(queryNoticesOptions.similarFields(), ",")); // depends on control dependency: [if], data = [(queryNoticesOptions.similarFields()] } return createServiceCall(builder.build(), ResponseConverterUtils.getObject(QueryNoticesResponse.class)); } }
public class class_name { public static void hist(float[] data, int fmax) { float[] hist = new float[data.length]; // scale maximum float hmax = 0; for (int i = 0; i < data.length; i++) { hmax = Math.max(data[i], hmax); } float shrink = fmax / hmax; for (int i = 0; i < data.length; i++) { hist[i] = shrink * data[i]; } NumberFormat nf = new DecimalFormat("00"); String scale = ""; for (int i = 1; i < fmax / 10 + 1; i++) { scale += " . " + i % 10; } System.out.println("x" + nf.format(hmax / fmax) + "\t0" + scale); for (int i = 0; i < hist.length; i++) { System.out.print(i + "\t|"); for (int j = 0; j < Math.round(hist[i]); j++) { if ((j + 1) % 10 == 0) System.out.print("]"); else System.out.print("|"); } System.out.println(); } } }
public class class_name { public static void hist(float[] data, int fmax) { float[] hist = new float[data.length]; // scale maximum float hmax = 0; for (int i = 0; i < data.length; i++) { hmax = Math.max(data[i], hmax); // depends on control dependency: [for], data = [i] } float shrink = fmax / hmax; for (int i = 0; i < data.length; i++) { hist[i] = shrink * data[i]; // depends on control dependency: [for], data = [i] } NumberFormat nf = new DecimalFormat("00"); String scale = ""; for (int i = 1; i < fmax / 10 + 1; i++) { scale += " . " + i % 10; // depends on control dependency: [for], data = [i] } System.out.println("x" + nf.format(hmax / fmax) + "\t0" + scale); for (int i = 0; i < hist.length; i++) { System.out.print(i + "\t|"); // depends on control dependency: [for], data = [i] for (int j = 0; j < Math.round(hist[i]); j++) { if ((j + 1) % 10 == 0) System.out.print("]"); else System.out.print("|"); } System.out.println(); // depends on control dependency: [for], data = [none] } } }
public class class_name { public static <T> void permuteCyclic(T[] array, T[] fill, int n) { if (array.length != fill.length) throw new IllegalArgumentException("Lengths do not match"); if (n < 0) n = array.length + n; while (n > array.length) { n -= array.length; } for (int i = 0; i < array.length; i++) { if (i + n < array.length) { fill[i] = array[i + n]; } else { fill[i] = array[i - array.length + n]; } } } }
public class class_name { public static <T> void permuteCyclic(T[] array, T[] fill, int n) { if (array.length != fill.length) throw new IllegalArgumentException("Lengths do not match"); if (n < 0) n = array.length + n; while (n > array.length) { n -= array.length; // depends on control dependency: [while], data = [none] } for (int i = 0; i < array.length; i++) { if (i + n < array.length) { fill[i] = array[i + n]; // depends on control dependency: [if], data = [none] } else { fill[i] = array[i - array.length + n]; // depends on control dependency: [if], data = [none] } } } }
public class class_name { protected boolean consumeCompactionBatch() { /* * Consume one compaction update batch generated by the compactor. */ CompactionUpdateBatch updateBatch = _compactor.pollCompactionBatch(); if(updateBatch != null) { try { consumeCompaction(updateBatch); } catch (Exception e) { _log.error("failed to consume compaction batch " + updateBatch.getDescriptiveId(), e); } finally { _compactor.recycleCompactionBatch(updateBatch); } return true; } return false; } }
public class class_name { protected boolean consumeCompactionBatch() { /* * Consume one compaction update batch generated by the compactor. */ CompactionUpdateBatch updateBatch = _compactor.pollCompactionBatch(); if(updateBatch != null) { try { consumeCompaction(updateBatch); // depends on control dependency: [try], data = [none] } catch (Exception e) { _log.error("failed to consume compaction batch " + updateBatch.getDescriptiveId(), e); } finally { // depends on control dependency: [catch], data = [none] _compactor.recycleCompactionBatch(updateBatch); } return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public static String encodeEndpoint(String uri, String operation) { StringBuilder buf=new StringBuilder(); if (uri != null && !uri.trim().isEmpty()) { buf.append(uri); } if (operation != null && !operation.trim().isEmpty()) { buf.append('['); buf.append(operation); buf.append(']'); } return buf.toString(); } }
public class class_name { public static String encodeEndpoint(String uri, String operation) { StringBuilder buf=new StringBuilder(); if (uri != null && !uri.trim().isEmpty()) { buf.append(uri); // depends on control dependency: [if], data = [(uri] } if (operation != null && !operation.trim().isEmpty()) { buf.append('['); // depends on control dependency: [if], data = [none] buf.append(operation); // depends on control dependency: [if], data = [(operation] buf.append(']'); // depends on control dependency: [if], data = [none] } return buf.toString(); } }
public class class_name { private TextField buildField(String label, CmsAccountInfo info) { TextField field = (TextField)m_binder.buildAndBind(label, info); field.setConverter(new CmsNullToEmptyConverter()); field.setWidth("100%"); boolean editable = (m_editLevel == EditLevel.all) || (info.isEditable() && (m_editLevel == EditLevel.configured)); field.setEnabled(editable); if (editable) { field.addValidator(new FieldValidator(info.getField())); } field.setImmediate(true); return field; } }
public class class_name { private TextField buildField(String label, CmsAccountInfo info) { TextField field = (TextField)m_binder.buildAndBind(label, info); field.setConverter(new CmsNullToEmptyConverter()); field.setWidth("100%"); boolean editable = (m_editLevel == EditLevel.all) || (info.isEditable() && (m_editLevel == EditLevel.configured)); field.setEnabled(editable); if (editable) { field.addValidator(new FieldValidator(info.getField())); // depends on control dependency: [if], data = [none] } field.setImmediate(true); return field; } }
public class class_name { public String safeGet(Locator locator, String key) { String cacheValue = null; try { cacheValue = get(locator, key); } catch (CacheException ex) { log.trace(String.format("no cache value found for locator=%s, key=%s", locator.toString(), key)); } return cacheValue; } }
public class class_name { public String safeGet(Locator locator, String key) { String cacheValue = null; try { cacheValue = get(locator, key); // depends on control dependency: [try], data = [none] } catch (CacheException ex) { log.trace(String.format("no cache value found for locator=%s, key=%s", locator.toString(), key)); } // depends on control dependency: [catch], data = [none] return cacheValue; } }
public class class_name { public String toSource(final JSModule module) { return runInCompilerThread( () -> { List<CompilerInput> inputs = module.getInputs(); int numInputs = inputs.size(); if (numInputs == 0) { return ""; } CodeBuilder cb = new CodeBuilder(); for (int i = 0; i < numInputs; i++) { Node scriptNode = inputs.get(i).getAstRoot(Compiler.this); if (scriptNode == null) { throw new IllegalArgumentException("Bad module: " + module.getName()); } toSource(cb, i, scriptNode); } return cb.toString(); }); } }
public class class_name { public String toSource(final JSModule module) { return runInCompilerThread( () -> { List<CompilerInput> inputs = module.getInputs(); int numInputs = inputs.size(); if (numInputs == 0) { return ""; // depends on control dependency: [if], data = [none] } CodeBuilder cb = new CodeBuilder(); for (int i = 0; i < numInputs; i++) { Node scriptNode = inputs.get(i).getAstRoot(Compiler.this); if (scriptNode == null) { throw new IllegalArgumentException("Bad module: " + module.getName()); } toSource(cb, i, scriptNode); // depends on control dependency: [for], data = [i] } return cb.toString(); }); } }
public class class_name { public void writeException(OutputStream out, Throwable e) { int len = excepWriters.length; for (int i = 0; i < len; i++) { if (excepWriters[i].getExceptionClass().isInstance(e)) { excepWriters[i].write(out, e); return; } } throw new UnknownException(e); } }
public class class_name { public void writeException(OutputStream out, Throwable e) { int len = excepWriters.length; for (int i = 0; i < len; i++) { if (excepWriters[i].getExceptionClass().isInstance(e)) { excepWriters[i].write(out, e); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } throw new UnknownException(e); } }
public class class_name { public void setAssociations(java.util.Collection<PhoneNumberAssociation> associations) { if (associations == null) { this.associations = null; return; } this.associations = new java.util.ArrayList<PhoneNumberAssociation>(associations); } }
public class class_name { public void setAssociations(java.util.Collection<PhoneNumberAssociation> associations) { if (associations == null) { this.associations = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.associations = new java.util.ArrayList<PhoneNumberAssociation>(associations); } }
public class class_name { @Override public Asset assetAt(String path) { // The simplest implementation is to delegate to the provider and see if they return something. for (AssetProvider provider : providers) { Asset asset = provider.assetAt(path); if (asset != null) { return asset; } } return null; } }
public class class_name { @Override public Asset assetAt(String path) { // The simplest implementation is to delegate to the provider and see if they return something. for (AssetProvider provider : providers) { Asset asset = provider.assetAt(path); if (asset != null) { return asset; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { private BasicDBObject getKeys(EntityMetadata m, String[] columns) { BasicDBObject keys = new BasicDBObject(); if (columns != null && columns.length > 0) { MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata() .getMetamodel(m.getPersistenceUnit()); EntityType entity = metaModel.entity(m.getEntityClazz()); for (int i = 1; i < columns.length; i++) { if (columns[i] != null) { Attribute col = entity.getAttribute(columns[i]); if (col == null) { throw new QueryHandlerException("column type is null for: " + columns); } keys.put(((AbstractAttribute) col).getJPAColumnName(), 1); } } } return keys; } }
public class class_name { private BasicDBObject getKeys(EntityMetadata m, String[] columns) { BasicDBObject keys = new BasicDBObject(); if (columns != null && columns.length > 0) { MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata() .getMetamodel(m.getPersistenceUnit()); EntityType entity = metaModel.entity(m.getEntityClazz()); for (int i = 1; i < columns.length; i++) { if (columns[i] != null) { Attribute col = entity.getAttribute(columns[i]); if (col == null) { throw new QueryHandlerException("column type is null for: " + columns); } keys.put(((AbstractAttribute) col).getJPAColumnName(), 1); // depends on control dependency: [if], data = [none] } } } return keys; } }
public class class_name { public double percentile(double p) { long[] counts = new long[PercentileBuckets.length()]; for (int i = 0; i < counts.length; ++i) { counts[i] = counterFor(i).count(); } return PercentileBuckets.percentile(counts, p); } }
public class class_name { public double percentile(double p) { long[] counts = new long[PercentileBuckets.length()]; for (int i = 0; i < counts.length; ++i) { counts[i] = counterFor(i).count(); // depends on control dependency: [for], data = [i] } return PercentileBuckets.percentile(counts, p); } }
public class class_name { public List<JAXBElement<Object>> get_GenericApplicationPropertyOfLandUse() { if (_GenericApplicationPropertyOfLandUse == null) { _GenericApplicationPropertyOfLandUse = new ArrayList<JAXBElement<Object>>(); } return this._GenericApplicationPropertyOfLandUse; } }
public class class_name { public List<JAXBElement<Object>> get_GenericApplicationPropertyOfLandUse() { if (_GenericApplicationPropertyOfLandUse == null) { _GenericApplicationPropertyOfLandUse = new ArrayList<JAXBElement<Object>>(); // depends on control dependency: [if], data = [none] } return this._GenericApplicationPropertyOfLandUse; } }
public class class_name { void execute(final ActivityHandle handle, final int activityFlags, boolean suspendActivity) throws SLEEException { final SleeTransaction tx = super.suspendTransaction(); ActivityContextHandle ach = null; try { ach = sleeEndpoint._startActivity(handle, activityFlags, suspendActivity ? tx : null); } finally { if (tx != null) { super.resumeTransaction(tx); // the activity was started out of the tx but it will be suspended, if the flags request the unreferenced callback then // we can load the ac now, which will schedule a check for references in the end of the tx, this ensures that the callback is received if no events are fired or // events are fired but not handled, that is, no reference is ever ever created if (ach != null && ActivityFlags.hasRequestSleeActivityGCCallback(activityFlags)) { acFactory.getActivityContext(ach); } } } } }
public class class_name { void execute(final ActivityHandle handle, final int activityFlags, boolean suspendActivity) throws SLEEException { final SleeTransaction tx = super.suspendTransaction(); ActivityContextHandle ach = null; try { ach = sleeEndpoint._startActivity(handle, activityFlags, suspendActivity ? tx : null); } finally { if (tx != null) { super.resumeTransaction(tx); // depends on control dependency: [if], data = [(tx] // the activity was started out of the tx but it will be suspended, if the flags request the unreferenced callback then // we can load the ac now, which will schedule a check for references in the end of the tx, this ensures that the callback is received if no events are fired or // events are fired but not handled, that is, no reference is ever ever created if (ach != null && ActivityFlags.hasRequestSleeActivityGCCallback(activityFlags)) { acFactory.getActivityContext(ach); // depends on control dependency: [if], data = [(ach] } } } } }
public class class_name { public final Transcoding transcoding(int flags) { Transcoding tc = new Transcoding(this, flags); if (hasStateInit()) { stateInit(tc.state); } return tc; } }
public class class_name { public final Transcoding transcoding(int flags) { Transcoding tc = new Transcoding(this, flags); if (hasStateInit()) { stateInit(tc.state); // depends on control dependency: [if], data = [none] } return tc; } }
public class class_name { public void drawTextBaseRatio(String label, double horizontalReference, double verticalReference, double rotation, double[] coord) { int[] sc = projection.screenProjectionBaseRatio(coord); int x = sc[0]; int y = sc[1]; AffineTransform transform = g2d.getTransform(); // Corner offset adjustment : Text Offset is used Here FontRenderContext frc = g2d.getFontRenderContext(); Font font = g2d.getFont(); double w = font.getStringBounds(label, frc).getWidth(); double h = font.getSize2D(); if (rotation != 0) { g2d.rotate(rotation, x, y); } x -= (int) (w * horizontalReference); y += (int) (h * verticalReference); g2d.drawString(label, x, y); g2d.setTransform(transform); } }
public class class_name { public void drawTextBaseRatio(String label, double horizontalReference, double verticalReference, double rotation, double[] coord) { int[] sc = projection.screenProjectionBaseRatio(coord); int x = sc[0]; int y = sc[1]; AffineTransform transform = g2d.getTransform(); // Corner offset adjustment : Text Offset is used Here FontRenderContext frc = g2d.getFontRenderContext(); Font font = g2d.getFont(); double w = font.getStringBounds(label, frc).getWidth(); double h = font.getSize2D(); if (rotation != 0) { g2d.rotate(rotation, x, y); // depends on control dependency: [if], data = [(rotation] } x -= (int) (w * horizontalReference); y += (int) (h * verticalReference); g2d.drawString(label, x, y); g2d.setTransform(transform); } }
public class class_name { public byte[] getByteArray(final String key, final byte[] def) { try { final byte[] result = getByteArray(key); return result != null ? result : def; } catch (final NumberFormatException nfe) { return def; } } }
public class class_name { public byte[] getByteArray(final String key, final byte[] def) { try { final byte[] result = getByteArray(key); return result != null ? result : def; // depends on control dependency: [try], data = [none] } catch (final NumberFormatException nfe) { return def; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static boolean isFloatingPointString(Object pObject) { if (pObject instanceof String) { String str = (String) pObject; int len = str.length(); for (int i = 0; i < len; i++) { char ch = str.charAt(i); if (ch == '.' || ch == 'e' || ch == 'E') { return true; } } return false; } else { return false; } } }
public class class_name { public static boolean isFloatingPointString(Object pObject) { if (pObject instanceof String) { String str = (String) pObject; int len = str.length(); for (int i = 0; i < len; i++) { char ch = str.charAt(i); if (ch == '.' || ch == 'e' || ch == 'E') { return true; // depends on control dependency: [if], data = [none] } } return false; // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setBindings(Map<String, String> bindings) { for (Map.Entry<String, String> entry : bindings.entrySet()) { bindNamespaceUri(entry.getKey(), entry.getValue()); } } }
public class class_name { public void setBindings(Map<String, String> bindings) { for (Map.Entry<String, String> entry : bindings.entrySet()) { bindNamespaceUri(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry] } } }
public class class_name { protected FieldExtractor getMetadataExtractorOrFallback(Metadata meta, FieldExtractor fallbackExtractor) { if (metaExtractor != null) { FieldExtractor metaFE = metaExtractor.get(meta); if (metaFE != null) { return metaFE; } } return fallbackExtractor; } }
public class class_name { protected FieldExtractor getMetadataExtractorOrFallback(Metadata meta, FieldExtractor fallbackExtractor) { if (metaExtractor != null) { FieldExtractor metaFE = metaExtractor.get(meta); if (metaFE != null) { return metaFE; // depends on control dependency: [if], data = [none] } } return fallbackExtractor; } }
public class class_name { public Object getFromClassNames(List<String> moduleClassNames) { Preconditions.checkNotNull(moduleClassNames, "The list of module class names cannot be null."); for (final String moduleClassName : moduleClassNames) { if (!shouldBeSkipped(moduleClassName)) { return new StackTraceElement(moduleClassName, "configure", null, -1); } } return UNKNOWN_SOURCE; } }
public class class_name { public Object getFromClassNames(List<String> moduleClassNames) { Preconditions.checkNotNull(moduleClassNames, "The list of module class names cannot be null."); for (final String moduleClassName : moduleClassNames) { if (!shouldBeSkipped(moduleClassName)) { return new StackTraceElement(moduleClassName, "configure", null, -1); // depends on control dependency: [if], data = [none] } } return UNKNOWN_SOURCE; } }
public class class_name { public void actionPerformed (ActionEvent event) { Object value = null; try { value = getDisplayValue(); } catch (Exception e) { updateBorder(true); return; } // submit an attribute changed event with the new value if (!valueMatches(value)) { _accessor.set(_field, value); } } }
public class class_name { public void actionPerformed (ActionEvent event) { Object value = null; try { value = getDisplayValue(); // depends on control dependency: [try], data = [none] } catch (Exception e) { updateBorder(true); return; } // depends on control dependency: [catch], data = [none] // submit an attribute changed event with the new value if (!valueMatches(value)) { _accessor.set(_field, value); // depends on control dependency: [if], data = [none] } } }
public class class_name { private Boolean _convertToBoolean(Object value) { Boolean booleanValue; if (value instanceof Boolean) { booleanValue = (Boolean) value; } else { booleanValue = Boolean.parseBoolean(value.toString()); } return booleanValue; } }
public class class_name { private Boolean _convertToBoolean(Object value) { Boolean booleanValue; if (value instanceof Boolean) { booleanValue = (Boolean) value; // depends on control dependency: [if], data = [none] } else { booleanValue = Boolean.parseBoolean(value.toString()); // depends on control dependency: [if], data = [none] } return booleanValue; } }
public class class_name { public void marshall(LambdaFunctionSucceededEventDetails lambdaFunctionSucceededEventDetails, ProtocolMarshaller protocolMarshaller) { if (lambdaFunctionSucceededEventDetails == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(lambdaFunctionSucceededEventDetails.getOutput(), OUTPUT_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(LambdaFunctionSucceededEventDetails lambdaFunctionSucceededEventDetails, ProtocolMarshaller protocolMarshaller) { if (lambdaFunctionSucceededEventDetails == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(lambdaFunctionSucceededEventDetails.getOutput(), OUTPUT_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 { @Override protected int addNodeRecord(NodeData data) throws SQLException, InvalidItemStateException, RepositoryException { // check if parent exists if (isParentValidationNeeded(data.getParentIdentifier())) { ResultSet item = findItemByIdentifier(data.getParentIdentifier()); try { if (!item.next()) { throw new SQLException("Parent is not found. Behaviour of " + JCR_FK_ITEM_PARENT); } } finally { try { item.close(); } catch (SQLException e) { LOG.error("Can't close the ResultSet: " + e); } } } if (!innoDBEngine) { addedNodes.add(data.getIdentifier()); } return super.addNodeRecord(data); } }
public class class_name { @Override protected int addNodeRecord(NodeData data) throws SQLException, InvalidItemStateException, RepositoryException { // check if parent exists if (isParentValidationNeeded(data.getParentIdentifier())) { ResultSet item = findItemByIdentifier(data.getParentIdentifier()); try { if (!item.next()) { throw new SQLException("Parent is not found. Behaviour of " + JCR_FK_ITEM_PARENT); } } finally { try { item.close(); // depends on control dependency: [try], data = [none] } catch (SQLException e) { LOG.error("Can't close the ResultSet: " + e); } // depends on control dependency: [catch], data = [none] } } if (!innoDBEngine) { addedNodes.add(data.getIdentifier()); } return super.addNodeRecord(data); } }
public class class_name { @Override public <NV extends NumberVector> NV projectRelativeScaledToDataSpace(double[] v, NumberVector.Factory<NV> prototype) { final int dim = v.length; double[] vec = new double[dim]; for(int d = 0; d < dim; d++) { vec[d] = scales[d].getRelativeUnscaled(v[d]); } return prototype.newNumberVector(vec); } }
public class class_name { @Override public <NV extends NumberVector> NV projectRelativeScaledToDataSpace(double[] v, NumberVector.Factory<NV> prototype) { final int dim = v.length; double[] vec = new double[dim]; for(int d = 0; d < dim; d++) { vec[d] = scales[d].getRelativeUnscaled(v[d]); // depends on control dependency: [for], data = [d] } return prototype.newNumberVector(vec); } }
public class class_name { private ProcPattern createPattern(Pattern pattern) { if (pattern.isEmpty()) { throw new IllegalStateException("Pattern elements list can't be empty."); } List<ProcPatternElement> elements = new ArrayList<ProcPatternElement>(); for (PatternElement element : pattern.getElements()) { elements.add(patternElementFactory.create(element)); } return new ProcPattern(elements); } }
public class class_name { private ProcPattern createPattern(Pattern pattern) { if (pattern.isEmpty()) { throw new IllegalStateException("Pattern elements list can't be empty."); } List<ProcPatternElement> elements = new ArrayList<ProcPatternElement>(); for (PatternElement element : pattern.getElements()) { elements.add(patternElementFactory.create(element)); // depends on control dependency: [for], data = [element] } return new ProcPattern(elements); } }
public class class_name { public int executeForCursorWindow(String sql, Object[] bindArgs, CursorWindow window, int startPos, int requiredPos, boolean countAllRows, int connectionFlags, CancellationSignal cancellationSignal) { if (sql == null) { throw new IllegalArgumentException("sql must not be null."); } if (window == null) { throw new IllegalArgumentException("window must not be null."); } if (executeSpecial(sql, bindArgs, connectionFlags, cancellationSignal)) { window.clear(); return 0; } acquireConnection(sql, connectionFlags, cancellationSignal); // might throw try { return mConnection.executeForCursorWindow(sql, bindArgs, window, startPos, requiredPos, countAllRows, cancellationSignal); // might throw } finally { releaseConnection(); // might throw } } }
public class class_name { public int executeForCursorWindow(String sql, Object[] bindArgs, CursorWindow window, int startPos, int requiredPos, boolean countAllRows, int connectionFlags, CancellationSignal cancellationSignal) { if (sql == null) { throw new IllegalArgumentException("sql must not be null."); } if (window == null) { throw new IllegalArgumentException("window must not be null."); } if (executeSpecial(sql, bindArgs, connectionFlags, cancellationSignal)) { window.clear(); // depends on control dependency: [if], data = [none] return 0; // depends on control dependency: [if], data = [none] } acquireConnection(sql, connectionFlags, cancellationSignal); // might throw try { return mConnection.executeForCursorWindow(sql, bindArgs, window, startPos, requiredPos, countAllRows, cancellationSignal); // might throw // depends on control dependency: [try], data = [none] } finally { releaseConnection(); // might throw } } }
public class class_name { @Override public void commit() throws IOException { if (!this.actualProcessedCopyableFile.isPresent()) { return; } CopyableFile copyableFile = this.actualProcessedCopyableFile.get(); Path stagingFilePath = getStagingFilePath(copyableFile); Path outputFilePath = getSplitOutputFilePath(copyableFile, this.outputDir, copyableFile.getDatasetAndPartition(this.copyableDatasetMetadata), this.state); log.info(String.format("Committing data from %s to %s", stagingFilePath, outputFilePath)); try { setFilePermissions(copyableFile); Iterator<OwnerAndPermission> ancestorOwnerAndPermissionIt = copyableFile.getAncestorsOwnerAndPermission() == null ? Iterators.<OwnerAndPermission>emptyIterator() : copyableFile.getAncestorsOwnerAndPermission().iterator(); ensureDirectoryExists(this.fs, outputFilePath.getParent(), ancestorOwnerAndPermissionIt); this.fileContext.rename(stagingFilePath, outputFilePath, renameOptions); } catch (IOException ioe) { log.error("Could not commit file %s.", outputFilePath); // persist file this.recoveryHelper.persistFile(this.state, copyableFile, stagingFilePath); throw ioe; } finally { try { this.fs.delete(this.stagingDir, true); } catch (IOException ioe) { log.warn("Failed to delete staging path at " + this.stagingDir); } } } }
public class class_name { @Override public void commit() throws IOException { if (!this.actualProcessedCopyableFile.isPresent()) { return; } CopyableFile copyableFile = this.actualProcessedCopyableFile.get(); Path stagingFilePath = getStagingFilePath(copyableFile); Path outputFilePath = getSplitOutputFilePath(copyableFile, this.outputDir, copyableFile.getDatasetAndPartition(this.copyableDatasetMetadata), this.state); log.info(String.format("Committing data from %s to %s", stagingFilePath, outputFilePath)); try { setFilePermissions(copyableFile); Iterator<OwnerAndPermission> ancestorOwnerAndPermissionIt = copyableFile.getAncestorsOwnerAndPermission() == null ? Iterators.<OwnerAndPermission>emptyIterator() : copyableFile.getAncestorsOwnerAndPermission().iterator(); ensureDirectoryExists(this.fs, outputFilePath.getParent(), ancestorOwnerAndPermissionIt); this.fileContext.rename(stagingFilePath, outputFilePath, renameOptions); } catch (IOException ioe) { log.error("Could not commit file %s.", outputFilePath); // persist file this.recoveryHelper.persistFile(this.state, copyableFile, stagingFilePath); throw ioe; } finally { try { this.fs.delete(this.stagingDir, true); // depends on control dependency: [try], data = [none] } catch (IOException ioe) { log.warn("Failed to delete staging path at " + this.stagingDir); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public void addRule(Rule<T> rule) { if (rule == null) { return; } if (!_headRule.isPresent()) { _headRule = Optional.of(rule); // this rule is the head if there was no head _tailRule = rule; } else { _tailRule.setNextRule(rule); _tailRule = rule; } } }
public class class_name { public void addRule(Rule<T> rule) { if (rule == null) { return; // depends on control dependency: [if], data = [none] } if (!_headRule.isPresent()) { _headRule = Optional.of(rule); // this rule is the head if there was no head // depends on control dependency: [if], data = [none] _tailRule = rule; // depends on control dependency: [if], data = [none] } else { _tailRule.setNextRule(rule); // depends on control dependency: [if], data = [none] _tailRule = rule; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static int[] parseInts(String nums, String sperator) { String[] ss = StringUtils.split(nums, sperator); int[] ints = new int[ss.length]; for (int i = 0; i < ss.length; i++) { ints[i] = Integer.parseInt(ss[i]); } return ints; } }
public class class_name { public static int[] parseInts(String nums, String sperator) { String[] ss = StringUtils.split(nums, sperator); int[] ints = new int[ss.length]; for (int i = 0; i < ss.length; i++) { ints[i] = Integer.parseInt(ss[i]); // depends on control dependency: [for], data = [i] } return ints; } }
public class class_name { @Override public EClass getIfcChiller() { if (ifcChillerEClass == null) { ifcChillerEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(87); } return ifcChillerEClass; } }
public class class_name { @Override public EClass getIfcChiller() { if (ifcChillerEClass == null) { ifcChillerEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(87); // depends on control dependency: [if], data = [none] } return ifcChillerEClass; } }
public class class_name { public DataSetMetadata getMetadata(String uuid) { DataSetMetadata metadata = clientDataSetManager.getDataSetMetadata(uuid); if (metadata != null) { return metadata; } return remoteMetadataMap.get(uuid); } }
public class class_name { public DataSetMetadata getMetadata(String uuid) { DataSetMetadata metadata = clientDataSetManager.getDataSetMetadata(uuid); if (metadata != null) { return metadata; // depends on control dependency: [if], data = [none] } return remoteMetadataMap.get(uuid); } }
public class class_name { private void resizeValueText() { double maxWidth = 0.5 * size; double fontSize = 0.20625 * size; valueText.setFont(Fonts.robotoBold(fontSize)); if (valueText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(valueText, maxWidth, fontSize); } valueText.relocate((size - valueText.getLayoutBounds().getWidth()) * 0.5, (size - valueText.getLayoutBounds().getHeight()) * (unitText.getText().isEmpty() ? 0.5 : 0.42)); } }
public class class_name { private void resizeValueText() { double maxWidth = 0.5 * size; double fontSize = 0.20625 * size; valueText.setFont(Fonts.robotoBold(fontSize)); if (valueText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(valueText, maxWidth, fontSize); } // depends on control dependency: [if], data = [none] valueText.relocate((size - valueText.getLayoutBounds().getWidth()) * 0.5, (size - valueText.getLayoutBounds().getHeight()) * (unitText.getText().isEmpty() ? 0.5 : 0.42)); } }
public class class_name { public static <IN, OUT> List<OUT> create(Collection<IN> collection, Creator<IN, OUT> creator) { if (collection == null) { return null; } ArrayList<OUT> list = new ArrayList<>(collection.size()); for (IN value : collection) { OUT item = value == null ? null : creator.create(value); if (item != null) { list.add(item); } } return list; } }
public class class_name { public static <IN, OUT> List<OUT> create(Collection<IN> collection, Creator<IN, OUT> creator) { if (collection == null) { return null; // depends on control dependency: [if], data = [none] } ArrayList<OUT> list = new ArrayList<>(collection.size()); for (IN value : collection) { OUT item = value == null ? null : creator.create(value); if (item != null) { list.add(item); // depends on control dependency: [if], data = [(item] } } return list; } }
public class class_name { @Override public long getQueuedFlowSize() { long size = 0L; try { size = this.executorLoader.fetchQueuedFlows().size(); } catch (final ExecutorManagerException e) { this.logger.error("Failed to get queued flow size.", e); } return size; } }
public class class_name { @Override public long getQueuedFlowSize() { long size = 0L; try { size = this.executorLoader.fetchQueuedFlows().size(); // depends on control dependency: [try], data = [none] } catch (final ExecutorManagerException e) { this.logger.error("Failed to get queued flow size.", e); } // depends on control dependency: [catch], data = [none] return size; } }
public class class_name { public final void elementValue() throws RecognitionException { int elementValue_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 69) ) { return; } // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:629:5: ( conditionalExpression | annotation | elementValueArrayInitializer ) int alt91=3; switch ( input.LA(1) ) { case CharacterLiteral: case DecimalLiteral: case FloatingPointLiteral: case HexLiteral: case Identifier: case OctalLiteral: case StringLiteral: case 29: case 36: case 40: case 41: case 44: case 45: case 53: case 65: case 67: case 70: case 71: case 77: case 79: case 80: case 82: case 85: case 92: case 94: case 97: case 98: case 105: case 108: case 111: case 115: case 118: case 126: { alt91=1; } break; case 58: { alt91=2; } break; case 121: { alt91=3; } break; default: if (state.backtracking>0) {state.failed=true; return;} NoViableAltException nvae = new NoViableAltException("", 91, 0, input); throw nvae; } switch (alt91) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:629:7: conditionalExpression { pushFollow(FOLLOW_conditionalExpression_in_elementValue2406); conditionalExpression(); state._fsp--; if (state.failed) return; } break; case 2 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:630:9: annotation { pushFollow(FOLLOW_annotation_in_elementValue2416); annotation(); state._fsp--; if (state.failed) return; } break; case 3 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:631:9: elementValueArrayInitializer { pushFollow(FOLLOW_elementValueArrayInitializer_in_elementValue2426); elementValueArrayInitializer(); state._fsp--; if (state.failed) return; } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 69, elementValue_StartIndex); } } } }
public class class_name { public final void elementValue() throws RecognitionException { int elementValue_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 69) ) { return; } // depends on control dependency: [if], data = [none] // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:629:5: ( conditionalExpression | annotation | elementValueArrayInitializer ) int alt91=3; switch ( input.LA(1) ) { case CharacterLiteral: case DecimalLiteral: case FloatingPointLiteral: case HexLiteral: case Identifier: case OctalLiteral: case StringLiteral: case 29: case 36: case 40: case 41: case 44: case 45: case 53: case 65: case 67: case 70: case 71: case 77: case 79: case 80: case 82: case 85: case 92: case 94: case 97: case 98: case 105: case 108: case 111: case 115: case 118: case 126: { alt91=1; } break; case 58: { alt91=2; } break; case 121: { alt91=3; } break; default: if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] NoViableAltException nvae = new NoViableAltException("", 91, 0, input); throw nvae; } switch (alt91) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:629:7: conditionalExpression { pushFollow(FOLLOW_conditionalExpression_in_elementValue2406); conditionalExpression(); state._fsp--; if (state.failed) return; } break; case 2 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:630:9: annotation { pushFollow(FOLLOW_annotation_in_elementValue2416); annotation(); state._fsp--; if (state.failed) return; } break; case 3 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:631:9: elementValueArrayInitializer { pushFollow(FOLLOW_elementValueArrayInitializer_in_elementValue2426); elementValueArrayInitializer(); state._fsp--; if (state.failed) return; } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 69, elementValue_StartIndex); } } } }
public class class_name { public void processMixPushMessage(String message) { if (!StringUtil.isEmpty(message)) { String channel = getChannel(message); if (channel == null || !containsDefaultPushCallback(channel)) { channel = AVOSCloud.getApplicationId(); } String action = getAction(message); boolean isSlient = getSilent(message); if (action != null) { sendBroadcast(channel, message, action); } else if (!isSlient) { sendNotification(channel, message); } else { LOGGER.e("ignore push silent message: " + message); } } } }
public class class_name { public void processMixPushMessage(String message) { if (!StringUtil.isEmpty(message)) { String channel = getChannel(message); if (channel == null || !containsDefaultPushCallback(channel)) { channel = AVOSCloud.getApplicationId(); // depends on control dependency: [if], data = [none] } String action = getAction(message); boolean isSlient = getSilent(message); if (action != null) { sendBroadcast(channel, message, action); // depends on control dependency: [if], data = [none] } else if (!isSlient) { sendNotification(channel, message); // depends on control dependency: [if], data = [none] } else { LOGGER.e("ignore push silent message: " + message); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public Defuzzifier constructDefuzzifier(String key, int resolution, WeightedDefuzzifier.Type type) { Defuzzifier result = constructObject(key); if (result instanceof IntegralDefuzzifier) { ((IntegralDefuzzifier) result).setResolution(resolution); } else if (result instanceof WeightedDefuzzifier) { ((WeightedDefuzzifier) result).setType(type); } return result; } }
public class class_name { public Defuzzifier constructDefuzzifier(String key, int resolution, WeightedDefuzzifier.Type type) { Defuzzifier result = constructObject(key); if (result instanceof IntegralDefuzzifier) { ((IntegralDefuzzifier) result).setResolution(resolution); // depends on control dependency: [if], data = [none] } else if (result instanceof WeightedDefuzzifier) { ((WeightedDefuzzifier) result).setType(type); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public Ordering createNewOrderingUpToIndex(int exclusiveIndex) { if (exclusiveIndex == 0) { return null; } final Ordering newOrdering = new Ordering(); for (int i = 0; i < exclusiveIndex; i++) { newOrdering.appendOrdering(this.indexes.get(i), this.types.get(i), this.orders.get(i)); } return newOrdering; } }
public class class_name { public Ordering createNewOrderingUpToIndex(int exclusiveIndex) { if (exclusiveIndex == 0) { return null; // depends on control dependency: [if], data = [none] } final Ordering newOrdering = new Ordering(); for (int i = 0; i < exclusiveIndex; i++) { newOrdering.appendOrdering(this.indexes.get(i), this.types.get(i), this.orders.get(i)); // depends on control dependency: [for], data = [i] } return newOrdering; } }
public class class_name { @Override public void close() { try { flush(); indexWriter.close(); } catch (MutationsRejectedException e) { throw new PrestoException(UNEXPECTED_ACCUMULO_ERROR, "Mutation was rejected by server on close", e); } } }
public class class_name { @Override public void close() { try { flush(); // depends on control dependency: [try], data = [none] indexWriter.close(); // depends on control dependency: [try], data = [none] } catch (MutationsRejectedException e) { throw new PrestoException(UNEXPECTED_ACCUMULO_ERROR, "Mutation was rejected by server on close", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public CommerceDiscountUserSegmentRel remove(Serializable primaryKey) throws NoSuchDiscountUserSegmentRelException { Session session = null; try { session = openSession(); CommerceDiscountUserSegmentRel commerceDiscountUserSegmentRel = (CommerceDiscountUserSegmentRel)session.get(CommerceDiscountUserSegmentRelImpl.class, primaryKey); if (commerceDiscountUserSegmentRel == null) { if (_log.isDebugEnabled()) { _log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } throw new NoSuchDiscountUserSegmentRelException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } return remove(commerceDiscountUserSegmentRel); } catch (NoSuchDiscountUserSegmentRelException nsee) { throw nsee; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } }
public class class_name { @Override public CommerceDiscountUserSegmentRel remove(Serializable primaryKey) throws NoSuchDiscountUserSegmentRelException { Session session = null; try { session = openSession(); CommerceDiscountUserSegmentRel commerceDiscountUserSegmentRel = (CommerceDiscountUserSegmentRel)session.get(CommerceDiscountUserSegmentRelImpl.class, primaryKey); if (commerceDiscountUserSegmentRel == null) { if (_log.isDebugEnabled()) { _log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); // depends on control dependency: [if], data = [none] } throw new NoSuchDiscountUserSegmentRelException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } return remove(commerceDiscountUserSegmentRel); } catch (NoSuchDiscountUserSegmentRelException nsee) { throw nsee; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } }
public class class_name { public DescribeReservedInstancesModificationsResult withReservedInstancesModifications(ReservedInstancesModification... reservedInstancesModifications) { if (this.reservedInstancesModifications == null) { setReservedInstancesModifications(new com.amazonaws.internal.SdkInternalList<ReservedInstancesModification>(reservedInstancesModifications.length)); } for (ReservedInstancesModification ele : reservedInstancesModifications) { this.reservedInstancesModifications.add(ele); } return this; } }
public class class_name { public DescribeReservedInstancesModificationsResult withReservedInstancesModifications(ReservedInstancesModification... reservedInstancesModifications) { if (this.reservedInstancesModifications == null) { setReservedInstancesModifications(new com.amazonaws.internal.SdkInternalList<ReservedInstancesModification>(reservedInstancesModifications.length)); // depends on control dependency: [if], data = [none] } for (ReservedInstancesModification ele : reservedInstancesModifications) { this.reservedInstancesModifications.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static Taint valueOf(State state) { Objects.requireNonNull(state, "state is null"); if (state == State.INVALID) { return null; } return new Taint(state); } }
public class class_name { public static Taint valueOf(State state) { Objects.requireNonNull(state, "state is null"); if (state == State.INVALID) { return null; // depends on control dependency: [if], data = [none] } return new Taint(state); } }
public class class_name { private void updateVertex(Shape shape, GeometryEditService editService, GeometryIndex index) throws GeometryIndexNotFoundException { if (shape instanceof Rectangle) { Rectangle rectangle = (Rectangle) shape; Geometry geometry = editService.getGeometry(); Coordinate v = editService.getIndexService().getVertex(geometry, index); if (!targetSpace.equals(RenderSpace.WORLD)) { v = mapPresenter.getViewPort().getTransformationService().transform(v, RenderSpace.WORLD, targetSpace); } rectangle.setUserX(v.getX() - VERTEX_HALF_SIZE); rectangle.setUserY(v.getY() - VERTEX_HALF_SIZE); } } }
public class class_name { private void updateVertex(Shape shape, GeometryEditService editService, GeometryIndex index) throws GeometryIndexNotFoundException { if (shape instanceof Rectangle) { Rectangle rectangle = (Rectangle) shape; Geometry geometry = editService.getGeometry(); Coordinate v = editService.getIndexService().getVertex(geometry, index); if (!targetSpace.equals(RenderSpace.WORLD)) { v = mapPresenter.getViewPort().getTransformationService().transform(v, RenderSpace.WORLD, targetSpace); // depends on control dependency: [if], data = [none] } rectangle.setUserX(v.getX() - VERTEX_HALF_SIZE); rectangle.setUserY(v.getY() - VERTEX_HALF_SIZE); } } }
public class class_name { protected HtmlTree getWinTitleScript(){ HtmlTree script = HtmlTree.SCRIPT(); if(winTitle != null && winTitle.length() > 0) { String scriptCode = "<!--" + DocletConstants.NL + " try {" + DocletConstants.NL + " if (location.href.indexOf('is-external=true') == -1) {" + DocletConstants.NL + " parent.document.title=\"" + escapeJavaScriptChars(winTitle) + "\";" + DocletConstants.NL + " }" + DocletConstants.NL + " }" + DocletConstants.NL + " catch(err) {" + DocletConstants.NL + " }" + DocletConstants.NL + "//-->" + DocletConstants.NL; RawHtml scriptContent = new RawHtml(scriptCode); script.addContent(scriptContent); } return script; } }
public class class_name { protected HtmlTree getWinTitleScript(){ HtmlTree script = HtmlTree.SCRIPT(); if(winTitle != null && winTitle.length() > 0) { String scriptCode = "<!--" + DocletConstants.NL + " try {" + DocletConstants.NL + " if (location.href.indexOf('is-external=true') == -1) {" + DocletConstants.NL + " parent.document.title=\"" + escapeJavaScriptChars(winTitle) + "\";" + DocletConstants.NL + " }" + DocletConstants.NL + " }" + DocletConstants.NL + " catch(err) {" + DocletConstants.NL + " }" + DocletConstants.NL + "//-->" + DocletConstants.NL; RawHtml scriptContent = new RawHtml(scriptCode); // depends on control dependency: [if], data = [none] script.addContent(scriptContent); // depends on control dependency: [if], data = [none] } return script; } }
public class class_name { public void insertAttributeValue(String attributeName, CmsEntity value, int index) { if (m_entityAttributes.containsKey(attributeName)) { m_entityAttributes.get(attributeName).add(index, value); } else { setAttributeValue(attributeName, value); } registerChangeHandler(value); fireChange(); } }
public class class_name { public void insertAttributeValue(String attributeName, CmsEntity value, int index) { if (m_entityAttributes.containsKey(attributeName)) { m_entityAttributes.get(attributeName).add(index, value); // depends on control dependency: [if], data = [none] } else { setAttributeValue(attributeName, value); // depends on control dependency: [if], data = [none] } registerChangeHandler(value); fireChange(); } }
public class class_name { public ByteMatchSet withByteMatchTuples(ByteMatchTuple... byteMatchTuples) { if (this.byteMatchTuples == null) { setByteMatchTuples(new java.util.ArrayList<ByteMatchTuple>(byteMatchTuples.length)); } for (ByteMatchTuple ele : byteMatchTuples) { this.byteMatchTuples.add(ele); } return this; } }
public class class_name { public ByteMatchSet withByteMatchTuples(ByteMatchTuple... byteMatchTuples) { if (this.byteMatchTuples == null) { setByteMatchTuples(new java.util.ArrayList<ByteMatchTuple>(byteMatchTuples.length)); // depends on control dependency: [if], data = [none] } for (ByteMatchTuple ele : byteMatchTuples) { this.byteMatchTuples.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private void initSnapshotWork(final Object[] procParams) { final String procedureName = "@SnapshotRestore"; StoredProcedureInvocation spi = new StoredProcedureInvocation(); spi.setProcName(procedureName); spi.params = new FutureTask<ParameterSet>(new Callable<ParameterSet>() { @Override public ParameterSet call() throws Exception { ParameterSet params = ParameterSet.fromArrayWithCopy(procParams); return params; } }); spi.setClientHandle(m_restoreAdapter.registerCallback(m_clientAdapterCallback)); // admin mode invocation as per third parameter ClientResponseImpl cr = m_initiator.dispatch(spi, m_restoreAdapter, true, OverrideCheck.INVOCATION); if (cr != null) { m_clientAdapterCallback.handleResponse(cr); } } }
public class class_name { private void initSnapshotWork(final Object[] procParams) { final String procedureName = "@SnapshotRestore"; StoredProcedureInvocation spi = new StoredProcedureInvocation(); spi.setProcName(procedureName); spi.params = new FutureTask<ParameterSet>(new Callable<ParameterSet>() { @Override public ParameterSet call() throws Exception { ParameterSet params = ParameterSet.fromArrayWithCopy(procParams); return params; } }); spi.setClientHandle(m_restoreAdapter.registerCallback(m_clientAdapterCallback)); // admin mode invocation as per third parameter ClientResponseImpl cr = m_initiator.dispatch(spi, m_restoreAdapter, true, OverrideCheck.INVOCATION); if (cr != null) { m_clientAdapterCallback.handleResponse(cr); // depends on control dependency: [if], data = [(cr] } } }
public class class_name { static final int crc8(final byte[] input, final int offset, final int len) { final int poly = 0x0D5; int crc = 0; for (int i = 0; i < len; i++) { final byte c = input[offset + i]; crc ^= c; for (int j = 0; j < 8; j++) { if ((crc & 0x80) != 0) { crc = ((crc << 1) ^ poly); } else { crc <<= 1; } } crc &= 0xFF; } return crc; } }
public class class_name { static final int crc8(final byte[] input, final int offset, final int len) { final int poly = 0x0D5; int crc = 0; for (int i = 0; i < len; i++) { final byte c = input[offset + i]; crc ^= c; // depends on control dependency: [for], data = [none] for (int j = 0; j < 8; j++) { if ((crc & 0x80) != 0) { crc = ((crc << 1) ^ poly); // depends on control dependency: [if], data = [none] } else { crc <<= 1; // depends on control dependency: [if], data = [none] } } crc &= 0xFF; // depends on control dependency: [for], data = [none] } return crc; } }
public class class_name { @Override public int compare(ILigand ligand1, ILigand ligand2) { int atomicNumberComp = atomicNumberRule.compare(ligand1, ligand2); if (atomicNumberComp != 0) return atomicNumberComp; int massNumberComp = massNumberRule.compare(ligand1, ligand2); if (massNumberComp != 0) return massNumberComp; if ("H".equals(ligand1.getLigandAtom().getSymbol())) { // both atoms are hydrogens return 0; } return massNumberComp; } }
public class class_name { @Override public int compare(ILigand ligand1, ILigand ligand2) { int atomicNumberComp = atomicNumberRule.compare(ligand1, ligand2); if (atomicNumberComp != 0) return atomicNumberComp; int massNumberComp = massNumberRule.compare(ligand1, ligand2); if (massNumberComp != 0) return massNumberComp; if ("H".equals(ligand1.getLigandAtom().getSymbol())) { // both atoms are hydrogens return 0; // depends on control dependency: [if], data = [none] } return massNumberComp; } }
public class class_name { public static Either<String,String> getBuildVersion() { //Find the right manifest from the many on classpath. See http://stackoverflow.com/questions/1272648/reading-my-own-jars-manifest Class clazz = BuildNumberCommand.class; String className = clazz.getSimpleName() + ".class"; String classPath = clazz.getResource(className).toString(); if (!classPath.startsWith("jar")) { return Either.right("Cannot determine build version when not running from JAR."); } String manifestPath = classPath.substring(0, classPath.lastIndexOf('!') + 1) + "/META-INF/MANIFEST.MF"; try { Manifest manifest = new Manifest(new URL(manifestPath).openStream()); String build = manifest.getMainAttributes().getValue(BUILD_VERSION); if (build == null) { return Either.right(String.format("Cannot determine build version when %s missing from JAR manifest %s", BUILD_VERSION, MANIFEST)); } else { return Either.left(build); } } catch (IOException e) { return Either.right(String.format("Cannot access %s: %s", manifestPath, e)); } } }
public class class_name { public static Either<String,String> getBuildVersion() { //Find the right manifest from the many on classpath. See http://stackoverflow.com/questions/1272648/reading-my-own-jars-manifest Class clazz = BuildNumberCommand.class; String className = clazz.getSimpleName() + ".class"; String classPath = clazz.getResource(className).toString(); if (!classPath.startsWith("jar")) { return Either.right("Cannot determine build version when not running from JAR."); // depends on control dependency: [if], data = [none] } String manifestPath = classPath.substring(0, classPath.lastIndexOf('!') + 1) + "/META-INF/MANIFEST.MF"; try { Manifest manifest = new Manifest(new URL(manifestPath).openStream()); String build = manifest.getMainAttributes().getValue(BUILD_VERSION); if (build == null) { return Either.right(String.format("Cannot determine build version when %s missing from JAR manifest %s", BUILD_VERSION, MANIFEST)); // depends on control dependency: [if], data = [none] } else { return Either.left(build); // depends on control dependency: [if], data = [(build] } } catch (IOException e) { return Either.right(String.format("Cannot access %s: %s", manifestPath, e)); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static void writeMemento(final File resourceDir, final Resource resource, final Instant time) { try (final BufferedWriter writer = newBufferedWriter( getNquadsFile(resourceDir, time).toPath(), UTF_8, CREATE, WRITE, TRUNCATE_EXISTING)) { try (final Stream<String> quads = generateServerManaged(resource).map(FileUtils::serializeQuad)) { final Iterator<String> lineIter = quads.iterator(); while (lineIter.hasNext()) { writer.write(lineIter.next() + lineSeparator()); } } try (final Stream<String> quads = resource.stream().filter(FileUtils::notServerManaged) .map(FileUtils::serializeQuad)) { final Iterator<String> lineiter = quads.iterator(); while (lineiter.hasNext()) { writer.write(lineiter.next() + lineSeparator()); } } } catch (final IOException ex) { throw new UncheckedIOException( "Error writing resource version for " + resource.getIdentifier().getIRIString(), ex); } } }
public class class_name { public static void writeMemento(final File resourceDir, final Resource resource, final Instant time) { try (final BufferedWriter writer = newBufferedWriter( getNquadsFile(resourceDir, time).toPath(), UTF_8, CREATE, WRITE, TRUNCATE_EXISTING)) { try (final Stream<String> quads = generateServerManaged(resource).map(FileUtils::serializeQuad)) { final Iterator<String> lineIter = quads.iterator(); while (lineIter.hasNext()) { writer.write(lineIter.next() + lineSeparator()); // depends on control dependency: [while], data = [none] } } try (final Stream<String> quads = resource.stream().filter(FileUtils::notServerManaged) .map(FileUtils::serializeQuad)) { final Iterator<String> lineiter = quads.iterator(); while (lineiter.hasNext()) { writer.write(lineiter.next() + lineSeparator()); // depends on control dependency: [while], data = [none] } } } catch (final IOException ex) { throw new UncheckedIOException( "Error writing resource version for " + resource.getIdentifier().getIRIString(), ex); } } }
public class class_name { @Override public synchronized CacheObject get(final Object key) { final CacheObject o = map.get(key); if (o != null) { updateAccess(o); ++hits; } else ++misses; return o; } }
public class class_name { @Override public synchronized CacheObject get(final Object key) { final CacheObject o = map.get(key); if (o != null) { updateAccess(o); // depends on control dependency: [if], data = [(o] ++hits; // depends on control dependency: [if], data = [none] } else ++misses; return o; } }
public class class_name { public void marshall(GreenFleetProvisioningOption greenFleetProvisioningOption, ProtocolMarshaller protocolMarshaller) { if (greenFleetProvisioningOption == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(greenFleetProvisioningOption.getAction(), ACTION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GreenFleetProvisioningOption greenFleetProvisioningOption, ProtocolMarshaller protocolMarshaller) { if (greenFleetProvisioningOption == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(greenFleetProvisioningOption.getAction(), ACTION_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 @Nullable JSONArray getFacetFilters() { try { String value = get(KEY_FACET_FILTERS); if (value != null) { return new JSONArray(value); } } catch (JSONException e) { // Will return null } return null; } }
public class class_name { public @Nullable JSONArray getFacetFilters() { try { String value = get(KEY_FACET_FILTERS); if (value != null) { return new JSONArray(value); // depends on control dependency: [if], data = [(value] } } catch (JSONException e) { // Will return null } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { private RendererSelection isRendererMatch(final RendererBeanDescriptor<?> rendererDescriptor, final Renderable renderable, final RendererSelection bestMatch) { final Class<? extends Renderable> renderableType = rendererDescriptor.getRenderableType(); final Class<? extends Renderable> renderableClass = renderable.getClass(); if (ReflectionUtils.is(renderableClass, renderableType)) { if (bestMatch == null) { return isRendererCapable(rendererDescriptor, renderable, bestMatch); } else { final int hierarchyDistance; try { hierarchyDistance = ReflectionUtils.getHierarchyDistance(renderableClass, renderableType); } catch (final IllegalArgumentException e) { logger.warn( "Failed to determine hierarchy distance between renderable type '{}' and renderable of class '{}'", renderableType, renderableClass, e); return null; } if (hierarchyDistance == 0) { // no hierarchy distance return isRendererCapable(rendererDescriptor, renderable, bestMatch); } if (hierarchyDistance <= bestMatch.getHierarchyDistance()) { // lower hierarchy distance than best match return isRendererCapable(rendererDescriptor, renderable, bestMatch); } } } return null; } }
public class class_name { private RendererSelection isRendererMatch(final RendererBeanDescriptor<?> rendererDescriptor, final Renderable renderable, final RendererSelection bestMatch) { final Class<? extends Renderable> renderableType = rendererDescriptor.getRenderableType(); final Class<? extends Renderable> renderableClass = renderable.getClass(); if (ReflectionUtils.is(renderableClass, renderableType)) { if (bestMatch == null) { return isRendererCapable(rendererDescriptor, renderable, bestMatch); } else { final int hierarchyDistance; try { hierarchyDistance = ReflectionUtils.getHierarchyDistance(renderableClass, renderableType); // depends on control dependency: [try], data = [none] } catch (final IllegalArgumentException e) { logger.warn( "Failed to determine hierarchy distance between renderable type '{}' and renderable of class '{}'", renderableType, renderableClass, e); return null; } // depends on control dependency: [catch], data = [none] if (hierarchyDistance == 0) { // no hierarchy distance return isRendererCapable(rendererDescriptor, renderable, bestMatch); // depends on control dependency: [if], data = [none] } if (hierarchyDistance <= bestMatch.getHierarchyDistance()) { // lower hierarchy distance than best match return isRendererCapable(rendererDescriptor, renderable, bestMatch); // depends on control dependency: [if], data = [none] } } } return null; } }
public class class_name { @Override public synchronized void updateLastAccessTime(long accessTime) { if (_lastAccessedTime == 0) { // newly created session object _lastAccessedTime = accessTime; } else { _lastAccessedTime = _currentAccessTime; } _currentAccessTime = accessTime; if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[UPDATE_LAST_ACCESS_TIME], "" + accessTime); } } }
public class class_name { @Override public synchronized void updateLastAccessTime(long accessTime) { if (_lastAccessedTime == 0) { // newly created session object _lastAccessedTime = accessTime; // depends on control dependency: [if], data = [none] } else { _lastAccessedTime = _currentAccessTime; // depends on control dependency: [if], data = [none] } _currentAccessTime = accessTime; if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[UPDATE_LAST_ACCESS_TIME], "" + accessTime); // depends on control dependency: [if], data = [none] } } }
public class class_name { @PostConstruct public void checkUniqueSchemes() { Multimap<String, ConfigFileLoaderPlugin> schemeToPluginMap = HashMultimap.create(); for (ConfigFileLoaderPlugin plugin: getLoaderPlugins()) { schemeToPluginMap.put(plugin.getUriScheme(), plugin); } StringBuilder violations = new StringBuilder(); for (String scheme: schemeToPluginMap.keySet()) { final Collection<ConfigFileLoaderPlugin> plugins = schemeToPluginMap.get(scheme); if (plugins.size() > 1) { violations.append("\n\n* ").append("There are has multiple ") .append(ConfigFileLoaderPlugin.class.getSimpleName()) .append(" plugins that support the scheme: '").append(scheme).append('\'') .append(":\n\t").append(plugins); } } if (violations.length() > 0) { throw new IllegalStateException(violations.toString()); } } }
public class class_name { @PostConstruct public void checkUniqueSchemes() { Multimap<String, ConfigFileLoaderPlugin> schemeToPluginMap = HashMultimap.create(); for (ConfigFileLoaderPlugin plugin: getLoaderPlugins()) { schemeToPluginMap.put(plugin.getUriScheme(), plugin); // depends on control dependency: [for], data = [plugin] } StringBuilder violations = new StringBuilder(); for (String scheme: schemeToPluginMap.keySet()) { final Collection<ConfigFileLoaderPlugin> plugins = schemeToPluginMap.get(scheme); if (plugins.size() > 1) { violations.append("\n\n* ").append("There are has multiple ") .append(ConfigFileLoaderPlugin.class.getSimpleName()) .append(" plugins that support the scheme: '").append(scheme).append('\'') .append(":\n\t").append(plugins); // depends on control dependency: [if], data = [none] } } if (violations.length() > 0) { throw new IllegalStateException(violations.toString()); } } }
public class class_name { public void updateButtonsForWorkFlow(WorkFlowState state) { // Check if it is in the NOT_INITIALIZED state if (state.getState().equals(WorkFlowState.NOT_INITIALIZED)) { backButton.setEnabled(false); nextButton.setEnabled(false); finishButton.setEnabled(false); cancelButton.setEnabled(false); } // Check if it is in the READY state if (state.getState().equals(WorkFlowState.READY)) { finishButton.setEnabled(false); cancelButton.setEnabled(true); // Update buttons for the current screen state updateButtonsForScreen(state.getCurrentScreenState()); } // Check if it is in the NOT_SAVED state if (state.getState().equals(WorkFlowState.NOT_SAVED)) { finishButton.setEnabled(true); cancelButton.setEnabled(true); } } }
public class class_name { public void updateButtonsForWorkFlow(WorkFlowState state) { // Check if it is in the NOT_INITIALIZED state if (state.getState().equals(WorkFlowState.NOT_INITIALIZED)) { backButton.setEnabled(false); // depends on control dependency: [if], data = [none] nextButton.setEnabled(false); // depends on control dependency: [if], data = [none] finishButton.setEnabled(false); // depends on control dependency: [if], data = [none] cancelButton.setEnabled(false); // depends on control dependency: [if], data = [none] } // Check if it is in the READY state if (state.getState().equals(WorkFlowState.READY)) { finishButton.setEnabled(false); // depends on control dependency: [if], data = [none] cancelButton.setEnabled(true); // depends on control dependency: [if], data = [none] // Update buttons for the current screen state updateButtonsForScreen(state.getCurrentScreenState()); // depends on control dependency: [if], data = [none] } // Check if it is in the NOT_SAVED state if (state.getState().equals(WorkFlowState.NOT_SAVED)) { finishButton.setEnabled(true); // depends on control dependency: [if], data = [none] cancelButton.setEnabled(true); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public <NV extends NumberVector> NV projectScaledToDataSpace(double[] v, NumberVector.Factory<NV> factory) { final int dim = v.length; double[] vec = new double[dim]; for(int d = 0; d < dim; d++) { vec[d] = scales[d].getUnscaled(v[d]); } return factory.newNumberVector(vec); } }
public class class_name { @Override public <NV extends NumberVector> NV projectScaledToDataSpace(double[] v, NumberVector.Factory<NV> factory) { final int dim = v.length; double[] vec = new double[dim]; for(int d = 0; d < dim; d++) { vec[d] = scales[d].getUnscaled(v[d]); // depends on control dependency: [for], data = [d] } return factory.newNumberVector(vec); } }
public class class_name { protected boolean validate( StringBuffer buff) { if (!_validate(buff)) return false; Object editValue = getEditValue(); if (editValue == null) return false; for (FieldValidator v : validators) { if (!v.validate(this, editValue, buff)) return false; } if (acceptIfDifferent( editValue)) { setEditValue( validValue); sendEvent(); } return true; } }
public class class_name { protected boolean validate( StringBuffer buff) { if (!_validate(buff)) return false; Object editValue = getEditValue(); if (editValue == null) return false; for (FieldValidator v : validators) { if (!v.validate(this, editValue, buff)) return false; } if (acceptIfDifferent( editValue)) { setEditValue( validValue); // depends on control dependency: [if], data = [none] sendEvent(); // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { private void exception(Throwable e) { try { _persistent=false; int error_code=HttpResponse.__500_Internal_Server_Error; if (e instanceof HttpException) { error_code=((HttpException)e).getCode(); if (_request==null) log.warn(e.toString()); else log.warn(_request.getRequestLine()+" "+e.toString()); log.debug(LogSupport.EXCEPTION,e); } else if (e instanceof EOFException) { LogSupport.ignore(log,e); return; } else { _request.setAttribute("javax.servlet.error.exception_type",e.getClass()); _request.setAttribute("javax.servlet.error.exception",e); if (_request==null) log.warn(LogSupport.EXCEPTION,e); else log.warn(_request.getRequestLine(),e); } if (_response != null && !_response.isCommitted()) { _response.reset(); _response.removeField(HttpFields.__TransferEncoding); _response.setField(HttpFields.__Connection,HttpFields.__Close); _response.sendError(error_code); } } catch(Exception ex) { LogSupport.ignore(log,ex); } } }
public class class_name { private void exception(Throwable e) { try { _persistent=false; // depends on control dependency: [try], data = [none] int error_code=HttpResponse.__500_Internal_Server_Error; if (e instanceof HttpException) { error_code=((HttpException)e).getCode(); // depends on control dependency: [if], data = [none] if (_request==null) log.warn(e.toString()); else log.warn(_request.getRequestLine()+" "+e.toString()); log.debug(LogSupport.EXCEPTION,e); // depends on control dependency: [if], data = [none] } else if (e instanceof EOFException) { LogSupport.ignore(log,e); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } else { _request.setAttribute("javax.servlet.error.exception_type",e.getClass()); // depends on control dependency: [if], data = [none] _request.setAttribute("javax.servlet.error.exception",e); // depends on control dependency: [if], data = [none] if (_request==null) log.warn(LogSupport.EXCEPTION,e); else log.warn(_request.getRequestLine(),e); } if (_response != null && !_response.isCommitted()) { _response.reset(); // depends on control dependency: [if], data = [none] _response.removeField(HttpFields.__TransferEncoding); // depends on control dependency: [if], data = [none] _response.setField(HttpFields.__Connection,HttpFields.__Close); // depends on control dependency: [if], data = [none] _response.sendError(error_code); // depends on control dependency: [if], data = [none] } } catch(Exception ex) { LogSupport.ignore(log,ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void writeHeaders(HttpServletRequest request, HttpServletResponse response) { if (requestMatcher.matches(request)) { if (!pins.isEmpty()) { String headerName = reportOnly ? HPKP_RO_HEADER_NAME : HPKP_HEADER_NAME; if (!response.containsHeader(headerName)) { response.setHeader(headerName, hpkpHeaderValue); } } if (logger.isDebugEnabled()) { logger.debug("Not injecting HPKP header since there aren't any pins"); } } else if (logger.isDebugEnabled()) { logger.debug("Not injecting HPKP header since it wasn't a secure connection"); } } }
public class class_name { public void writeHeaders(HttpServletRequest request, HttpServletResponse response) { if (requestMatcher.matches(request)) { if (!pins.isEmpty()) { String headerName = reportOnly ? HPKP_RO_HEADER_NAME : HPKP_HEADER_NAME; if (!response.containsHeader(headerName)) { response.setHeader(headerName, hpkpHeaderValue); // depends on control dependency: [if], data = [none] } } if (logger.isDebugEnabled()) { logger.debug("Not injecting HPKP header since there aren't any pins"); } } else if (logger.isDebugEnabled()) { logger.debug("Not injecting HPKP header since it wasn't a secure connection"); } } }
public class class_name { @Override public void connect() { try { // Create MQTT client config final MqttClientConfig config = new MqttClientConfig(); String uri = url; if (uri.indexOf(':') == -1) { uri = uri + ":1883"; } uri = uri.replace("mqtt://", "tcp://"); if (url.indexOf("://") == -1) { uri = "tcp://" + uri; } // Set properties config.setReconnectionStrategy(new NullReconnectStrategy()); config.setKeepAliveSeconds(keepAliveSeconds); config.setConnectTimeoutSeconds(connectTimeoutSeconds); config.setMessageResendIntervalSeconds(messageResendIntervalSeconds); config.setBlockingTimeoutSeconds(blockingTimeoutSeconds); config.setMaxInFlightMessages(maxInFlightMessages); // Create MQTT client disconnect(); client = new AsyncMqttClient(uri, this, executor, config); client.connect(nodeID + '-' + broker.getConfig().getUidGenerator().nextUID(), cleanSession, username, password); } catch (Exception cause) { reconnect(cause); } } }
public class class_name { @Override public void connect() { try { // Create MQTT client config final MqttClientConfig config = new MqttClientConfig(); String uri = url; if (uri.indexOf(':') == -1) { uri = uri + ":1883"; // depends on control dependency: [if], data = [none] } uri = uri.replace("mqtt://", "tcp://"); if (url.indexOf("://") == -1) { uri = "tcp://" + uri; } // Set properties config.setReconnectionStrategy(new NullReconnectStrategy()); config.setKeepAliveSeconds(keepAliveSeconds); config.setConnectTimeoutSeconds(connectTimeoutSeconds); config.setMessageResendIntervalSeconds(messageResendIntervalSeconds); config.setBlockingTimeoutSeconds(blockingTimeoutSeconds); config.setMaxInFlightMessages(maxInFlightMessages); // Create MQTT client disconnect(); client = new AsyncMqttClient(uri, this, executor, config); client.connect(nodeID + '-' + broker.getConfig().getUidGenerator().nextUID(), cleanSession, username, password); } catch (Exception cause) { reconnect(cause); } } }
public class class_name { @Override public synchronized void addRecord(Slice record, boolean force) throws IOException { checkState(!closed.get(), "Log has been closed"); SliceInput sliceInput = record.input(); // used to track first, middle and last blocks boolean begin = true; // Fragment the record int chunks as necessary and write it. Note that if record // is empty, we still want to iterate once to write a single // zero-length chunk. do { int bytesRemainingInBlock = BLOCK_SIZE - blockOffset; checkState(bytesRemainingInBlock >= 0); // Switch to a new block if necessary if (bytesRemainingInBlock < HEADER_SIZE) { if (bytesRemainingInBlock > 0) { // Fill the rest of the block with zeros // todo lame... need a better way to write zeros ensureCapacity(bytesRemainingInBlock); mappedByteBuffer.put(new byte[bytesRemainingInBlock]); } blockOffset = 0; bytesRemainingInBlock = BLOCK_SIZE - blockOffset; } // Invariant: we never leave less than HEADER_SIZE bytes available in a block int bytesAvailableInBlock = bytesRemainingInBlock - HEADER_SIZE; checkState(bytesAvailableInBlock >= 0); // if there are more bytes in the record then there are available in the block, // fragment the record; otherwise write to the end of the record boolean end; int fragmentLength; if (sliceInput.available() > bytesAvailableInBlock) { end = false; fragmentLength = bytesAvailableInBlock; } else { end = true; fragmentLength = sliceInput.available(); } // determine block type LogChunkType type; if (begin && end) { type = LogChunkType.FULL; } else if (begin) { type = LogChunkType.FIRST; } else if (end) { type = LogChunkType.LAST; } else { type = LogChunkType.MIDDLE; } // write the chunk writeChunk(type, sliceInput.readBytes(fragmentLength)); // we are no longer on the first chunk begin = false; } while (sliceInput.isReadable()); if (force) { mappedByteBuffer.force(); } } }
public class class_name { @Override public synchronized void addRecord(Slice record, boolean force) throws IOException { checkState(!closed.get(), "Log has been closed"); SliceInput sliceInput = record.input(); // used to track first, middle and last blocks boolean begin = true; // Fragment the record int chunks as necessary and write it. Note that if record // is empty, we still want to iterate once to write a single // zero-length chunk. do { int bytesRemainingInBlock = BLOCK_SIZE - blockOffset; checkState(bytesRemainingInBlock >= 0); // Switch to a new block if necessary if (bytesRemainingInBlock < HEADER_SIZE) { if (bytesRemainingInBlock > 0) { // Fill the rest of the block with zeros // todo lame... need a better way to write zeros ensureCapacity(bytesRemainingInBlock); // depends on control dependency: [if], data = [(bytesRemainingInBlock] mappedByteBuffer.put(new byte[bytesRemainingInBlock]); // depends on control dependency: [if], data = [none] } blockOffset = 0; // depends on control dependency: [if], data = [none] bytesRemainingInBlock = BLOCK_SIZE - blockOffset; // depends on control dependency: [if], data = [none] } // Invariant: we never leave less than HEADER_SIZE bytes available in a block int bytesAvailableInBlock = bytesRemainingInBlock - HEADER_SIZE; checkState(bytesAvailableInBlock >= 0); // if there are more bytes in the record then there are available in the block, // fragment the record; otherwise write to the end of the record boolean end; int fragmentLength; if (sliceInput.available() > bytesAvailableInBlock) { end = false; // depends on control dependency: [if], data = [none] fragmentLength = bytesAvailableInBlock; // depends on control dependency: [if], data = [none] } else { end = true; // depends on control dependency: [if], data = [none] fragmentLength = sliceInput.available(); // depends on control dependency: [if], data = [none] } // determine block type LogChunkType type; if (begin && end) { type = LogChunkType.FULL; // depends on control dependency: [if], data = [none] } else if (begin) { type = LogChunkType.FIRST; // depends on control dependency: [if], data = [none] } else if (end) { type = LogChunkType.LAST; // depends on control dependency: [if], data = [none] } else { type = LogChunkType.MIDDLE; // depends on control dependency: [if], data = [none] } // write the chunk writeChunk(type, sliceInput.readBytes(fragmentLength)); // we are no longer on the first chunk begin = false; } while (sliceInput.isReadable()); if (force) { mappedByteBuffer.force(); } } }
public class class_name { @SuppressWarnings({"fallthrough"}) public static void spooky12(final BitVector bv, final long seed, final long[] tuple) { if (bv.length() < Long.SIZE * 12) { spooky4(bv, seed, tuple); return; } long h0, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11; h0 = h3 = h6 = h9 = seed; h1 = h4 = h7 = h10 = seed; h2 = h5 = h8 = h11 = ARBITRARY_BITS; final long length = bv.length(); long pos = 0; long remaining = length; while (remaining >= Long.SIZE * 11) { h0 += bv.getLong(pos + 0 * Long.SIZE, pos + 1 * Long.SIZE); h2 ^= h10; h11 ^= h0; h0 = Long.rotateLeft(h0, 11); h11 += h1; h1 += bv.getLong(pos + 1 * Long.SIZE, pos + 2 * Long.SIZE); h3 ^= h11; h0 ^= h1; h1 = Long.rotateLeft(h1, 32); h0 += h2; h2 += bv.getLong(pos + 2 * Long.SIZE, pos + 3 * Long.SIZE); h4 ^= h0; h1 ^= h2; h2 = Long.rotateLeft(h2, 43); h1 += h3; h3 += bv.getLong(pos + 3 * Long.SIZE, pos + 4 * Long.SIZE); h5 ^= h1; h2 ^= h3; h3 = Long.rotateLeft(h3, 31); h2 += h4; h4 += bv.getLong(pos + 4 * Long.SIZE, pos + 5 * Long.SIZE); h6 ^= h2; h3 ^= h4; h4 = Long.rotateLeft(h4, 17); h3 += h5; h5 += bv.getLong(pos + 5 * Long.SIZE, pos + 6 * Long.SIZE); h7 ^= h3; h4 ^= h5; h5 = Long.rotateLeft(h5, 28); h4 += h6; h6 += bv.getLong(pos + 6 * Long.SIZE, pos + 7 * Long.SIZE); h8 ^= h4; h5 ^= h6; h6 = Long.rotateLeft(h6, 39); h5 += h7; h7 += bv.getLong(pos + 7 * Long.SIZE, pos + 8 * Long.SIZE); h9 ^= h5; h6 ^= h7; h7 = Long.rotateLeft(h7, 57); h6 += h8; h8 += bv.getLong(pos + 8 * Long.SIZE, pos + 9 * Long.SIZE); h10 ^= h6; h7 ^= h8; h8 = Long.rotateLeft(h8, 55); h7 += h9; h9 += bv.getLong(pos + 9 * Long.SIZE, pos + 10 * Long.SIZE); h11 ^= h7; h8 ^= h9; h9 = Long.rotateLeft(h9, 54); h8 += h10; h10 += bv.getLong(pos + 10 * Long.SIZE, pos + 11 * Long.SIZE); h0 ^= h8; h9 ^= h10; h10 = Long.rotateLeft(h10, 22); h9 += h11; h11 += bv.getLong(pos + 11 * Long.SIZE, Math.min(length, pos + 12 * Long.SIZE)); h1 ^= h9; h10 ^= h11; h11 = Long.rotateLeft(h11, 46); h10 += h0; pos += Long.SIZE * 12; remaining -= Long.SIZE * 12; } final int remainingWords = (int) (remaining / Long.SIZE); switch (remainingWords) { case 10: h9 += bv.getLong(pos + Long.SIZE * 9, pos + Long.SIZE * 10); case 9: h8 += bv.getLong(pos + Long.SIZE * 8, pos + Long.SIZE * 9); case 8: h7 += bv.getLong(pos + Long.SIZE * 7, pos + Long.SIZE * 8); case 7: h6 += bv.getLong(pos + Long.SIZE * 6, pos + Long.SIZE * 7); case 6: h5 += bv.getLong(pos + Long.SIZE * 5, pos + Long.SIZE * 6); case 5: h4 += bv.getLong(pos + Long.SIZE * 4, pos + Long.SIZE * 5); case 4: h3 += bv.getLong(pos + Long.SIZE * 3, pos + Long.SIZE * 4); case 3: h2 += bv.getLong(pos + Long.SIZE * 2, pos + Long.SIZE * 3); case 2: h1 += bv.getLong(pos + Long.SIZE * 1, pos + Long.SIZE * 2); case 1: h0 += bv.getLong(pos + Long.SIZE * 0, pos + Long.SIZE * 1); default: break; } final int bits = (int) (remaining % Long.SIZE); if (bits > 0) { final long partial = bv.getLong(length - bits, length); switch (remainingWords) { case 0: h0 += partial; break; case 1: h1 += partial; break; case 2: h2 += partial; break; case 3: h3 += partial; break; case 4: h4 += partial; break; case 5: h5 += partial; break; case 6: h6 += partial; break; case 7: h7 += partial; break; case 8: h8 += partial; break; case 9: h9 += partial; break; case 10: h10 += partial; break; } } h11 += length; for (int i = 0; i < 3; i++) { h11 += h1; h2 ^= h11; h1 = Long.rotateLeft(h1, 44); h0 += h2; h3 ^= h0; h2 = Long.rotateLeft(h2, 15); h1 += h3; h4 ^= h1; h3 = Long.rotateLeft(h3, 34); h2 += h4; h5 ^= h2; h4 = Long.rotateLeft(h4, 21); h3 += h5; h6 ^= h3; h5 = Long.rotateLeft(h5, 38); h4 += h6; h7 ^= h4; h6 = Long.rotateLeft(h6, 33); h5 += h7; h8 ^= h5; h7 = Long.rotateLeft(h7, 10); h6 += h8; h9 ^= h6; h8 = Long.rotateLeft(h8, 13); h7 += h9; h10 ^= h7; h9 = Long.rotateLeft(h9, 38); h8 += h10; h11 ^= h8; h10 = Long.rotateLeft(h10, 53); h9 += h11; h0 ^= h9; h11 = Long.rotateLeft(h11, 42); h10 += h0; h1 ^= h10; h0 = Long.rotateLeft(h0, 54); } switch (tuple.length) { case 4: tuple[3] = h3; case 3: tuple[2] = h2; case 2: tuple[1] = h1; case 1: tuple[0] = h0; } } }
public class class_name { @SuppressWarnings({"fallthrough"}) public static void spooky12(final BitVector bv, final long seed, final long[] tuple) { if (bv.length() < Long.SIZE * 12) { spooky4(bv, seed, tuple); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } long h0, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11; h0 = h3 = h6 = h9 = seed; h1 = h4 = h7 = h10 = seed; h2 = h5 = h8 = h11 = ARBITRARY_BITS; final long length = bv.length(); long pos = 0; long remaining = length; while (remaining >= Long.SIZE * 11) { h0 += bv.getLong(pos + 0 * Long.SIZE, pos + 1 * Long.SIZE); // depends on control dependency: [while], data = [none] h2 ^= h10; // depends on control dependency: [while], data = [none] h11 ^= h0; // depends on control dependency: [while], data = [none] h0 = Long.rotateLeft(h0, 11); // depends on control dependency: [while], data = [none] h11 += h1; // depends on control dependency: [while], data = [none] h1 += bv.getLong(pos + 1 * Long.SIZE, pos + 2 * Long.SIZE); // depends on control dependency: [while], data = [none] h3 ^= h11; // depends on control dependency: [while], data = [none] h0 ^= h1; // depends on control dependency: [while], data = [none] h1 = Long.rotateLeft(h1, 32); // depends on control dependency: [while], data = [none] h0 += h2; // depends on control dependency: [while], data = [none] h2 += bv.getLong(pos + 2 * Long.SIZE, pos + 3 * Long.SIZE); // depends on control dependency: [while], data = [none] h4 ^= h0; // depends on control dependency: [while], data = [none] h1 ^= h2; // depends on control dependency: [while], data = [none] h2 = Long.rotateLeft(h2, 43); // depends on control dependency: [while], data = [none] h1 += h3; // depends on control dependency: [while], data = [none] h3 += bv.getLong(pos + 3 * Long.SIZE, pos + 4 * Long.SIZE); // depends on control dependency: [while], data = [none] h5 ^= h1; // depends on control dependency: [while], data = [none] h2 ^= h3; // depends on control dependency: [while], data = [none] h3 = Long.rotateLeft(h3, 31); // depends on control dependency: [while], data = [none] h2 += h4; // depends on control dependency: [while], data = [none] h4 += bv.getLong(pos + 4 * Long.SIZE, pos + 5 * Long.SIZE); // depends on control dependency: [while], data = [none] h6 ^= h2; // depends on control dependency: [while], data = [none] h3 ^= h4; // depends on control dependency: [while], data = [none] h4 = Long.rotateLeft(h4, 17); // depends on control dependency: [while], data = [none] h3 += h5; // depends on control dependency: [while], data = [none] h5 += bv.getLong(pos + 5 * Long.SIZE, pos + 6 * Long.SIZE); // depends on control dependency: [while], data = [none] h7 ^= h3; // depends on control dependency: [while], data = [none] h4 ^= h5; // depends on control dependency: [while], data = [none] h5 = Long.rotateLeft(h5, 28); // depends on control dependency: [while], data = [none] h4 += h6; // depends on control dependency: [while], data = [none] h6 += bv.getLong(pos + 6 * Long.SIZE, pos + 7 * Long.SIZE); // depends on control dependency: [while], data = [none] h8 ^= h4; // depends on control dependency: [while], data = [none] h5 ^= h6; // depends on control dependency: [while], data = [none] h6 = Long.rotateLeft(h6, 39); // depends on control dependency: [while], data = [none] h5 += h7; // depends on control dependency: [while], data = [none] h7 += bv.getLong(pos + 7 * Long.SIZE, pos + 8 * Long.SIZE); // depends on control dependency: [while], data = [none] h9 ^= h5; // depends on control dependency: [while], data = [none] h6 ^= h7; // depends on control dependency: [while], data = [none] h7 = Long.rotateLeft(h7, 57); // depends on control dependency: [while], data = [none] h6 += h8; // depends on control dependency: [while], data = [none] h8 += bv.getLong(pos + 8 * Long.SIZE, pos + 9 * Long.SIZE); // depends on control dependency: [while], data = [none] h10 ^= h6; // depends on control dependency: [while], data = [none] h7 ^= h8; // depends on control dependency: [while], data = [none] h8 = Long.rotateLeft(h8, 55); // depends on control dependency: [while], data = [none] h7 += h9; // depends on control dependency: [while], data = [none] h9 += bv.getLong(pos + 9 * Long.SIZE, pos + 10 * Long.SIZE); // depends on control dependency: [while], data = [none] h11 ^= h7; // depends on control dependency: [while], data = [none] h8 ^= h9; // depends on control dependency: [while], data = [none] h9 = Long.rotateLeft(h9, 54); // depends on control dependency: [while], data = [none] h8 += h10; // depends on control dependency: [while], data = [none] h10 += bv.getLong(pos + 10 * Long.SIZE, pos + 11 * Long.SIZE); // depends on control dependency: [while], data = [none] h0 ^= h8; // depends on control dependency: [while], data = [none] h9 ^= h10; // depends on control dependency: [while], data = [none] h10 = Long.rotateLeft(h10, 22); // depends on control dependency: [while], data = [none] h9 += h11; // depends on control dependency: [while], data = [none] h11 += bv.getLong(pos + 11 * Long.SIZE, Math.min(length, pos + 12 * Long.SIZE)); // depends on control dependency: [while], data = [none] h1 ^= h9; // depends on control dependency: [while], data = [none] h10 ^= h11; // depends on control dependency: [while], data = [none] h11 = Long.rotateLeft(h11, 46); // depends on control dependency: [while], data = [none] h10 += h0; // depends on control dependency: [while], data = [none] pos += Long.SIZE * 12; // depends on control dependency: [while], data = [none] remaining -= Long.SIZE * 12; // depends on control dependency: [while], data = [none] } final int remainingWords = (int) (remaining / Long.SIZE); switch (remainingWords) { case 10: h9 += bv.getLong(pos + Long.SIZE * 9, pos + Long.SIZE * 10); case 9: h8 += bv.getLong(pos + Long.SIZE * 8, pos + Long.SIZE * 9); case 8: h7 += bv.getLong(pos + Long.SIZE * 7, pos + Long.SIZE * 8); case 7: h6 += bv.getLong(pos + Long.SIZE * 6, pos + Long.SIZE * 7); case 6: h5 += bv.getLong(pos + Long.SIZE * 5, pos + Long.SIZE * 6); case 5: h4 += bv.getLong(pos + Long.SIZE * 4, pos + Long.SIZE * 5); case 4: h3 += bv.getLong(pos + Long.SIZE * 3, pos + Long.SIZE * 4); case 3: h2 += bv.getLong(pos + Long.SIZE * 2, pos + Long.SIZE * 3); case 2: h1 += bv.getLong(pos + Long.SIZE * 1, pos + Long.SIZE * 2); case 1: h0 += bv.getLong(pos + Long.SIZE * 0, pos + Long.SIZE * 1); default: break; } final int bits = (int) (remaining % Long.SIZE); if (bits > 0) { final long partial = bv.getLong(length - bits, length); switch (remainingWords) { case 0: h0 += partial; break; case 1: h1 += partial; break; case 2: h2 += partial; break; case 3: h3 += partial; break; case 4: h4 += partial; break; case 5: h5 += partial; break; case 6: h6 += partial; break; case 7: h7 += partial; break; case 8: h8 += partial; break; case 9: h9 += partial; break; case 10: h10 += partial; break; } } h11 += length; for (int i = 0; i < 3; i++) { h11 += h1; // depends on control dependency: [for], data = [none] h2 ^= h11; // depends on control dependency: [for], data = [none] h1 = Long.rotateLeft(h1, 44); // depends on control dependency: [for], data = [none] h0 += h2; // depends on control dependency: [for], data = [none] h3 ^= h0; // depends on control dependency: [for], data = [none] h2 = Long.rotateLeft(h2, 15); // depends on control dependency: [for], data = [none] h1 += h3; // depends on control dependency: [for], data = [none] h4 ^= h1; // depends on control dependency: [for], data = [none] h3 = Long.rotateLeft(h3, 34); // depends on control dependency: [for], data = [none] h2 += h4; // depends on control dependency: [for], data = [none] h5 ^= h2; // depends on control dependency: [for], data = [none] h4 = Long.rotateLeft(h4, 21); // depends on control dependency: [for], data = [none] h3 += h5; // depends on control dependency: [for], data = [none] h6 ^= h3; // depends on control dependency: [for], data = [none] h5 = Long.rotateLeft(h5, 38); // depends on control dependency: [for], data = [none] h4 += h6; // depends on control dependency: [for], data = [none] h7 ^= h4; // depends on control dependency: [for], data = [none] h6 = Long.rotateLeft(h6, 33); // depends on control dependency: [for], data = [none] h5 += h7; // depends on control dependency: [for], data = [none] h8 ^= h5; // depends on control dependency: [for], data = [none] h7 = Long.rotateLeft(h7, 10); // depends on control dependency: [for], data = [none] h6 += h8; // depends on control dependency: [for], data = [none] h9 ^= h6; // depends on control dependency: [for], data = [none] h8 = Long.rotateLeft(h8, 13); // depends on control dependency: [for], data = [none] h7 += h9; // depends on control dependency: [for], data = [none] h10 ^= h7; // depends on control dependency: [for], data = [none] h9 = Long.rotateLeft(h9, 38); // depends on control dependency: [for], data = [none] h8 += h10; // depends on control dependency: [for], data = [none] h11 ^= h8; // depends on control dependency: [for], data = [none] h10 = Long.rotateLeft(h10, 53); // depends on control dependency: [for], data = [none] h9 += h11; // depends on control dependency: [for], data = [none] h0 ^= h9; // depends on control dependency: [for], data = [none] h11 = Long.rotateLeft(h11, 42); // depends on control dependency: [for], data = [none] h10 += h0; // depends on control dependency: [for], data = [none] h1 ^= h10; // depends on control dependency: [for], data = [none] h0 = Long.rotateLeft(h0, 54); // depends on control dependency: [for], data = [none] } switch (tuple.length) { case 4: tuple[3] = h3; case 3: tuple[2] = h2; case 2: tuple[1] = h1; case 1: tuple[0] = h0; } } }
public class class_name { @SuppressWarnings("rawtypes") private List<InetAddress> resolve(String hostname, String attrName) throws NamingException, UnknownHostException { Attributes attrs = context.getAttributes(hostname, new String[] { attrName }); List<InetAddress> inetAddresses = new ArrayList<>(); Attribute attr = attrs.get(attrName); if (attr != null && attr.size() > 0) { NamingEnumeration e = attr.getAll(); while (e.hasMore()) { InetAddress inetAddress = InetAddress.getByName("" + e.next()); inetAddresses.add(InetAddress.getByAddress(hostname, inetAddress.getAddress())); } } return inetAddresses; } }
public class class_name { @SuppressWarnings("rawtypes") private List<InetAddress> resolve(String hostname, String attrName) throws NamingException, UnknownHostException { Attributes attrs = context.getAttributes(hostname, new String[] { attrName }); List<InetAddress> inetAddresses = new ArrayList<>(); Attribute attr = attrs.get(attrName); if (attr != null && attr.size() > 0) { NamingEnumeration e = attr.getAll(); while (e.hasMore()) { InetAddress inetAddress = InetAddress.getByName("" + e.next()); inetAddresses.add(InetAddress.getByAddress(hostname, inetAddress.getAddress())); // depends on control dependency: [while], data = [none] } } return inetAddresses; } }
public class class_name { public <T extends Widget & Checkable> List<T> getCheckedWidgets() { List<T> checked = new ArrayList<>(); for (Widget c : getChildren()) { if (c instanceof Checkable && ((Checkable) c).isChecked()) { checked.add((T) c); } } return checked; } }
public class class_name { public <T extends Widget & Checkable> List<T> getCheckedWidgets() { List<T> checked = new ArrayList<>(); for (Widget c : getChildren()) { if (c instanceof Checkable && ((Checkable) c).isChecked()) { checked.add((T) c); // depends on control dependency: [if], data = [none] } } return checked; } }
public class class_name { List<Long> getCountList() { List<Long> ret = new ArrayList<Long>(); long lastValue = 0; int positionInBlock = 0; for (long index = 0; index < this.bitVector.size(); index++) { if (this.bitVector.getBit(index)) { lastValue++; } positionInBlock++; if (positionInBlock == this.blockSize) { ret.add(lastValue); positionInBlock = 0; } } if (positionInBlock > 0) { ret.add(lastValue); } return ret; } }
public class class_name { List<Long> getCountList() { List<Long> ret = new ArrayList<Long>(); long lastValue = 0; int positionInBlock = 0; for (long index = 0; index < this.bitVector.size(); index++) { if (this.bitVector.getBit(index)) { lastValue++; // depends on control dependency: [if], data = [none] } positionInBlock++; // depends on control dependency: [for], data = [none] if (positionInBlock == this.blockSize) { ret.add(lastValue); // depends on control dependency: [if], data = [none] positionInBlock = 0; // depends on control dependency: [if], data = [none] } } if (positionInBlock > 0) { ret.add(lastValue); // depends on control dependency: [if], data = [none] } return ret; } }
public class class_name { public void marshall(Get get, ProtocolMarshaller protocolMarshaller) { if (get == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(get.getKey(), KEY_BINDING); protocolMarshaller.marshall(get.getTableName(), TABLENAME_BINDING); protocolMarshaller.marshall(get.getProjectionExpression(), PROJECTIONEXPRESSION_BINDING); protocolMarshaller.marshall(get.getExpressionAttributeNames(), EXPRESSIONATTRIBUTENAMES_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(Get get, ProtocolMarshaller protocolMarshaller) { if (get == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(get.getKey(), KEY_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(get.getTableName(), TABLENAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(get.getProjectionExpression(), PROJECTIONEXPRESSION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(get.getExpressionAttributeNames(), EXPRESSIONATTRIBUTENAMES_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] } }