code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { private void handleDeclarationBlock(CssToken start, CssTokenIterator iter, final CssContentHandler doc, CssErrorHandler err) throws CssException { while (true) { if (MATCH_CLOSEBRACE.apply(start)) { return; } CssDeclaration decl = handleDeclaration(start, iter, doc, err, false); try { if (decl != null) { doc.declaration(decl); if (debug) { checkState(MATCH_SEMI_CLOSEBRACE.apply(iter.last)); } // continue or return: we may be at "; next decl" or "}" or ";}" if (MATCH_CLOSEBRACE.apply(iter.last)) { return; } else if (MATCH_SEMI.apply(iter.last) && MATCH_CLOSEBRACE.apply(iter.peek())) { iter.next(); return; } else { if (debug) { checkState(MATCH_SEMI.apply(iter.last)); } // we have ';', expect another decl start = iter.next(); // first token after ';' } } else { // #handleDeclaration returned null to signal error // #handleDeclaration has issued errors, we forward start = iter.next(MATCH_SEMI_CLOSEBRACE); if (MATCH_SEMI.apply(start)) { start = iter.next(); } } } catch (NoSuchElementException nse) { err.error(new CssGrammarException(GRAMMAR_PREMATURE_EOF, iter.last.location, messages.getLocale(), "';' " + messages.get("or") + " '}'")); throw new PrematureEOFException(); } } } }
public class class_name { private void handleDeclarationBlock(CssToken start, CssTokenIterator iter, final CssContentHandler doc, CssErrorHandler err) throws CssException { while (true) { if (MATCH_CLOSEBRACE.apply(start)) { return; // depends on control dependency: [if], data = [none] } CssDeclaration decl = handleDeclaration(start, iter, doc, err, false); try { if (decl != null) { doc.declaration(decl); // depends on control dependency: [if], data = [(decl] if (debug) { checkState(MATCH_SEMI_CLOSEBRACE.apply(iter.last)); // depends on control dependency: [if], data = [none] } // continue or return: we may be at "; next decl" or "}" or ";}" if (MATCH_CLOSEBRACE.apply(iter.last)) { return; // depends on control dependency: [if], data = [none] } else if (MATCH_SEMI.apply(iter.last) && MATCH_CLOSEBRACE.apply(iter.peek())) { iter.next(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } else { if (debug) { checkState(MATCH_SEMI.apply(iter.last)); // depends on control dependency: [if], data = [none] } // we have ';', expect another decl start = iter.next(); // first token after ';' // depends on control dependency: [if], data = [none] } } else { // #handleDeclaration returned null to signal error // #handleDeclaration has issued errors, we forward start = iter.next(MATCH_SEMI_CLOSEBRACE); // depends on control dependency: [if], data = [none] if (MATCH_SEMI.apply(start)) { start = iter.next(); // depends on control dependency: [if], data = [none] } } } catch (NoSuchElementException nse) { err.error(new CssGrammarException(GRAMMAR_PREMATURE_EOF, iter.last.location, messages.getLocale(), "';' " + messages.get("or") + " '}'")); throw new PrematureEOFException(); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public static TypedValue untypedValue(Object value, boolean isTransient) { if(value == null) { return untypedNullValue(isTransient); } else if (value instanceof TypedValueBuilder<?>) { return ((TypedValueBuilder<?>) value).setTransient(isTransient).create(); } else if (value instanceof TypedValue) { TypedValue transientValue = (TypedValue) value; if (value instanceof NullValueImpl) { transientValue = untypedNullValue(isTransient); } else if (value instanceof FileValue) { ((FileValueImpl) transientValue).setTransient(isTransient); } else if (value instanceof AbstractTypedValue<?>) { ((AbstractTypedValue<?>) transientValue).setTransient(isTransient); } return transientValue; } else { // unknown value return new UntypedValueImpl(value, isTransient); } } }
public class class_name { public static TypedValue untypedValue(Object value, boolean isTransient) { if(value == null) { return untypedNullValue(isTransient); // depends on control dependency: [if], data = [none] } else if (value instanceof TypedValueBuilder<?>) { return ((TypedValueBuilder<?>) value).setTransient(isTransient).create(); // depends on control dependency: [if], data = [)] } else if (value instanceof TypedValue) { TypedValue transientValue = (TypedValue) value; if (value instanceof NullValueImpl) { transientValue = untypedNullValue(isTransient); // depends on control dependency: [if], data = [none] } else if (value instanceof FileValue) { ((FileValueImpl) transientValue).setTransient(isTransient); // depends on control dependency: [if], data = [none] } else if (value instanceof AbstractTypedValue<?>) { ((AbstractTypedValue<?>) transientValue).setTransient(isTransient); // depends on control dependency: [if], data = [)] } return transientValue; // depends on control dependency: [if], data = [none] } else { // unknown value return new UntypedValueImpl(value, isTransient); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static int getKeyLength(String cipherSuite) { // Roughly ordered from most common to least common. if (cipherSuite == null) { return 0; } else if (cipherSuite.contains("WITH_AES_256_")) { return 256; } else if (cipherSuite.contains("WITH_RC4_128_")) { return 128; } else if (cipherSuite.contains("WITH_AES_128_")) { return 128; } else if (cipherSuite.contains("WITH_RC4_40_")) { return 40; } else if (cipherSuite.contains("WITH_3DES_EDE_CBC_")) { return 168; } else if (cipherSuite.contains("WITH_IDEA_CBC_")) { return 128; } else if (cipherSuite.contains("WITH_RC2_CBC_40_")) { return 40; } else if (cipherSuite.contains("WITH_DES40_CBC_")) { return 40; } else if (cipherSuite.contains("WITH_DES_CBC_")) { return 56; } else { return 0; } } }
public class class_name { public static int getKeyLength(String cipherSuite) { // Roughly ordered from most common to least common. if (cipherSuite == null) { return 0; // depends on control dependency: [if], data = [none] } else if (cipherSuite.contains("WITH_AES_256_")) { return 256; // depends on control dependency: [if], data = [none] } else if (cipherSuite.contains("WITH_RC4_128_")) { return 128; // depends on control dependency: [if], data = [none] } else if (cipherSuite.contains("WITH_AES_128_")) { return 128; // depends on control dependency: [if], data = [none] } else if (cipherSuite.contains("WITH_RC4_40_")) { return 40; // depends on control dependency: [if], data = [none] } else if (cipherSuite.contains("WITH_3DES_EDE_CBC_")) { return 168; // depends on control dependency: [if], data = [none] } else if (cipherSuite.contains("WITH_IDEA_CBC_")) { return 128; // depends on control dependency: [if], data = [none] } else if (cipherSuite.contains("WITH_RC2_CBC_40_")) { return 40; // depends on control dependency: [if], data = [none] } else if (cipherSuite.contains("WITH_DES40_CBC_")) { return 40; // depends on control dependency: [if], data = [none] } else if (cipherSuite.contains("WITH_DES_CBC_")) { return 56; // depends on control dependency: [if], data = [none] } else { return 0; // depends on control dependency: [if], data = [none] } } }
public class class_name { public synchronized void transferError(Exception e) { logger.debug("intercepted exception", e); if (transferException == null) { transferException = e; } else if (transferException instanceof InterruptedException || transferException instanceof InterruptedIOException) { //if one of the threads throws an error, it interrupts //the other thread (by InterruptedException). //Here we make sure that transferException will store the //primary failure reason, not the resulting InterruptedException transferException = e; } notifyAll(); } }
public class class_name { public synchronized void transferError(Exception e) { logger.debug("intercepted exception", e); if (transferException == null) { transferException = e; // depends on control dependency: [if], data = [none] } else if (transferException instanceof InterruptedException || transferException instanceof InterruptedIOException) { //if one of the threads throws an error, it interrupts //the other thread (by InterruptedException). //Here we make sure that transferException will store the //primary failure reason, not the resulting InterruptedException transferException = e; // depends on control dependency: [if], data = [none] } notifyAll(); } }
public class class_name { public static void setMetaClass(Object self, MetaClass metaClass) { if (metaClass instanceof HandleMetaClass) metaClass = ((HandleMetaClass)metaClass).getAdaptee(); if (self instanceof Class) { GroovySystem.getMetaClassRegistry().setMetaClass((Class) self, metaClass); } else { ((MetaClassRegistryImpl)GroovySystem.getMetaClassRegistry()).setMetaClass(self, metaClass); } } }
public class class_name { public static void setMetaClass(Object self, MetaClass metaClass) { if (metaClass instanceof HandleMetaClass) metaClass = ((HandleMetaClass)metaClass).getAdaptee(); if (self instanceof Class) { GroovySystem.getMetaClassRegistry().setMetaClass((Class) self, metaClass); // depends on control dependency: [if], data = [none] } else { ((MetaClassRegistryImpl)GroovySystem.getMetaClassRegistry()).setMetaClass(self, metaClass); // depends on control dependency: [if], data = [none] } } }
public class class_name { private Long getCpuTime() { if (bean instanceof com.sun.management.OperatingSystemMXBean) { //NOSONAR return ((com.sun.management.OperatingSystemMXBean) bean).getProcessCpuTime(); //NOSONAR } else { return -1L; } } }
public class class_name { private Long getCpuTime() { if (bean instanceof com.sun.management.OperatingSystemMXBean) { //NOSONAR return ((com.sun.management.OperatingSystemMXBean) bean).getProcessCpuTime(); //NOSONAR // depends on control dependency: [if], data = [none] } else { return -1L; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void setIntHeader(final String name, final int value) { if (buffer == null || !name.equalsIgnoreCase(CONTENT_LENGTH)) { super.setIntHeader(name, value); } } }
public class class_name { @Override public void setIntHeader(final String name, final int value) { if (buffer == null || !name.equalsIgnoreCase(CONTENT_LENGTH)) { super.setIntHeader(name, value); // depends on control dependency: [if], data = [none] } } }
public class class_name { @JsonIgnore public String getSigningCertificateDecoded() { if (EncodingUtils.isBase64(signingCertificate)) { return EncodingUtils.decodeBase64ToString(signingCertificate); } return signingCertificate; } }
public class class_name { @JsonIgnore public String getSigningCertificateDecoded() { if (EncodingUtils.isBase64(signingCertificate)) { return EncodingUtils.decodeBase64ToString(signingCertificate); // depends on control dependency: [if], data = [none] } return signingCertificate; } }
public class class_name { private static <T extends Comparable<T>> Optional<Range<T>> smallestContainerForRange( Collection<Range<T>> ranges, Range<T> target) { Range<T> best = Range.all(); for (final Range<T> r : ranges) { if (r.equals(target)) { continue; } // prefer a smaller range, always; if (r.encloses(target) && best.encloses(r)) { best = r; } } if (best.equals(Range.<T>all())) { return Optional.absent(); } return Optional.of(best); } }
public class class_name { private static <T extends Comparable<T>> Optional<Range<T>> smallestContainerForRange( Collection<Range<T>> ranges, Range<T> target) { Range<T> best = Range.all(); for (final Range<T> r : ranges) { if (r.equals(target)) { continue; } // prefer a smaller range, always; if (r.encloses(target) && best.encloses(r)) { best = r; // depends on control dependency: [if], data = [none] } } if (best.equals(Range.<T>all())) { return Optional.absent(); // depends on control dependency: [if], data = [none] } return Optional.of(best); } }
public class class_name { protected String getCrid(Map result) { HashMap mgnData = getObjectOr(result, "management", new HashMap()); ArrayList<HashMap> events = getObjectOr(mgnData, "events", new ArrayList()); String crid = null; boolean isPlEventExist = false; for (HashMap event : events) { if ("planting".equals(event.get("event"))) { isPlEventExist = true; if (crid == null) { crid = (String) event.get("crid"); } else if (!crid.equals(event.get("crid"))) { return "SQ"; } } } if (crid == null) { crid = getValueOr(result, "crid", "XX"); } if (!isPlEventExist && "XX".equals(crid)) { return "FA"; } else { // DssatCRIDHelper crids = new DssatCRIDHelper(); return DssatCRIDHelper.get2BitCrid(crid); } } }
public class class_name { protected String getCrid(Map result) { HashMap mgnData = getObjectOr(result, "management", new HashMap()); ArrayList<HashMap> events = getObjectOr(mgnData, "events", new ArrayList()); String crid = null; boolean isPlEventExist = false; for (HashMap event : events) { if ("planting".equals(event.get("event"))) { isPlEventExist = true; // depends on control dependency: [if], data = [none] if (crid == null) { crid = (String) event.get("crid"); // depends on control dependency: [if], data = [none] } else if (!crid.equals(event.get("crid"))) { return "SQ"; // depends on control dependency: [if], data = [none] } } } if (crid == null) { crid = getValueOr(result, "crid", "XX"); // depends on control dependency: [if], data = [none] } if (!isPlEventExist && "XX".equals(crid)) { return "FA"; // depends on control dependency: [if], data = [none] } else { // DssatCRIDHelper crids = new DssatCRIDHelper(); return DssatCRIDHelper.get2BitCrid(crid); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void drainAndHalt() { Sequence[] workerSequences = getWorkerSequences(); while (ringBuffer.getCursor() > Util.getMinimumSequence(workerSequences)) { Thread.yield(); } for (WorkProcessor<?> processor : workProcessors) { processor.halt(); } started.set(false); } }
public class class_name { public void drainAndHalt() { Sequence[] workerSequences = getWorkerSequences(); while (ringBuffer.getCursor() > Util.getMinimumSequence(workerSequences)) { Thread.yield(); // depends on control dependency: [while], data = [none] } for (WorkProcessor<?> processor : workProcessors) { processor.halt(); // depends on control dependency: [for], data = [processor] } started.set(false); } }
public class class_name { public CommandArgs<K, V> add(Map<K, V> map) { LettuceAssert.notNull(map, "Map must not be null"); for (Map.Entry<K, V> entry : map.entrySet()) { addKey(entry.getKey()).addValue(entry.getValue()); } return this; } }
public class class_name { public CommandArgs<K, V> add(Map<K, V> map) { LettuceAssert.notNull(map, "Map must not be null"); for (Map.Entry<K, V> entry : map.entrySet()) { addKey(entry.getKey()).addValue(entry.getValue()); // depends on control dependency: [for], data = [entry] } return this; } }
public class class_name { public void cancel(String tag) { List<NotificationEntry> entries = mCenter.getEntries(ID, tag); if (entries != null && !entries.isEmpty()) { for (NotificationEntry entry : entries) { cancel(entry); } } } }
public class class_name { public void cancel(String tag) { List<NotificationEntry> entries = mCenter.getEntries(ID, tag); if (entries != null && !entries.isEmpty()) { for (NotificationEntry entry : entries) { cancel(entry); // depends on control dependency: [for], data = [entry] } } } }
public class class_name { public void onContentChange() { Scheduler.get().scheduleDeferred(new ScheduledCommand() { public void execute() { Widget parent = getParent(); while (parent != null) { if (parent instanceof CmsGalleryDialog) { ((CmsGalleryDialog)parent).updateSizes(); parent = null; } else { parent = parent.getParent(); } } } }); } }
public class class_name { public void onContentChange() { Scheduler.get().scheduleDeferred(new ScheduledCommand() { public void execute() { Widget parent = getParent(); while (parent != null) { if (parent instanceof CmsGalleryDialog) { ((CmsGalleryDialog)parent).updateSizes(); // depends on control dependency: [if], data = [none] parent = null; // depends on control dependency: [if], data = [none] } else { parent = parent.getParent(); // depends on control dependency: [if], data = [none] } } } }); } }
public class class_name { public Tensor select(int dim, int idx) { int[] yDims = IntArrays.removeEntry(this.getDims(), dim); Tensor y = new Tensor(s, yDims); DimIter yIter = new DimIter(y.getDims()); while (yIter.hasNext()) { int[] yIdx = yIter.next(); int[] xIdx = IntArrays.insertEntry(yIdx, dim, idx); y.set(yIdx, this.get(xIdx)); } return y; } }
public class class_name { public Tensor select(int dim, int idx) { int[] yDims = IntArrays.removeEntry(this.getDims(), dim); Tensor y = new Tensor(s, yDims); DimIter yIter = new DimIter(y.getDims()); while (yIter.hasNext()) { int[] yIdx = yIter.next(); int[] xIdx = IntArrays.insertEntry(yIdx, dim, idx); y.set(yIdx, this.get(xIdx)); // depends on control dependency: [while], data = [none] } return y; } }
public class class_name { public Set<Auth> createAuthsFromString(String authInfo) { if ("".equals(authInfo) || authInfo == null) return Collections.emptySet(); String[] parts = authInfo.split(","); final Set<Auth> auths = new HashSet<Auth>(); try { for (String auth : parts) { StringTokenizer tokenizer = new StringTokenizer(auth, ":"); while (tokenizer.hasMoreTokens()) { auths.add(new Auth(tokenizer.nextToken(), tokenizer.nextToken(), tokenizer.nextToken(), tokenizer.nextToken())); } } return auths; } catch (NoSuchElementException e) { final StringBuilder b = new StringBuilder(); for (String auth : parts) { b.append(auth); } throw new IllegalArgumentException( "Auth configuration is configured wrongly:" + b.toString(), e); } } }
public class class_name { public Set<Auth> createAuthsFromString(String authInfo) { if ("".equals(authInfo) || authInfo == null) return Collections.emptySet(); String[] parts = authInfo.split(","); final Set<Auth> auths = new HashSet<Auth>(); try { for (String auth : parts) { StringTokenizer tokenizer = new StringTokenizer(auth, ":"); while (tokenizer.hasMoreTokens()) { auths.add(new Auth(tokenizer.nextToken(), tokenizer.nextToken(), tokenizer.nextToken(), tokenizer.nextToken())); // depends on control dependency: [while], data = [none] } } return auths; // depends on control dependency: [try], data = [none] } catch (NoSuchElementException e) { final StringBuilder b = new StringBuilder(); for (String auth : parts) { b.append(auth); // depends on control dependency: [for], data = [auth] } throw new IllegalArgumentException( "Auth configuration is configured wrongly:" + b.toString(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public byte[] getImageBytes(BufferedImage image) { byte[] bytes = null; try { bytes = ImageUtils.writeImageToBytes(image, ImageUtils.IMAGE_FORMAT_PNG); } catch (IOException e) { throw new GeoPackageException("Failed to write image to " + ImageUtils.IMAGE_FORMAT_PNG + " bytes", e); } return bytes; } }
public class class_name { public byte[] getImageBytes(BufferedImage image) { byte[] bytes = null; try { bytes = ImageUtils.writeImageToBytes(image, ImageUtils.IMAGE_FORMAT_PNG); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new GeoPackageException("Failed to write image to " + ImageUtils.IMAGE_FORMAT_PNG + " bytes", e); } // depends on control dependency: [catch], data = [none] return bytes; } }
public class class_name { public static void main(String[] args) { try { HadoopLogsAnalyzer analyzer = new HadoopLogsAnalyzer(); int result = ToolRunner.run(analyzer, args); if (result == 0) { return; } System.exit(result); } catch (FileNotFoundException e) { LOG.error("", e); e.printStackTrace(staticDebugOutput); System.exit(1); } catch (IOException e) { LOG.error("", e); e.printStackTrace(staticDebugOutput); System.exit(2); } catch (Exception e) { LOG.error("", e); e.printStackTrace(staticDebugOutput); System.exit(3); } } }
public class class_name { public static void main(String[] args) { try { HadoopLogsAnalyzer analyzer = new HadoopLogsAnalyzer(); int result = ToolRunner.run(analyzer, args); if (result == 0) { return; // depends on control dependency: [if], data = [none] } System.exit(result); // depends on control dependency: [try], data = [none] } catch (FileNotFoundException e) { LOG.error("", e); e.printStackTrace(staticDebugOutput); System.exit(1); } catch (IOException e) { // depends on control dependency: [catch], data = [none] LOG.error("", e); e.printStackTrace(staticDebugOutput); System.exit(2); } catch (Exception e) { // depends on control dependency: [catch], data = [none] LOG.error("", e); e.printStackTrace(staticDebugOutput); System.exit(3); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private boolean checkHeader(RandomAccessInputStream raf) throws IOException { raf.seek(HEAD_LOCATION); byte[] buf = new byte[HEAD_SIZE]; if (raf.read(buf) != HEAD_SIZE) { throw new IOException("Error encountered finding id3v2 header"); } String result = new String(buf, ENC_TYPE); if (result.substring(0, TAG_START.length()).equals(TAG_START)) { if ((((int)buf[3]&0xFF) < 0xff) && (((int)buf[4]&0xFF) < 0xff)) { if ((((int)buf[6]&0xFF) < 0x80) && (((int)buf[7]&0xFF) < 0x80) && (((int)buf[8]&0xFF) < 0x80) && (((int)buf[9]&0xFF) < 0x80)) { return true; } } } return false; } }
public class class_name { private boolean checkHeader(RandomAccessInputStream raf) throws IOException { raf.seek(HEAD_LOCATION); byte[] buf = new byte[HEAD_SIZE]; if (raf.read(buf) != HEAD_SIZE) { throw new IOException("Error encountered finding id3v2 header"); } String result = new String(buf, ENC_TYPE); if (result.substring(0, TAG_START.length()).equals(TAG_START)) { if ((((int)buf[3]&0xFF) < 0xff) && (((int)buf[4]&0xFF) < 0xff)) { if ((((int)buf[6]&0xFF) < 0x80) && (((int)buf[7]&0xFF) < 0x80) && (((int)buf[8]&0xFF) < 0x80) && (((int)buf[9]&0xFF) < 0x80)) { return true; // depends on control dependency: [if], data = [none] } } } return false; } }
public class class_name { public static List<double[]> op(@javax.annotation.Nonnull final List<double[]> a, @javax.annotation.Nonnull final List<double[]> b, @javax.annotation.Nonnull final DoubleBinaryOperator fn) { assert a.size() == b.size(); return IntStream.range(0, a.size()).parallel().mapToObj(i -> { assert a.get(i).length == b.get(i).length; @javax.annotation.Nonnull final double[] c = new double[a.get(i).length]; for (int j = 0; j < a.get(i).length; j++) { c[j] = fn.applyAsDouble(a.get(i)[j], b.get(i)[j]); } return c; }).collect(Collectors.toList()); } }
public class class_name { public static List<double[]> op(@javax.annotation.Nonnull final List<double[]> a, @javax.annotation.Nonnull final List<double[]> b, @javax.annotation.Nonnull final DoubleBinaryOperator fn) { assert a.size() == b.size(); return IntStream.range(0, a.size()).parallel().mapToObj(i -> { assert a.get(i).length == b.get(i).length; @javax.annotation.Nonnull final double[] c = new double[a.get(i).length]; for (int j = 0; j < a.get(i).length; j++) { c[j] = fn.applyAsDouble(a.get(i)[j], b.get(i)[j]); // depends on control dependency: [for], data = [j] } return c; }).collect(Collectors.toList()); } }
public class class_name { private void fireMouseClicked(int button, int x, int y, int clickCount) { consumed = false; for (int i=0;i<mouseListeners.size();i++) { MouseListener listener = (MouseListener) mouseListeners.get(i); if (listener.isAcceptingInput()) { listener.mouseClicked(button, x, y, clickCount); if (consumed) { break; } } } } }
public class class_name { private void fireMouseClicked(int button, int x, int y, int clickCount) { consumed = false; for (int i=0;i<mouseListeners.size();i++) { MouseListener listener = (MouseListener) mouseListeners.get(i); if (listener.isAcceptingInput()) { listener.mouseClicked(button, x, y, clickCount); // depends on control dependency: [if], data = [none] if (consumed) { break; } } } } }
public class class_name { public Tracer createTracer(String tracerName, boolean requestedBySource) { TracerImpl tparent = null; TracerImpl t = tracers.get(tracerName); if (t == null) { String[] split = tracerName.split("\\."); String currentName = ""; for (String s : split) { if (tparent == null) { // first loop tparent = rootTracer; currentName = s; } else { currentName = currentName + "." + s; } t = tracers.get(currentName); if (t == null) { t = new TracerImpl(currentName, tparent, this.notificationSource, this.traceFacility); final TracerImpl u = tracers.putIfAbsent(t.getTracerName(), t); if (u != null) { t = u; } } tparent = t; } } if (requestedBySource) t.setRequestedBySource(requestedBySource); return t; } }
public class class_name { public Tracer createTracer(String tracerName, boolean requestedBySource) { TracerImpl tparent = null; TracerImpl t = tracers.get(tracerName); if (t == null) { String[] split = tracerName.split("\\."); String currentName = ""; for (String s : split) { if (tparent == null) { // first loop tparent = rootTracer; // depends on control dependency: [if], data = [none] currentName = s; // depends on control dependency: [if], data = [none] } else { currentName = currentName + "." + s; // depends on control dependency: [if], data = [none] } t = tracers.get(currentName); // depends on control dependency: [for], data = [s] if (t == null) { t = new TracerImpl(currentName, tparent, this.notificationSource, this.traceFacility); // depends on control dependency: [if], data = [none] final TracerImpl u = tracers.putIfAbsent(t.getTracerName(), t); if (u != null) { t = u; // depends on control dependency: [if], data = [none] } } tparent = t; // depends on control dependency: [for], data = [none] } } if (requestedBySource) t.setRequestedBySource(requestedBySource); return t; } }
public class class_name { private static<V> LongHashTrieMap<V> mergeLeafMaps (long hash0, ALongHashMap<V> elem0, long hash1, ALongHashMap<V> elem1, int level, int size) { final int index0 = (int) ((hash0 >>> level) & 0x3f); final int index1 = (int) ((hash1 >>> level) & 0x3f); if(index0 != index1) { final long bitmap = (1L << index0) | (1L << index1); final ALongHashMap<V>[] elems = createArray(2); if(index0 < index1) { elems[0] = elem0; elems[1] = elem1; } else { elems[0] = elem1; elems[1] = elem0; } return new LongHashTrieMap<>(bitmap, elems, size); } else { final ALongHashMap<V>[] elems = createArray(1); final long bitmap = (1L << index0); // try again, based on the elems[0] = mergeLeafMaps(hash0, elem0, hash1, elem1, level + LEVEL_INCREMENT, size); return new LongHashTrieMap<>(bitmap, elems, size); } } }
public class class_name { private static<V> LongHashTrieMap<V> mergeLeafMaps (long hash0, ALongHashMap<V> elem0, long hash1, ALongHashMap<V> elem1, int level, int size) { final int index0 = (int) ((hash0 >>> level) & 0x3f); final int index1 = (int) ((hash1 >>> level) & 0x3f); if(index0 != index1) { final long bitmap = (1L << index0) | (1L << index1); final ALongHashMap<V>[] elems = createArray(2); if(index0 < index1) { elems[0] = elem0; // depends on control dependency: [if], data = [none] elems[1] = elem1; // depends on control dependency: [if], data = [none] } else { elems[0] = elem1; // depends on control dependency: [if], data = [none] elems[1] = elem0; // depends on control dependency: [if], data = [none] } return new LongHashTrieMap<>(bitmap, elems, size); // depends on control dependency: [if], data = [none] } else { final ALongHashMap<V>[] elems = createArray(1); final long bitmap = (1L << index0); // try again, based on the elems[0] = mergeLeafMaps(hash0, elem0, hash1, elem1, level + LEVEL_INCREMENT, size); // depends on control dependency: [if], data = [none] return new LongHashTrieMap<>(bitmap, elems, size); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String getStackTrace(Throwable t, int depth, String prefix) { StringBuffer retval = new StringBuffer(); int nrWritten = 0; retval.append(t.toString() + " with message: " + t.getMessage()); StackTraceElement[] elements = t.getStackTrace(); for (int i = 0; nrWritten < depth && i < elements.length; i++) { String line = elements[i].toString(); if (prefix == null || line.startsWith(prefix)) { retval.append("\n" + line); nrWritten++; } } return retval.toString(); } }
public class class_name { public static String getStackTrace(Throwable t, int depth, String prefix) { StringBuffer retval = new StringBuffer(); int nrWritten = 0; retval.append(t.toString() + " with message: " + t.getMessage()); StackTraceElement[] elements = t.getStackTrace(); for (int i = 0; nrWritten < depth && i < elements.length; i++) { String line = elements[i].toString(); if (prefix == null || line.startsWith(prefix)) { retval.append("\n" + line); // depends on control dependency: [if], data = [none] nrWritten++; // depends on control dependency: [if], data = [none] } } return retval.toString(); } }
public class class_name { @Override public List<Group> getSeqResGroups(GroupType type) { List<Group> tmp = new ArrayList<>() ; for (Group g : seqResGroups) { if (g.getType().equals(type)) { tmp.add(g); } } return tmp ; } }
public class class_name { @Override public List<Group> getSeqResGroups(GroupType type) { List<Group> tmp = new ArrayList<>() ; for (Group g : seqResGroups) { if (g.getType().equals(type)) { tmp.add(g); // depends on control dependency: [if], data = [none] } } return tmp ; } }
public class class_name { private void setDeliverValueChangeEvents(boolean enable) { formObjectHolder.setDeliverValueChangeEvents(enable); for (Object o : mediatingValueModels.values()) { FormModelMediatingValueModel valueModel = (FormModelMediatingValueModel) o; valueModel.setDeliverValueChangeEvents(enable); } } }
public class class_name { private void setDeliverValueChangeEvents(boolean enable) { formObjectHolder.setDeliverValueChangeEvents(enable); for (Object o : mediatingValueModels.values()) { FormModelMediatingValueModel valueModel = (FormModelMediatingValueModel) o; valueModel.setDeliverValueChangeEvents(enable); // depends on control dependency: [for], data = [o] } } }
public class class_name { static Optional<BigQueryTableSchema> getTableSchema(Configuration conf) throws IOException { String fieldsJson = conf.get(BigQueryConfiguration.OUTPUT_TABLE_SCHEMA_KEY); if (!Strings.isNullOrEmpty(fieldsJson)) { try { TableSchema tableSchema = BigQueryTableHelper.createTableSchemaFromFields(fieldsJson); return Optional.of(BigQueryTableSchema.wrap(tableSchema)); } catch (IOException e) { throw new IOException( "Unable to parse key '" + BigQueryConfiguration.OUTPUT_TABLE_SCHEMA_KEY + "'.", e); } } return Optional.empty(); } }
public class class_name { static Optional<BigQueryTableSchema> getTableSchema(Configuration conf) throws IOException { String fieldsJson = conf.get(BigQueryConfiguration.OUTPUT_TABLE_SCHEMA_KEY); if (!Strings.isNullOrEmpty(fieldsJson)) { try { TableSchema tableSchema = BigQueryTableHelper.createTableSchemaFromFields(fieldsJson); return Optional.of(BigQueryTableSchema.wrap(tableSchema)); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new IOException( "Unable to parse key '" + BigQueryConfiguration.OUTPUT_TABLE_SCHEMA_KEY + "'.", e); } // depends on control dependency: [catch], data = [none] } return Optional.empty(); } }
public class class_name { public void deactivate () { if (_host != null) { // unwire ourselves from the host component Component comp = _host.getComponent(); comp.removeMouseListener(this); comp.removeMouseMotionListener(this); // reinstate the previous mouse listeners if (_hijacker != null) { _hijacker.release(); _hijacker = null; } // tell our host that we are no longer _host.menuDeactivated(this); // fire off a last repaint to clean up after ourselves repaint(); } // clear out our references _host = null; _tbounds = null; _argument = null; // clear out our action listeners _actlist.clear(); } }
public class class_name { public void deactivate () { if (_host != null) { // unwire ourselves from the host component Component comp = _host.getComponent(); comp.removeMouseListener(this); // depends on control dependency: [if], data = [none] comp.removeMouseMotionListener(this); // depends on control dependency: [if], data = [none] // reinstate the previous mouse listeners if (_hijacker != null) { _hijacker.release(); // depends on control dependency: [if], data = [none] _hijacker = null; // depends on control dependency: [if], data = [none] } // tell our host that we are no longer _host.menuDeactivated(this); // depends on control dependency: [if], data = [none] // fire off a last repaint to clean up after ourselves repaint(); // depends on control dependency: [if], data = [none] } // clear out our references _host = null; _tbounds = null; _argument = null; // clear out our action listeners _actlist.clear(); } }
public class class_name { public void setModel (PropertySheetModel pm) { if (pm instanceof org.apache.ojb.tools.mapping.reversedb.DBSchema) { this.aSchema = (org.apache.ojb.tools.mapping.reversedb.DBSchema)pm; this.readValuesFromSchema(); } else throw new IllegalArgumentException(); } }
public class class_name { public void setModel (PropertySheetModel pm) { if (pm instanceof org.apache.ojb.tools.mapping.reversedb.DBSchema) { this.aSchema = (org.apache.ojb.tools.mapping.reversedb.DBSchema)pm; // depends on control dependency: [if], data = [none] this.readValuesFromSchema(); // depends on control dependency: [if], data = [none] } else throw new IllegalArgumentException(); } }
public class class_name { private static void parseStyle(SvgElementBase obj, String style) { TextScanner scan = new TextScanner(style.replaceAll("/\\*.*?\\*/", "")); // regex strips block comments while (true) { String propertyName = scan.nextToken(':'); scan.skipWhitespace(); if (!scan.consume(':')) break; // Syntax error. Stop processing CSS rules. scan.skipWhitespace(); String propertyValue = scan.nextTokenWithWhitespace(';'); if (propertyValue == null) break; // Syntax error scan.skipWhitespace(); if (scan.empty() || scan.consume(';')) { if (obj.style == null) obj.style = new Style(); processStyleProperty(obj.style, propertyName, propertyValue); scan.skipWhitespace(); } } } }
public class class_name { private static void parseStyle(SvgElementBase obj, String style) { TextScanner scan = new TextScanner(style.replaceAll("/\\*.*?\\*/", "")); // regex strips block comments while (true) { String propertyName = scan.nextToken(':'); scan.skipWhitespace(); // depends on control dependency: [while], data = [none] if (!scan.consume(':')) break; // Syntax error. Stop processing CSS rules. scan.skipWhitespace(); // depends on control dependency: [while], data = [none] String propertyValue = scan.nextTokenWithWhitespace(';'); if (propertyValue == null) break; // Syntax error scan.skipWhitespace(); // depends on control dependency: [while], data = [none] if (scan.empty() || scan.consume(';')) { if (obj.style == null) obj.style = new Style(); processStyleProperty(obj.style, propertyName, propertyValue); // depends on control dependency: [if], data = [none] scan.skipWhitespace(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public Object readClassAndObject (Input input) { if (input == null) throw new IllegalArgumentException("input cannot be null."); beginObject(); try { Registration registration = readClass(input); if (registration == null) return null; Class type = registration.getType(); Object object; if (references) { int stackSize = readReferenceOrNull(input, type, false); if (stackSize == REF) return readObject; object = registration.getSerializer().read(this, input, type); if (stackSize == readReferenceIds.size) reference(object); } else object = registration.getSerializer().read(this, input, type); if (TRACE || (DEBUG && depth == 1)) log("Read", object, input.position()); return object; } finally { if (--depth == 0 && autoReset) reset(); } } }
public class class_name { public Object readClassAndObject (Input input) { if (input == null) throw new IllegalArgumentException("input cannot be null."); beginObject(); try { Registration registration = readClass(input); if (registration == null) return null; Class type = registration.getType(); Object object; if (references) { int stackSize = readReferenceOrNull(input, type, false); if (stackSize == REF) return readObject; object = registration.getSerializer().read(this, input, type); // depends on control dependency: [if], data = [none] if (stackSize == readReferenceIds.size) reference(object); } else object = registration.getSerializer().read(this, input, type); if (TRACE || (DEBUG && depth == 1)) log("Read", object, input.position()); return object; // depends on control dependency: [try], data = [none] } finally { if (--depth == 0 && autoReset) reset(); } } }
public class class_name { @Override public void setBundleDataHashCode(String variantKey, String bundleDataHashCode) { String prefix = bundleDataHashCode; if (StringUtils.isEmpty(variantKey)) { this.urlPrefix = prefix; } else { prefixMap.put(variantKey, prefix); } } }
public class class_name { @Override public void setBundleDataHashCode(String variantKey, String bundleDataHashCode) { String prefix = bundleDataHashCode; if (StringUtils.isEmpty(variantKey)) { this.urlPrefix = prefix; // depends on control dependency: [if], data = [none] } else { prefixMap.put(variantKey, prefix); // depends on control dependency: [if], data = [none] } } }
public class class_name { public final T pop() { if (size > 0) { T result = heap[1]; // save first value heap[1] = heap[size]; // move last to first heap[size] = null; // permit GC of objects size--; downHeap(); // adjust heap return result; } else { return null; } } }
public class class_name { public final T pop() { if (size > 0) { T result = heap[1]; // save first value heap[1] = heap[size]; // move last to first // depends on control dependency: [if], data = [none] heap[size] = null; // permit GC of objects // depends on control dependency: [if], data = [none] size--; // depends on control dependency: [if], data = [none] downHeap(); // adjust heap // depends on control dependency: [if], data = [none] return result; // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public byte[] decrypt(byte[] bytes) { lock.lock(); try { if (null == this.params) { cipher.init(Cipher.DECRYPT_MODE, secretKey); } else { cipher.init(Cipher.DECRYPT_MODE, secretKey, params); } return cipher.doFinal(bytes); } catch (Exception e) { throw new CryptoException(e); } finally { lock.unlock(); } } }
public class class_name { public byte[] decrypt(byte[] bytes) { lock.lock(); try { if (null == this.params) { cipher.init(Cipher.DECRYPT_MODE, secretKey); // depends on control dependency: [if], data = [none] } else { cipher.init(Cipher.DECRYPT_MODE, secretKey, params); // depends on control dependency: [if], data = [none] } return cipher.doFinal(bytes); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new CryptoException(e); } finally { // depends on control dependency: [catch], data = [none] lock.unlock(); } } }
public class class_name { public static <E> int exponentialSearchBwd(AbstractCounterexample<E> acex, int low, int high) { assert !acex.testEffects(low, high); int ofs = 1; E effHigh = acex.effect(high); int highIter = high; int lowIter = low; while (highIter - ofs > lowIter) { int next = highIter - ofs; E eff = acex.effect(next); if (!acex.checkEffects(eff, effHigh)) { lowIter = next; break; } highIter = next; ofs *= 2; } return binarySearchRight(acex, lowIter, highIter); } }
public class class_name { public static <E> int exponentialSearchBwd(AbstractCounterexample<E> acex, int low, int high) { assert !acex.testEffects(low, high); int ofs = 1; E effHigh = acex.effect(high); int highIter = high; int lowIter = low; while (highIter - ofs > lowIter) { int next = highIter - ofs; E eff = acex.effect(next); if (!acex.checkEffects(eff, effHigh)) { lowIter = next; // depends on control dependency: [if], data = [none] break; } highIter = next; // depends on control dependency: [while], data = [none] ofs *= 2; // depends on control dependency: [while], data = [none] } return binarySearchRight(acex, lowIter, highIter); } }
public class class_name { public PtoPMessageItemStream addNewRemotePtoPLocalization( TransactionCommon transaction, SIBUuid8 messagingEngineUuid, LocalizationDefinition destinationLocalizationDefinition, boolean queuePoint, AbstractRemoteSupport remoteSupport) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "addNewRemotePtoPLocalization", new Object[] { transaction, messagingEngineUuid, destinationLocalizationDefinition, Boolean.valueOf(queuePoint), remoteSupport }); PtoPMessageItemStream newMsgItemStream = null; // Add to the MessageStore try { if (queuePoint) { newMsgItemStream = new PtoPXmitMsgsItemStream(_baseDestinationHandler, messagingEngineUuid); } transaction.registerCallback( new LocalizationAddTransactionCallback(newMsgItemStream)); Transaction msTran = _messageProcessor.resolveAndEnlistMsgStoreTransaction(transaction); _baseDestinationHandler.addItemStream(newMsgItemStream, msTran); // Set the default limits newMsgItemStream.setDefaultDestLimits(); // Setup any message depth interval checking (510343) newMsgItemStream.setDestMsgInterval(); attachRemotePtoPLocalisation(newMsgItemStream, remoteSupport); } catch (OutOfCacheSpace e) { // No FFDC code needed SibTr.exception(tc, e); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addNewRemotePtoPLocalization", "SIResourceException"); throw new SIResourceException(e); } catch (MessageStoreException e) { // MessageStoreException shouldn't occur so FFDC. FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.destination.LocalisationManager.addNewRemotePtoPLocalization", "1:1562:1.30", this); SibTr.exception(tc, e); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addNewRemotePtoPLocalization", e); throw new SIResourceException(e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addNewRemotePtoPLocalization", newMsgItemStream); return newMsgItemStream; } }
public class class_name { public PtoPMessageItemStream addNewRemotePtoPLocalization( TransactionCommon transaction, SIBUuid8 messagingEngineUuid, LocalizationDefinition destinationLocalizationDefinition, boolean queuePoint, AbstractRemoteSupport remoteSupport) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "addNewRemotePtoPLocalization", new Object[] { transaction, messagingEngineUuid, destinationLocalizationDefinition, Boolean.valueOf(queuePoint), remoteSupport }); PtoPMessageItemStream newMsgItemStream = null; // Add to the MessageStore try { if (queuePoint) { newMsgItemStream = new PtoPXmitMsgsItemStream(_baseDestinationHandler, messagingEngineUuid); // depends on control dependency: [if], data = [none] } transaction.registerCallback( new LocalizationAddTransactionCallback(newMsgItemStream)); // depends on control dependency: [try], data = [none] Transaction msTran = _messageProcessor.resolveAndEnlistMsgStoreTransaction(transaction); _baseDestinationHandler.addItemStream(newMsgItemStream, msTran); // depends on control dependency: [try], data = [none] // Set the default limits newMsgItemStream.setDefaultDestLimits(); // depends on control dependency: [try], data = [none] // Setup any message depth interval checking (510343) newMsgItemStream.setDestMsgInterval(); // depends on control dependency: [try], data = [none] attachRemotePtoPLocalisation(newMsgItemStream, remoteSupport); // depends on control dependency: [try], data = [none] } catch (OutOfCacheSpace e) { // No FFDC code needed SibTr.exception(tc, e); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addNewRemotePtoPLocalization", "SIResourceException"); throw new SIResourceException(e); } // depends on control dependency: [catch], data = [none] catch (MessageStoreException e) { // MessageStoreException shouldn't occur so FFDC. FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.destination.LocalisationManager.addNewRemotePtoPLocalization", "1:1562:1.30", this); SibTr.exception(tc, e); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addNewRemotePtoPLocalization", e); throw new SIResourceException(e); } // depends on control dependency: [catch], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addNewRemotePtoPLocalization", newMsgItemStream); return newMsgItemStream; } }
public class class_name { public static long[] asLongArray(Collection collection) { long[] result = new long[collection.size()]; int i = 0; for (Object c : collection) { result[i++] = asLong(c); } return result; } }
public class class_name { public static long[] asLongArray(Collection collection) { long[] result = new long[collection.size()]; int i = 0; for (Object c : collection) { result[i++] = asLong(c); // depends on control dependency: [for], data = [c] } return result; } }
public class class_name { private BigDecimal parseBasicNumber(final NumberBuffer buffer) { final StringBuilder builder = new StringBuilder(); int i = buffer.position(); while (i < buffer.length()) { final char c = buffer.charAt(i); if (isArabicNumeral(c)) { // Arabic numerals; 0 to 9 or 0 to 9 (full-width) builder.append(arabicNumeralValue(c)); } else if (isKanjiNumeral(c)) { // Kanji numerals; 〇, 一, 二, 三, 四, 五, 六, 七, 八, or 九 builder.append(kanjiNumeralValue(c)); } else if (isDecimalPoint(c)) { builder.append("."); } else if (isThousandSeparator(c)) { // Just skip and move to the next character } else { // We don't have an Arabic nor kanji numeral, nor separation or punctuation, so we'll stop. break; } i++; buffer.advance(); } if (builder.length() == 0) { // We didn't build anything, so we don't have a number return null; } return new BigDecimal(builder.toString()); } }
public class class_name { private BigDecimal parseBasicNumber(final NumberBuffer buffer) { final StringBuilder builder = new StringBuilder(); int i = buffer.position(); while (i < buffer.length()) { final char c = buffer.charAt(i); if (isArabicNumeral(c)) { // Arabic numerals; 0 to 9 or 0 to 9 (full-width) builder.append(arabicNumeralValue(c)); // depends on control dependency: [if], data = [none] } else if (isKanjiNumeral(c)) { // Kanji numerals; 〇, 一, 二, 三, 四, 五, 六, 七, 八, or 九 builder.append(kanjiNumeralValue(c)); // depends on control dependency: [if], data = [none] } else if (isDecimalPoint(c)) { builder.append("."); // depends on control dependency: [if], data = [none] } else if (isThousandSeparator(c)) { // Just skip and move to the next character } else { // We don't have an Arabic nor kanji numeral, nor separation or punctuation, so we'll stop. break; } i++; // depends on control dependency: [while], data = [none] buffer.advance(); // depends on control dependency: [while], data = [none] } if (builder.length() == 0) { // We didn't build anything, so we don't have a number return null; // depends on control dependency: [if], data = [none] } return new BigDecimal(builder.toString()); } }
public class class_name { public void marshall(ActionTypeSettings actionTypeSettings, ProtocolMarshaller protocolMarshaller) { if (actionTypeSettings == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(actionTypeSettings.getThirdPartyConfigurationUrl(), THIRDPARTYCONFIGURATIONURL_BINDING); protocolMarshaller.marshall(actionTypeSettings.getEntityUrlTemplate(), ENTITYURLTEMPLATE_BINDING); protocolMarshaller.marshall(actionTypeSettings.getExecutionUrlTemplate(), EXECUTIONURLTEMPLATE_BINDING); protocolMarshaller.marshall(actionTypeSettings.getRevisionUrlTemplate(), REVISIONURLTEMPLATE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ActionTypeSettings actionTypeSettings, ProtocolMarshaller protocolMarshaller) { if (actionTypeSettings == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(actionTypeSettings.getThirdPartyConfigurationUrl(), THIRDPARTYCONFIGURATIONURL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(actionTypeSettings.getEntityUrlTemplate(), ENTITYURLTEMPLATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(actionTypeSettings.getExecutionUrlTemplate(), EXECUTIONURLTEMPLATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(actionTypeSettings.getRevisionUrlTemplate(), REVISIONURLTEMPLATE_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 int getIntValue(Keyframe<Integer> keyframe, float keyframeProgress) { if (keyframe.startValue == null || keyframe.endValue == null) { throw new IllegalStateException("Missing values for keyframe."); } int startColor = keyframe.startValue; int endColor = keyframe.endValue; if (valueCallback != null) { //noinspection ConstantConditions Integer value = valueCallback.getValueInternal(keyframe.startFrame, keyframe.endFrame, startColor, endColor, keyframeProgress, getLinearCurrentKeyframeProgress(), getProgress()); if (value != null) { return value; } } return GammaEvaluator.evaluate(MiscUtils.clamp(keyframeProgress, 0f, 1f), startColor, endColor); } }
public class class_name { public int getIntValue(Keyframe<Integer> keyframe, float keyframeProgress) { if (keyframe.startValue == null || keyframe.endValue == null) { throw new IllegalStateException("Missing values for keyframe."); } int startColor = keyframe.startValue; int endColor = keyframe.endValue; if (valueCallback != null) { //noinspection ConstantConditions Integer value = valueCallback.getValueInternal(keyframe.startFrame, keyframe.endFrame, startColor, endColor, keyframeProgress, getLinearCurrentKeyframeProgress(), getProgress()); if (value != null) { return value; // depends on control dependency: [if], data = [none] } } return GammaEvaluator.evaluate(MiscUtils.clamp(keyframeProgress, 0f, 1f), startColor, endColor); } }
public class class_name { public void putAll(final Properties p) { synchronized (map) { for (final String key : p.stringPropertyNames()) { map.put(key, p.getProperty(key)); } } } }
public class class_name { public void putAll(final Properties p) { synchronized (map) { for (final String key : p.stringPropertyNames()) { map.put(key, p.getProperty(key)); // depends on control dependency: [for], data = [key] } } } }
public class class_name { public static Iterator<Object> getKeys(Object[] array) { if (array == null) { return null; } ArrayList<Object> keyList = new ArrayList<Object>(); int i = array.length - 2; while (i >= 0) { keyList.add(array[i]); i = i - 2; } return keyList.iterator(); } }
public class class_name { public static Iterator<Object> getKeys(Object[] array) { if (array == null) { return null; // depends on control dependency: [if], data = [none] } ArrayList<Object> keyList = new ArrayList<Object>(); int i = array.length - 2; while (i >= 0) { keyList.add(array[i]); // depends on control dependency: [while], data = [none] i = i - 2; // depends on control dependency: [while], data = [none] } return keyList.iterator(); } }
public class class_name { public double[] toArray() { if (vectorOffset > 0 || vectorLength != vector.length()) { double[] r = new double[vectorLength - vectorOffset]; for (int i = vectorOffset; i < vectorLength; ++i) r[i] = doubleVector.get(i); return r; } else return doubleVector.toArray(); } }
public class class_name { public double[] toArray() { if (vectorOffset > 0 || vectorLength != vector.length()) { double[] r = new double[vectorLength - vectorOffset]; for (int i = vectorOffset; i < vectorLength; ++i) r[i] = doubleVector.get(i); return r; // depends on control dependency: [if], data = [none] } else return doubleVector.toArray(); } }
public class class_name { protected void generateAnonymousClassDefinition(AnonymousClass anonClass, IAppendable it, IExtraLanguageGeneratorContext context) { if (!it.hasName(anonClass) && it instanceof PyAppendable) { final LightweightTypeReference jvmAnonType = getExpectedType(anonClass); final String anonName = it.declareSyntheticVariable(anonClass, jvmAnonType.getSimpleName()); QualifiedName anonQualifiedName = QualifiedName.create( jvmAnonType.getType().getQualifiedName().split(Pattern.quote("."))); //$NON-NLS-1$ anonQualifiedName = anonQualifiedName.skipLast(1); if (anonQualifiedName.isEmpty()) { // The type resolver does not include the enclosing class. assert anonClass.getDeclaringType() == null : "The Xtend API has changed the AnonymousClass definition!"; //$NON-NLS-1$ final XtendTypeDeclaration container = EcoreUtil2.getContainerOfType(anonClass.eContainer(), XtendTypeDeclaration.class); anonQualifiedName = anonQualifiedName.append(this.qualifiedNameProvider.getFullyQualifiedName(container)); } anonQualifiedName = anonQualifiedName.append(anonName); it.openPseudoScope(); final IRootGenerator rootGenerator = context.getRootGenerator(); assert rootGenerator instanceof PyGenerator; final List<JvmTypeReference> types = new ArrayList<>(); for (final JvmTypeReference superType : anonClass.getConstructorCall().getConstructor().getDeclaringType().getSuperTypes()) { if (!Object.class.getCanonicalName().equals(superType.getIdentifier())) { types.add(superType); } } ((PyGenerator) rootGenerator).generateTypeDeclaration( anonQualifiedName.toString(), anonName, false, types, getTypeBuilder().getDocumentation(anonClass), false, anonClass.getMembers(), (PyAppendable) it, context, null); it.closeScope(); } } }
public class class_name { protected void generateAnonymousClassDefinition(AnonymousClass anonClass, IAppendable it, IExtraLanguageGeneratorContext context) { if (!it.hasName(anonClass) && it instanceof PyAppendable) { final LightweightTypeReference jvmAnonType = getExpectedType(anonClass); final String anonName = it.declareSyntheticVariable(anonClass, jvmAnonType.getSimpleName()); QualifiedName anonQualifiedName = QualifiedName.create( jvmAnonType.getType().getQualifiedName().split(Pattern.quote("."))); //$NON-NLS-1$ anonQualifiedName = anonQualifiedName.skipLast(1); // depends on control dependency: [if], data = [none] if (anonQualifiedName.isEmpty()) { // The type resolver does not include the enclosing class. assert anonClass.getDeclaringType() == null : "The Xtend API has changed the AnonymousClass definition!"; //$NON-NLS-1$ final XtendTypeDeclaration container = EcoreUtil2.getContainerOfType(anonClass.eContainer(), XtendTypeDeclaration.class); anonQualifiedName = anonQualifiedName.append(this.qualifiedNameProvider.getFullyQualifiedName(container)); // depends on control dependency: [if], data = [none] } anonQualifiedName = anonQualifiedName.append(anonName); // depends on control dependency: [if], data = [none] it.openPseudoScope(); // depends on control dependency: [if], data = [none] final IRootGenerator rootGenerator = context.getRootGenerator(); assert rootGenerator instanceof PyGenerator; final List<JvmTypeReference> types = new ArrayList<>(); for (final JvmTypeReference superType : anonClass.getConstructorCall().getConstructor().getDeclaringType().getSuperTypes()) { if (!Object.class.getCanonicalName().equals(superType.getIdentifier())) { types.add(superType); // depends on control dependency: [if], data = [none] } } ((PyGenerator) rootGenerator).generateTypeDeclaration( anonQualifiedName.toString(), anonName, false, types, getTypeBuilder().getDocumentation(anonClass), false, anonClass.getMembers(), (PyAppendable) it, context, null); // depends on control dependency: [if], data = [none] it.closeScope(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void update(final FileUpdater updater, final File destFile) throws UpdateException { final File lockFile = new File(destFile.getAbsolutePath() + ".lock"); final File newDestFile = new File(destFile.getAbsolutePath() + ".new"); try { // synchronize writing to file within this jvm synchronized (UpdateUtils.class) { final FileChannel channel = new RandomAccessFile(lockFile, "rw").getChannel(); //acquire file lock to block external jvm (commandline) from writing to file final FileLock lock = channel.lock(); try { FileUtils.copyFileStreams(destFile, newDestFile); updater.updateFile(newDestFile); if (newDestFile.isFile() && newDestFile.length() > 0) { moveFile(newDestFile, destFile); } else { throw new UpdateException("Result file was empty or not present: " + newDestFile); } } catch (FileUpdaterException e) { throw new UpdateException(e); } finally { lock.release(); channel.close(); } } } catch (IOException e) { throw new UpdateException("Unable to get and write file: " + e.toString(), e); } } }
public class class_name { public static void update(final FileUpdater updater, final File destFile) throws UpdateException { final File lockFile = new File(destFile.getAbsolutePath() + ".lock"); final File newDestFile = new File(destFile.getAbsolutePath() + ".new"); try { // synchronize writing to file within this jvm synchronized (UpdateUtils.class) { final FileChannel channel = new RandomAccessFile(lockFile, "rw").getChannel(); //acquire file lock to block external jvm (commandline) from writing to file final FileLock lock = channel.lock(); try { FileUtils.copyFileStreams(destFile, newDestFile); // depends on control dependency: [try], data = [none] updater.updateFile(newDestFile); // depends on control dependency: [try], data = [none] if (newDestFile.isFile() && newDestFile.length() > 0) { moveFile(newDestFile, destFile); // depends on control dependency: [if], data = [none] } else { throw new UpdateException("Result file was empty or not present: " + newDestFile); } } catch (FileUpdaterException e) { throw new UpdateException(e); } finally { // depends on control dependency: [catch], data = [none] lock.release(); channel.close(); } } } catch (IOException e) { throw new UpdateException("Unable to get and write file: " + e.toString(), e); } } }
public class class_name { public void setStaleIpPermissionsEgress(java.util.Collection<StaleIpPermission> staleIpPermissionsEgress) { if (staleIpPermissionsEgress == null) { this.staleIpPermissionsEgress = null; return; } this.staleIpPermissionsEgress = new com.amazonaws.internal.SdkInternalList<StaleIpPermission>(staleIpPermissionsEgress); } }
public class class_name { public void setStaleIpPermissionsEgress(java.util.Collection<StaleIpPermission> staleIpPermissionsEgress) { if (staleIpPermissionsEgress == null) { this.staleIpPermissionsEgress = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.staleIpPermissionsEgress = new com.amazonaws.internal.SdkInternalList<StaleIpPermission>(staleIpPermissionsEgress); } }
public class class_name { private void writeNumber(PrintWriter pw, NumberFormat numFormat, Number num){ if( num.doubleValue() == Math.round(num.doubleValue()) ){ // Integer if( null != numFormat ){ pw.print( numFormat.format(num.intValue()) ); } else { pw.print( num.intValue() ); } } else { if( null != numFormat ){ pw.print( numFormat.format(num) ); } else { pw.print( num ); } } } }
public class class_name { private void writeNumber(PrintWriter pw, NumberFormat numFormat, Number num){ if( num.doubleValue() == Math.round(num.doubleValue()) ){ // Integer if( null != numFormat ){ pw.print( numFormat.format(num.intValue()) ); // depends on control dependency: [if], data = [none] } else { pw.print( num.intValue() ); // depends on control dependency: [if], data = [none] } } else { if( null != numFormat ){ pw.print( numFormat.format(num) ); // depends on control dependency: [if], data = [none] } else { pw.print( num ); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static void insert(String key, String... split) { Forest forest = get(key); StringBuilder sb = new StringBuilder(); if (split.length % 2 != 0) { LOG.error("init ambiguity error in line :" + Arrays.toString(split) + " format err !"); return; } for (int i = 0; i < split.length; i += 2) { sb.append(split[i]); } forest.addBranch(sb.toString(), split); } }
public class class_name { public static void insert(String key, String... split) { Forest forest = get(key); StringBuilder sb = new StringBuilder(); if (split.length % 2 != 0) { LOG.error("init ambiguity error in line :" + Arrays.toString(split) + " format err !"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } for (int i = 0; i < split.length; i += 2) { sb.append(split[i]); // depends on control dependency: [for], data = [i] } forest.addBranch(sb.toString(), split); } }
public class class_name { @Override protected void doProcess(ITemplateContext context, IProcessableElementTag tag, IElementTagStructureHandler structureHandler) { checkPreconditions(context, tag, structureHandler); final WebEngineContext webEngineContext = (WebEngineContext) context; final IModelFactory modelFactory = context.getModelFactory(); final IModel model = modelFactory.createModel(); final HttpServletRequest request = webEngineContext.getRequest(); final Context flashMessagesContext = context(request); for (Level level : flashMessagesContext.levels()) { final Collection<Message> messages = flashMessagesContext.levelMessages(level, request); if (!messages.isEmpty()) { model.addModel(levelMessages(level, messages, request, modelFactory)); } } /* * Instruct the engine to replace this entire element with the specified model. */ structureHandler.replaceWith(model, false); } }
public class class_name { @Override protected void doProcess(ITemplateContext context, IProcessableElementTag tag, IElementTagStructureHandler structureHandler) { checkPreconditions(context, tag, structureHandler); final WebEngineContext webEngineContext = (WebEngineContext) context; final IModelFactory modelFactory = context.getModelFactory(); final IModel model = modelFactory.createModel(); final HttpServletRequest request = webEngineContext.getRequest(); final Context flashMessagesContext = context(request); for (Level level : flashMessagesContext.levels()) { final Collection<Message> messages = flashMessagesContext.levelMessages(level, request); if (!messages.isEmpty()) { model.addModel(levelMessages(level, messages, request, modelFactory)); // depends on control dependency: [if], data = [none] } } /* * Instruct the engine to replace this entire element with the specified model. */ structureHandler.replaceWith(model, false); } }
public class class_name { public static boolean validateOrInitialize(Connection rawConnection, String sqlQuery, ViburConfig config) { if (sqlQuery == null) { return true; } try { if (sqlQuery.equals(IS_VALID_QUERY)) { return rawConnection.isValid(config.getValidateTimeoutInSeconds()); } executeSqlQuery(rawConnection, sqlQuery, config); return true; } catch (SQLException e) { logger.debug("Couldn't validate/ initialize rawConnection {}", rawConnection, e); return false; } } }
public class class_name { public static boolean validateOrInitialize(Connection rawConnection, String sqlQuery, ViburConfig config) { if (sqlQuery == null) { return true; // depends on control dependency: [if], data = [none] } try { if (sqlQuery.equals(IS_VALID_QUERY)) { return rawConnection.isValid(config.getValidateTimeoutInSeconds()); // depends on control dependency: [if], data = [none] } executeSqlQuery(rawConnection, sqlQuery, config); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (SQLException e) { logger.debug("Couldn't validate/ initialize rawConnection {}", rawConnection, e); return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static List<MediaType> parseMediaTypes(String mediaTypes) { if (!StringUtils.hasLength(mediaTypes)) { return Collections.emptyList(); } String[] tokens = mediaTypes.split(",\\s*"); List<MediaType> result = new ArrayList<MediaType>(tokens.length); for (String token : tokens) { result.add(parseMediaType(token)); } return result; } }
public class class_name { public static List<MediaType> parseMediaTypes(String mediaTypes) { if (!StringUtils.hasLength(mediaTypes)) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } String[] tokens = mediaTypes.split(",\\s*"); List<MediaType> result = new ArrayList<MediaType>(tokens.length); for (String token : tokens) { result.add(parseMediaType(token)); // depends on control dependency: [for], data = [token] } return result; } }
public class class_name { @Override public ImmutableList<Require> getRequires() { if (hasFullParseDependencyInfo) { return ImmutableList.copyOf(orderedRequires); } return getDependencyInfo().getRequires(); } }
public class class_name { @Override public ImmutableList<Require> getRequires() { if (hasFullParseDependencyInfo) { return ImmutableList.copyOf(orderedRequires); // depends on control dependency: [if], data = [none] } return getDependencyInfo().getRequires(); } }
public class class_name { public BatchGetQueryExecutionResult withQueryExecutions(QueryExecution... queryExecutions) { if (this.queryExecutions == null) { setQueryExecutions(new java.util.ArrayList<QueryExecution>(queryExecutions.length)); } for (QueryExecution ele : queryExecutions) { this.queryExecutions.add(ele); } return this; } }
public class class_name { public BatchGetQueryExecutionResult withQueryExecutions(QueryExecution... queryExecutions) { if (this.queryExecutions == null) { setQueryExecutions(new java.util.ArrayList<QueryExecution>(queryExecutions.length)); // depends on control dependency: [if], data = [none] } for (QueryExecution ele : queryExecutions) { this.queryExecutions.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private Object getJavaObjectInstance(Context c, Hashtable<?, ?> envmt, String className, String bindingName, ResourceInfo resourceRefInfo, IndirectReference ref) throws Exception { // Return null if we don't find a binding so that the caller can // use JNDI if enabled. Object resource = null; NamingConstants.JavaColonNamespace namespace = NamingConstants.JavaColonNamespace.match(bindingName); if (namespace != null) { ComponentMetaData cmd = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().getComponentMetaData(); if (cmd != null) { OSGiInjectionScopeData isd = injectionEngine.getInjectionScopeData(cmd, namespace); if (isd != null) { String name = namespace.unprefix(bindingName); InjectionBinding<?> binding = isd.getInjectionBinding(namespace, name); if (binding == null && isd.processDeferredReferenceData()) { // Try again after processing deferred reference data. binding = isd.getInjectionBinding(namespace, name); } if (binding != null) { resource = getBindingObjectInstance(c, envmt, className, resourceRefInfo, ref, binding); } } } if (resource == null && namespace == NamingConstants.JavaColonNamespace.COMP) { resource = getDefaultJavaCompObjectInstance(namespace, bindingName, resourceRefInfo); } // If not found and the customer did not provide a binding, then try and // auto-link to a resource that matches on name in the service registry. if (resource == null && ref.defaultBinding && !ref.name.startsWith("java:")) { resource = createResource(ref.name, className, ref.name, resourceRefInfo); } } return resource; } }
public class class_name { private Object getJavaObjectInstance(Context c, Hashtable<?, ?> envmt, String className, String bindingName, ResourceInfo resourceRefInfo, IndirectReference ref) throws Exception { // Return null if we don't find a binding so that the caller can // use JNDI if enabled. Object resource = null; NamingConstants.JavaColonNamespace namespace = NamingConstants.JavaColonNamespace.match(bindingName); if (namespace != null) { ComponentMetaData cmd = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().getComponentMetaData(); if (cmd != null) { OSGiInjectionScopeData isd = injectionEngine.getInjectionScopeData(cmd, namespace); if (isd != null) { String name = namespace.unprefix(bindingName); InjectionBinding<?> binding = isd.getInjectionBinding(namespace, name); if (binding == null && isd.processDeferredReferenceData()) { // Try again after processing deferred reference data. binding = isd.getInjectionBinding(namespace, name); // depends on control dependency: [if], data = [none] } if (binding != null) { resource = getBindingObjectInstance(c, envmt, className, resourceRefInfo, ref, binding); // depends on control dependency: [if], data = [none] } } } if (resource == null && namespace == NamingConstants.JavaColonNamespace.COMP) { resource = getDefaultJavaCompObjectInstance(namespace, bindingName, resourceRefInfo); } // If not found and the customer did not provide a binding, then try and // auto-link to a resource that matches on name in the service registry. if (resource == null && ref.defaultBinding && !ref.name.startsWith("java:")) { resource = createResource(ref.name, className, ref.name, resourceRefInfo); } } return resource; } }
public class class_name { public void addDispatcher(String dispatcherId, int threadsCount) { synchronized (dispatchers) { if (dispatchers.containsKey(dispatcherId)) { return; } ActorDispatcher dispatcher = new ActorDispatcher(dispatcherId, ThreadPriority.LOW, this, Runtime.isSingleThread() ? 1 : threadsCount); dispatchers.put(dispatcherId, dispatcher); } } }
public class class_name { public void addDispatcher(String dispatcherId, int threadsCount) { synchronized (dispatchers) { if (dispatchers.containsKey(dispatcherId)) { return; // depends on control dependency: [if], data = [none] } ActorDispatcher dispatcher = new ActorDispatcher(dispatcherId, ThreadPriority.LOW, this, Runtime.isSingleThread() ? 1 : threadsCount); dispatchers.put(dispatcherId, dispatcher); } } }
public class class_name { public void close() { try { state = "CLOSING"; if( connection != null ) { logger.warn("Connection not committed, rolling back."); rollback(); } if( !events.empty() ) { state = "CLOSING EVENTS"; do { Execution exec = (Execution)events.pop(); try { Stack<Execution> stack; exec.close(); stack = eventCache.get(exec.getClass().getName()); if( stack != null ) { stack.push(exec); } } catch( Throwable t ) { logger.error(t.getMessage(), t); } } while( !events.empty() ); } state = "CLOSED"; } finally { if (tracking) { transactions.remove(new Integer(transactionId)); } events.clear(); statements.clear(); stackTrace = null; } } }
public class class_name { public void close() { try { state = "CLOSING"; // depends on control dependency: [try], data = [none] if( connection != null ) { logger.warn("Connection not committed, rolling back."); // depends on control dependency: [if], data = [none] rollback(); // depends on control dependency: [if], data = [none] } if( !events.empty() ) { state = "CLOSING EVENTS"; // depends on control dependency: [if], data = [none] do { Execution exec = (Execution)events.pop(); try { Stack<Execution> stack; exec.close(); // depends on control dependency: [try], data = [none] stack = eventCache.get(exec.getClass().getName()); // depends on control dependency: [try], data = [none] if( stack != null ) { stack.push(exec); // depends on control dependency: [if], data = [none] } } catch( Throwable t ) { logger.error(t.getMessage(), t); } // depends on control dependency: [catch], data = [none] } while( !events.empty() ); } state = "CLOSED"; // depends on control dependency: [try], data = [none] } finally { if (tracking) { transactions.remove(new Integer(transactionId)); // depends on control dependency: [if], data = [none] } events.clear(); statements.clear(); stackTrace = null; } } }
public class class_name { protected void recoverSubscriptions(MultiMEProxyHandler proxyHandler) throws MessageStoreException, SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "recoverSubscriptions", proxyHandler); iProxyHandler = proxyHandler; iProxies = new Hashtable(); NonLockingCursor cursor = null; try { cursor = newNonLockingItemCursor(new ClassEqualsFilter(MESubscription.class)); AbstractItem item = null; while ((item = cursor.next()) != null) { MESubscription sub = null; sub = (MESubscription)item; // Generate a key for the topicSpace/topic final String key = BusGroup.subscriptionKey(sub.getTopicSpaceUuid(), sub.getTopic()); // Add the Neighbour into the list of recovered Neighbours iProxies.put(key, sub); // Having created the Proxy, need to readd the proxy to the matchspace or just reference it. iNeighbours.createProxy(this, iDestinationManager.getDestinationInternal(sub.getTopicSpaceUuid(), false), sub, sub.getTopicSpaceUuid(), sub.getTopic(), true); // When recovering subscriptions, we need to call the event post commit // code to either add a reference, or put in the MatchSpace. sub.eventPostCommitAdd(null); } } finally { if (cursor != null) cursor.finished(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "recoverSubscriptions"); } }
public class class_name { protected void recoverSubscriptions(MultiMEProxyHandler proxyHandler) throws MessageStoreException, SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "recoverSubscriptions", proxyHandler); iProxyHandler = proxyHandler; iProxies = new Hashtable(); NonLockingCursor cursor = null; try { cursor = newNonLockingItemCursor(new ClassEqualsFilter(MESubscription.class)); AbstractItem item = null; while ((item = cursor.next()) != null) { MESubscription sub = null; sub = (MESubscription)item; // depends on control dependency: [while], data = [none] // Generate a key for the topicSpace/topic final String key = BusGroup.subscriptionKey(sub.getTopicSpaceUuid(), sub.getTopic()); // Add the Neighbour into the list of recovered Neighbours iProxies.put(key, sub); // depends on control dependency: [while], data = [none] // Having created the Proxy, need to readd the proxy to the matchspace or just reference it. iNeighbours.createProxy(this, iDestinationManager.getDestinationInternal(sub.getTopicSpaceUuid(), false), sub, sub.getTopicSpaceUuid(), sub.getTopic(), true); // depends on control dependency: [while], data = [none] // When recovering subscriptions, we need to call the event post commit // code to either add a reference, or put in the MatchSpace. sub.eventPostCommitAdd(null); // depends on control dependency: [while], data = [null)] } } finally { if (cursor != null) cursor.finished(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "recoverSubscriptions"); } }
public class class_name { private static <T> T filterBySupportedProperties( Class<T> factoryClass, Map<String, String> properties, List<TableFactory> foundFactories, List<TableFactory> classFactories) { final List<String> plainGivenKeys = new LinkedList<>(); properties.keySet().forEach(k -> { // replace arrays with wildcard String key = k.replaceAll(".\\d+", ".#"); // ignore duplicates if (!plainGivenKeys.contains(key)) { plainGivenKeys.add(key); } }); Optional<String> lastKey = Optional.empty(); List<TableFactory> supportedFactories = new LinkedList<>(); for (TableFactory factory: classFactories) { Set<String> requiredContextKeys = normalizeContext(factory).keySet(); Tuple2<List<String>, List<String>> tuple2 = normalizeSupportedProperties(factory); // ignore context keys List<String> givenContextFreeKeys = plainGivenKeys.stream() .filter(p -> !requiredContextKeys.contains(p)) .collect(Collectors.toList()); List<String> givenFilteredKeys = filterSupportedPropertiesFactorySpecific( factory, givenContextFreeKeys); Boolean allTrue = true; for (String k: givenFilteredKeys) { lastKey = Optional.of(k); if (!(tuple2.f0.contains(k) || tuple2.f1.stream().anyMatch(p -> k.startsWith(p)))) { allTrue = false; break; } } if (allTrue) { supportedFactories.add(factory); } } if (supportedFactories.isEmpty() && classFactories.size() == 1 && lastKey.isPresent()) { // special case: when there is only one matching factory but the last property key // was incorrect TableFactory factory = classFactories.get(0); Tuple2<List<String>, List<String>> tuple2 = normalizeSupportedProperties(factory); String errorMessage = String.format( "The matching factory '%s' doesn't support '%s'.\n\nSupported properties of " + "this factory are:\n%s", factory.getClass().getName(), lastKey.get(), String.join("\n", tuple2.f0)); throw new NoMatchingTableFactoryException( errorMessage, factoryClass, foundFactories, properties); } else if (supportedFactories.isEmpty()) { throw new NoMatchingTableFactoryException( "No factory supports all properties.", factoryClass, foundFactories, properties); } else if (supportedFactories.size() > 1) { throw new AmbiguousTableFactoryException( supportedFactories, factoryClass, foundFactories, properties); } return (T) supportedFactories.get(0); } }
public class class_name { private static <T> T filterBySupportedProperties( Class<T> factoryClass, Map<String, String> properties, List<TableFactory> foundFactories, List<TableFactory> classFactories) { final List<String> plainGivenKeys = new LinkedList<>(); properties.keySet().forEach(k -> { // replace arrays with wildcard String key = k.replaceAll(".\\d+", ".#"); // ignore duplicates if (!plainGivenKeys.contains(key)) { plainGivenKeys.add(key); } }); Optional<String> lastKey = Optional.empty(); List<TableFactory> supportedFactories = new LinkedList<>(); for (TableFactory factory: classFactories) { Set<String> requiredContextKeys = normalizeContext(factory).keySet(); Tuple2<List<String>, List<String>> tuple2 = normalizeSupportedProperties(factory); // ignore context keys List<String> givenContextFreeKeys = plainGivenKeys.stream() .filter(p -> !requiredContextKeys.contains(p)) .collect(Collectors.toList()); List<String> givenFilteredKeys = filterSupportedPropertiesFactorySpecific( factory, givenContextFreeKeys); Boolean allTrue = true; for (String k: givenFilteredKeys) { lastKey = Optional.of(k); // depends on control dependency: [for], data = [k] if (!(tuple2.f0.contains(k) || tuple2.f1.stream().anyMatch(p -> k.startsWith(p)))) { allTrue = false; // depends on control dependency: [if], data = [none] break; } } if (allTrue) { supportedFactories.add(factory); // depends on control dependency: [if], data = [none] } } if (supportedFactories.isEmpty() && classFactories.size() == 1 && lastKey.isPresent()) { // special case: when there is only one matching factory but the last property key // was incorrect TableFactory factory = classFactories.get(0); Tuple2<List<String>, List<String>> tuple2 = normalizeSupportedProperties(factory); String errorMessage = String.format( "The matching factory '%s' doesn't support '%s'.\n\nSupported properties of " + "this factory are:\n%s", factory.getClass().getName(), lastKey.get(), String.join("\n", tuple2.f0)); throw new NoMatchingTableFactoryException( errorMessage, factoryClass, foundFactories, properties); } else if (supportedFactories.isEmpty()) { throw new NoMatchingTableFactoryException( "No factory supports all properties.", factoryClass, foundFactories, properties); } else if (supportedFactories.size() > 1) { throw new AmbiguousTableFactoryException( supportedFactories, factoryClass, foundFactories, properties); } return (T) supportedFactories.get(0); } }
public class class_name { private static Pair<Cluster, Cluster> getTwoLastClusters(@NotNull VirtualFileSystem vfs, @NotNull final Transaction txn, @NotNull final File file) { // todo: seek to end of file without loading all clusters try (ClusterIterator iterator = new ClusterIterator(vfs, txn, file)) { Cluster prevCluster = null; Cluster currCluster = null; while (iterator.hasCluster()) { prevCluster = currCluster; currCluster = iterator.getCurrent(); iterator.moveToNext(); } return new Pair<>(prevCluster, currCluster); } } }
public class class_name { private static Pair<Cluster, Cluster> getTwoLastClusters(@NotNull VirtualFileSystem vfs, @NotNull final Transaction txn, @NotNull final File file) { // todo: seek to end of file without loading all clusters try (ClusterIterator iterator = new ClusterIterator(vfs, txn, file)) { Cluster prevCluster = null; Cluster currCluster = null; while (iterator.hasCluster()) { prevCluster = currCluster; // depends on control dependency: [while], data = [none] currCluster = iterator.getCurrent(); // depends on control dependency: [while], data = [none] iterator.moveToNext(); // depends on control dependency: [while], data = [none] } return new Pair<>(prevCluster, currCluster); } } }
public class class_name { public void disconnect() { if (connection != null && connection.isOpen()) { connection.close(); transaction = null; setTransaction(null); } } }
public class class_name { public void disconnect() { if (connection != null && connection.isOpen()) { connection.close(); // depends on control dependency: [if], data = [none] transaction = null; // depends on control dependency: [if], data = [none] setTransaction(null); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void addExcludeResource(String resource) { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_ADD_MOD_EXCLUDERESOURCE_1, resource)); } m_excluderesources.add(resource); } }
public class class_name { public void addExcludeResource(String resource) { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_ADD_MOD_EXCLUDERESOURCE_1, resource)); // depends on control dependency: [if], data = [none] } m_excluderesources.add(resource); } }
public class class_name { private String getCertCN(X509Certificate x509) throws CertificateParsingException { X500Principal principal = x509.getSubjectX500Principal(); String subjectName = principal.getName(); String[] fields = subjectName.split(","); for (String field : fields) { if (field.startsWith("CN=")) { String serverName = field.substring(3); return serverName.toLowerCase(); } } throw new CertificateParsingException("Certificate CN not found"); } }
public class class_name { private String getCertCN(X509Certificate x509) throws CertificateParsingException { X500Principal principal = x509.getSubjectX500Principal(); String subjectName = principal.getName(); String[] fields = subjectName.split(","); for (String field : fields) { if (field.startsWith("CN=")) { String serverName = field.substring(3); return serverName.toLowerCase(); // depends on control dependency: [if], data = [none] } } throw new CertificateParsingException("Certificate CN not found"); } }
public class class_name { public String renderShortName(String shortName) { Assert.notNull(shortName, "No short name specified"); StringBuffer sb = new StringBuffer(shortName.length() + 5); char[] chars = shortName.toCharArray(); sb.append(Character.toUpperCase(chars[0])); for (int i = 1; i < chars.length; i++) { char c = chars[i]; if (Character.isUpperCase(c)) { sb.append(' '); } sb.append(c); } return sb.toString(); } }
public class class_name { public String renderShortName(String shortName) { Assert.notNull(shortName, "No short name specified"); StringBuffer sb = new StringBuffer(shortName.length() + 5); char[] chars = shortName.toCharArray(); sb.append(Character.toUpperCase(chars[0])); for (int i = 1; i < chars.length; i++) { char c = chars[i]; if (Character.isUpperCase(c)) { sb.append(' '); // depends on control dependency: [if], data = [none] } sb.append(c); // depends on control dependency: [for], data = [none] } return sb.toString(); } }
public class class_name { protected void agentCreationFailed (ClientObject client, int agentId) { FoundAgent found = resolve(client, agentId, "agentCreationFailed"); if (found == null) { return; } log.info("Agent creation failed", "agent", found.agent.which()); if (found.state == AgentState.STARTED || found.state == AgentState.STILL_BORN) { found.bureau.agentStates.remove(found.agent); _omgr.destroyObject(found.agent.getOid()); } else if (found.state == AgentState.PENDING || found.state == AgentState.RUNNING || found.state == AgentState.DESTROYED) { log.warning("Ignoring failure of creation of an agent in an unexpected state", "state", found.state, "agent", found.agent.which()); } found.bureau.summarize(); } }
public class class_name { protected void agentCreationFailed (ClientObject client, int agentId) { FoundAgent found = resolve(client, agentId, "agentCreationFailed"); if (found == null) { return; // depends on control dependency: [if], data = [none] } log.info("Agent creation failed", "agent", found.agent.which()); if (found.state == AgentState.STARTED || found.state == AgentState.STILL_BORN) { found.bureau.agentStates.remove(found.agent); // depends on control dependency: [if], data = [none] _omgr.destroyObject(found.agent.getOid()); // depends on control dependency: [if], data = [none] } else if (found.state == AgentState.PENDING || found.state == AgentState.RUNNING || found.state == AgentState.DESTROYED) { log.warning("Ignoring failure of creation of an agent in an unexpected state", "state", found.state, "agent", found.agent.which()); // depends on control dependency: [if], data = [none] } found.bureau.summarize(); } }
public class class_name { public boolean addChild(BaseVertex vertex) { if ( vertex != null && vertices.add( vertex ) ) { firePropertyChange( PROP_CHILD_ADDED, null, vertex ); return true; } return false; } }
public class class_name { public boolean addChild(BaseVertex vertex) { if ( vertex != null && vertices.add( vertex ) ) { firePropertyChange( PROP_CHILD_ADDED, null, vertex ); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public void maybeAppendColumn(Cell cell, DeletionInfo.InOrderTester tester, int gcBefore) { if (cell.getLocalDeletionTime() >= gcBefore && !tester.isDeleted(cell)) { internalAdd(cell); sortedSize++; } } }
public class class_name { public void maybeAppendColumn(Cell cell, DeletionInfo.InOrderTester tester, int gcBefore) { if (cell.getLocalDeletionTime() >= gcBefore && !tester.isDeleted(cell)) { internalAdd(cell); // depends on control dependency: [if], data = [none] sortedSize++; // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void evaluateProxiedServiceIfNeeded(final Service service, final TicketGrantingTicket ticketGrantingTicket, final RegisteredService registeredService) { val proxiedBy = ticketGrantingTicket.getProxiedBy(); if (proxiedBy != null) { LOGGER.debug("Ticket-granting ticket is proxied by [{}]. Locating proxy service in registry...", proxiedBy.getId()); val proxyingService = this.servicesManager.findServiceBy(proxiedBy); if (proxyingService != null) { LOGGER.debug("Located proxying service [{}] in the service registry", proxyingService); if (!proxyingService.getProxyPolicy().isAllowedToProxy()) { LOGGER.warn("Found proxying service [{}], but it is not authorized to fulfill the proxy attempt made by [{}]", proxyingService.getId(), service.getId()); throw new UnauthorizedProxyingException(UnauthorizedProxyingException.MESSAGE + registeredService.getId()); } } else { LOGGER.warn("No proxying service found. Proxy attempt by service [{}] (registered service [{}]) is not allowed.", service.getId(), registeredService.getId()); throw new UnauthorizedProxyingException(UnauthorizedProxyingException.MESSAGE + registeredService.getId()); } } else { LOGGER.trace("Ticket-granting ticket is not proxied by another service"); } } }
public class class_name { protected void evaluateProxiedServiceIfNeeded(final Service service, final TicketGrantingTicket ticketGrantingTicket, final RegisteredService registeredService) { val proxiedBy = ticketGrantingTicket.getProxiedBy(); if (proxiedBy != null) { LOGGER.debug("Ticket-granting ticket is proxied by [{}]. Locating proxy service in registry...", proxiedBy.getId()); // depends on control dependency: [if], data = [none] val proxyingService = this.servicesManager.findServiceBy(proxiedBy); if (proxyingService != null) { LOGGER.debug("Located proxying service [{}] in the service registry", proxyingService); // depends on control dependency: [if], data = [none] if (!proxyingService.getProxyPolicy().isAllowedToProxy()) { LOGGER.warn("Found proxying service [{}], but it is not authorized to fulfill the proxy attempt made by [{}]", proxyingService.getId(), service.getId()); // depends on control dependency: [if], data = [none] throw new UnauthorizedProxyingException(UnauthorizedProxyingException.MESSAGE + registeredService.getId()); } } else { LOGGER.warn("No proxying service found. Proxy attempt by service [{}] (registered service [{}]) is not allowed.", service.getId(), registeredService.getId()); // depends on control dependency: [if], data = [none] throw new UnauthorizedProxyingException(UnauthorizedProxyingException.MESSAGE + registeredService.getId()); } } else { LOGGER.trace("Ticket-granting ticket is not proxied by another service"); // depends on control dependency: [if], data = [none] } } }
public class class_name { private Expr parseNewExpression(EnclosingScope scope, boolean terminated) { int start = index; // try to match a lifetime Identifier lifetime = parseOptionalLifetimeIdentifier(scope, terminated); if (lifetime != null) { scope.mustBeLifetime(lifetime); match(Colon); } else { // FIXME: this should really be null lifetime = new Identifier("*"); } match(New); Expr e = parseExpression(scope, terminated); return annotateSourceLocation(new Expr.New(Type.Void, e, lifetime), start); } }
public class class_name { private Expr parseNewExpression(EnclosingScope scope, boolean terminated) { int start = index; // try to match a lifetime Identifier lifetime = parseOptionalLifetimeIdentifier(scope, terminated); if (lifetime != null) { scope.mustBeLifetime(lifetime); // depends on control dependency: [if], data = [(lifetime] match(Colon); // depends on control dependency: [if], data = [none] } else { // FIXME: this should really be null lifetime = new Identifier("*"); // depends on control dependency: [if], data = [none] } match(New); Expr e = parseExpression(scope, terminated); return annotateSourceLocation(new Expr.New(Type.Void, e, lifetime), start); } }
public class class_name { @Override public void close() { long timeout = 10000; long expires = System.currentTimeMillis() + timeout; if (_logQueue.size() > 0 && System.currentTimeMillis() < expires) { _logQueue.wake(); //try { Thread.sleep(1); } catch (Exception e) {} } } }
public class class_name { @Override public void close() { long timeout = 10000; long expires = System.currentTimeMillis() + timeout; if (_logQueue.size() > 0 && System.currentTimeMillis() < expires) { _logQueue.wake(); // depends on control dependency: [if], data = [none] //try { Thread.sleep(1); } catch (Exception e) {} } } }
public class class_name { @Override public void writeMetadata(final byte[] bytes, final IHLLMetadata metadata) { final HLLType type = metadata.HLLType(); final int typeOrdinal = getOrdinal(type); final int explicitCutoffValue; if(metadata.explicitOff()) { explicitCutoffValue = EXPLICIT_OFF; } else if(metadata.explicitAuto()) { explicitCutoffValue = EXPLICIT_AUTO; } else { explicitCutoffValue = metadata.log2ExplicitCutoff() + 1/*per spec*/; } bytes[0] = SerializationUtil.packVersionByte(SCHEMA_VERSION, typeOrdinal); bytes[1] = SerializationUtil.packParametersByte(metadata.registerWidth(), metadata.registerCountLog2()); bytes[2] = SerializationUtil.packCutoffByte(explicitCutoffValue, metadata.sparseEnabled()); } }
public class class_name { @Override public void writeMetadata(final byte[] bytes, final IHLLMetadata metadata) { final HLLType type = metadata.HLLType(); final int typeOrdinal = getOrdinal(type); final int explicitCutoffValue; if(metadata.explicitOff()) { explicitCutoffValue = EXPLICIT_OFF; // depends on control dependency: [if], data = [none] } else if(metadata.explicitAuto()) { explicitCutoffValue = EXPLICIT_AUTO; // depends on control dependency: [if], data = [none] } else { explicitCutoffValue = metadata.log2ExplicitCutoff() + 1/*per spec*/; // depends on control dependency: [if], data = [none] } bytes[0] = SerializationUtil.packVersionByte(SCHEMA_VERSION, typeOrdinal); bytes[1] = SerializationUtil.packParametersByte(metadata.registerWidth(), metadata.registerCountLog2()); bytes[2] = SerializationUtil.packCutoffByte(explicitCutoffValue, metadata.sparseEnabled()); } }
public class class_name { private void readHeader(final PushbackInputStream stream) throws IOException { UnbufferedASCIIReader hdrReader = new UnbufferedASCIIReader(stream); String magic = hdrReader.readLine(); if (!"ply".equals(magic)) { throw new IOException("Invalid PLY file: does not start " + "with 'ply'."); } format = null; ElementType.HeaderEntry currentElement = null; List<Property> currentElementProperties = null; elements = new ArrayList<ElementType>(); elementCounts = new HashMap<String, Integer>(); rawHeaders = new ArrayList<String>(); for (String line = hdrReader.readLine(); true; line = hdrReader.readLine()) { if (line == null) { throw new IOException("Unexpected end of file while " + "reading the header."); } line = line.trim(); if (line.isEmpty()) { continue; } rawHeaders.add(line); if (line.startsWith("format ")) { if (format != null) { throw new IOException("Multiple format definitions."); } format = Format.parse(line); } else if (line.startsWith("element ")) { if (currentElement != null) { // finish the last element ElementType element = new ElementType( currentElement.getName(), currentElementProperties); elements.add(element); elementCounts.put(currentElement.getName(), currentElement.getCount()); currentElement = null; currentElementProperties = null; } currentElement = ElementType.parse(line); currentElementProperties = new ArrayList<Property>(); } else if (line.startsWith("property ")) { if (currentElement == null) { throw new IOException("Property without element found."); } Property property = Property.parse(line); currentElementProperties.add(property); } else if (line.startsWith("end_header")) { break; } } if (currentElement != null) { // finish the last element ElementType element = new ElementType(currentElement.getName(), currentElementProperties); elements.add(element); elementCounts.put(currentElement.getName(), currentElement.getCount()); currentElement = null; currentElementProperties = null; } elements = Collections.unmodifiableList(elements); if (format == null) { throw new IOException("Missing format header entry."); } switch (format) { case ASCII: this.asciiReader = new BufferedReader(new InputStreamReader( stream, Charset.forName("US-ASCII"))); this.binaryStream = null; break; case BINARY_BIG_ENDIAN: this.asciiReader = null; this.binaryStream = new BinaryPlyInputStream( Channels.newChannel(stream), ByteOrder.BIG_ENDIAN); break; case BINARY_LITTLE_ENDIAN: this.asciiReader = null; this.binaryStream = new BinaryPlyInputStream( Channels.newChannel(stream), ByteOrder.LITTLE_ENDIAN); break; default: throw new IOException("Unsupported format: " + format); } } }
public class class_name { private void readHeader(final PushbackInputStream stream) throws IOException { UnbufferedASCIIReader hdrReader = new UnbufferedASCIIReader(stream); String magic = hdrReader.readLine(); if (!"ply".equals(magic)) { throw new IOException("Invalid PLY file: does not start " + "with 'ply'."); } format = null; ElementType.HeaderEntry currentElement = null; List<Property> currentElementProperties = null; elements = new ArrayList<ElementType>(); elementCounts = new HashMap<String, Integer>(); rawHeaders = new ArrayList<String>(); for (String line = hdrReader.readLine(); true; line = hdrReader.readLine()) { if (line == null) { throw new IOException("Unexpected end of file while " + "reading the header."); } line = line.trim(); if (line.isEmpty()) { continue; } rawHeaders.add(line); if (line.startsWith("format ")) { if (format != null) { throw new IOException("Multiple format definitions."); } format = Format.parse(line); } else if (line.startsWith("element ")) { if (currentElement != null) { // finish the last element ElementType element = new ElementType( currentElement.getName(), currentElementProperties); elements.add(element); // depends on control dependency: [if], data = [none] elementCounts.put(currentElement.getName(), currentElement.getCount()); // depends on control dependency: [if], data = [(currentElement] currentElement = null; // depends on control dependency: [if], data = [none] currentElementProperties = null; // depends on control dependency: [if], data = [none] } currentElement = ElementType.parse(line); currentElementProperties = new ArrayList<Property>(); } else if (line.startsWith("property ")) { if (currentElement == null) { throw new IOException("Property without element found."); } Property property = Property.parse(line); currentElementProperties.add(property); } else if (line.startsWith("end_header")) { break; } } if (currentElement != null) { // finish the last element ElementType element = new ElementType(currentElement.getName(), currentElementProperties); elements.add(element); elementCounts.put(currentElement.getName(), currentElement.getCount()); currentElement = null; currentElementProperties = null; } elements = Collections.unmodifiableList(elements); if (format == null) { throw new IOException("Missing format header entry."); } switch (format) { case ASCII: this.asciiReader = new BufferedReader(new InputStreamReader( stream, Charset.forName("US-ASCII"))); this.binaryStream = null; break; case BINARY_BIG_ENDIAN: this.asciiReader = null; this.binaryStream = new BinaryPlyInputStream( Channels.newChannel(stream), ByteOrder.BIG_ENDIAN); break; case BINARY_LITTLE_ENDIAN: this.asciiReader = null; this.binaryStream = new BinaryPlyInputStream( Channels.newChannel(stream), ByteOrder.LITTLE_ENDIAN); break; default: throw new IOException("Unsupported format: " + format); } } }
public class class_name { private static Iterator<MarkerRange.Builder> addProjected( Predicate projected, String name, Iterator<MarkerRange.Builder> inner) { if (projected instanceof In) { return new SetIterator((In) projected, name, inner); } else if (projected instanceof Range) { return new RangeIterator(name, (Range) projected, inner); } else { return inner; } } }
public class class_name { private static Iterator<MarkerRange.Builder> addProjected( Predicate projected, String name, Iterator<MarkerRange.Builder> inner) { if (projected instanceof In) { return new SetIterator((In) projected, name, inner); // depends on control dependency: [if], data = [none] } else if (projected instanceof Range) { return new RangeIterator(name, (Range) projected, inner); // depends on control dependency: [if], data = [none] } else { return inner; // depends on control dependency: [if], data = [none] } } }
public class class_name { public DescribeAccountLimitsResult withAccountLimits(AccountLimit... accountLimits) { if (this.accountLimits == null) { setAccountLimits(new com.amazonaws.internal.SdkInternalList<AccountLimit>(accountLimits.length)); } for (AccountLimit ele : accountLimits) { this.accountLimits.add(ele); } return this; } }
public class class_name { public DescribeAccountLimitsResult withAccountLimits(AccountLimit... accountLimits) { if (this.accountLimits == null) { setAccountLimits(new com.amazonaws.internal.SdkInternalList<AccountLimit>(accountLimits.length)); // depends on control dependency: [if], data = [none] } for (AccountLimit ele : accountLimits) { this.accountLimits.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public void requestPermissions(int requestCode) { String[] request = mPermissionsToRequest.toArray(new String[mPermissionsToRequest.size()]); StringBuilder log = new StringBuilder(); log.append("Requesting permissions:\n"); for (String permission : request) { log.append(permission).append("\n"); } Log.i(getClass().getSimpleName(), log.toString()); ActivityCompat.requestPermissions(mContext, request, requestCode); } }
public class class_name { public void requestPermissions(int requestCode) { String[] request = mPermissionsToRequest.toArray(new String[mPermissionsToRequest.size()]); StringBuilder log = new StringBuilder(); log.append("Requesting permissions:\n"); for (String permission : request) { log.append(permission).append("\n"); // depends on control dependency: [for], data = [permission] } Log.i(getClass().getSimpleName(), log.toString()); ActivityCompat.requestPermissions(mContext, request, requestCode); } }
public class class_name { public int getIndex(XExtension extension) { for (int i = 0; i < extensionList.size(); i++) { if (extensionList.get(i).equals(extension)) { return i; } } return -1; } }
public class class_name { public int getIndex(XExtension extension) { for (int i = 0; i < extensionList.size(); i++) { if (extensionList.get(i).equals(extension)) { return i; // depends on control dependency: [if], data = [none] } } return -1; } }
public class class_name { public Object getImageIcon(Object value) { int index = 0; if (value instanceof Integer) index = ((Integer)value).intValue(); else if (value != null) { try { index = Integer.parseInt(value.toString()); } catch (NumberFormatException ex) { } } return this.getIcon(index); } }
public class class_name { public Object getImageIcon(Object value) { int index = 0; if (value instanceof Integer) index = ((Integer)value).intValue(); else if (value != null) { try { index = Integer.parseInt(value.toString()); // depends on control dependency: [try], data = [none] } catch (NumberFormatException ex) { } // depends on control dependency: [catch], data = [none] } return this.getIcon(index); } }
public class class_name { private void createMenuEntry( MenuItem parent, final CmsTreeNode<I_CmsContextMenuItem> node, CmsContextMenuTreeBuilder treeBuilder) { Command entryCommand = null; if (node.getChildren().size() == 0) { entryCommand = new Command() { private static final long serialVersionUID = 1L; public void menuSelected(MenuItem selectedItem) { node.getData().executeAction(getDialogContext()); } }; } MenuItem entry = parent.addItem((node.getData().getTitle(A_CmsUI.get().getLocale())), entryCommand); for (CmsTreeNode<I_CmsContextMenuItem> child : node.getChildren()) { createMenuEntry(entry, child, treeBuilder); } if (treeBuilder.getVisibility(node.getData()).isInActive()) { entry.setEnabled(false); } } }
public class class_name { private void createMenuEntry( MenuItem parent, final CmsTreeNode<I_CmsContextMenuItem> node, CmsContextMenuTreeBuilder treeBuilder) { Command entryCommand = null; if (node.getChildren().size() == 0) { entryCommand = new Command() { private static final long serialVersionUID = 1L; public void menuSelected(MenuItem selectedItem) { node.getData().executeAction(getDialogContext()); } }; // depends on control dependency: [if], data = [none] } MenuItem entry = parent.addItem((node.getData().getTitle(A_CmsUI.get().getLocale())), entryCommand); for (CmsTreeNode<I_CmsContextMenuItem> child : node.getChildren()) { createMenuEntry(entry, child, treeBuilder); // depends on control dependency: [for], data = [child] } if (treeBuilder.getVisibility(node.getData()).isInActive()) { entry.setEnabled(false); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void setLimitOfTokenSize(int size) { if (0 >= size) { throw new IllegalArgumentException("Invalid limit on token size: " + size); } this.limitTokenSize = size; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Limit on token size now: " + this.limitTokenSize); } } }
public class class_name { @Override public void setLimitOfTokenSize(int size) { if (0 >= size) { throw new IllegalArgumentException("Invalid limit on token size: " + size); } this.limitTokenSize = size; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Limit on token size now: " + this.limitTokenSize); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public Enumeration<String> getEntryPaths(String path, boolean recurse) { path = preSlashify(path); Iterator<Entry> entries; if (path.equals("/")) { // asking for entries of the root container entries = container.iterator(); } else { Entry entry = container.getEntry(path); Container entryContainer = entry == null ? null : getContainer(entry); // Check if the entry is a container; // if so only iterate over its entries if the container is not a root entries = entryContainer == null || entryContainer.isRoot() ? null : entryContainer.iterator(); path = postSlashify(path, null); } return entries == null ? null : new ContainerEnumeration(path, entries, recurse); } }
public class class_name { @Override public Enumeration<String> getEntryPaths(String path, boolean recurse) { path = preSlashify(path); Iterator<Entry> entries; if (path.equals("/")) { // asking for entries of the root container entries = container.iterator(); // depends on control dependency: [if], data = [none] } else { Entry entry = container.getEntry(path); Container entryContainer = entry == null ? null : getContainer(entry); // Check if the entry is a container; // if so only iterate over its entries if the container is not a root entries = entryContainer == null || entryContainer.isRoot() ? null : entryContainer.iterator(); // depends on control dependency: [if], data = [none] path = postSlashify(path, null); // depends on control dependency: [if], data = [none] } return entries == null ? null : new ContainerEnumeration(path, entries, recurse); } }
public class class_name { public void setResourceAwsEc2InstanceLaunchedAt(java.util.Collection<DateFilter> resourceAwsEc2InstanceLaunchedAt) { if (resourceAwsEc2InstanceLaunchedAt == null) { this.resourceAwsEc2InstanceLaunchedAt = null; return; } this.resourceAwsEc2InstanceLaunchedAt = new java.util.ArrayList<DateFilter>(resourceAwsEc2InstanceLaunchedAt); } }
public class class_name { public void setResourceAwsEc2InstanceLaunchedAt(java.util.Collection<DateFilter> resourceAwsEc2InstanceLaunchedAt) { if (resourceAwsEc2InstanceLaunchedAt == null) { this.resourceAwsEc2InstanceLaunchedAt = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.resourceAwsEc2InstanceLaunchedAt = new java.util.ArrayList<DateFilter>(resourceAwsEc2InstanceLaunchedAt); } }
public class class_name { public EClass getIfcCompositeCurveSegment() { if (ifcCompositeCurveSegmentEClass == null) { ifcCompositeCurveSegmentEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(93); } return ifcCompositeCurveSegmentEClass; } }
public class class_name { public EClass getIfcCompositeCurveSegment() { if (ifcCompositeCurveSegmentEClass == null) { ifcCompositeCurveSegmentEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(93); // depends on control dependency: [if], data = [none] } return ifcCompositeCurveSegmentEClass; } }
public class class_name { public void marshall(BrokerSummary brokerSummary, ProtocolMarshaller protocolMarshaller) { if (brokerSummary == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(brokerSummary.getBrokerArn(), BROKERARN_BINDING); protocolMarshaller.marshall(brokerSummary.getBrokerId(), BROKERID_BINDING); protocolMarshaller.marshall(brokerSummary.getBrokerName(), BROKERNAME_BINDING); protocolMarshaller.marshall(brokerSummary.getBrokerState(), BROKERSTATE_BINDING); protocolMarshaller.marshall(brokerSummary.getCreated(), CREATED_BINDING); protocolMarshaller.marshall(brokerSummary.getDeploymentMode(), DEPLOYMENTMODE_BINDING); protocolMarshaller.marshall(brokerSummary.getHostInstanceType(), HOSTINSTANCETYPE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(BrokerSummary brokerSummary, ProtocolMarshaller protocolMarshaller) { if (brokerSummary == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(brokerSummary.getBrokerArn(), BROKERARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(brokerSummary.getBrokerId(), BROKERID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(brokerSummary.getBrokerName(), BROKERNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(brokerSummary.getBrokerState(), BROKERSTATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(brokerSummary.getCreated(), CREATED_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(brokerSummary.getDeploymentMode(), DEPLOYMENTMODE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(brokerSummary.getHostInstanceType(), HOSTINSTANCETYPE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private PreparedStatement createPreparedStatement(String query, int fetchSize, Object... params) throws SQLException { PreparedStatement stat = connection.prepareStatement(query); stat.setFetchSize(fetchSize); for (int i = 0; i < params.length; i++) { stat.setObject(i + 1, params[i]); } return stat; } }
public class class_name { private PreparedStatement createPreparedStatement(String query, int fetchSize, Object... params) throws SQLException { PreparedStatement stat = connection.prepareStatement(query); stat.setFetchSize(fetchSize); for (int i = 0; i < params.length; i++) { stat.setObject(i + 1, params[i]); // depends on control dependency: [for], data = [i] } return stat; } }
public class class_name { public static <T> T[] ensureCapacity(final T[] oldElements, final int requiredLength) { T[] result = oldElements; if (oldElements.length < requiredLength) { result = Arrays.copyOf(oldElements, requiredLength); } return result; } }
public class class_name { public static <T> T[] ensureCapacity(final T[] oldElements, final int requiredLength) { T[] result = oldElements; if (oldElements.length < requiredLength) { result = Arrays.copyOf(oldElements, requiredLength); // depends on control dependency: [if], data = [requiredLength)] } return result; } }
public class class_name { public static void addActionOutput( String name, Object value, ServletRequest request ) { Map map = InternalUtils.getActionOutputMap( request, true ); if ( map.containsKey( name ) ) { if ( _log.isWarnEnabled() ) { _log.warn( "Overwriting action output\"" + name + "\"." ); } } map.put( name, value ); } }
public class class_name { public static void addActionOutput( String name, Object value, ServletRequest request ) { Map map = InternalUtils.getActionOutputMap( request, true ); if ( map.containsKey( name ) ) { if ( _log.isWarnEnabled() ) { _log.warn( "Overwriting action output\"" + name + "\"." ); // depends on control dependency: [if], data = [none] } } map.put( name, value ); } }
public class class_name { @Override public Promise<T> take() { assert take == null; if (exception == null) { if (put != null && willBeExhausted()) { assert !isEmpty(); T item = doPoll(); SettablePromise<Void> put = this.put; this.put = null; put.set(null); return Promise.of(item); } if (!isEmpty()) { return Promise.of(doPoll()); } take = new SettablePromise<>(); return take; } else { return Promise.ofException(exception); } } }
public class class_name { @Override public Promise<T> take() { assert take == null; if (exception == null) { if (put != null && willBeExhausted()) { assert !isEmpty(); // depends on control dependency: [if], data = [none] T item = doPoll(); SettablePromise<Void> put = this.put; this.put = null; // depends on control dependency: [if], data = [none] put.set(null); // depends on control dependency: [if], data = [none] return Promise.of(item); // depends on control dependency: [if], data = [none] } if (!isEmpty()) { return Promise.of(doPoll()); // depends on control dependency: [if], data = [none] } take = new SettablePromise<>(); // depends on control dependency: [if], data = [none] return take; // depends on control dependency: [if], data = [none] } else { return Promise.ofException(exception); // depends on control dependency: [if], data = [(exception] } } }
public class class_name { private void refresh() { try { Canvas canvas = mSurface.lockCanvas(null); mWebView.draw(canvas); mSurface.unlockCanvasAndPost(canvas); } catch (Surface.OutOfResourcesException t) { Log.e("GVRWebBoardObject", "lockCanvas failed"); } mSurfaceTexture.updateTexImage(); } }
public class class_name { private void refresh() { try { Canvas canvas = mSurface.lockCanvas(null); mWebView.draw(canvas); // depends on control dependency: [try], data = [none] mSurface.unlockCanvasAndPost(canvas); // depends on control dependency: [try], data = [none] } catch (Surface.OutOfResourcesException t) { Log.e("GVRWebBoardObject", "lockCanvas failed"); } // depends on control dependency: [catch], data = [none] mSurfaceTexture.updateTexImage(); } }
public class class_name { protected void registerForMBeanNotifications() { Set<MBeanServerConnection> servers = getMBeanServers(); Exception lastExp = null; StringBuilder errors = new StringBuilder(); for (MBeanServerConnection server : servers) { try { JmxUtil.addMBeanRegistrationListener(server,this,null); } catch (IllegalStateException e) { lastExp = updateErrorMsg(errors,e); } } if (lastExp != null) { throw new IllegalStateException(errors.substring(0,errors.length()-1),lastExp); } } }
public class class_name { protected void registerForMBeanNotifications() { Set<MBeanServerConnection> servers = getMBeanServers(); Exception lastExp = null; StringBuilder errors = new StringBuilder(); for (MBeanServerConnection server : servers) { try { JmxUtil.addMBeanRegistrationListener(server,this,null); // depends on control dependency: [try], data = [none] } catch (IllegalStateException e) { lastExp = updateErrorMsg(errors,e); } // depends on control dependency: [catch], data = [none] } if (lastExp != null) { throw new IllegalStateException(errors.substring(0,errors.length()-1),lastExp); } } }
public class class_name { public void goBackTo(final Screen screen, NavigationType navigationType) { navigate(new HistoryRewriter() { @Override public void rewriteHistory(Deque<Screen> history) { checkArgument(history.contains(screen), "Can't go back to a screen that isn't in history."); while (history.size() > 1) { if (history.peek() == screen) { break; } history.pop(); } } }, navigationType, BACKWARD); } }
public class class_name { public void goBackTo(final Screen screen, NavigationType navigationType) { navigate(new HistoryRewriter() { @Override public void rewriteHistory(Deque<Screen> history) { checkArgument(history.contains(screen), "Can't go back to a screen that isn't in history."); while (history.size() > 1) { if (history.peek() == screen) { break; } history.pop(); // depends on control dependency: [while], data = [none] } } }, navigationType, BACKWARD); } }
public class class_name { public Iterator<MobicentsSipSession> getDerivedSipSessions() { if(derivedSipSessions != null) { return derivedSipSessions.values().iterator(); } return new HashMap<String, MobicentsSipSession>().values().iterator(); } }
public class class_name { public Iterator<MobicentsSipSession> getDerivedSipSessions() { if(derivedSipSessions != null) { return derivedSipSessions.values().iterator(); // depends on control dependency: [if], data = [none] } return new HashMap<String, MobicentsSipSession>().values().iterator(); } }
public class class_name { private void appendList(Output out, Collection collection, String separator, boolean areColumns) { Iterator it = collection.iterator(); boolean hasNext = it.hasNext(); //boolean areColumns = (columns == collection); while (hasNext) { Outputable sqlToken = (Outputable) it.next(); hasNext = it.hasNext(); sqlToken.write(out); if (areColumns) { Column column = (Column) sqlToken; String columnAlias = column.getAlias(); if (columnAlias != null) { out.print(" AS "); out.print("\""); out.print(columnAlias); out.print("\""); } } if (hasNext) { out.print(separator); out.println(); } } } }
public class class_name { private void appendList(Output out, Collection collection, String separator, boolean areColumns) { Iterator it = collection.iterator(); boolean hasNext = it.hasNext(); //boolean areColumns = (columns == collection); while (hasNext) { Outputable sqlToken = (Outputable) it.next(); hasNext = it.hasNext(); // depends on control dependency: [while], data = [none] sqlToken.write(out); // depends on control dependency: [while], data = [none] if (areColumns) { Column column = (Column) sqlToken; String columnAlias = column.getAlias(); if (columnAlias != null) { out.print(" AS "); // depends on control dependency: [if], data = [none] out.print("\""); // depends on control dependency: [if], data = [none] out.print(columnAlias); // depends on control dependency: [if], data = [(columnAlias] out.print("\""); // depends on control dependency: [if], data = [none] } } if (hasNext) { out.print(separator); // depends on control dependency: [if], data = [none] out.println(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override protected void paintComponent(Graphics g) { final Graphics2D G2 = (Graphics2D) g.create(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); // Translate the coordinate system related to the insets G2.translate(getFramelessOffset().getX(), getFramelessOffset().getY()); final AffineTransform OLD_TRANSFORM = G2.getTransform(); // Draw combined background image G2.drawImage(bImage, 0, 0, null); // Draw the hour pointer G2.rotate(Math.toRadians(hourPointerAngle + (2 * Math.sin(Math.toRadians(hourPointerAngle)))), CENTER.getX(), CENTER.getY()); G2.drawImage(hourShadowImage, 0, 0, null); G2.setTransform(OLD_TRANSFORM); G2.rotate(Math.toRadians(hourPointerAngle), CENTER.getX(), CENTER.getY()); G2.drawImage(hourImage, 0, 0, null); G2.setTransform(OLD_TRANSFORM); // Draw the minute pointer G2.rotate(Math.toRadians(minutePointerAngle + (2 * Math.sin(Math.toRadians(minutePointerAngle)))), CENTER.getX(), CENTER.getY()); G2.drawImage(minuteShadowImage, 0, 0, null); G2.setTransform(OLD_TRANSFORM); G2.rotate(Math.toRadians(minutePointerAngle), CENTER.getX(), CENTER.getY()); G2.drawImage(minuteImage, 0, 0, null); G2.setTransform(OLD_TRANSFORM); // Draw knob image if (getPointerType() == PointerType.TYPE1) { G2.drawImage(knobImage, 0, 0, null); } // Draw the second pointer if (secondPointerVisible) { G2.rotate(Math.toRadians(secondPointerAngle + (2 * Math.sin(Math.toRadians(secondPointerAngle)))), CENTER.getX(), CENTER.getY()); G2.drawImage(secondShadowImage, 0, 0, null); G2.setTransform(OLD_TRANSFORM); G2.rotate(Math.toRadians(secondPointerAngle), CENTER.getX(), CENTER.getY()); G2.drawImage(secondImage, 0, 0, null); G2.setTransform(OLD_TRANSFORM); } // Draw the top knob G2.drawImage(topKnobImage, 0, 0, null); // Draw combined foreground image G2.drawImage(fImage, 0, 0, null); if (!isEnabled()) { G2.drawImage(disabledImage, 0, 0, null); } G2.dispose(); } }
public class class_name { @Override protected void paintComponent(Graphics g) { final Graphics2D G2 = (Graphics2D) g.create(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); // Translate the coordinate system related to the insets G2.translate(getFramelessOffset().getX(), getFramelessOffset().getY()); final AffineTransform OLD_TRANSFORM = G2.getTransform(); // Draw combined background image G2.drawImage(bImage, 0, 0, null); // Draw the hour pointer G2.rotate(Math.toRadians(hourPointerAngle + (2 * Math.sin(Math.toRadians(hourPointerAngle)))), CENTER.getX(), CENTER.getY()); G2.drawImage(hourShadowImage, 0, 0, null); G2.setTransform(OLD_TRANSFORM); G2.rotate(Math.toRadians(hourPointerAngle), CENTER.getX(), CENTER.getY()); G2.drawImage(hourImage, 0, 0, null); G2.setTransform(OLD_TRANSFORM); // Draw the minute pointer G2.rotate(Math.toRadians(minutePointerAngle + (2 * Math.sin(Math.toRadians(minutePointerAngle)))), CENTER.getX(), CENTER.getY()); G2.drawImage(minuteShadowImage, 0, 0, null); G2.setTransform(OLD_TRANSFORM); G2.rotate(Math.toRadians(minutePointerAngle), CENTER.getX(), CENTER.getY()); G2.drawImage(minuteImage, 0, 0, null); G2.setTransform(OLD_TRANSFORM); // Draw knob image if (getPointerType() == PointerType.TYPE1) { G2.drawImage(knobImage, 0, 0, null); // depends on control dependency: [if], data = [none] } // Draw the second pointer if (secondPointerVisible) { G2.rotate(Math.toRadians(secondPointerAngle + (2 * Math.sin(Math.toRadians(secondPointerAngle)))), CENTER.getX(), CENTER.getY()); // depends on control dependency: [if], data = [none] G2.drawImage(secondShadowImage, 0, 0, null); // depends on control dependency: [if], data = [none] G2.setTransform(OLD_TRANSFORM); // depends on control dependency: [if], data = [none] G2.rotate(Math.toRadians(secondPointerAngle), CENTER.getX(), CENTER.getY()); // depends on control dependency: [if], data = [none] G2.drawImage(secondImage, 0, 0, null); // depends on control dependency: [if], data = [none] G2.setTransform(OLD_TRANSFORM); // depends on control dependency: [if], data = [none] } // Draw the top knob G2.drawImage(topKnobImage, 0, 0, null); // Draw combined foreground image G2.drawImage(fImage, 0, 0, null); if (!isEnabled()) { G2.drawImage(disabledImage, 0, 0, null); // depends on control dependency: [if], data = [none] } G2.dispose(); } }
public class class_name { public int[] predict(int[] o) { // The porbability of the most probable path. double[][] trellis = new double[o.length][numStates]; // Backtrace. int[][] psy = new int[o.length][numStates]; // The most likely state sequence. int[] s = new int[o.length]; // forward for (int i = 0; i < numStates; i++) { trellis[0][i] = log(pi[i]) + log(b[i][o[0]]); psy[0][i] = 0; } for (int t = 1; t < o.length; t++) { for (int j = 0; j < numStates; j++) { double maxDelta = Double.NEGATIVE_INFINITY; int maxPsy = 0; for (int i = 0; i < numStates; i++) { double delta = trellis[t - 1][i] + log(a[i][j]); if (maxDelta < delta) { maxDelta = delta; maxPsy = i; } } trellis[t][j] = maxDelta + log(b[j][o[t]]); psy[t][j] = maxPsy; } } // trace back int n = o.length - 1; double maxDelta = Double.NEGATIVE_INFINITY; for (int i = 0; i < numStates; i++) { if (maxDelta < trellis[n][i]) { maxDelta = trellis[n][i]; s[n] = i; } } for (int t = n; t-- > 0;) { s[t] = psy[t + 1][s[t + 1]]; } return s; } }
public class class_name { public int[] predict(int[] o) { // The porbability of the most probable path. double[][] trellis = new double[o.length][numStates]; // Backtrace. int[][] psy = new int[o.length][numStates]; // The most likely state sequence. int[] s = new int[o.length]; // forward for (int i = 0; i < numStates; i++) { trellis[0][i] = log(pi[i]) + log(b[i][o[0]]); // depends on control dependency: [for], data = [i] psy[0][i] = 0; // depends on control dependency: [for], data = [i] } for (int t = 1; t < o.length; t++) { for (int j = 0; j < numStates; j++) { double maxDelta = Double.NEGATIVE_INFINITY; int maxPsy = 0; for (int i = 0; i < numStates; i++) { double delta = trellis[t - 1][i] + log(a[i][j]); if (maxDelta < delta) { maxDelta = delta; // depends on control dependency: [if], data = [none] maxPsy = i; // depends on control dependency: [if], data = [none] } } trellis[t][j] = maxDelta + log(b[j][o[t]]); // depends on control dependency: [for], data = [j] psy[t][j] = maxPsy; // depends on control dependency: [for], data = [j] } } // trace back int n = o.length - 1; double maxDelta = Double.NEGATIVE_INFINITY; for (int i = 0; i < numStates; i++) { if (maxDelta < trellis[n][i]) { maxDelta = trellis[n][i]; // depends on control dependency: [if], data = [none] s[n] = i; // depends on control dependency: [if], data = [none] } } for (int t = n; t-- > 0;) { s[t] = psy[t + 1][s[t + 1]]; // depends on control dependency: [for], data = [t] } return s; } }
public class class_name { @Override public <ATTRIBUTE> OptionalThing<ATTRIBUTE> getAttribute(String key, Class<ATTRIBUTE> attributeType) { assertArgumentNotNull("key", key); final OptionalThing<ATTRIBUTE> foundShared = findAttributeInShareStorage(key, attributeType); if (foundShared.isPresent()) { return foundShared; } if (isSuppressHttpSession()) { // needs to check because it cannot use attribute name list in message return OptionalThing.ofNullable(null, () -> { final String msg = "Not found the session attribute in shared storage by the string key: " + key; throw new SessionAttributeNotFoundException(msg); }); } final boolean withShared = true; // automatically synchronize with shared storage return findHttpAttribute(key, attributeType, withShared); } }
public class class_name { @Override public <ATTRIBUTE> OptionalThing<ATTRIBUTE> getAttribute(String key, Class<ATTRIBUTE> attributeType) { assertArgumentNotNull("key", key); final OptionalThing<ATTRIBUTE> foundShared = findAttributeInShareStorage(key, attributeType); if (foundShared.isPresent()) { return foundShared; // depends on control dependency: [if], data = [none] } if (isSuppressHttpSession()) { // needs to check because it cannot use attribute name list in message return OptionalThing.ofNullable(null, () -> { final String msg = "Not found the session attribute in shared storage by the string key: " + key; throw new SessionAttributeNotFoundException(msg); }); // depends on control dependency: [if], data = [none] } final boolean withShared = true; // automatically synchronize with shared storage return findHttpAttribute(key, attributeType, withShared); } }
public class class_name { public static void initCipher(Cipher cipher, int mode, SecretKey secretKey, AlgorithmParameterSpec parameterSpec) { try { if (parameterSpec != null) { cipher.init(mode, secretKey, parameterSpec); } else { cipher.init(mode, secretKey); } } catch (InvalidKeyException e) { throw new IllegalArgumentException( "Unable to initialize due to invalid secret key", e); } catch (InvalidAlgorithmParameterException e) { throw new IllegalStateException( "Unable to initialize due to invalid decryption parameter spec", e); } } }
public class class_name { public static void initCipher(Cipher cipher, int mode, SecretKey secretKey, AlgorithmParameterSpec parameterSpec) { try { if (parameterSpec != null) { cipher.init(mode, secretKey, parameterSpec); // depends on control dependency: [if], data = [none] } else { cipher.init(mode, secretKey); // depends on control dependency: [if], data = [none] } } catch (InvalidKeyException e) { throw new IllegalArgumentException( "Unable to initialize due to invalid secret key", e); } // depends on control dependency: [catch], data = [none] catch (InvalidAlgorithmParameterException e) { throw new IllegalStateException( "Unable to initialize due to invalid decryption parameter spec", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void initSupportedExtensions(SMTPClientSession session, SMTPResponse response) { Iterator<String> lines = response.getLines().iterator(); while(lines.hasNext()) { String line = lines.next(); if (line.equalsIgnoreCase(PIPELINING_EXTENSION)) { session.addSupportedExtensions(PIPELINING_EXTENSION); } else if (line.equalsIgnoreCase(STARTTLS_EXTENSION)) { session.addSupportedExtensions(STARTTLS_EXTENSION); } } } }
public class class_name { private void initSupportedExtensions(SMTPClientSession session, SMTPResponse response) { Iterator<String> lines = response.getLines().iterator(); while(lines.hasNext()) { String line = lines.next(); if (line.equalsIgnoreCase(PIPELINING_EXTENSION)) { session.addSupportedExtensions(PIPELINING_EXTENSION); // depends on control dependency: [if], data = [none] } else if (line.equalsIgnoreCase(STARTTLS_EXTENSION)) { session.addSupportedExtensions(STARTTLS_EXTENSION); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public java.util.List<Interconnect> getInterconnects() { if (interconnects == null) { interconnects = new com.amazonaws.internal.SdkInternalList<Interconnect>(); } return interconnects; } }
public class class_name { public java.util.List<Interconnect> getInterconnects() { if (interconnects == null) { interconnects = new com.amazonaws.internal.SdkInternalList<Interconnect>(); // depends on control dependency: [if], data = [none] } return interconnects; } }
public class class_name { public void marshall(GetByteMatchSetRequest getByteMatchSetRequest, ProtocolMarshaller protocolMarshaller) { if (getByteMatchSetRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getByteMatchSetRequest.getByteMatchSetId(), BYTEMATCHSETID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetByteMatchSetRequest getByteMatchSetRequest, ProtocolMarshaller protocolMarshaller) { if (getByteMatchSetRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getByteMatchSetRequest.getByteMatchSetId(), BYTEMATCHSETID_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static boolean isCase(Pattern caseValue, Object switchValue) { if (switchValue == null) { return caseValue == null; } final Matcher matcher = caseValue.matcher(switchValue.toString()); if (matcher.matches()) { RegexSupport.setLastMatcher(matcher); return true; } else { return false; } } }
public class class_name { public static boolean isCase(Pattern caseValue, Object switchValue) { if (switchValue == null) { return caseValue == null; // depends on control dependency: [if], data = [none] } final Matcher matcher = caseValue.matcher(switchValue.toString()); if (matcher.matches()) { RegexSupport.setLastMatcher(matcher); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void warn( String format, Object[] argArray ) { if( m_delegate.isWarnEnabled() ) { FormattingTuple tuple = MessageFormatter.arrayFormat( format, argArray ); m_delegate.warn( tuple.getMessage(), tuple.getThrowable() ); } } }
public class class_name { public void warn( String format, Object[] argArray ) { if( m_delegate.isWarnEnabled() ) { FormattingTuple tuple = MessageFormatter.arrayFormat( format, argArray ); m_delegate.warn( tuple.getMessage(), tuple.getThrowable() ); // depends on control dependency: [if], data = [none] } } }