code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public static final void indexAllClasses(final Indexer indexer, final List<File> classFiles) { classFiles.forEach(file -> { try { final InputStream in = new FileInputStream(file); try { indexer.index(in); } finally { in.close(); } } catch (final IOException ex) { throw new RuntimeException(ex); } }); } }
public class class_name { public static final void indexAllClasses(final Indexer indexer, final List<File> classFiles) { classFiles.forEach(file -> { try { final InputStream in = new FileInputStream(file); try { indexer.index(in); // depends on control dependency: [try], data = [none] } finally { in.close(); } } catch (final IOException ex) { throw new RuntimeException(ex); } }); } }
public class class_name { public java.util.List<TaskDefinitionPlacementConstraint> getPlacementConstraints() { if (placementConstraints == null) { placementConstraints = new com.amazonaws.internal.SdkInternalList<TaskDefinitionPlacementConstraint>(); } return placementConstraints; } }
public class class_name { public java.util.List<TaskDefinitionPlacementConstraint> getPlacementConstraints() { if (placementConstraints == null) { placementConstraints = new com.amazonaws.internal.SdkInternalList<TaskDefinitionPlacementConstraint>(); // depends on control dependency: [if], data = [none] } return placementConstraints; } }
public class class_name { public static Rect getTilesRect(final BoundingBox pBB, final int pZoomLevel){ final int mapTileUpperBound = 1 << pZoomLevel; final int right = MapView.getTileSystem().getTileXFromLongitude(pBB.getLonEast(), pZoomLevel); final int bottom = MapView.getTileSystem().getTileYFromLatitude(pBB.getLatSouth(), pZoomLevel); final int left = MapView.getTileSystem().getTileXFromLongitude(pBB.getLonWest(), pZoomLevel); final int top = MapView.getTileSystem().getTileYFromLatitude(pBB.getLatNorth(), pZoomLevel); int width = right - left + 1; // handling the modulo if (width <= 0) { width += mapTileUpperBound; } int height = bottom - top + 1; // handling the modulo if (height <= 0) { height += mapTileUpperBound; } return new Rect(left, top, left + width - 1, top + height - 1); } }
public class class_name { public static Rect getTilesRect(final BoundingBox pBB, final int pZoomLevel){ final int mapTileUpperBound = 1 << pZoomLevel; final int right = MapView.getTileSystem().getTileXFromLongitude(pBB.getLonEast(), pZoomLevel); final int bottom = MapView.getTileSystem().getTileYFromLatitude(pBB.getLatSouth(), pZoomLevel); final int left = MapView.getTileSystem().getTileXFromLongitude(pBB.getLonWest(), pZoomLevel); final int top = MapView.getTileSystem().getTileYFromLatitude(pBB.getLatNorth(), pZoomLevel); int width = right - left + 1; // handling the modulo if (width <= 0) { width += mapTileUpperBound; // depends on control dependency: [if], data = [none] } int height = bottom - top + 1; // handling the modulo if (height <= 0) { height += mapTileUpperBound; // depends on control dependency: [if], data = [none] } return new Rect(left, top, left + width - 1, top + height - 1); } }
public class class_name { @Override public void setResponse(HttpResponseMessage msg) throws IllegalResponseObjectException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "setResponse: " + msg); } // null message isn't allowed if (null == msg) { throw new IllegalResponseObjectException("Illegal null message"); } // save new object as our response object HttpResponseMessageImpl temp = null; try { temp = (HttpResponseMessageImpl) msg; } catch (ClassCastException cce) { // no FFDC required if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Non msg impl passed to setResponse"); } throw new IllegalResponseObjectException("Invalid message provided"); } // possibly clean up any existing response object if (null != getMyResponse() && isResponseOwner()) { if (!getMyResponse().equals(temp)) { getMyResponse().destroy(); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Caller overlaying same message"); } } } setMyResponse(temp); getMyResponse().init(this); // moving the response to the inbound side will use the inbound sides // configured header change limit getMyResponse().setHeaderChangeLimit(getHttpConfig().getHeaderChangeLimit()); updatePersistence(getMyResponse()); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "setResponse"); } } }
public class class_name { @Override public void setResponse(HttpResponseMessage msg) throws IllegalResponseObjectException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "setResponse: " + msg); } // null message isn't allowed if (null == msg) { throw new IllegalResponseObjectException("Illegal null message"); } // save new object as our response object HttpResponseMessageImpl temp = null; try { temp = (HttpResponseMessageImpl) msg; } catch (ClassCastException cce) { // no FFDC required if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Non msg impl passed to setResponse"); // depends on control dependency: [if], data = [none] } throw new IllegalResponseObjectException("Invalid message provided"); } // possibly clean up any existing response object if (null != getMyResponse() && isResponseOwner()) { if (!getMyResponse().equals(temp)) { getMyResponse().destroy(); // depends on control dependency: [if], data = [none] } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Caller overlaying same message"); // depends on control dependency: [if], data = [none] } } } setMyResponse(temp); getMyResponse().init(this); // moving the response to the inbound side will use the inbound sides // configured header change limit getMyResponse().setHeaderChangeLimit(getHttpConfig().getHeaderChangeLimit()); updatePersistence(getMyResponse()); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "setResponse"); } } }
public class class_name { public final ImmutableList<Parameter> getParameters() { Type[] parameterTypes = getGenericParameterTypes(); Annotation[][] annotations = getParameterAnnotations(); AnnotatedType[] annotatedTypes = getAnnotatedParameterTypes(); ImmutableList.Builder<Parameter> builder = ImmutableList.builder(); for (int i = 0; i < parameterTypes.length; i++) { builder.add( new Parameter( this, i, TypeToken.of(parameterTypes[i]), annotations[i], annotatedTypes[i])); } return builder.build(); } }
public class class_name { public final ImmutableList<Parameter> getParameters() { Type[] parameterTypes = getGenericParameterTypes(); Annotation[][] annotations = getParameterAnnotations(); AnnotatedType[] annotatedTypes = getAnnotatedParameterTypes(); ImmutableList.Builder<Parameter> builder = ImmutableList.builder(); for (int i = 0; i < parameterTypes.length; i++) { builder.add( new Parameter( this, i, TypeToken.of(parameterTypes[i]), annotations[i], annotatedTypes[i])); // depends on control dependency: [for], data = [none] } return builder.build(); } }
public class class_name { private int getPriority(ResourceReader o1) { int priority = 0; if (o1 instanceof ServletContextResourceReader) { priority = baseDirHighPriority ? 5 : 4; } else if (o1 instanceof FileSystemResourceReader) { priority = baseDirHighPriority ? 4 : 5; } else if (o1 instanceof CssSmartSpritesResourceReader) { priority = 1; } else if (o1 instanceof ResourceGenerator) { if (((ResourceGenerator) o1).getResolver().getType().equals(ResolverType.PREFIXED)) { priority = 3; } else { priority = 2; } } return priority; } }
public class class_name { private int getPriority(ResourceReader o1) { int priority = 0; if (o1 instanceof ServletContextResourceReader) { priority = baseDirHighPriority ? 5 : 4; // depends on control dependency: [if], data = [none] } else if (o1 instanceof FileSystemResourceReader) { priority = baseDirHighPriority ? 4 : 5; // depends on control dependency: [if], data = [none] } else if (o1 instanceof CssSmartSpritesResourceReader) { priority = 1; // depends on control dependency: [if], data = [none] } else if (o1 instanceof ResourceGenerator) { if (((ResourceGenerator) o1).getResolver().getType().equals(ResolverType.PREFIXED)) { priority = 3; // depends on control dependency: [if], data = [none] } else { priority = 2; // depends on control dependency: [if], data = [none] } } return priority; } }
public class class_name { public Map<K, V> getAll(Iterable<K> keys) { List<K> missingKeys = new ArrayList<>(); Map<K, V> result = new HashMap<>(); for (K key : keys) { V value = map.get(key); if (value == null && !map.containsKey(key)) { missingKeys.add(key); } else { result.put(key, value); } } if (!missingKeys.isEmpty()) { Map<K, V> missingValues = loader.loadAll(missingKeys); map.putAll(missingValues); result.putAll(missingValues); for (K missingKey : missingKeys) { if (!map.containsKey(missingKey)) { map.put(missingKey, null); result.put(missingKey, null); } } } return result; } }
public class class_name { public Map<K, V> getAll(Iterable<K> keys) { List<K> missingKeys = new ArrayList<>(); Map<K, V> result = new HashMap<>(); for (K key : keys) { V value = map.get(key); if (value == null && !map.containsKey(key)) { missingKeys.add(key); // depends on control dependency: [if], data = [none] } else { result.put(key, value); // depends on control dependency: [if], data = [none] } } if (!missingKeys.isEmpty()) { Map<K, V> missingValues = loader.loadAll(missingKeys); map.putAll(missingValues); // depends on control dependency: [if], data = [none] result.putAll(missingValues); // depends on control dependency: [if], data = [none] for (K missingKey : missingKeys) { if (!map.containsKey(missingKey)) { map.put(missingKey, null); // depends on control dependency: [if], data = [none] result.put(missingKey, null); // depends on control dependency: [if], data = [none] } } } return result; } }
public class class_name { public int lookup(Object key, int hash) { Object node; int hash1 = hash ^ (hash >>> 15); int hash2 = (hash ^ (hash << 6)) | 1; //ensure coprimeness int deleted = -1; for (int i = hash1 & mask;; i = (i + hash2) & mask) { node = objs[i]; if (node == key) return i; if (node == null) return deleted >= 0 ? deleted : i; if (node == DELETED && deleted < 0) deleted = i; } } }
public class class_name { public int lookup(Object key, int hash) { Object node; int hash1 = hash ^ (hash >>> 15); int hash2 = (hash ^ (hash << 6)) | 1; //ensure coprimeness int deleted = -1; for (int i = hash1 & mask;; i = (i + hash2) & mask) { node = objs[i]; // depends on control dependency: [for], data = [i] if (node == key) return i; if (node == null) return deleted >= 0 ? deleted : i; if (node == DELETED && deleted < 0) deleted = i; } } }
public class class_name { public double deviance(double w, double y, double f) { switch (distribution) { case AUTO: case gaussian: return w * (y - f) * (y - f); // leads to wMSE case huber: if (Math.abs(y-f) <= huberDelta) { return w * (y - f) * (y - f); // same as wMSE } else { return 2 * w * (Math.abs(y-f) - huberDelta)*huberDelta; // note quite the same as wMAE } case laplace: return w * Math.abs(y-f); // same as wMAE case quantile: return y > f ? w*quantileAlpha*(y-f) : w*(1-quantileAlpha)*(f-y); case bernoulli: // unused return -2 * w * (y * log(f) + (1 - y) * log(1 - f)); case quasibinomial: // unused if (y==f) return 0; if (f > 1) return - 2 * w * y * log(f); else if (f < 0) return - 2 * w * (1 - y) * log(1 - f); else return -2 * w * (y * log(f) + (1 - y) * log(1 - f)); case poisson: f = link(f); //bring back f to link space return -2 * w * (y * f - exp(f)); case gamma: f = link(f); //bring back f to link space return 2 * w * (y * exp(-f) + f); case tweedie: f = link(f); //bring back f to link space assert (tweediePower > 1 && tweediePower < 2); return 2 * w * (Math.pow(y, 2 - tweediePower) / ((1 - tweediePower) * (2 - tweediePower)) - y * exp(f * (1 - tweediePower)) / (1 - tweediePower) + exp(f * (2 - tweediePower)) / (2 - tweediePower)); case modified_huber: double yf = (2*y-1)*f; if (yf < -1) return -w*4*yf; else if (yf > 1) return 0; else return w* yf * yf; default: throw H2O.unimpl(); } } }
public class class_name { public double deviance(double w, double y, double f) { switch (distribution) { case AUTO: case gaussian: return w * (y - f) * (y - f); // leads to wMSE case huber: if (Math.abs(y-f) <= huberDelta) { return w * (y - f) * (y - f); // same as wMSE // depends on control dependency: [if], data = [none] } else { return 2 * w * (Math.abs(y-f) - huberDelta)*huberDelta; // note quite the same as wMAE // depends on control dependency: [if], data = [(Math.abs(y-f)] } case laplace: return w * Math.abs(y-f); // same as wMAE case quantile: return y > f ? w*quantileAlpha*(y-f) : w*(1-quantileAlpha)*(f-y); case bernoulli: // unused return -2 * w * (y * log(f) + (1 - y) * log(1 - f)); case quasibinomial: // unused if (y==f) return 0; if (f > 1) return - 2 * w * y * log(f); else if (f < 0) return - 2 * w * (1 - y) * log(1 - f); else return -2 * w * (y * log(f) + (1 - y) * log(1 - f)); case poisson: f = link(f); //bring back f to link space return -2 * w * (y * f - exp(f)); case gamma: f = link(f); //bring back f to link space return 2 * w * (y * exp(-f) + f); case tweedie: f = link(f); //bring back f to link space assert (tweediePower > 1 && tweediePower < 2); return 2 * w * (Math.pow(y, 2 - tweediePower) / ((1 - tweediePower) * (2 - tweediePower)) - y * exp(f * (1 - tweediePower)) / (1 - tweediePower) + exp(f * (2 - tweediePower)) / (2 - tweediePower)); case modified_huber: double yf = (2*y-1)*f; if (yf < -1) return -w*4*yf; else if (yf > 1) return 0; else return w* yf * yf; default: throw H2O.unimpl(); } } }
public class class_name { public static boolean isTimeConflict(Time timeFrom, Time timeTo, Time otherTimeFrom, Time otherTimeTo) { if (JKDateTimeUtil.isTimesEqaualed(timeFrom, otherTimeFrom) || JKDateTimeUtil.isTimesEqaualed(timeTo, otherTimeTo)) { return true; } // other time start time is between start and end time for this time if (timeFrom.after(otherTimeFrom) && timeFrom.before(otherTimeTo)) { return true; } // other time e is between start and end time for this time if (timeTo.after(otherTimeFrom) && timeTo.before(otherTimeTo)) { return true; } // if time starting before this time and ends after this time if (timeFrom.before(otherTimeFrom) && timeTo.after(otherTimeTo)) { return true; } return false; } }
public class class_name { public static boolean isTimeConflict(Time timeFrom, Time timeTo, Time otherTimeFrom, Time otherTimeTo) { if (JKDateTimeUtil.isTimesEqaualed(timeFrom, otherTimeFrom) || JKDateTimeUtil.isTimesEqaualed(timeTo, otherTimeTo)) { return true; // depends on control dependency: [if], data = [none] } // other time start time is between start and end time for this time if (timeFrom.after(otherTimeFrom) && timeFrom.before(otherTimeTo)) { return true; // depends on control dependency: [if], data = [none] } // other time e is between start and end time for this time if (timeTo.after(otherTimeFrom) && timeTo.before(otherTimeTo)) { return true; // depends on control dependency: [if], data = [none] } // if time starting before this time and ends after this time if (timeFrom.before(otherTimeFrom) && timeTo.after(otherTimeTo)) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public static OffsetDateTime from(TemporalAccessor temporal) { if (temporal instanceof OffsetDateTime) { return (OffsetDateTime) temporal; } try { ZoneOffset offset = ZoneOffset.from(temporal); try { LocalDateTime ldt = LocalDateTime.from(temporal); return OffsetDateTime.of(ldt, offset); } catch (DateTimeException ignore) { Instant instant = Instant.from(temporal); return OffsetDateTime.ofInstant(instant, offset); } } catch (DateTimeException ex) { throw new DateTimeException("Unable to obtain OffsetDateTime from TemporalAccessor: " + temporal + ", type " + temporal.getClass().getName()); } } }
public class class_name { public static OffsetDateTime from(TemporalAccessor temporal) { if (temporal instanceof OffsetDateTime) { return (OffsetDateTime) temporal; // depends on control dependency: [if], data = [none] } try { ZoneOffset offset = ZoneOffset.from(temporal); try { LocalDateTime ldt = LocalDateTime.from(temporal); return OffsetDateTime.of(ldt, offset); // depends on control dependency: [try], data = [none] } catch (DateTimeException ignore) { Instant instant = Instant.from(temporal); return OffsetDateTime.ofInstant(instant, offset); } // depends on control dependency: [catch], data = [none] } catch (DateTimeException ex) { throw new DateTimeException("Unable to obtain OffsetDateTime from TemporalAccessor: " + temporal + ", type " + temporal.getClass().getName()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static SearchView setBackground(SearchView view, @DrawableRes int drawableId) { int id = view.getResources().getIdentifier("android:id/search_plate", null, null); if (id > 0) { View search = view.findViewById(id); if (search != null) { search.setBackgroundResource(drawableId); } } return view; } }
public class class_name { public static SearchView setBackground(SearchView view, @DrawableRes int drawableId) { int id = view.getResources().getIdentifier("android:id/search_plate", null, null); if (id > 0) { View search = view.findViewById(id); if (search != null) { search.setBackgroundResource(drawableId); // depends on control dependency: [if], data = [none] } } return view; } }
public class class_name { public <T> void sort(List<T> list, Comparator<T> cmp) { if(index.size() < list.size()) for(int i = index.size(); i < list.size(); i++ ) index.add(i); if(list.size() == index.size()) Collections.sort(index, new IndexViewCompList(list, cmp)); else { Collections.sort(index);//so [0, list.size) is at the front Collections.sort(index.subList(0, list.size()), new IndexViewCompList(list, cmp)); } prevSize = list.size(); } }
public class class_name { public <T> void sort(List<T> list, Comparator<T> cmp) { if(index.size() < list.size()) for(int i = index.size(); i < list.size(); i++ ) index.add(i); if(list.size() == index.size()) Collections.sort(index, new IndexViewCompList(list, cmp)); else { Collections.sort(index);//so [0, list.size) is at the front // depends on control dependency: [if], data = [none] Collections.sort(index.subList(0, list.size()), new IndexViewCompList(list, cmp)); // depends on control dependency: [if], data = [none] } prevSize = list.size(); } }
public class class_name { public boolean populate(OggPacket packet) { // TODO Finish the flac support properly if (type == OggStreamIdentifier.OGG_FLAC) { if (tags == null) { tags = new FlacTags(packet); return true; } else { // TODO Finish FLAC support return false; } } OggStreamPacket sPacket = createNext(packet); if (sPacket instanceof OggAudioTagsHeader) { tags = (OggAudioTagsHeader)sPacket; // Are there more headers to come? if (type == OggStreamIdentifier.OGG_VORBIS) { return true; } else { return false; } } if (sPacket instanceof OggAudioSetupHeader) { setup = (OggAudioSetupHeader)sPacket; // Setup is always last return false; } throw new IllegalArgumentException("Expecting header packet but got " + sPacket); } }
public class class_name { public boolean populate(OggPacket packet) { // TODO Finish the flac support properly if (type == OggStreamIdentifier.OGG_FLAC) { if (tags == null) { tags = new FlacTags(packet); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } else { // TODO Finish FLAC support return false; // depends on control dependency: [if], data = [none] } } OggStreamPacket sPacket = createNext(packet); if (sPacket instanceof OggAudioTagsHeader) { tags = (OggAudioTagsHeader)sPacket; // depends on control dependency: [if], data = [none] // Are there more headers to come? if (type == OggStreamIdentifier.OGG_VORBIS) { return true; // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } if (sPacket instanceof OggAudioSetupHeader) { setup = (OggAudioSetupHeader)sPacket; // depends on control dependency: [if], data = [none] // Setup is always last return false; // depends on control dependency: [if], data = [none] } throw new IllegalArgumentException("Expecting header packet but got " + sPacket); } }
public class class_name { void setLocale(Locale l) { if (l == null) { hnd_create_params = hnd_local_names = hnd_remarks = -1; locale_set = false; return; } Locale oldLocale; synchronized (BundleHandler.class) { oldLocale = BundleHandler.getLocale(); BundleHandler.setLocale(l); hnd_create_params = BundleHandler.getBundleHandle("data-type-create-parameters", null); hnd_local_names = BundleHandler.getBundleHandle("data-type-names", null); hnd_remarks = BundleHandler.getBundleHandle("data-type-remarks", null); BundleHandler.setLocale(oldLocale); locale_set = true; } } }
public class class_name { void setLocale(Locale l) { if (l == null) { hnd_create_params = hnd_local_names = hnd_remarks = -1; // depends on control dependency: [if], data = [none] locale_set = false; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } Locale oldLocale; synchronized (BundleHandler.class) { oldLocale = BundleHandler.getLocale(); BundleHandler.setLocale(l); hnd_create_params = BundleHandler.getBundleHandle("data-type-create-parameters", null); hnd_local_names = BundleHandler.getBundleHandle("data-type-names", null); hnd_remarks = BundleHandler.getBundleHandle("data-type-remarks", null); BundleHandler.setLocale(oldLocale); locale_set = true; } } }
public class class_name { public java.util.List<DocumentKeyValuesFilter> getFilters() { if (filters == null) { filters = new com.amazonaws.internal.SdkInternalList<DocumentKeyValuesFilter>(); } return filters; } }
public class class_name { public java.util.List<DocumentKeyValuesFilter> getFilters() { if (filters == null) { filters = new com.amazonaws.internal.SdkInternalList<DocumentKeyValuesFilter>(); // depends on control dependency: [if], data = [none] } return filters; } }
public class class_name { public JobDeleteOptions withIfModifiedSince(DateTime ifModifiedSince) { if (ifModifiedSince == null) { this.ifModifiedSince = null; } else { this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); } return this; } }
public class class_name { public JobDeleteOptions withIfModifiedSince(DateTime ifModifiedSince) { if (ifModifiedSince == null) { this.ifModifiedSince = null; // depends on control dependency: [if], data = [none] } else { this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); // depends on control dependency: [if], data = [(ifModifiedSince] } return this; } }
public class class_name { public static void main(String[] args) { gbStandAlone = true; m_args = args; // For a standalone app, you must save the args to parse them later. if (Application.getRootApplet() != null) { Application.getRootApplet().init(); Application.getRootApplet().start(); } } }
public class class_name { public static void main(String[] args) { gbStandAlone = true; m_args = args; // For a standalone app, you must save the args to parse them later. if (Application.getRootApplet() != null) { Application.getRootApplet().init(); // depends on control dependency: [if], data = [none] Application.getRootApplet().start(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private String getFileName(MultivaluedMap<String, String> header) { String[] contentDisposition = header.getFirst("Content-Disposition").split(";"); for (String filename : contentDisposition) { if ((filename.trim().startsWith("filename"))) { String[] name = filename.split("="); String finalFileName = name[1].trim().replaceAll("\"", ""); return finalFileName; } } return "unknown"; } }
public class class_name { private String getFileName(MultivaluedMap<String, String> header) { String[] contentDisposition = header.getFirst("Content-Disposition").split(";"); for (String filename : contentDisposition) { if ((filename.trim().startsWith("filename"))) { String[] name = filename.split("="); String finalFileName = name[1].trim().replaceAll("\"", ""); return finalFileName; // depends on control dependency: [if], data = [none] } } return "unknown"; } }
public class class_name { public UnsupportedAvailabilityZoneException withValidZones(String... validZones) { if (this.validZones == null) { setValidZones(new java.util.ArrayList<String>(validZones.length)); } for (String ele : validZones) { this.validZones.add(ele); } return this; } }
public class class_name { public UnsupportedAvailabilityZoneException withValidZones(String... validZones) { if (this.validZones == null) { setValidZones(new java.util.ArrayList<String>(validZones.length)); // depends on control dependency: [if], data = [none] } for (String ele : validZones) { this.validZones.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public void addAll(IntCounter<E> counter) { for (E key : counter.keySet()) { int count = counter.getIntCount(key); incrementCount(key, count); } } }
public class class_name { public void addAll(IntCounter<E> counter) { for (E key : counter.keySet()) { int count = counter.getIntCount(key); incrementCount(key, count); // depends on control dependency: [for], data = [key] } } }
public class class_name { protected void writeRaw(CharSequence seq, CharBuf buffer) { if (seq != null) { buffer.add(seq.toString()); } } }
public class class_name { protected void writeRaw(CharSequence seq, CharBuf buffer) { if (seq != null) { buffer.add(seq.toString()); // depends on control dependency: [if], data = [(seq] } } }
public class class_name { private void resize() { width = getWidth() - getInsets().getLeft() - getInsets().getRight(); height = getHeight() - getInsets().getTop() - getInsets().getBottom(); size = width < height ? width : height; double center = size * 0.5; if (width > 0 && height > 0) { pane.setMaxSize(size, size); pane.setPrefSize(size, size); pane.relocate((getWidth() - size) * 0.5, (getHeight() - size) * 0.5); ring.setStrokeWidth(size * 0.078125); ring.setRadius(center); ring.setCenterX(center); ring.setCenterY(center); dot.setRadius(size * 0.3125); dot.setCenterX(center); dot.setCenterY(center); redraw(); } } }
public class class_name { private void resize() { width = getWidth() - getInsets().getLeft() - getInsets().getRight(); height = getHeight() - getInsets().getTop() - getInsets().getBottom(); size = width < height ? width : height; double center = size * 0.5; if (width > 0 && height > 0) { pane.setMaxSize(size, size); // depends on control dependency: [if], data = [none] pane.setPrefSize(size, size); // depends on control dependency: [if], data = [none] pane.relocate((getWidth() - size) * 0.5, (getHeight() - size) * 0.5); // depends on control dependency: [if], data = [none] ring.setStrokeWidth(size * 0.078125); // depends on control dependency: [if], data = [none] ring.setRadius(center); // depends on control dependency: [if], data = [none] ring.setCenterX(center); // depends on control dependency: [if], data = [none] ring.setCenterY(center); // depends on control dependency: [if], data = [none] dot.setRadius(size * 0.3125); // depends on control dependency: [if], data = [none] dot.setCenterX(center); // depends on control dependency: [if], data = [none] dot.setCenterY(center); // depends on control dependency: [if], data = [none] redraw(); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected boolean isStoredProcedure(String sql) { /* Stored procedures start with {?= call <procedure-name>[<arg1>,<arg2>, ...]} or {call <procedure-name>[<arg1>,<arg2>, ...]} but also statements with white space like { ?= call <procedure-name>[<arg1>,<arg2>, ...]} are possible. */ int k = 0, i = 0; char c; while(k < 3 && i < sql.length()) { c = sql.charAt(i); if(c != ' ') { switch (k) { case 0: if(c != '{') return false; break; case 1: if(c != '?' && c != 'c') return false; break; case 2: if(c != '=' && c != 'a') return false; break; } k++; } i++; } return true; } }
public class class_name { protected boolean isStoredProcedure(String sql) { /* Stored procedures start with {?= call <procedure-name>[<arg1>,<arg2>, ...]} or {call <procedure-name>[<arg1>,<arg2>, ...]} but also statements with white space like { ?= call <procedure-name>[<arg1>,<arg2>, ...]} are possible. */ int k = 0, i = 0; char c; while(k < 3 && i < sql.length()) { c = sql.charAt(i); // depends on control dependency: [while], data = [none] if(c != ' ') { switch (k) { case 0: if(c != '{') return false; break; case 1: if(c != '?' && c != 'c') return false; break; case 2: if(c != '=' && c != 'a') return false; break; } k++; // depends on control dependency: [if], data = [none] } i++; // depends on control dependency: [while], data = [none] } return true; } }
public class class_name { @Pure @Override public FunctionalPoint3D getClosestPointTo(Point3D p) { Vector3f v = new Vector3f(p); v.sub(this.getX(), this.getY(), this.getZ()); double l = v.lengthSquared(); if (l<=(this.getRadius()*this.getRadius())) { if (p instanceof Point3f) return (Point3f)p; return new Point3f(p); } double s = this.getRadius()/Math.sqrt(l); v.scale(s); return new Point3f(this.getX() + v.getX(), this.getY() + v.getY(), this.getZ() + v.getZ()); } }
public class class_name { @Pure @Override public FunctionalPoint3D getClosestPointTo(Point3D p) { Vector3f v = new Vector3f(p); v.sub(this.getX(), this.getY(), this.getZ()); double l = v.lengthSquared(); if (l<=(this.getRadius()*this.getRadius())) { if (p instanceof Point3f) return (Point3f)p; return new Point3f(p); // depends on control dependency: [if], data = [none] } double s = this.getRadius()/Math.sqrt(l); v.scale(s); return new Point3f(this.getX() + v.getX(), this.getY() + v.getY(), this.getZ() + v.getZ()); } }
public class class_name { public static @CheckForNull @SlashedClassName String fromFieldSignature(String signature) { if (signature.charAt(0) != 'L') { return null; } return signature.substring(1, signature.length() - 1); } }
public class class_name { public static @CheckForNull @SlashedClassName String fromFieldSignature(String signature) { if (signature.charAt(0) != 'L') { return null; // depends on control dependency: [if], data = [none] } return signature.substring(1, signature.length() - 1); } }
public class class_name { protected void validateEntityReferentialConstraint(Object entity, DAOMode mode, DAOValidatorEvaluationTime validationTime) { // Obtention de la liste des annotations DAO qui sont sur la classe List<Annotation> daoAnnotations = DAOValidatorHelper.loadDAOValidatorAnnotations(entity); // Si la liste est vide if(daoAnnotations == null || daoAnnotations.size() == 0) return; // On parcours cette liste for (Annotation daoAnnotation : daoAnnotations) { // Obtention de la classe du Validateur Class<?> validatorClass = DAOValidatorHelper.getValidationLogicClass(daoAnnotation); // Le validateur IDAOValidator<Annotation> validator = null; try { // On instancie le validateur validator = (IDAOValidator<Annotation>) validatorClass.newInstance(); // Initialisation du Validateur validator.initialize(daoAnnotation, getEntityManager(), mode, validationTime); } catch (Throwable e) { // On relance l'exception throw new JPersistenceToolsException("ValidatorInstanciationException.message", e); } // Validation des contraintes d'integrites validator.processValidation(entity); } } }
public class class_name { protected void validateEntityReferentialConstraint(Object entity, DAOMode mode, DAOValidatorEvaluationTime validationTime) { // Obtention de la liste des annotations DAO qui sont sur la classe List<Annotation> daoAnnotations = DAOValidatorHelper.loadDAOValidatorAnnotations(entity); // Si la liste est vide if(daoAnnotations == null || daoAnnotations.size() == 0) return; // On parcours cette liste for (Annotation daoAnnotation : daoAnnotations) { // Obtention de la classe du Validateur Class<?> validatorClass = DAOValidatorHelper.getValidationLogicClass(daoAnnotation); // Le validateur IDAOValidator<Annotation> validator = null; try { // On instancie le validateur validator = (IDAOValidator<Annotation>) validatorClass.newInstance(); // Initialisation du Validateur validator.initialize(daoAnnotation, getEntityManager(), mode, validationTime); } catch (Throwable e) { // depends on control dependency: [for], data = [none] // On relance l'exception throw new JPersistenceToolsException("ValidatorInstanciationException.message", e); } // Validation des contraintes d'integrites validator.processValidation(entity); // depends on control dependency: [for], data = [none] } } }
public class class_name { public void sendAuditEvent(AuditEventMessage[] msgs, InetAddress destination, int port) throws Exception { if (!EventUtils.isEmptyOrNull(msgs)) { // Check to validate port int portToUse = getTransportPort(port); DatagramSocket socket = new DatagramSocket(); for (int i=0; i<msgs.length; i++) { byte[] msgBytes = getTransportPayload(msgs[i]); send(msgBytes, socket, destination, portToUse); } socket.close(); } } }
public class class_name { public void sendAuditEvent(AuditEventMessage[] msgs, InetAddress destination, int port) throws Exception { if (!EventUtils.isEmptyOrNull(msgs)) { // Check to validate port int portToUse = getTransportPort(port); DatagramSocket socket = new DatagramSocket(); for (int i=0; i<msgs.length; i++) { byte[] msgBytes = getTransportPayload(msgs[i]); send(msgBytes, socket, destination, portToUse); // depends on control dependency: [for], data = [none] } socket.close(); } } }
public class class_name { private void layoutComponents(int[] x, int[] y) { Rectangle cellBounds = new Rectangle(); for (Object element : constraintMap.entrySet()) { Map.Entry entry = (Map.Entry) element; Component component = (Component) entry.getKey(); CellConstraints constraints = (CellConstraints) entry.getValue(); int gridX = constraints.gridX - 1; int gridY = constraints.gridY - 1; int gridWidth = constraints.gridWidth; int gridHeight = constraints.gridHeight; cellBounds.x = x[gridX]; cellBounds.y = y[gridY]; cellBounds.width = x[gridX + gridWidth] - cellBounds.x; cellBounds.height = y[gridY + gridHeight] - cellBounds.y; constraints.setBounds(component, this, cellBounds, minimumWidthMeasure, minimumHeightMeasure, preferredWidthMeasure, preferredHeightMeasure); } } }
public class class_name { private void layoutComponents(int[] x, int[] y) { Rectangle cellBounds = new Rectangle(); for (Object element : constraintMap.entrySet()) { Map.Entry entry = (Map.Entry) element; Component component = (Component) entry.getKey(); CellConstraints constraints = (CellConstraints) entry.getValue(); int gridX = constraints.gridX - 1; int gridY = constraints.gridY - 1; int gridWidth = constraints.gridWidth; int gridHeight = constraints.gridHeight; cellBounds.x = x[gridX]; // depends on control dependency: [for], data = [none] cellBounds.y = y[gridY]; // depends on control dependency: [for], data = [none] cellBounds.width = x[gridX + gridWidth] - cellBounds.x; // depends on control dependency: [for], data = [none] cellBounds.height = y[gridY + gridHeight] - cellBounds.y; // depends on control dependency: [for], data = [none] constraints.setBounds(component, this, cellBounds, minimumWidthMeasure, minimumHeightMeasure, preferredWidthMeasure, preferredHeightMeasure); // depends on control dependency: [for], data = [none] } } }
public class class_name { public static int getXPathLocation(String dom, String xpath) { String dom_lower = dom.toLowerCase(); String xpath_lower = xpath.toLowerCase(); String[] elements = xpath_lower.split("/"); int pos = 0; int temp; int number; for (String element : elements) { if (!element.isEmpty() && !element.startsWith("@") && !element.contains("()")) { if (element.contains("[")) { try { number = Integer.parseInt(element.substring(element.indexOf("[") + 1, element.indexOf("]"))); } catch (NumberFormatException e) { return -1; } } else { number = 1; } for (int i = 0; i < number; i++) { // find new open element temp = dom_lower.indexOf("<" + stripEndSquareBrackets(element), pos); if (temp > -1) { pos = temp + 1; // if depth>1 then goto end of current element if (number > 1 && i < number - 1) { pos = getCloseElementLocation(dom_lower, pos, stripEndSquareBrackets(element)); } } } } } return pos - 1; } }
public class class_name { public static int getXPathLocation(String dom, String xpath) { String dom_lower = dom.toLowerCase(); String xpath_lower = xpath.toLowerCase(); String[] elements = xpath_lower.split("/"); int pos = 0; int temp; int number; for (String element : elements) { if (!element.isEmpty() && !element.startsWith("@") && !element.contains("()")) { if (element.contains("[")) { try { number = Integer.parseInt(element.substring(element.indexOf("[") + 1, element.indexOf("]"))); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { return -1; } // depends on control dependency: [catch], data = [none] } else { number = 1; // depends on control dependency: [if], data = [none] } for (int i = 0; i < number; i++) { // find new open element temp = dom_lower.indexOf("<" + stripEndSquareBrackets(element), pos); // depends on control dependency: [for], data = [none] if (temp > -1) { pos = temp + 1; // depends on control dependency: [if], data = [none] // if depth>1 then goto end of current element if (number > 1 && i < number - 1) { pos = getCloseElementLocation(dom_lower, pos, stripEndSquareBrackets(element)); // depends on control dependency: [if], data = [none] } } } } } return pos - 1; } }
public class class_name { protected void doSetSpaceProperties(String spaceId, Map<String, String> spaceProperties) { log.debug("setSpaceProperties(" + spaceId + ")"); // Will throw if bucket does not exist String bucketName = getBucketName(spaceId); Map<String, String> originalProperties; try { originalProperties = getAllSpaceProperties(spaceId); } catch (NotFoundException e) { // Likely adding a new space, so no existing properties yet. originalProperties = new HashMap<>(); } // Set creation date String creationDate = originalProperties.get(PROPERTIES_SPACE_CREATED); if (creationDate == null) { creationDate = spaceProperties.get(PROPERTIES_SPACE_CREATED); if (creationDate == null) { creationDate = getBucketCreationDate(bucketName); } } spaceProperties.put(PROPERTIES_SPACE_CREATED, creationDate); // Handle @ symbol (change to +), to allow for email usernames in ACLs spaceProperties = replaceInMapValues(spaceProperties, "@", "+"); // Store properties BucketTaggingConfiguration tagConfig = new BucketTaggingConfiguration() .withTagSets(new TagSet(spaceProperties)); s3Client.setBucketTaggingConfiguration(bucketName, tagConfig); } }
public class class_name { protected void doSetSpaceProperties(String spaceId, Map<String, String> spaceProperties) { log.debug("setSpaceProperties(" + spaceId + ")"); // Will throw if bucket does not exist String bucketName = getBucketName(spaceId); Map<String, String> originalProperties; try { originalProperties = getAllSpaceProperties(spaceId); } catch (NotFoundException e) { // Likely adding a new space, so no existing properties yet. originalProperties = new HashMap<>(); } // Set creation date String creationDate = originalProperties.get(PROPERTIES_SPACE_CREATED); if (creationDate == null) { creationDate = spaceProperties.get(PROPERTIES_SPACE_CREATED); if (creationDate == null) { creationDate = getBucketCreationDate(bucketName); // depends on control dependency: [if], data = [none] } } spaceProperties.put(PROPERTIES_SPACE_CREATED, creationDate); // Handle @ symbol (change to +), to allow for email usernames in ACLs spaceProperties = replaceInMapValues(spaceProperties, "@", "+"); // Store properties BucketTaggingConfiguration tagConfig = new BucketTaggingConfiguration() .withTagSets(new TagSet(spaceProperties)); s3Client.setBucketTaggingConfiguration(bucketName, tagConfig); } }
public class class_name { boolean resolve( final MethodWriter owner, final int position, final byte[] data) { boolean needUpdate = false; this.status |= RESOLVED; this.position = position; int i = 0; while (i < referenceCount) { int source = srcAndRefPositions[i++]; int reference = srcAndRefPositions[i++]; int offset; if (source >= 0) { offset = position - source; if (offset < Short.MIN_VALUE || offset > Short.MAX_VALUE) { /* * changes the opcode of the jump instruction, in order to * be able to find it later (see resizeInstructions in * MethodWriter). These temporary opcodes are similar to * jump instruction opcodes, except that the 2 bytes offset * is unsigned (and can therefore represent values from 0 to * 65535, which is sufficient since the size of a method is * limited to 65535 bytes). */ int opcode = data[reference - 1] & 0xFF; if (opcode <= Opcodes.JSR) { // changes IFEQ ... JSR to opcodes 202 to 217 data[reference - 1] = (byte) (opcode + 49); } else { // changes IFNULL and IFNONNULL to opcodes 218 and 219 data[reference - 1] = (byte) (opcode + 20); } needUpdate = true; } data[reference++] = (byte) (offset >>> 8); data[reference] = (byte) offset; } else { offset = position + source + 1; data[reference++] = (byte) (offset >>> 24); data[reference++] = (byte) (offset >>> 16); data[reference++] = (byte) (offset >>> 8); data[reference] = (byte) offset; } } return needUpdate; } }
public class class_name { boolean resolve( final MethodWriter owner, final int position, final byte[] data) { boolean needUpdate = false; this.status |= RESOLVED; this.position = position; int i = 0; while (i < referenceCount) { int source = srcAndRefPositions[i++]; int reference = srcAndRefPositions[i++]; int offset; if (source >= 0) { offset = position - source; // depends on control dependency: [if], data = [none] if (offset < Short.MIN_VALUE || offset > Short.MAX_VALUE) { /* * changes the opcode of the jump instruction, in order to * be able to find it later (see resizeInstructions in * MethodWriter). These temporary opcodes are similar to * jump instruction opcodes, except that the 2 bytes offset * is unsigned (and can therefore represent values from 0 to * 65535, which is sufficient since the size of a method is * limited to 65535 bytes). */ int opcode = data[reference - 1] & 0xFF; if (opcode <= Opcodes.JSR) { // changes IFEQ ... JSR to opcodes 202 to 217 data[reference - 1] = (byte) (opcode + 49); // depends on control dependency: [if], data = [(opcode] } else { // changes IFNULL and IFNONNULL to opcodes 218 and 219 data[reference - 1] = (byte) (opcode + 20); // depends on control dependency: [if], data = [(opcode] } needUpdate = true; // depends on control dependency: [if], data = [none] } data[reference++] = (byte) (offset >>> 8); // depends on control dependency: [if], data = [none] data[reference] = (byte) offset; // depends on control dependency: [if], data = [none] } else { offset = position + source + 1; // depends on control dependency: [if], data = [none] data[reference++] = (byte) (offset >>> 24); // depends on control dependency: [if], data = [none] data[reference++] = (byte) (offset >>> 16); // depends on control dependency: [if], data = [none] data[reference++] = (byte) (offset >>> 8); // depends on control dependency: [if], data = [none] data[reference] = (byte) offset; // depends on control dependency: [if], data = [none] } } return needUpdate; } }
public class class_name { public final <T extends IInvoice, L extends IInvoiceLine<T>> void mkLnFinal( final L pLine, final BigDecimal pTotTxs, final BigDecimal pTotTxsFc, final Boolean pIsTxByUser) { if (pIsTxByUser) { if (pLine.getItsOwner().getForeignCurrency() == null) { if (pLine.getTotalTaxes().compareTo(pTotTxs) != 0) { if (pLine.getDescription() == null) { pLine.setDescription(pLine.getTotalTaxes().toString() + "!=" + pTotTxs + "!"); } else { pLine.setDescription(pLine.getDescription() + " " + pLine .getTotalTaxes().toString() + "!=" + pTotTxs + "!"); } } } else { pLine.setTotalTaxes(pTotTxs); if (pLine.getForeignTotalTaxes().compareTo(pTotTxsFc) != 0) { if (pLine.getDescription() == null) { pLine.setDescription(pLine.getForeignTotalTaxes().toString() + "!=" + pTotTxsFc + "!"); } else { pLine.setDescription(pLine.getDescription() + " " + pLine .getForeignTotalTaxes().toString() + "!=" + pTotTxsFc + "!"); } } } } else { pLine.setTotalTaxes(pTotTxs); pLine.setForeignTotalTaxes(pTotTxsFc); } } }
public class class_name { public final <T extends IInvoice, L extends IInvoiceLine<T>> void mkLnFinal( final L pLine, final BigDecimal pTotTxs, final BigDecimal pTotTxsFc, final Boolean pIsTxByUser) { if (pIsTxByUser) { if (pLine.getItsOwner().getForeignCurrency() == null) { if (pLine.getTotalTaxes().compareTo(pTotTxs) != 0) { if (pLine.getDescription() == null) { pLine.setDescription(pLine.getTotalTaxes().toString() + "!=" + pTotTxs + "!"); // depends on control dependency: [if], data = [none] } else { pLine.setDescription(pLine.getDescription() + " " + pLine .getTotalTaxes().toString() + "!=" + pTotTxs + "!"); // depends on control dependency: [if], data = [(pLine.getDescription()] } } } else { pLine.setTotalTaxes(pTotTxs); // depends on control dependency: [if], data = [none] if (pLine.getForeignTotalTaxes().compareTo(pTotTxsFc) != 0) { if (pLine.getDescription() == null) { pLine.setDescription(pLine.getForeignTotalTaxes().toString() + "!=" + pTotTxsFc + "!"); // depends on control dependency: [if], data = [none] } else { pLine.setDescription(pLine.getDescription() + " " + pLine .getForeignTotalTaxes().toString() + "!=" + pTotTxsFc + "!"); // depends on control dependency: [if], data = [(pLine.getDescription()] } } } } else { pLine.setTotalTaxes(pTotTxs); // depends on control dependency: [if], data = [none] pLine.setForeignTotalTaxes(pTotTxsFc); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Filter get(FilterPredicate filterPredicate, UnboundRecordFilter unboundRecordFilter) { checkArgument(filterPredicate == null || unboundRecordFilter == null, "Cannot provide both a FilterPredicate and an UnboundRecordFilter"); if (filterPredicate != null) { return get(filterPredicate); } if (unboundRecordFilter != null) { return get(unboundRecordFilter); } return NOOP; } }
public class class_name { public static Filter get(FilterPredicate filterPredicate, UnboundRecordFilter unboundRecordFilter) { checkArgument(filterPredicate == null || unboundRecordFilter == null, "Cannot provide both a FilterPredicate and an UnboundRecordFilter"); if (filterPredicate != null) { return get(filterPredicate); // depends on control dependency: [if], data = [(filterPredicate] } if (unboundRecordFilter != null) { return get(unboundRecordFilter); // depends on control dependency: [if], data = [(unboundRecordFilter] } return NOOP; } }
public class class_name { protected <G extends T> G parseElements(Type targetType, String value, Type elementType) { String cleanedValue = cleanValue(value); try { // Set up a StreamTokenizer on the characters in this String StreamTokenizer st = createStreamTokenizer(cleanedValue); // Split comma-delimited tokens into a List T collection = newCollection(targetType); while (true) { int ttype = st.nextToken(); if (ttype == StreamTokenizer.TT_WORD || ttype > 0) { if (st.sval != null) { Object objValue = st.sval; if (elementType != null && elementType != String.class) { objValue = this.converterManager.convert(elementType, objValue); } collection.add(objValue); } } else if (ttype == StreamTokenizer.TT_EOF) { break; } else { throw new ConversionException("Encountered token of type " + ttype + " parsing elements."); } } // Return the completed list return (G) collection; } catch (IOException e) { throw new ConversionException("Error converting from String: " + e.getMessage(), e); } } }
public class class_name { protected <G extends T> G parseElements(Type targetType, String value, Type elementType) { String cleanedValue = cleanValue(value); try { // Set up a StreamTokenizer on the characters in this String StreamTokenizer st = createStreamTokenizer(cleanedValue); // Split comma-delimited tokens into a List T collection = newCollection(targetType); while (true) { int ttype = st.nextToken(); if (ttype == StreamTokenizer.TT_WORD || ttype > 0) { if (st.sval != null) { Object objValue = st.sval; if (elementType != null && elementType != String.class) { objValue = this.converterManager.convert(elementType, objValue); // depends on control dependency: [if], data = [(elementType] } collection.add(objValue); // depends on control dependency: [if], data = [none] } } else if (ttype == StreamTokenizer.TT_EOF) { break; } else { throw new ConversionException("Encountered token of type " + ttype + " parsing elements."); } } // Return the completed list return (G) collection; // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new ConversionException("Error converting from String: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private HttpPut preparePut(final String url) { final HttpPut httpPut = new HttpPut(this.instanceUrl + url); for (final Header header : this.headers) { httpPut.addHeader(header); } return httpPut; } }
public class class_name { private HttpPut preparePut(final String url) { final HttpPut httpPut = new HttpPut(this.instanceUrl + url); for (final Header header : this.headers) { httpPut.addHeader(header); // depends on control dependency: [for], data = [header] } return httpPut; } }
public class class_name { public T next(T ignoreReplicaSet) { if (entry == null) return null; entry = entry.next; if (entry.element.equals(ignoreReplicaSet)) { return entry.next.element; } else { return entry.element; } } }
public class class_name { public T next(T ignoreReplicaSet) { if (entry == null) return null; entry = entry.next; if (entry.element.equals(ignoreReplicaSet)) { return entry.next.element; // depends on control dependency: [if], data = [none] } else { return entry.element; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void removeTextSearchParameter(String key) { try { ParamType type = ParamType.valueOf(key); switch (type) { case language: m_searchObject.setLocale(getStartLocale()); break; case text: m_searchObject.setQuery(null); break; case expired: m_searchObject.setIncludeExpired(false); break; case creation: m_searchObject.setDateCreatedEnd(-1L); m_searchObject.setDateCreatedStart(-1L); break; case modification: m_searchObject.setDateModifiedEnd(-1L); m_searchObject.setDateModifiedStart(-1L); break; default: } m_handler.onRemoveSearchParam(type); updateResultsTab(false); ValueChangeEvent.fire(this, m_searchObject); } catch (IllegalArgumentException e) { // should not happen } } }
public class class_name { public void removeTextSearchParameter(String key) { try { ParamType type = ParamType.valueOf(key); switch (type) { case language: m_searchObject.setLocale(getStartLocale()); break; case text: m_searchObject.setQuery(null); break; case expired: m_searchObject.setIncludeExpired(false); break; case creation: m_searchObject.setDateCreatedEnd(-1L); m_searchObject.setDateCreatedStart(-1L); break; case modification: m_searchObject.setDateModifiedEnd(-1L); m_searchObject.setDateModifiedStart(-1L); break; default: } m_handler.onRemoveSearchParam(type); // depends on control dependency: [try], data = [none] updateResultsTab(false); // depends on control dependency: [try], data = [none] ValueChangeEvent.fire(this, m_searchObject); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException e) { // should not happen } // depends on control dependency: [catch], data = [none] } }
public class class_name { @SuppressWarnings("unchecked") public static ParamExtractor makeParamExtractor(HttpServletRequest req, Object refer) { if (refer != null && Map.class.isAssignableFrom(refer.getClass())) { return new MapParamExtractor(req, (Map<String, Object>) refer); } return new BaseParamExtractor(req); } }
public class class_name { @SuppressWarnings("unchecked") public static ParamExtractor makeParamExtractor(HttpServletRequest req, Object refer) { if (refer != null && Map.class.isAssignableFrom(refer.getClass())) { return new MapParamExtractor(req, (Map<String, Object>) refer); // depends on control dependency: [if], data = [none] } return new BaseParamExtractor(req); } }
public class class_name { public void convert(EntrySet entrySet, OutputStream outputStream, boolean forceInteractionToComplex) { // check args if (entrySet == null || outputStream == null) { throw new IllegalArgumentException("convert: one or more null arguments."); } if (entrySet.getLevel() != 2) { throw new IllegalArgumentException("convert: only PSI-MI Level 2.5 is supported."); } //create a new empty BioPAX Model final Model model = BioPAXLevel.L3.getDefaultFactory().createModel(); model.setXmlBase(xmlBase); // convert all psimi entries EntryMapper entryMapper = new EntryMapper(model, forceInteractionToComplex); for (Entry entry : entrySet.getEntries()) { entryMapper.run(entry); } //try to release some RAM earlier entrySet.getEntries().clear(); entrySet = null; // write BioPAX RDF/XML (new SimpleIOHandler()).convertToOWL(model, outputStream); } }
public class class_name { public void convert(EntrySet entrySet, OutputStream outputStream, boolean forceInteractionToComplex) { // check args if (entrySet == null || outputStream == null) { throw new IllegalArgumentException("convert: one or more null arguments."); } if (entrySet.getLevel() != 2) { throw new IllegalArgumentException("convert: only PSI-MI Level 2.5 is supported."); } //create a new empty BioPAX Model final Model model = BioPAXLevel.L3.getDefaultFactory().createModel(); model.setXmlBase(xmlBase); // convert all psimi entries EntryMapper entryMapper = new EntryMapper(model, forceInteractionToComplex); for (Entry entry : entrySet.getEntries()) { entryMapper.run(entry); // depends on control dependency: [for], data = [entry] } //try to release some RAM earlier entrySet.getEntries().clear(); entrySet = null; // write BioPAX RDF/XML (new SimpleIOHandler()).convertToOWL(model, outputStream); } }
public class class_name { public void setMitigations(java.util.Collection<Mitigation> mitigations) { if (mitigations == null) { this.mitigations = null; return; } this.mitigations = new java.util.ArrayList<Mitigation>(mitigations); } }
public class class_name { public void setMitigations(java.util.Collection<Mitigation> mitigations) { if (mitigations == null) { this.mitigations = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.mitigations = new java.util.ArrayList<Mitigation>(mitigations); } }
public class class_name { public static GenderEnumeration findByValue(final String value) { if (value == null) { return null; } final String gender = value.toUpperCase(); if (gender.charAt(0) == 'M') { return GenderEnumeration.MALE; } else if (gender.charAt(0) == 'F') { return GenderEnumeration.FEMALE; } else { return null; } } }
public class class_name { public static GenderEnumeration findByValue(final String value) { if (value == null) { return null; // depends on control dependency: [if], data = [none] } final String gender = value.toUpperCase(); if (gender.charAt(0) == 'M') { return GenderEnumeration.MALE; // depends on control dependency: [if], data = [none] } else if (gender.charAt(0) == 'F') { return GenderEnumeration.FEMALE; // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public ReshardingConfiguration withPreferredAvailabilityZones(String... preferredAvailabilityZones) { if (this.preferredAvailabilityZones == null) { setPreferredAvailabilityZones(new com.amazonaws.internal.SdkInternalList<String>(preferredAvailabilityZones.length)); } for (String ele : preferredAvailabilityZones) { this.preferredAvailabilityZones.add(ele); } return this; } }
public class class_name { public ReshardingConfiguration withPreferredAvailabilityZones(String... preferredAvailabilityZones) { if (this.preferredAvailabilityZones == null) { setPreferredAvailabilityZones(new com.amazonaws.internal.SdkInternalList<String>(preferredAvailabilityZones.length)); // depends on control dependency: [if], data = [none] } for (String ele : preferredAvailabilityZones) { this.preferredAvailabilityZones.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private static void initFactory() { if (jsonFactory == null) { try { // We use reflection because the server side should not // depend on gwt-servlet nor gwt-dev. Hence if GWT is not // in our classpath means that we are in server side, otherwise // we use GWT to figure out if we are running devmode. // This is run once, so no performance issues to worry about. Class.forName("com.google.gwt.core.shared.GWTBridge"); Class<?> gwt = Class.forName("com.google.gwt.core.shared.GWT"); Method method = gwt.getMethod("isClient"); Object ret = method.invoke(null); if (ret instanceof Boolean && ((Boolean) ret)) { // We are running DevMode, so create Js versions of the factories method = gwt.getMethod("create", Class.class); ret = method.invoke(null, new Object[] {JsonFactory.class}); jsonFactory = (JsonFactory) ret; ajaxTransport = new AjaxTransportJs(); return; } } catch (ClassNotFoundException ignore) { } catch (NoSuchMethodException ignore) { } catch (SecurityException ignore) { } catch (IllegalAccessException ignore) { } catch (IllegalArgumentException ignore) { } catch (InvocationTargetException ignore) { } // We are running in the JVM, so create Jre versions. jsonFactory = new JsonFactoryJre(); ajaxTransport = new AjaxTransportJre(); } } }
public class class_name { private static void initFactory() { if (jsonFactory == null) { try { // We use reflection because the server side should not // depend on gwt-servlet nor gwt-dev. Hence if GWT is not // in our classpath means that we are in server side, otherwise // we use GWT to figure out if we are running devmode. // This is run once, so no performance issues to worry about. Class.forName("com.google.gwt.core.shared.GWTBridge"); Class<?> gwt = Class.forName("com.google.gwt.core.shared.GWT"); Method method = gwt.getMethod("isClient"); Object ret = method.invoke(null); // depends on control dependency: [try], data = [none] if (ret instanceof Boolean && ((Boolean) ret)) { // We are running DevMode, so create Js versions of the factories method = gwt.getMethod("create", Class.class); // depends on control dependency: [if], data = [none] ret = method.invoke(null, new Object[] {JsonFactory.class}); // depends on control dependency: [if], data = [none] jsonFactory = (JsonFactory) ret; // depends on control dependency: [if], data = [none] ajaxTransport = new AjaxTransportJs(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } catch (ClassNotFoundException ignore) { } catch (NoSuchMethodException ignore) { // depends on control dependency: [catch], data = [none] } catch (SecurityException ignore) { // depends on control dependency: [catch], data = [none] } catch (IllegalAccessException ignore) { // depends on control dependency: [catch], data = [none] } catch (IllegalArgumentException ignore) { // depends on control dependency: [catch], data = [none] } catch (InvocationTargetException ignore) { // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] // We are running in the JVM, so create Jre versions. jsonFactory = new JsonFactoryJre(); // depends on control dependency: [if], data = [none] ajaxTransport = new AjaxTransportJre(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public AppliedTerminology withTerms(Term... terms) { if (this.terms == null) { setTerms(new java.util.ArrayList<Term>(terms.length)); } for (Term ele : terms) { this.terms.add(ele); } return this; } }
public class class_name { public AppliedTerminology withTerms(Term... terms) { if (this.terms == null) { setTerms(new java.util.ArrayList<Term>(terms.length)); // depends on control dependency: [if], data = [none] } for (Term ele : terms) { this.terms.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public String unescapeJava(final Object target) { if (target == null) { return null; } return StringUtils.unescapeJava(target); } }
public class class_name { public String unescapeJava(final Object target) { if (target == null) { return null; // depends on control dependency: [if], data = [none] } return StringUtils.unescapeJava(target); } }
public class class_name { public String[] getDictionaryClass(String identifier) { Entry[] dictEntries = dict.getEntries(); String specRef = getSpecRef(identifier); if (specRef == null) { logger.error("Cannot determine specification for id: ", identifier); return new String[0]; } List<String> dictClasses = new ArrayList<String>(); for (Entry dictEntry : dictEntries) { if (!dictEntry.getClassName().equals("Descriptor")) continue; if (dictEntry.getID().equals(specRef.toLowerCase())) { Element rawElement = (Element) dictEntry.getRawContent(); Elements classifications = rawElement.getChildElements("isClassifiedAs", dict.getNS()); for (int i = 0; i < classifications.size(); i++) { Element element = classifications.get(i); Attribute attr = element.getAttribute("resource", rdfNS); if ((attr.getValue().indexOf("molecularDescriptor") >= 0) || (attr.getValue().indexOf("atomicDescriptor") >= 0)) { continue; } String[] tmp = attr.getValue().split("#"); dictClasses.add(tmp[1]); } } } if (dictClasses.size() == 0) return null; else return (String[]) dictClasses.toArray(new String[]{}); } }
public class class_name { public String[] getDictionaryClass(String identifier) { Entry[] dictEntries = dict.getEntries(); String specRef = getSpecRef(identifier); if (specRef == null) { logger.error("Cannot determine specification for id: ", identifier); // depends on control dependency: [if], data = [none] return new String[0]; // depends on control dependency: [if], data = [none] } List<String> dictClasses = new ArrayList<String>(); for (Entry dictEntry : dictEntries) { if (!dictEntry.getClassName().equals("Descriptor")) continue; if (dictEntry.getID().equals(specRef.toLowerCase())) { Element rawElement = (Element) dictEntry.getRawContent(); Elements classifications = rawElement.getChildElements("isClassifiedAs", dict.getNS()); for (int i = 0; i < classifications.size(); i++) { Element element = classifications.get(i); Attribute attr = element.getAttribute("resource", rdfNS); if ((attr.getValue().indexOf("molecularDescriptor") >= 0) || (attr.getValue().indexOf("atomicDescriptor") >= 0)) { continue; } String[] tmp = attr.getValue().split("#"); dictClasses.add(tmp[1]); // depends on control dependency: [for], data = [none] } } } if (dictClasses.size() == 0) return null; else return (String[]) dictClasses.toArray(new String[]{}); } }
public class class_name { public JSONReader withFeatures(int features) { if (_features == features) { return this; } return _with(features, _readerLocator, _treeCodec, _collectionBuilder, _mapBuilder); } }
public class class_name { public JSONReader withFeatures(int features) { if (_features == features) { return this; // depends on control dependency: [if], data = [none] } return _with(features, _readerLocator, _treeCodec, _collectionBuilder, _mapBuilder); } }
public class class_name { protected ExecutorService createDefaultExecutorService(ConcurrentAsyncExecutorProvider provider) { final int corePoolSize = 0; Integer maximumPoolSize = provider != null ? provider.provideMaxPoolSize() : null; if (maximumPoolSize == null) { maximumPoolSize = 10; } final long keepAliveTime = 60L; final TimeUnit seconds = TimeUnit.SECONDS; final BlockingQueue<Runnable> workQueue = createDefaultBlockingQueue(); final RejectedExecutionHandler rejected = createRejectedExecutionHandler(); return new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, seconds, workQueue, rejected); } }
public class class_name { protected ExecutorService createDefaultExecutorService(ConcurrentAsyncExecutorProvider provider) { final int corePoolSize = 0; Integer maximumPoolSize = provider != null ? provider.provideMaxPoolSize() : null; if (maximumPoolSize == null) { maximumPoolSize = 10; // depends on control dependency: [if], data = [none] } final long keepAliveTime = 60L; final TimeUnit seconds = TimeUnit.SECONDS; final BlockingQueue<Runnable> workQueue = createDefaultBlockingQueue(); final RejectedExecutionHandler rejected = createRejectedExecutionHandler(); return new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, seconds, workQueue, rejected); } }
public class class_name { public static double trigamma(double x) { if(!(x > 0)) { return Double.NaN; } // Method of equation 5: if(x <= 1e-5) { return 1. / (x * x); } // Method of equation 4: else if(x > 49.) { final double ix2 = 1. / (x * x); // Partial series expansion return 1 / x - ix2 / 2. + ix2 / x * (1.0 / 6. - ix2 * (1.0 / 30. + ix2 / 42.)); // + O(x^8) error } else { // Stirling expansion return trigamma(x + 1.) - 1. / (x * x); } } }
public class class_name { public static double trigamma(double x) { if(!(x > 0)) { return Double.NaN; // depends on control dependency: [if], data = [none] } // Method of equation 5: if(x <= 1e-5) { return 1. / (x * x); // depends on control dependency: [if], data = [(x] } // Method of equation 4: else if(x > 49.) { final double ix2 = 1. / (x * x); // Partial series expansion return 1 / x - ix2 / 2. + ix2 / x * (1.0 / 6. - ix2 * (1.0 / 30. + ix2 / 42.)); // depends on control dependency: [if], data = [none] // + O(x^8) error } else { // Stirling expansion return trigamma(x + 1.) - 1. / (x * x); // depends on control dependency: [if], data = [(x] } } }
public class class_name { private ParseTree parseMultiplicativeExpression() { SourcePosition start = getTreeStartLocation(); ParseTree left = parseExponentiationExpression(); while (peekMultiplicativeOperator()) { Token operator = nextToken(); ParseTree right = parseExponentiationExpression(); left = new BinaryOperatorTree(getTreeLocation(start), left, operator, right); } return left; } }
public class class_name { private ParseTree parseMultiplicativeExpression() { SourcePosition start = getTreeStartLocation(); ParseTree left = parseExponentiationExpression(); while (peekMultiplicativeOperator()) { Token operator = nextToken(); ParseTree right = parseExponentiationExpression(); left = new BinaryOperatorTree(getTreeLocation(start), left, operator, right); // depends on control dependency: [while], data = [none] } return left; } }
public class class_name { @SuppressWarnings({ "unchecked", "rawtypes" }) protected AbstractAuditLogger getAuditLoggerInstance(RuntimeEngine engine) { DeploymentDescriptor descriptor = getRuntimeManager().getDeploymentDescriptor(); AbstractAuditLogger auditLogger = null; if ("true".equals(System.getProperty("jbpm.audit.jms.enabled")) || descriptor.getAuditMode() == AuditMode.JMS) { try { Properties properties = new Properties(); properties.load(getRuntimeManager().getEnvironment().getClassLoader().getResourceAsStream("/jbpm.audit.jms.properties")); auditLogger = AuditLoggerFactory.newJMSInstance((Map)properties); } catch (IOException e) { logger.error("Unable to load jms audit properties from {}", "/jbpm.audit.jms.properties", e); } auditLogger.setBuilder(getAuditBuilder(engine)); } else if (descriptor.getAuditMode() == AuditMode.JPA){ if (descriptor.getPersistenceUnit().equals(descriptor.getAuditPersistenceUnit())) { auditLogger = AuditLoggerFactory.newJPAInstance(engine.getKieSession().getEnvironment()); } else { auditLogger = new JPAWorkingMemoryDbLogger(EntityManagerFactoryManager.get().getOrCreate(descriptor.getAuditPersistenceUnit())); } auditLogger.setBuilder(getAuditBuilder(engine)); } return auditLogger; } }
public class class_name { @SuppressWarnings({ "unchecked", "rawtypes" }) protected AbstractAuditLogger getAuditLoggerInstance(RuntimeEngine engine) { DeploymentDescriptor descriptor = getRuntimeManager().getDeploymentDescriptor(); AbstractAuditLogger auditLogger = null; if ("true".equals(System.getProperty("jbpm.audit.jms.enabled")) || descriptor.getAuditMode() == AuditMode.JMS) { try { Properties properties = new Properties(); properties.load(getRuntimeManager().getEnvironment().getClassLoader().getResourceAsStream("/jbpm.audit.jms.properties")); auditLogger = AuditLoggerFactory.newJMSInstance((Map)properties); // depends on control dependency: [try], data = [none] } catch (IOException e) { logger.error("Unable to load jms audit properties from {}", "/jbpm.audit.jms.properties", e); } // depends on control dependency: [catch], data = [none] auditLogger.setBuilder(getAuditBuilder(engine)); // depends on control dependency: [if], data = [none] } else if (descriptor.getAuditMode() == AuditMode.JPA){ if (descriptor.getPersistenceUnit().equals(descriptor.getAuditPersistenceUnit())) { auditLogger = AuditLoggerFactory.newJPAInstance(engine.getKieSession().getEnvironment()); // depends on control dependency: [if], data = [none] } else { auditLogger = new JPAWorkingMemoryDbLogger(EntityManagerFactoryManager.get().getOrCreate(descriptor.getAuditPersistenceUnit())); // depends on control dependency: [if], data = [none] } auditLogger.setBuilder(getAuditBuilder(engine)); // depends on control dependency: [if], data = [none] } return auditLogger; } }
public class class_name { public final String getDirectoryName(final String property) { String directory = properties.get(property); if (directory == null || directory.isEmpty()){ return null; } if (IS_WINDOWS) { // Windows swings both ways. If a forward slash was already used, we'll // add one at the end if missing. Otherwise use the windows default of \ if (directory.charAt(directory.length() - 1) == '\\' || directory.charAt(directory.length() - 1) == '/') { return directory; } if (directory.contains("/")) { return directory + "/"; } return directory + "\\"; } if (directory.contains("\\")) { throw new IllegalArgumentException( "Unix path names cannot contain a back slash"); } if (directory == null || directory.isEmpty()){ return null; } if (directory.charAt(directory.length() - 1) == '/') { return directory; } return directory + "/"; } }
public class class_name { public final String getDirectoryName(final String property) { String directory = properties.get(property); if (directory == null || directory.isEmpty()){ return null; // depends on control dependency: [if], data = [none] } if (IS_WINDOWS) { // Windows swings both ways. If a forward slash was already used, we'll // add one at the end if missing. Otherwise use the windows default of \ if (directory.charAt(directory.length() - 1) == '\\' || directory.charAt(directory.length() - 1) == '/') { return directory; // depends on control dependency: [if], data = [none] } if (directory.contains("/")) { return directory + "/"; // depends on control dependency: [if], data = [none] } return directory + "\\"; // depends on control dependency: [if], data = [none] } if (directory.contains("\\")) { throw new IllegalArgumentException( "Unix path names cannot contain a back slash"); } if (directory == null || directory.isEmpty()){ return null; // depends on control dependency: [if], data = [none] } if (directory.charAt(directory.length() - 1) == '/') { return directory; // depends on control dependency: [if], data = [none] } return directory + "/"; } }
public class class_name { public static MediaTable create(String tableName, String idColumnName, List<UserCustomColumn> additionalColumns) { List<UserCustomColumn> columns = new ArrayList<>(); columns.addAll(createRequiredColumns(idColumnName)); if (additionalColumns != null) { columns.addAll(additionalColumns); } return new MediaTable(tableName, columns, idColumnName); } }
public class class_name { public static MediaTable create(String tableName, String idColumnName, List<UserCustomColumn> additionalColumns) { List<UserCustomColumn> columns = new ArrayList<>(); columns.addAll(createRequiredColumns(idColumnName)); if (additionalColumns != null) { columns.addAll(additionalColumns); // depends on control dependency: [if], data = [(additionalColumns] } return new MediaTable(tableName, columns, idColumnName); } }
public class class_name { static boolean overlapPolyPoly2D(float[] polya, int npolya, float[] polyb, int npolyb) { for (int i = 0, j = npolya - 1; i < npolya; j = i++) { int va = j * 3; int vb = i * 3; float[] n = new float[] { polya[vb + 2] - polya[va + 2], 0, -(polya[vb + 0] - polya[va + 0]) }; float[] aminmax = projectPoly(n, polya, npolya); float[] bminmax = projectPoly(n, polyb, npolyb); if (!overlapRange(aminmax[0], aminmax[1], bminmax[0], bminmax[1], eps)) { // Found separating axis return false; } } for (int i = 0, j = npolyb - 1; i < npolyb; j = i++) { int va = j * 3; int vb = i * 3; float[] n = new float[] { polyb[vb + 2] - polyb[va + 2], 0, -(polyb[vb + 0] - polyb[va + 0]) }; float[] aminmax = projectPoly(n, polya, npolya); float[] bminmax = projectPoly(n, polyb, npolyb); if (!overlapRange(aminmax[0], aminmax[1], bminmax[0], bminmax[1], eps)) { // Found separating axis return false; } } return true; } }
public class class_name { static boolean overlapPolyPoly2D(float[] polya, int npolya, float[] polyb, int npolyb) { for (int i = 0, j = npolya - 1; i < npolya; j = i++) { int va = j * 3; int vb = i * 3; float[] n = new float[] { polya[vb + 2] - polya[va + 2], 0, -(polya[vb + 0] - polya[va + 0]) }; float[] aminmax = projectPoly(n, polya, npolya); float[] bminmax = projectPoly(n, polyb, npolyb); if (!overlapRange(aminmax[0], aminmax[1], bminmax[0], bminmax[1], eps)) { // Found separating axis return false; // depends on control dependency: [if], data = [none] } } for (int i = 0, j = npolyb - 1; i < npolyb; j = i++) { int va = j * 3; int vb = i * 3; float[] n = new float[] { polyb[vb + 2] - polyb[va + 2], 0, -(polyb[vb + 0] - polyb[va + 0]) }; float[] aminmax = projectPoly(n, polya, npolya); float[] bminmax = projectPoly(n, polyb, npolyb); if (!overlapRange(aminmax[0], aminmax[1], bminmax[0], bminmax[1], eps)) { // Found separating axis return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { public boolean hasComponent(int blockId) { for (int i = 0; i < length; i++) { if (blockIdList[i] == blockId) { return true; } } return false; } }
public class class_name { public boolean hasComponent(int blockId) { for (int i = 0; i < length; i++) { if (blockIdList[i] == blockId) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { @Private @Override public void aggregationThrewException(final List<Integer> taskletIds, final Exception exception) { try { failedTasklets(exception, taskletIds); } catch (final InterruptedException e) { throw new RuntimeException(e); } } }
public class class_name { @Private @Override public void aggregationThrewException(final List<Integer> taskletIds, final Exception exception) { try { failedTasklets(exception, taskletIds); // depends on control dependency: [try], data = [exception] } catch (final InterruptedException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static Map<String, Object> createContext( final StenoEncoder encoder, final ILoggingEvent event, final ObjectMapper objectMapper, @Nullable final List<String> contextKeys, @Nullable final List<Object> contextValues) { final Map<String, Object> context = new LinkedHashMap<>(); if (encoder.isInjectContextHost()) { context.put("host", StenoSerializationHelper.HOST_CONVERTER.convert(event)); } if (encoder.isInjectContextProcess()) { context.put("processId", StenoSerializationHelper.PROCESS_CONVERTER.convert(event)); } if (encoder.isInjectContextThread()) { context.put("threadId", StenoSerializationHelper.THREAD_CONVERTER.convert(event)); } if (encoder.isInjectContextLogger()) { if (encoder.isCompressLoggerName()) { context.put("logger", StenoSerializationHelper.CONDENSED_LOGGER_CONVERTER.convert(event)); } else { context.put("logger", StenoSerializationHelper.LOGGER_CONVERTER.convert(event)); } } if (encoder.isInjectContextFile()) { context.put("file", StenoSerializationHelper.FILE_CONVERTER.convert(event)); } if (encoder.isInjectContextClass()) { context.put("class", StenoSerializationHelper.CLASS_CONVERTER.convert(event)); } if (encoder.isInjectContextMethod()) { context.put("method", StenoSerializationHelper.METHOD_CONVERTER.convert(event)); } if (encoder.isInjectContextLine()) { context.put("line", StenoSerializationHelper.LINE_CONVERTER.convert(event)); } final Iterator<String> injectContextMdcIterator = encoder.iteratorForInjectContextMdc(); while (injectContextMdcIterator.hasNext()) { final String key = injectContextMdcIterator.next(); final String value = event.getMDCPropertyMap().get(key); context.put(key, value); } if (contextKeys != null) { final int contextValuesLength = contextValues == null ? 0 : contextValues.size(); for (int i = 0; i < contextKeys.size(); ++i) { final String key = contextKeys.get(i); final Object value = i < contextValuesLength ? contextValues.get(i) : null; context.put(key, value); } } return context; } }
public class class_name { public static Map<String, Object> createContext( final StenoEncoder encoder, final ILoggingEvent event, final ObjectMapper objectMapper, @Nullable final List<String> contextKeys, @Nullable final List<Object> contextValues) { final Map<String, Object> context = new LinkedHashMap<>(); if (encoder.isInjectContextHost()) { context.put("host", StenoSerializationHelper.HOST_CONVERTER.convert(event)); // depends on control dependency: [if], data = [none] } if (encoder.isInjectContextProcess()) { context.put("processId", StenoSerializationHelper.PROCESS_CONVERTER.convert(event)); // depends on control dependency: [if], data = [none] } if (encoder.isInjectContextThread()) { context.put("threadId", StenoSerializationHelper.THREAD_CONVERTER.convert(event)); // depends on control dependency: [if], data = [none] } if (encoder.isInjectContextLogger()) { if (encoder.isCompressLoggerName()) { context.put("logger", StenoSerializationHelper.CONDENSED_LOGGER_CONVERTER.convert(event)); // depends on control dependency: [if], data = [none] } else { context.put("logger", StenoSerializationHelper.LOGGER_CONVERTER.convert(event)); // depends on control dependency: [if], data = [none] } } if (encoder.isInjectContextFile()) { context.put("file", StenoSerializationHelper.FILE_CONVERTER.convert(event)); // depends on control dependency: [if], data = [none] } if (encoder.isInjectContextClass()) { context.put("class", StenoSerializationHelper.CLASS_CONVERTER.convert(event)); // depends on control dependency: [if], data = [none] } if (encoder.isInjectContextMethod()) { context.put("method", StenoSerializationHelper.METHOD_CONVERTER.convert(event)); // depends on control dependency: [if], data = [none] } if (encoder.isInjectContextLine()) { context.put("line", StenoSerializationHelper.LINE_CONVERTER.convert(event)); // depends on control dependency: [if], data = [none] } final Iterator<String> injectContextMdcIterator = encoder.iteratorForInjectContextMdc(); while (injectContextMdcIterator.hasNext()) { final String key = injectContextMdcIterator.next(); final String value = event.getMDCPropertyMap().get(key); context.put(key, value); // depends on control dependency: [while], data = [none] } if (contextKeys != null) { final int contextValuesLength = contextValues == null ? 0 : contextValues.size(); for (int i = 0; i < contextKeys.size(); ++i) { final String key = contextKeys.get(i); final Object value = i < contextValuesLength ? contextValues.get(i) : null; context.put(key, value); // depends on control dependency: [for], data = [none] } } return context; } }
public class class_name { public List<JCCompilationUnit> enterTrees(List<JCCompilationUnit> roots) { //enter symbols for all files if (!taskListener.isEmpty()) { for (JCCompilationUnit unit: roots) { TaskEvent e = new TaskEvent(TaskEvent.Kind.ENTER, unit); taskListener.started(e); } } enter.main(roots); if (!taskListener.isEmpty()) { for (JCCompilationUnit unit: roots) { TaskEvent e = new TaskEvent(TaskEvent.Kind.ENTER, unit); taskListener.finished(e); } } // If generating source, or if tracking public apis, // then remember the classes declared in // the original compilation units listed on the command line. if (needRootClasses || sourceOutput || stubOutput) { ListBuffer<JCClassDecl> cdefs = new ListBuffer<>(); for (JCCompilationUnit unit : roots) { for (List<JCTree> defs = unit.defs; defs.nonEmpty(); defs = defs.tail) { if (defs.head instanceof JCClassDecl) cdefs.append((JCClassDecl)defs.head); } } rootClasses = cdefs.toList(); } // Ensure the input files have been recorded. Although this is normally // done by readSource, it may not have been done if the trees were read // in a prior round of annotation processing, and the trees have been // cleaned and are being reused. for (JCCompilationUnit unit : roots) { inputFiles.add(unit.sourcefile); } return roots; } }
public class class_name { public List<JCCompilationUnit> enterTrees(List<JCCompilationUnit> roots) { //enter symbols for all files if (!taskListener.isEmpty()) { for (JCCompilationUnit unit: roots) { TaskEvent e = new TaskEvent(TaskEvent.Kind.ENTER, unit); taskListener.started(e); // depends on control dependency: [for], data = [none] } } enter.main(roots); if (!taskListener.isEmpty()) { for (JCCompilationUnit unit: roots) { TaskEvent e = new TaskEvent(TaskEvent.Kind.ENTER, unit); taskListener.finished(e); // depends on control dependency: [for], data = [none] } } // If generating source, or if tracking public apis, // then remember the classes declared in // the original compilation units listed on the command line. if (needRootClasses || sourceOutput || stubOutput) { ListBuffer<JCClassDecl> cdefs = new ListBuffer<>(); for (JCCompilationUnit unit : roots) { for (List<JCTree> defs = unit.defs; defs.nonEmpty(); defs = defs.tail) { if (defs.head instanceof JCClassDecl) cdefs.append((JCClassDecl)defs.head); } } rootClasses = cdefs.toList(); // depends on control dependency: [if], data = [none] } // Ensure the input files have been recorded. Although this is normally // done by readSource, it may not have been done if the trees were read // in a prior round of annotation processing, and the trees have been // cleaned and are being reused. for (JCCompilationUnit unit : roots) { inputFiles.add(unit.sourcefile); // depends on control dependency: [for], data = [unit] } return roots; } }
public class class_name { private String createUri(String uri) { try { return FileUtil.URI_SEPARATOR_CHAR + FilenameUtils.getPath(uri) + URLEncoder.encode(FilenameUtils.getBaseName(uri), StandardCharsets.UTF_8.name()) + config.getOutputExtension(); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Missing UTF-8 encoding??", e); // Won't happen unless JDK is broken. } } }
public class class_name { private String createUri(String uri) { try { return FileUtil.URI_SEPARATOR_CHAR + FilenameUtils.getPath(uri) + URLEncoder.encode(FilenameUtils.getBaseName(uri), StandardCharsets.UTF_8.name()) + config.getOutputExtension(); // depends on control dependency: [try], data = [none] } catch (UnsupportedEncodingException e) { throw new RuntimeException("Missing UTF-8 encoding??", e); // Won't happen unless JDK is broken. } // depends on control dependency: [catch], data = [none] } }
public class class_name { Symbol findIdentInType(Env<AttrContext> env, Type site, Name name, int kind) { Symbol bestSoFar = typeNotFound; Symbol sym; if ((kind & VAR) != 0) { sym = findField(env, site, name, site.tsym); if (sym.exists()) return sym; else if (sym.kind < bestSoFar.kind) bestSoFar = sym; } if ((kind & TYP) != 0) { sym = findMemberType(env, site, name, site.tsym); if (sym.exists()) return sym; else if (sym.kind < bestSoFar.kind) bestSoFar = sym; } return bestSoFar; } }
public class class_name { Symbol findIdentInType(Env<AttrContext> env, Type site, Name name, int kind) { Symbol bestSoFar = typeNotFound; Symbol sym; if ((kind & VAR) != 0) { sym = findField(env, site, name, site.tsym); // depends on control dependency: [if], data = [none] if (sym.exists()) return sym; else if (sym.kind < bestSoFar.kind) bestSoFar = sym; } if ((kind & TYP) != 0) { sym = findMemberType(env, site, name, site.tsym); // depends on control dependency: [if], data = [none] if (sym.exists()) return sym; else if (sym.kind < bestSoFar.kind) bestSoFar = sym; } return bestSoFar; } }
public class class_name { @Override public boolean verify(@Sensitive char[] password, String hashedPassword) { String[] items = parseData(hashedPassword); byte[] originalHash = Base64Coder.base64DecodeString(items[3]); if (tc.isDebugEnabled()) { Tr.debug(tc, "original Hash length : " + (originalHash != null?originalHash.length:"null")); } if (originalHash == null) { String message = Tr.formatMessage(tc, "JAVAEESEC_CDI_ERROR_PASSWORDHASH_INVALID_DATA", Tr.formatMessage(tc, "JAVAEESEC_CDI_INVALID_HASH_VALUE")); Tr.error(tc, message); throw new IllegalArgumentException(message); } byte[] salt = Base64Coder.base64DecodeString(items[2]); if (tc.isDebugEnabled()) { Tr.debug(tc, "original Salt length : " + (salt != null?salt.length:"null")); } if (salt == null) { String message = Tr.formatMessage(tc, "JAVAEESEC_CDI_ERROR_PASSWORDHASH_INVALID_DATA", Tr.formatMessage(tc, "JAVAEESEC_CDI_INVALID_SALT_VALUE")); Tr.error(tc, message); throw new IllegalArgumentException(message); } byte[] calculatedHash = generate(items[0], Integer.parseInt(items[1]), originalHash.length, salt, password); return Arrays.equals(originalHash, calculatedHash); } }
public class class_name { @Override public boolean verify(@Sensitive char[] password, String hashedPassword) { String[] items = parseData(hashedPassword); byte[] originalHash = Base64Coder.base64DecodeString(items[3]); if (tc.isDebugEnabled()) { Tr.debug(tc, "original Hash length : " + (originalHash != null?originalHash.length:"null")); // depends on control dependency: [if], data = [none] } if (originalHash == null) { String message = Tr.formatMessage(tc, "JAVAEESEC_CDI_ERROR_PASSWORDHASH_INVALID_DATA", Tr.formatMessage(tc, "JAVAEESEC_CDI_INVALID_HASH_VALUE")); Tr.error(tc, message); // depends on control dependency: [if], data = [none] throw new IllegalArgumentException(message); } byte[] salt = Base64Coder.base64DecodeString(items[2]); if (tc.isDebugEnabled()) { Tr.debug(tc, "original Salt length : " + (salt != null?salt.length:"null")); // depends on control dependency: [if], data = [none] } if (salt == null) { String message = Tr.formatMessage(tc, "JAVAEESEC_CDI_ERROR_PASSWORDHASH_INVALID_DATA", Tr.formatMessage(tc, "JAVAEESEC_CDI_INVALID_SALT_VALUE")); Tr.error(tc, message); // depends on control dependency: [if], data = [none] throw new IllegalArgumentException(message); } byte[] calculatedHash = generate(items[0], Integer.parseInt(items[1]), originalHash.length, salt, password); return Arrays.equals(originalHash, calculatedHash); } }
public class class_name { private void createPropertyGetterSetter(ClassNode classNode, PropertyNode originalProp) { Expression initExp = originalProp.getInitialExpression(); originalProp.getField().setInitialValueExpression(null); PropertyNode fxProperty = createFXProperty(originalProp); List<AnnotationNode> methodAnnotations = new ArrayList<>(); List<AnnotationNode> fieldAnnotations = new ArrayList<>(); for (AnnotationNode annotation : originalProp.getField().getAnnotations()) { if (FXBINDABLE_CNODE.equals(annotation.getClassNode())) continue; Class annotationClass = annotation.getClassNode().getTypeClass(); Target target = (Target) annotationClass.getAnnotation(Target.class); if (isTargetAllowed(target, ElementType.METHOD)) { methodAnnotations.add(annotation); } else if (isTargetAllowed(target, ElementType.FIELD)) { fieldAnnotations.add(annotation); } } String getterName = "get" + MetaClassHelper.capitalize(originalProp.getName()); if (classNode.getMethods(getterName).isEmpty()) { Statement getterBlock = createGetterStatement(createFXProperty(originalProp)); createGetterMethod(classNode, originalProp, getterName, getterBlock, methodAnnotations); methodAnnotations = null; } else { wrapGetterMethod(classNode, originalProp.getName(), methodAnnotations); methodAnnotations = null; } String setterName = "set" + MetaClassHelper.capitalize(originalProp.getName()); if (classNode.getMethods(setterName).isEmpty()) { Statement setterBlock = createSetterStatement(createFXProperty(originalProp)); createSetterMethod(classNode, originalProp, setterName, setterBlock, methodAnnotations); } else { wrapSetterMethod(classNode, originalProp.getName(), methodAnnotations); } // We want the actual name of the field to be different from the getter (Prop vs Property) so // that the getter takes precedence when we say this.somethingProperty. FieldNode fxFieldShortName = createFieldNodeCopy(originalProp.getName() + "Prop", null, fxProperty.getField()); createPropertyAccessor(classNode, createFXProperty(originalProp), fxFieldShortName, initExp); classNode.removeField(originalProp.getName()); classNode.addField(fxFieldShortName); fxFieldShortName.addAnnotations(fieldAnnotations); } }
public class class_name { private void createPropertyGetterSetter(ClassNode classNode, PropertyNode originalProp) { Expression initExp = originalProp.getInitialExpression(); originalProp.getField().setInitialValueExpression(null); PropertyNode fxProperty = createFXProperty(originalProp); List<AnnotationNode> methodAnnotations = new ArrayList<>(); List<AnnotationNode> fieldAnnotations = new ArrayList<>(); for (AnnotationNode annotation : originalProp.getField().getAnnotations()) { if (FXBINDABLE_CNODE.equals(annotation.getClassNode())) continue; Class annotationClass = annotation.getClassNode().getTypeClass(); Target target = (Target) annotationClass.getAnnotation(Target.class); if (isTargetAllowed(target, ElementType.METHOD)) { methodAnnotations.add(annotation); // depends on control dependency: [if], data = [none] } else if (isTargetAllowed(target, ElementType.FIELD)) { fieldAnnotations.add(annotation); // depends on control dependency: [if], data = [none] } } String getterName = "get" + MetaClassHelper.capitalize(originalProp.getName()); if (classNode.getMethods(getterName).isEmpty()) { Statement getterBlock = createGetterStatement(createFXProperty(originalProp)); createGetterMethod(classNode, originalProp, getterName, getterBlock, methodAnnotations); // depends on control dependency: [if], data = [none] methodAnnotations = null; // depends on control dependency: [if], data = [none] } else { wrapGetterMethod(classNode, originalProp.getName(), methodAnnotations); // depends on control dependency: [if], data = [none] methodAnnotations = null; // depends on control dependency: [if], data = [none] } String setterName = "set" + MetaClassHelper.capitalize(originalProp.getName()); if (classNode.getMethods(setterName).isEmpty()) { Statement setterBlock = createSetterStatement(createFXProperty(originalProp)); createSetterMethod(classNode, originalProp, setterName, setterBlock, methodAnnotations); // depends on control dependency: [if], data = [none] } else { wrapSetterMethod(classNode, originalProp.getName(), methodAnnotations); // depends on control dependency: [if], data = [none] } // We want the actual name of the field to be different from the getter (Prop vs Property) so // that the getter takes precedence when we say this.somethingProperty. FieldNode fxFieldShortName = createFieldNodeCopy(originalProp.getName() + "Prop", null, fxProperty.getField()); createPropertyAccessor(classNode, createFXProperty(originalProp), fxFieldShortName, initExp); classNode.removeField(originalProp.getName()); classNode.addField(fxFieldShortName); fxFieldShortName.addAnnotations(fieldAnnotations); } }
public class class_name { private void writeXmi(CAS aCas, File name, String modelFileName) throws IOException, SAXException { FileOutputStream out = null; try { // write XMI out = new FileOutputStream(name); XmiCasSerializer ser = new XmiCasSerializer(aCas.getTypeSystem()); XMLSerializer xmlSer = new XMLSerializer(out, false); ser.serialize(aCas, xmlSer.getContentHandler()); } finally { if (out != null) { out.close(); } } } }
public class class_name { private void writeXmi(CAS aCas, File name, String modelFileName) throws IOException, SAXException { FileOutputStream out = null; try { // write XMI out = new FileOutputStream(name); XmiCasSerializer ser = new XmiCasSerializer(aCas.getTypeSystem()); XMLSerializer xmlSer = new XMLSerializer(out, false); ser.serialize(aCas, xmlSer.getContentHandler()); } finally { if (out != null) { out.close(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public Observable<ServiceResponse<List<Export>>> getExportsWithServiceResponseAsync(UUID projectId, UUID iterationId) { if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (iterationId == null) { throw new IllegalArgumentException("Parameter iterationId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } return service.getExports(projectId, iterationId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<Export>>>>() { @Override public Observable<ServiceResponse<List<Export>>> call(Response<ResponseBody> response) { try { ServiceResponse<List<Export>> clientResponse = getExportsDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<List<Export>>> getExportsWithServiceResponseAsync(UUID projectId, UUID iterationId) { if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (iterationId == null) { throw new IllegalArgumentException("Parameter iterationId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } return service.getExports(projectId, iterationId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<Export>>>>() { @Override public Observable<ServiceResponse<List<Export>>> call(Response<ResponseBody> response) { try { ServiceResponse<List<Export>> clientResponse = getExportsDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { public final String toFFDCString(Object[] objects) { StringBuffer buffer = new StringBuffer(); buffer.append('{'); if (objects == null) { buffer.append("<null>"); } else { for (int i = 0; i < objects.length; i++) { Object value = objects[i]; buffer.append((value == objects ? "<this array>" : toFFDCStringSingleObject(value)) + lineSeparator); if (i > multiple_object_count_to_ffdc) { buffer.append("........contd"); break; } } } buffer.append('}'); return buffer.toString(); } }
public class class_name { public final String toFFDCString(Object[] objects) { StringBuffer buffer = new StringBuffer(); buffer.append('{'); if (objects == null) { buffer.append("<null>"); // depends on control dependency: [if], data = [none] } else { for (int i = 0; i < objects.length; i++) { Object value = objects[i]; buffer.append((value == objects ? "<this array>" : toFFDCStringSingleObject(value)) + lineSeparator); // depends on control dependency: [for], data = [none] if (i > multiple_object_count_to_ffdc) { buffer.append("........contd"); // depends on control dependency: [if], data = [none] break; } } } buffer.append('}'); return buffer.toString(); } }
public class class_name { @Override public boolean containsAll(final Collection collection) { for (Object object : collection) { if (!contains(object)) { return false; } } return true; } }
public class class_name { @Override public boolean containsAll(final Collection collection) { for (Object object : collection) { if (!contains(object)) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { private void addSupertypeEdges(ClassVertex vertex, LinkedList<XClass> workList) { XClass xclass = vertex.getXClass(); // Direct superclass ClassDescriptor superclassDescriptor = xclass.getSuperclassDescriptor(); if (superclassDescriptor != null) { addInheritanceEdge(vertex, superclassDescriptor, false, workList); } // Directly implemented interfaces for (ClassDescriptor ifaceDesc : xclass.getInterfaceDescriptorList()) { addInheritanceEdge(vertex, ifaceDesc, true, workList); } } }
public class class_name { private void addSupertypeEdges(ClassVertex vertex, LinkedList<XClass> workList) { XClass xclass = vertex.getXClass(); // Direct superclass ClassDescriptor superclassDescriptor = xclass.getSuperclassDescriptor(); if (superclassDescriptor != null) { addInheritanceEdge(vertex, superclassDescriptor, false, workList); // depends on control dependency: [if], data = [none] } // Directly implemented interfaces for (ClassDescriptor ifaceDesc : xclass.getInterfaceDescriptorList()) { addInheritanceEdge(vertex, ifaceDesc, true, workList); // depends on control dependency: [for], data = [ifaceDesc] } } }
public class class_name { public void send(final BitSet bitSet, int length) { if (transmitterPin != null) { for (int nRepeat = 0; nRepeat < repeatTransmit; nRepeat++) { for (int i = 0; i < length; i++) { if (bitSet.get(i)) { transmit(protocol.getOneBit()); } else { transmit(protocol.getZeroBit()); } } sendSync(); } transmitterPin.low(); } } }
public class class_name { public void send(final BitSet bitSet, int length) { if (transmitterPin != null) { for (int nRepeat = 0; nRepeat < repeatTransmit; nRepeat++) { for (int i = 0; i < length; i++) { if (bitSet.get(i)) { transmit(protocol.getOneBit()); // depends on control dependency: [if], data = [none] } else { transmit(protocol.getZeroBit()); // depends on control dependency: [if], data = [none] } } sendSync(); // depends on control dependency: [for], data = [none] } transmitterPin.low(); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected Content getNavSummaryLink(TypeElement typeElement, boolean link) { if (link) { return writer.getHyperLink( SectionName.ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY, contents.navAnnotationTypeOptionalMember); } else { return contents.navAnnotationTypeOptionalMember; } } }
public class class_name { protected Content getNavSummaryLink(TypeElement typeElement, boolean link) { if (link) { return writer.getHyperLink( SectionName.ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY, contents.navAnnotationTypeOptionalMember); // depends on control dependency: [if], data = [none] } else { return contents.navAnnotationTypeOptionalMember; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public Iterator<T> iterator() { return new Iterator<T>() { private int index; @Override public boolean hasNext() { return index < size; } @Override public T next() { if (index < size) { return elementData[index++]; } throw new NoSuchElementException("No more elements in FastList"); } }; } }
public class class_name { @Override public Iterator<T> iterator() { return new Iterator<T>() { private int index; @Override public boolean hasNext() { return index < size; } @Override public T next() { if (index < size) { return elementData[index++]; // depends on control dependency: [if], data = [none] } throw new NoSuchElementException("No more elements in FastList"); } }; } }
public class class_name { public ORDER compare(OQueryOperator other) { final Class<?> thisClass = this.getClass(); final Class<?> otherClass = other.getClass(); int thisPosition = -1; int otherPosition = -1; for (int i = 0; i < DEFAULT_OPERATORS_ORDER.length; i++) { // subclass of default operators inherit their parent ordering final Class<?> clazz = DEFAULT_OPERATORS_ORDER[i]; if (clazz.isAssignableFrom(thisClass)) { thisPosition = i; } if (clazz.isAssignableFrom(otherClass)) { otherPosition = i; } } if (thisPosition == -1 || otherPosition == -1) { // can not decide which comes first return ORDER.UNKNOWNED; } if (thisPosition > otherPosition) { return ORDER.AFTER; } else if (thisPosition < otherPosition) { return ORDER.BEFORE; } return ORDER.EQUAL; } }
public class class_name { public ORDER compare(OQueryOperator other) { final Class<?> thisClass = this.getClass(); final Class<?> otherClass = other.getClass(); int thisPosition = -1; int otherPosition = -1; for (int i = 0; i < DEFAULT_OPERATORS_ORDER.length; i++) { // subclass of default operators inherit their parent ordering final Class<?> clazz = DEFAULT_OPERATORS_ORDER[i]; if (clazz.isAssignableFrom(thisClass)) { thisPosition = i; // depends on control dependency: [if], data = [none] } if (clazz.isAssignableFrom(otherClass)) { otherPosition = i; // depends on control dependency: [if], data = [none] } } if (thisPosition == -1 || otherPosition == -1) { // can not decide which comes first return ORDER.UNKNOWNED; // depends on control dependency: [if], data = [none] } if (thisPosition > otherPosition) { return ORDER.AFTER; // depends on control dependency: [if], data = [none] } else if (thisPosition < otherPosition) { return ORDER.BEFORE; // depends on control dependency: [if], data = [none] } return ORDER.EQUAL; } }
public class class_name { public Long getFirstLongValue(String name) { Object objs[] = getValues(name); for (Object obj : objs) { if (obj instanceof Long) { return (Long) obj; } } return null; } }
public class class_name { public Long getFirstLongValue(String name) { Object objs[] = getValues(name); for (Object obj : objs) { if (obj instanceof Long) { return (Long) obj; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { @Override @SuppressWarnings("unchecked") public void renew(Map<String, String> credentials, Map topologyConf) { try { Credentials credential = getCredentials(credentials); if (credential != null) { Configuration configuration = new Configuration(); Collection<Token<? extends TokenIdentifier>> tokens = credential.getAllTokens(); if(tokens != null && tokens.isEmpty() == false) { for (Token token : tokens) { //We need to re-login some other thread might have logged into hadoop using // their credentials (e.g. AutoHBase might be also part of nimbu auto creds) login(configuration); long expiration = (Long) token.renew(configuration); LOG.info("HDFS delegation token renewed, new expiration time {}", expiration); } } else { LOG.debug("No tokens found for credentials, skipping renewal."); } } } catch (Exception e) { LOG.warn("could not renew the credentials, one of the possible reason is tokens are beyond " + "renewal period so attempting to get new tokens.", e); populateCredentials(credentials, topologyConf); } } }
public class class_name { @Override @SuppressWarnings("unchecked") public void renew(Map<String, String> credentials, Map topologyConf) { try { Credentials credential = getCredentials(credentials); if (credential != null) { Configuration configuration = new Configuration(); Collection<Token<? extends TokenIdentifier>> tokens = credential.getAllTokens(); // depends on control dependency: [if], data = [none] if(tokens != null && tokens.isEmpty() == false) { for (Token token : tokens) { //We need to re-login some other thread might have logged into hadoop using // their credentials (e.g. AutoHBase might be also part of nimbu auto creds) login(configuration); // depends on control dependency: [for], data = [none] long expiration = (Long) token.renew(configuration); LOG.info("HDFS delegation token renewed, new expiration time {}", expiration); // depends on control dependency: [for], data = [token] } } else { LOG.debug("No tokens found for credentials, skipping renewal."); // depends on control dependency: [if], data = [none] } } } catch (Exception e) { LOG.warn("could not renew the credentials, one of the possible reason is tokens are beyond " + "renewal period so attempting to get new tokens.", e); populateCredentials(credentials, topologyConf); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected void updateGui() { ButtonLayoutStyle buttonButtonLayoutStyle = buttonAction.getButtonLayoutStyle(); if (ButtonLayoutStyle.ICON_TITLE_AND_DESCRIPTION.equals(buttonButtonLayoutStyle)) { buildGuiWithDescription(); } else { // LayoutParameter.Layout.ICON_AND_TITLE || null || ... setWidth(50); if (titleAlignment.equals(TitleAlignment.BOTTOM)) { setHeight100(); outer = new VStack(); outer.setOverflow(Overflow.VISIBLE); outer.setWidth(GuwLayout.ribbonButtonWidth); outer.setAutoHeight(); outer.addMember(icon); if (showTitles && !GuwLayout.hideRibbonTitles) { titleLabel.setBaseStyle(getBaseStyle() + "LargeTitle"); titleLabel.setAutoHeight(); titleLabel.setWidth(GuwLayout.ribbonButtonWidth); outer.addMember(titleLabel); } outer.setAlign(Alignment.CENTER); } else { setAutoHeight(); outer = new HStack(GuwLayout.ribbonButtonInnerMargin); outer.setOverflow(Overflow.VISIBLE); outer.setWidth100(); outer.setAutoHeight(); outer.addMember(icon); if (showTitles) { titleLabel.setBaseStyle(getBaseStyle() + "SmallTitle"); titleLabel.setAutoHeight(); titleLabel.setAutoWidth(); outer.addMember(titleLabel); } } } } }
public class class_name { protected void updateGui() { ButtonLayoutStyle buttonButtonLayoutStyle = buttonAction.getButtonLayoutStyle(); if (ButtonLayoutStyle.ICON_TITLE_AND_DESCRIPTION.equals(buttonButtonLayoutStyle)) { buildGuiWithDescription(); // depends on control dependency: [if], data = [none] } else { // LayoutParameter.Layout.ICON_AND_TITLE || null || ... setWidth(50); // depends on control dependency: [if], data = [none] if (titleAlignment.equals(TitleAlignment.BOTTOM)) { setHeight100(); // depends on control dependency: [if], data = [none] outer = new VStack(); // depends on control dependency: [if], data = [none] outer.setOverflow(Overflow.VISIBLE); // depends on control dependency: [if], data = [none] outer.setWidth(GuwLayout.ribbonButtonWidth); // depends on control dependency: [if], data = [none] outer.setAutoHeight(); // depends on control dependency: [if], data = [none] outer.addMember(icon); // depends on control dependency: [if], data = [none] if (showTitles && !GuwLayout.hideRibbonTitles) { titleLabel.setBaseStyle(getBaseStyle() + "LargeTitle"); // depends on control dependency: [if], data = [none] titleLabel.setAutoHeight(); // depends on control dependency: [if], data = [none] titleLabel.setWidth(GuwLayout.ribbonButtonWidth); // depends on control dependency: [if], data = [none] outer.addMember(titleLabel); // depends on control dependency: [if], data = [none] } outer.setAlign(Alignment.CENTER); // depends on control dependency: [if], data = [none] } else { setAutoHeight(); // depends on control dependency: [if], data = [none] outer = new HStack(GuwLayout.ribbonButtonInnerMargin); // depends on control dependency: [if], data = [none] outer.setOverflow(Overflow.VISIBLE); // depends on control dependency: [if], data = [none] outer.setWidth100(); // depends on control dependency: [if], data = [none] outer.setAutoHeight(); // depends on control dependency: [if], data = [none] outer.addMember(icon); // depends on control dependency: [if], data = [none] if (showTitles) { titleLabel.setBaseStyle(getBaseStyle() + "SmallTitle"); // depends on control dependency: [if], data = [none] titleLabel.setAutoHeight(); // depends on control dependency: [if], data = [none] titleLabel.setAutoWidth(); // depends on control dependency: [if], data = [none] outer.addMember(titleLabel); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { private void undeployInstances(List<InstanceContext> instances, final CountingCompletionHandler<Void> counter) { for (final InstanceContext instance : instances) { if (instance.component().isModule()) { undeployModule(instance, counter); } else if (instance.component().isVerticle()) { undeployVerticle(instance, counter); } } } }
public class class_name { private void undeployInstances(List<InstanceContext> instances, final CountingCompletionHandler<Void> counter) { for (final InstanceContext instance : instances) { if (instance.component().isModule()) { undeployModule(instance, counter); // depends on control dependency: [if], data = [none] } else if (instance.component().isVerticle()) { undeployVerticle(instance, counter); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public void saveOrUpdate() { if (checkBox.getValue() && dsCombo.getValue() != null) { final ActionType autoAssignActionType = ((ActionTypeOption) actionTypeOptionGroupLayout .getActionTypeOptionGroup().getValue()).getActionType(); updateTargetFilterQueryDS(tfqId, (Long) dsCombo.getValue(), autoAssignActionType); } else if (!checkBox.getValue()) { updateTargetFilterQueryDS(tfqId, null, null); } } }
public class class_name { @Override public void saveOrUpdate() { if (checkBox.getValue() && dsCombo.getValue() != null) { final ActionType autoAssignActionType = ((ActionTypeOption) actionTypeOptionGroupLayout .getActionTypeOptionGroup().getValue()).getActionType(); updateTargetFilterQueryDS(tfqId, (Long) dsCombo.getValue(), autoAssignActionType); // depends on control dependency: [if], data = [none] } else if (!checkBox.getValue()) { updateTargetFilterQueryDS(tfqId, null, null); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String getResourceAsString(final String resourcePath) { File resource = getFileForResource(resourcePath); if (!resource.exists() || resource.isDirectory()) { logger.error("Cannot read resource, does not exist" + " (or is a directory)."); return ""; } try { return FileUtils.readFileToString(resource); } catch (IOException ioe) { logger.error(ioe.getMessage()); return ""; } } }
public class class_name { public static String getResourceAsString(final String resourcePath) { File resource = getFileForResource(resourcePath); if (!resource.exists() || resource.isDirectory()) { logger.error("Cannot read resource, does not exist" + " (or is a directory)."); // depends on control dependency: [if], data = [none] return ""; // depends on control dependency: [if], data = [none] } try { return FileUtils.readFileToString(resource); // depends on control dependency: [try], data = [none] } catch (IOException ioe) { logger.error(ioe.getMessage()); return ""; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void addSinkTasks() { Runnable sinkTasks = new Runnable() { @Override public void run() { while (!metricsInSinkQueue.isEmpty()) { metricsSink.processRecord(metricsInSinkQueue.poll()); } } }; slaveLooper.addTasksOnWakeup(sinkTasks); } }
public class class_name { private void addSinkTasks() { Runnable sinkTasks = new Runnable() { @Override public void run() { while (!metricsInSinkQueue.isEmpty()) { metricsSink.processRecord(metricsInSinkQueue.poll()); // depends on control dependency: [while], data = [none] } } }; slaveLooper.addTasksOnWakeup(sinkTasks); } }
public class class_name { public static byte schemaToColumnType(Schema s) { Schema.Type typ = s.getType(); switch (typ) { case BOOLEAN: case INT: case LONG: case FLOAT: case DOUBLE: return Vec.T_NUM; case ENUM: return Vec.T_CAT; case STRING: return Vec.T_STR; case NULL: return Vec.T_BAD; case BYTES: return Vec.T_STR; case UNION: // Flattenize the union List<Schema> unionSchemas = s.getTypes(); if (unionSchemas.size() == 1) { return schemaToColumnType(unionSchemas.get(0)); } else if (unionSchemas.size() == 2) { Schema s1 = unionSchemas.get(0); Schema s2 = unionSchemas.get(1); if (s1.getType().equals(Schema.Type.NULL)) return schemaToColumnType(s2); else if (s2.getType().equals(Schema.Type.NULL)) return schemaToColumnType(s1); } default: throw new IllegalArgumentException("Unsupported Avro schema type: " + s); } } }
public class class_name { public static byte schemaToColumnType(Schema s) { Schema.Type typ = s.getType(); switch (typ) { case BOOLEAN: case INT: case LONG: case FLOAT: case DOUBLE: return Vec.T_NUM; case ENUM: return Vec.T_CAT; case STRING: return Vec.T_STR; case NULL: return Vec.T_BAD; case BYTES: return Vec.T_STR; case UNION: // Flattenize the union List<Schema> unionSchemas = s.getTypes(); if (unionSchemas.size() == 1) { return schemaToColumnType(unionSchemas.get(0)); // depends on control dependency: [if], data = [none] } else if (unionSchemas.size() == 2) { Schema s1 = unionSchemas.get(0); Schema s2 = unionSchemas.get(1); if (s1.getType().equals(Schema.Type.NULL)) return schemaToColumnType(s2); else if (s2.getType().equals(Schema.Type.NULL)) return schemaToColumnType(s1); } default: throw new IllegalArgumentException("Unsupported Avro schema type: " + s); } } }
public class class_name { private static String getHostIPAddressFromString(String propIPAddress, String niName) { String hostIPAddr = propIPAddress; if (propIPAddress.equals("")) { // If the listenerIPAddress is blank, then try to get the ip address of // the interface try { NetworkInterface ni = null; if (niName != null) ni = NetworkInterface.getByName(niName); if (ni == null) { LOGGER.info("Network Interface name not specified or incorrect. Defaulting to localhost"); hostIPAddr = InetAddress.getLocalHost().getHostAddress(); } else { if (!ni.isLoopback()) { Enumeration<InetAddress> ee = ni.getInetAddresses(); while (ee.hasMoreElements()) { InetAddress i = (InetAddress) ee.nextElement(); if (i instanceof Inet4Address) { hostIPAddr = i.getHostAddress(); break; // get the first one an get out of the loop } } } } } catch (SocketException e) { LOGGER.warn("A socket exception occurred."); } catch (UnknownHostException e) { LOGGER.warn( "Error finding Network Interface", e); } } return hostIPAddr; } }
public class class_name { private static String getHostIPAddressFromString(String propIPAddress, String niName) { String hostIPAddr = propIPAddress; if (propIPAddress.equals("")) { // If the listenerIPAddress is blank, then try to get the ip address of // the interface try { NetworkInterface ni = null; if (niName != null) ni = NetworkInterface.getByName(niName); if (ni == null) { LOGGER.info("Network Interface name not specified or incorrect. Defaulting to localhost"); // depends on control dependency: [if], data = [none] hostIPAddr = InetAddress.getLocalHost().getHostAddress(); // depends on control dependency: [if], data = [none] } else { if (!ni.isLoopback()) { Enumeration<InetAddress> ee = ni.getInetAddresses(); while (ee.hasMoreElements()) { InetAddress i = (InetAddress) ee.nextElement(); if (i instanceof Inet4Address) { hostIPAddr = i.getHostAddress(); // depends on control dependency: [if], data = [none] break; // get the first one an get out of the loop } } } } } catch (SocketException e) { LOGGER.warn("A socket exception occurred."); } catch (UnknownHostException e) { // depends on control dependency: [catch], data = [none] LOGGER.warn( "Error finding Network Interface", e); } // depends on control dependency: [catch], data = [none] } return hostIPAddr; } }
public class class_name { protected BigDecimal round(double val){ BigDecimal value = new BigDecimal(val); if(val!=0.0){ value = value.setScale(3, BigDecimal.ROUND_DOWN); } return value; } }
public class class_name { protected BigDecimal round(double val){ BigDecimal value = new BigDecimal(val); if(val!=0.0){ value = value.setScale(3, BigDecimal.ROUND_DOWN); // depends on control dependency: [if], data = [none] } return value; } }
public class class_name { public static int setValue(Document document, String xPath, String value, String nodeToInsert) { int changes = 0; // be naive and try to find the node Iterator<Node> itNodes = CmsCollectionsGenericWrapper.<Node> list(document.selectNodes(xPath)).iterator(); // if not found if (!itNodes.hasNext()) { if (value == null) { // if no node found for deletion return 0; } // find the node creating missing nodes in the way Iterator<String> it = CmsStringUtil.splitAsList(xPath, "/", false).iterator(); Node currentNode = document; while (it.hasNext()) { String nodeName = it.next(); // if a string condition contains '/' while ((nodeName.indexOf("='") > 0) && (nodeName.indexOf("']") < 0)) { nodeName += "/" + it.next(); } Node node = currentNode.selectSingleNode(nodeName); if (node != null) { // node found currentNode = node; if (!it.hasNext()) { currentNode.setText(value); } } else if (currentNode.getNodeType() == Node.ELEMENT_NODE) { Element elem = (Element)currentNode; if (!nodeName.startsWith("@")) { elem = handleNode(elem, nodeName); if (!it.hasNext() && CmsStringUtil.isNotEmptyOrWhitespaceOnly(value)) { elem.setText(value); } } else { // if node is attribute create it with given value elem.addAttribute(nodeName.substring(1), value); } currentNode = elem; } else { // should never happen if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.ERR_XML_SET_VALUE_2, xPath, value)); } break; } } if (nodeToInsert == null) { // if not inserting we are done return 1; } // if inserting, we just created the insertion point, so continue itNodes = CmsCollectionsGenericWrapper.<Node> list(document.selectNodes(xPath)).iterator(); } // if found while (itNodes.hasNext()) { Node node = itNodes.next(); if (nodeToInsert == null) { // if not inserting if (value != null) { // if found, change the value node.setText(value); } else { // if node for deletion is found node.getParent().remove(node); } } else { // first create the node to insert Element parent = node.getParent(); Element elem = handleNode(parent, nodeToInsert); if (value != null) { elem.setText(value); } // get the parent element list List<Node> list = CmsCollectionsGenericWrapper.<Node> list(parent.content()); // remove the just created element list.remove(list.size() - 1); // insert it back to the right position int pos = list.indexOf(node); list.add(pos + 1, elem); // insert after } changes++; } return changes; } }
public class class_name { public static int setValue(Document document, String xPath, String value, String nodeToInsert) { int changes = 0; // be naive and try to find the node Iterator<Node> itNodes = CmsCollectionsGenericWrapper.<Node> list(document.selectNodes(xPath)).iterator(); // if not found if (!itNodes.hasNext()) { if (value == null) { // if no node found for deletion return 0; // depends on control dependency: [if], data = [none] } // find the node creating missing nodes in the way Iterator<String> it = CmsStringUtil.splitAsList(xPath, "/", false).iterator(); Node currentNode = document; while (it.hasNext()) { String nodeName = it.next(); // if a string condition contains '/' while ((nodeName.indexOf("='") > 0) && (nodeName.indexOf("']") < 0)) { nodeName += "/" + it.next(); // depends on control dependency: [while], data = [none] } Node node = currentNode.selectSingleNode(nodeName); if (node != null) { // node found currentNode = node; // depends on control dependency: [if], data = [none] if (!it.hasNext()) { currentNode.setText(value); // depends on control dependency: [if], data = [none] } } else if (currentNode.getNodeType() == Node.ELEMENT_NODE) { Element elem = (Element)currentNode; if (!nodeName.startsWith("@")) { elem = handleNode(elem, nodeName); // depends on control dependency: [if], data = [none] if (!it.hasNext() && CmsStringUtil.isNotEmptyOrWhitespaceOnly(value)) { elem.setText(value); // depends on control dependency: [if], data = [none] } } else { // if node is attribute create it with given value elem.addAttribute(nodeName.substring(1), value); // depends on control dependency: [if], data = [none] } currentNode = elem; // depends on control dependency: [if], data = [none] } else { // should never happen if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.ERR_XML_SET_VALUE_2, xPath, value)); // depends on control dependency: [if], data = [none] } break; } } if (nodeToInsert == null) { // if not inserting we are done return 1; // depends on control dependency: [if], data = [none] } // if inserting, we just created the insertion point, so continue itNodes = CmsCollectionsGenericWrapper.<Node> list(document.selectNodes(xPath)).iterator(); // depends on control dependency: [if], data = [none] } // if found while (itNodes.hasNext()) { Node node = itNodes.next(); if (nodeToInsert == null) { // if not inserting if (value != null) { // if found, change the value node.setText(value); // depends on control dependency: [if], data = [(value] } else { // if node for deletion is found node.getParent().remove(node); // depends on control dependency: [if], data = [none] } } else { // first create the node to insert Element parent = node.getParent(); Element elem = handleNode(parent, nodeToInsert); if (value != null) { elem.setText(value); // depends on control dependency: [if], data = [(value] } // get the parent element list List<Node> list = CmsCollectionsGenericWrapper.<Node> list(parent.content()); // remove the just created element list.remove(list.size() - 1); // depends on control dependency: [if], data = [none] // insert it back to the right position int pos = list.indexOf(node); list.add(pos + 1, elem); // insert after // depends on control dependency: [if], data = [none] } changes++; // depends on control dependency: [while], data = [none] } return changes; } }
public class class_name { public java.util.List<StackResourceSummary> getStackResourceSummaries() { if (stackResourceSummaries == null) { stackResourceSummaries = new com.amazonaws.internal.SdkInternalList<StackResourceSummary>(); } return stackResourceSummaries; } }
public class class_name { public java.util.List<StackResourceSummary> getStackResourceSummaries() { if (stackResourceSummaries == null) { stackResourceSummaries = new com.amazonaws.internal.SdkInternalList<StackResourceSummary>(); // depends on control dependency: [if], data = [none] } return stackResourceSummaries; } }
public class class_name { public void addItem(int row , int col , double value ) { if( nz_length == nz_value.data.length ) { int amount = nz_length + 10; nz_value.growInternal(amount); nz_rowcol.growInternal(amount*2); } nz_value.data[nz_length] = value; nz_rowcol.data[nz_length*2] = row; nz_rowcol.data[nz_length*2+1] = col; nz_length += 1; } }
public class class_name { public void addItem(int row , int col , double value ) { if( nz_length == nz_value.data.length ) { int amount = nz_length + 10; nz_value.growInternal(amount); // depends on control dependency: [if], data = [none] nz_rowcol.growInternal(amount*2); // depends on control dependency: [if], data = [none] } nz_value.data[nz_length] = value; nz_rowcol.data[nz_length*2] = row; nz_rowcol.data[nz_length*2+1] = col; nz_length += 1; } }
public class class_name { @Override public final CacheKey getCacheKey(HttpServletRequest request, HttpServletResponse response) { final Resource stylesheetResource = this.getStylesheetResource(request); final Serializable stylesheetCacheKey; try { stylesheetCacheKey = this.xmlUtilities.getStylesheetCacheKey(stylesheetResource); } catch (TransformerConfigurationException e) { throw new RuntimeException( "Failed to get Transformer for stylesheet: " + stylesheetResource, e); } catch (IOException e) { throw new RuntimeException("Failed to load stylesheet: " + stylesheetResource, e); } return CacheKey.build(stylesheetResource.getDescription(), stylesheetCacheKey); } }
public class class_name { @Override public final CacheKey getCacheKey(HttpServletRequest request, HttpServletResponse response) { final Resource stylesheetResource = this.getStylesheetResource(request); final Serializable stylesheetCacheKey; try { stylesheetCacheKey = this.xmlUtilities.getStylesheetCacheKey(stylesheetResource); // depends on control dependency: [try], data = [none] } catch (TransformerConfigurationException e) { throw new RuntimeException( "Failed to get Transformer for stylesheet: " + stylesheetResource, e); } catch (IOException e) { // depends on control dependency: [catch], data = [none] throw new RuntimeException("Failed to load stylesheet: " + stylesheetResource, e); } // depends on control dependency: [catch], data = [none] return CacheKey.build(stylesheetResource.getDescription(), stylesheetCacheKey); } }
public class class_name { @Override public void setConsumer(IDataSetConsumer consumer) { logger.debug("setConsumer(consumer) - start"); if (this._columnSensing) { _consumer = new BufferedConsumer(consumer); } else { _consumer = consumer; } } }
public class class_name { @Override public void setConsumer(IDataSetConsumer consumer) { logger.debug("setConsumer(consumer) - start"); if (this._columnSensing) { _consumer = new BufferedConsumer(consumer); // depends on control dependency: [if], data = [none] } else { _consumer = consumer; // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void fireClusterChange(long timestamp, String type, String message) { // if we have no listeners, do nothing... if (listeners != null && !listeners.isEmpty()) { // create the event object to send ClusterEvent event = new ClusterEvent(this, timestamp, type , message); // make a copy of the listener list in case // anyone adds/removes listeners Vector targets; synchronized (this) { targets = (Vector) listeners.clone(); } // walk through the listener list and // call the sunMoved method in each Enumeration e = targets.elements(); while (e.hasMoreElements()) { ClusterEventListener l = (ClusterEventListener) e.nextElement(); l.changeCluster(event); } } } }
public class class_name { protected void fireClusterChange(long timestamp, String type, String message) { // if we have no listeners, do nothing... if (listeners != null && !listeners.isEmpty()) { // create the event object to send ClusterEvent event = new ClusterEvent(this, timestamp, type , message); // make a copy of the listener list in case // anyone adds/removes listeners Vector targets; synchronized (this) { // depends on control dependency: [if], data = [none] targets = (Vector) listeners.clone(); } // walk through the listener list and // call the sunMoved method in each Enumeration e = targets.elements(); while (e.hasMoreElements()) { ClusterEventListener l = (ClusterEventListener) e.nextElement(); l.changeCluster(event); // depends on control dependency: [while], data = [none] } } } }
public class class_name { Observable<ChatResult> synchroniseStore() { if (isSynchronising.getAndSet(true)) { log.i("Synchronisation in progress."); return Observable.fromCallable(() -> new ChatResult(true, null)); } log.i("Synchronising store."); return synchroniseConversations() .onErrorReturn(t -> new ChatResult(false, new ChatResult.Error(0, t))) .doOnNext(i -> { if (i.isSuccessful()) { log.i("Synchronisation successfully finished."); } else { log.e("Synchronisation finished with error. " + (i.getError() != null ? i.getError().getDetails() : "")); } isSynchronising.compareAndSet(true, false); }); } }
public class class_name { Observable<ChatResult> synchroniseStore() { if (isSynchronising.getAndSet(true)) { log.i("Synchronisation in progress."); // depends on control dependency: [if], data = [none] return Observable.fromCallable(() -> new ChatResult(true, null)); // depends on control dependency: [if], data = [none] } log.i("Synchronising store."); return synchroniseConversations() .onErrorReturn(t -> new ChatResult(false, new ChatResult.Error(0, t))) .doOnNext(i -> { if (i.isSuccessful()) { log.i("Synchronisation successfully finished."); } else { log.e("Synchronisation finished with error. " + (i.getError() != null ? i.getError().getDetails() : "")); } isSynchronising.compareAndSet(true, false); }); } }
public class class_name { public com.google.protobuf.ByteString getOwnerBytes() { java.lang.Object ref = owner_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); owner_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } }
public class class_name { public com.google.protobuf.ByteString getOwnerBytes() { java.lang.Object ref = owner_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); owner_ = b; // depends on control dependency: [if], data = [none] return b; // depends on control dependency: [if], data = [none] } else { return (com.google.protobuf.ByteString) ref; // depends on control dependency: [if], data = [none] } } }
public class class_name { void setDecoded(CharSequence name, Object... values) { if (name != null && values != null) { List<Object> encodedValues = new ArrayList<Object>(values.length); for (Object value : values) { if (value == null) encodedValues.add(value); else encodedValues.add(Decoder.path(value.toString())); } this.parameters.put(name.toString(), Parameter.create(name.toString(), encodedValues)); } } }
public class class_name { void setDecoded(CharSequence name, Object... values) { if (name != null && values != null) { List<Object> encodedValues = new ArrayList<Object>(values.length); for (Object value : values) { if (value == null) encodedValues.add(value); else encodedValues.add(Decoder.path(value.toString())); } this.parameters.put(name.toString(), Parameter.create(name.toString(), encodedValues)); // depends on control dependency: [if], data = [(name] } } }
public class class_name { @Override public void parseHeader(String header, S sequence) { //uniptrot // tr|Q0TET7|Q0TET7_ECOL5 Putative uncharacterized protein OS=Escherichia coli O6:K15:H31 (strain 536 / UPEC) GN=ECP_2553 PE=4 SV=1 sequence.setOriginalHeader(header); String[] data = getHeaderValues(header); if (data.length == 1) { sequence.setAccession(new AccessionID(data[0])); } else if (data[0].equalsIgnoreCase("sp") || data[0].equalsIgnoreCase("tr")) { if (data[0].equalsIgnoreCase("sp")) { sequence.setAnnotationType(AnnotationType.CURATED); } else { sequence.setAnnotationType(AnnotationType.PREDICTED); } sequence.setAccession(new AccessionID(data[1], DataSource.UNIPROT)); if (data.length > 2) { sequence.setDescription(data[2]); } } else if (data[0].equalsIgnoreCase("gi")) { DataSource giSource = DataSource.UNKNOWN; if (data.length >= 3) { if (data[2].equalsIgnoreCase("gb")) { giSource = DataSource.GENBANK; } else if (data[2].equalsIgnoreCase("emb")) { giSource = DataSource.ENA; } else if (data[2].equalsIgnoreCase("dbj")) { giSource = DataSource.DDBJ; } sequence.setAccession(new AccessionID(data[3], giSource)); } else { sequence.setAccession(new AccessionID(header, giSource)); } } else if (data[0].equalsIgnoreCase("pir")) { sequence.setAccession(new AccessionID(data[2], DataSource.NBRF)); } else if (data[0].equalsIgnoreCase("prf")) { sequence.setAccession(new AccessionID(data[2], DataSource.PRF)); } else if (data[0].equalsIgnoreCase("pdb")) { sequence.setAccession(new AccessionID(data[1] + ":" + data[2], DataSource.PDB1)); } else if (data[0].startsWith("PDB")) { String[] pdbe = data[0].split(" "); String[] pdbaccession = pdbe[0].split(":"); sequence.setAccession(new AccessionID(pdbaccession[1], DataSource.PDBe)); } else if (data[0].indexOf(":") != -1 && data.length > 1 && data[1].equals("PDBID")) { sequence.setAccession(new AccessionID(data[0], DataSource.PDB2)); } else if (data[0].equalsIgnoreCase("pat")) { sequence.setAccession(new AccessionID(data[2], DataSource.PATENTS)); } else if (data[0].equalsIgnoreCase("bbs")) { sequence.setAccession(new AccessionID(data[1], DataSource.GENINFO)); } else if (data[0].equalsIgnoreCase("gnl")) { sequence.setAccession(new AccessionID(data[2], DataSource.GENERAL)); } else if (data[0].equalsIgnoreCase("ref")) { sequence.setAccession(new AccessionID(data[1], DataSource.NCBI)); } else if (data[0].equalsIgnoreCase("lcl")) { sequence.setAccession(new AccessionID(data[1], DataSource.LOCAL)); } else { sequence.setAccession(new AccessionID(data[0])); // avoid the common problem of picking up all the comments original header in getOriginalHeader } } }
public class class_name { @Override public void parseHeader(String header, S sequence) { //uniptrot // tr|Q0TET7|Q0TET7_ECOL5 Putative uncharacterized protein OS=Escherichia coli O6:K15:H31 (strain 536 / UPEC) GN=ECP_2553 PE=4 SV=1 sequence.setOriginalHeader(header); String[] data = getHeaderValues(header); if (data.length == 1) { sequence.setAccession(new AccessionID(data[0])); // depends on control dependency: [if], data = [none] } else if (data[0].equalsIgnoreCase("sp") || data[0].equalsIgnoreCase("tr")) { if (data[0].equalsIgnoreCase("sp")) { sequence.setAnnotationType(AnnotationType.CURATED); // depends on control dependency: [if], data = [none] } else { sequence.setAnnotationType(AnnotationType.PREDICTED); // depends on control dependency: [if], data = [none] } sequence.setAccession(new AccessionID(data[1], DataSource.UNIPROT)); // depends on control dependency: [if], data = [none] if (data.length > 2) { sequence.setDescription(data[2]); // depends on control dependency: [if], data = [none] } } else if (data[0].equalsIgnoreCase("gi")) { DataSource giSource = DataSource.UNKNOWN; if (data.length >= 3) { if (data[2].equalsIgnoreCase("gb")) { giSource = DataSource.GENBANK; // depends on control dependency: [if], data = [none] } else if (data[2].equalsIgnoreCase("emb")) { giSource = DataSource.ENA; // depends on control dependency: [if], data = [none] } else if (data[2].equalsIgnoreCase("dbj")) { giSource = DataSource.DDBJ; // depends on control dependency: [if], data = [none] } sequence.setAccession(new AccessionID(data[3], giSource)); // depends on control dependency: [if], data = [none] } else { sequence.setAccession(new AccessionID(header, giSource)); // depends on control dependency: [if], data = [none] } } else if (data[0].equalsIgnoreCase("pir")) { sequence.setAccession(new AccessionID(data[2], DataSource.NBRF)); // depends on control dependency: [if], data = [none] } else if (data[0].equalsIgnoreCase("prf")) { sequence.setAccession(new AccessionID(data[2], DataSource.PRF)); // depends on control dependency: [if], data = [none] } else if (data[0].equalsIgnoreCase("pdb")) { sequence.setAccession(new AccessionID(data[1] + ":" + data[2], DataSource.PDB1)); // depends on control dependency: [if], data = [none] } else if (data[0].startsWith("PDB")) { String[] pdbe = data[0].split(" "); String[] pdbaccession = pdbe[0].split(":"); sequence.setAccession(new AccessionID(pdbaccession[1], DataSource.PDBe)); // depends on control dependency: [if], data = [none] } else if (data[0].indexOf(":") != -1 && data.length > 1 && data[1].equals("PDBID")) { sequence.setAccession(new AccessionID(data[0], DataSource.PDB2)); // depends on control dependency: [if], data = [none] } else if (data[0].equalsIgnoreCase("pat")) { sequence.setAccession(new AccessionID(data[2], DataSource.PATENTS)); // depends on control dependency: [if], data = [none] } else if (data[0].equalsIgnoreCase("bbs")) { sequence.setAccession(new AccessionID(data[1], DataSource.GENINFO)); // depends on control dependency: [if], data = [none] } else if (data[0].equalsIgnoreCase("gnl")) { sequence.setAccession(new AccessionID(data[2], DataSource.GENERAL)); // depends on control dependency: [if], data = [none] } else if (data[0].equalsIgnoreCase("ref")) { sequence.setAccession(new AccessionID(data[1], DataSource.NCBI)); // depends on control dependency: [if], data = [none] } else if (data[0].equalsIgnoreCase("lcl")) { sequence.setAccession(new AccessionID(data[1], DataSource.LOCAL)); // depends on control dependency: [if], data = [none] } else { sequence.setAccession(new AccessionID(data[0])); // avoid the common problem of picking up all the comments original header in getOriginalHeader // depends on control dependency: [if], data = [none] } } }
public class class_name { public void start() { synchronized (getLock()) { if (destroyed.get()) { return; } if (bundle.getState() != Bundle.ACTIVE) { return; } if (bundle.getBundleContext() != bundleContext) { return; } try { doStart(); } catch (Throwable e) { logger.warn("Error starting extension for bundle " + bundle, e); } } } }
public class class_name { public void start() { synchronized (getLock()) { if (destroyed.get()) { return; // depends on control dependency: [if], data = [none] } if (bundle.getState() != Bundle.ACTIVE) { return; // depends on control dependency: [if], data = [none] } if (bundle.getBundleContext() != bundleContext) { return; // depends on control dependency: [if], data = [none] } try { doStart(); // depends on control dependency: [try], data = [none] } catch (Throwable e) { logger.warn("Error starting extension for bundle " + bundle, e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public static void tint(View view, Tint tint) { final ColorStateList color = tint.getColor(view.getContext()); if (view instanceof ImageView) { tint(((ImageView) view).getDrawable(), color); } else if (view instanceof TextView) { TextView text = (TextView) view; Drawable[] comp = text.getCompoundDrawables(); for (int i = 0; i < comp.length; i++) { if (comp[i] != null) { comp[i] = tint(comp[i], color); } } text.setCompoundDrawablesWithIntrinsicBounds(comp[0], comp[1], comp[2], comp[3]); } else { throw new IllegalArgumentException("Unsupported view type"); } } }
public class class_name { public static void tint(View view, Tint tint) { final ColorStateList color = tint.getColor(view.getContext()); if (view instanceof ImageView) { tint(((ImageView) view).getDrawable(), color); // depends on control dependency: [if], data = [none] } else if (view instanceof TextView) { TextView text = (TextView) view; Drawable[] comp = text.getCompoundDrawables(); for (int i = 0; i < comp.length; i++) { if (comp[i] != null) { comp[i] = tint(comp[i], color); // depends on control dependency: [if], data = [(comp[i]] } } text.setCompoundDrawablesWithIntrinsicBounds(comp[0], comp[1], comp[2], comp[3]); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Unsupported view type"); } } }
public class class_name { protected double[][] splitCentroid(Cluster<? extends MeanModel> parentCluster, Relation<V> relation) { double[] parentCentroid = parentCluster.getModel().getMean(); // Compute size of cluster/region double radius = 0.; for(DBIDIter it = parentCluster.getIDs().iter(); it.valid(); it.advance()) { double d = getDistanceFunction().distance(relation.get(it), DoubleVector.wrap(parentCentroid)); radius = (d > radius) ? d : radius; } // Choose random vector Random random = rnd.getSingleThreadedRandom(); final int dim = RelationUtil.dimensionality(relation); double[] randomVector = normalize(MathUtil.randomDoubleArray(dim, random)); timesEquals(randomVector, (.4 + random.nextDouble() * .5) * radius); // Get the new centroids for(int d = 0; d < dim; d++) { double a = parentCentroid[d], b = randomVector[d]; parentCentroid[d] = a - b; randomVector[d] = a + b; } return new double[][] { parentCentroid, randomVector }; } }
public class class_name { protected double[][] splitCentroid(Cluster<? extends MeanModel> parentCluster, Relation<V> relation) { double[] parentCentroid = parentCluster.getModel().getMean(); // Compute size of cluster/region double radius = 0.; for(DBIDIter it = parentCluster.getIDs().iter(); it.valid(); it.advance()) { double d = getDistanceFunction().distance(relation.get(it), DoubleVector.wrap(parentCentroid)); radius = (d > radius) ? d : radius; // depends on control dependency: [for], data = [none] } // Choose random vector Random random = rnd.getSingleThreadedRandom(); final int dim = RelationUtil.dimensionality(relation); double[] randomVector = normalize(MathUtil.randomDoubleArray(dim, random)); timesEquals(randomVector, (.4 + random.nextDouble() * .5) * radius); // Get the new centroids for(int d = 0; d < dim; d++) { double a = parentCentroid[d], b = randomVector[d]; parentCentroid[d] = a - b; // depends on control dependency: [for], data = [d] randomVector[d] = a + b; // depends on control dependency: [for], data = [d] } return new double[][] { parentCentroid, randomVector }; } }
public class class_name { public void setupDb(boolean createDb, boolean createTables, boolean dropDb) throws Exception { if (m_setupBean.isInitialized()) { System.out.println("Setup-Bean initialized successfully."); CmsSetupDb db = new CmsSetupDb(m_setupBean.getWebAppRfsPath()); try { // try to connect as the runtime user db.setConnection( m_setupBean.getDbDriver(), m_setupBean.getDbWorkConStr(), m_setupBean.getDbConStrParams(), m_setupBean.getDbWorkUser(), m_setupBean.getDbWorkPwd(), false); if (!db.noErrors()) { // try to connect as the setup user db.closeConnection(); db.clearErrors(); db.setConnection( m_setupBean.getDbDriver(), m_setupBean.getDbCreateConStr(), m_setupBean.getDbConStrParams(), m_setupBean.getDbCreateUser(), m_setupBean.getDbCreatePwd()); } if (!db.noErrors() || !m_setupBean.validateJdbc()) { throw new DBException("DB connection test failed.", db.getErrors()); } } finally { db.clearErrors(); db.closeConnection(); } } System.out.println("DB connection tested successfully."); CmsSetupDb db = null; boolean dbExists = false; if (m_setupBean.isInitialized()) { if (createDb || createTables) { db = new CmsSetupDb(m_setupBean.getWebAppRfsPath()); // check if database exists if (m_setupBean.getDatabase().startsWith("oracle") || m_setupBean.getDatabase().startsWith("db2") || m_setupBean.getDatabase().startsWith("as400")) { setWorkConnection(db); } else { db.setConnection( m_setupBean.getDbDriver(), m_setupBean.getDbWorkConStr(), m_setupBean.getDbConStrParams(), m_setupBean.getDbCreateUser(), m_setupBean.getDbCreatePwd(), false); dbExists = db.noErrors(); if (dbExists) { db.closeConnection(); } else { db.clearErrors(); } } if (!dbExists || dropDb) { db.closeConnection(); if (!m_setupBean.getDatabase().startsWith("db2") && !m_setupBean.getDatabase().startsWith("as400")) { db.setConnection( m_setupBean.getDbDriver(), m_setupBean.getDbCreateConStr(), m_setupBean.getDbConStrParams(), m_setupBean.getDbCreateUser(), m_setupBean.getDbCreatePwd()); } } } } if (!createDb && !createTables && !dbExists) { throw new Exception("You have not created the Alkacon OpenCms database."); } if (dbExists && createTables && !dropDb && (db != null)) { throw new Exception("You have selected to not drop existing DBs, but a DB with the given name exists."); } if (dbExists && createDb && dropDb && (db != null)) { // drop the DB db.closeConnection(); db.setConnection( m_setupBean.getDbDriver(), m_setupBean.getDbCreateConStr(), m_setupBean.getDbConStrParams(), m_setupBean.getDbCreateUser(), m_setupBean.getDbCreatePwd()); db.dropDatabase(m_setupBean.getDatabase(), m_setupBean.getReplacer()); if (!db.noErrors()) { List<String> errors = new ArrayList<>(db.getErrors()); db.clearErrors(); throw new DBException("Error occurred while dropping the DB!", errors); } System.out.println("Database dropped successfully."); } if (createDb && (db != null)) { // Create Database db.createDatabase(m_setupBean.getDatabase(), m_setupBean.getReplacer()); if (!db.noErrors()) { DBException ex = new DBException("Error occurred while creating the DB!", db.getErrors()); db.clearErrors(); throw ex; } db.closeConnection(); System.out.println("Database created successfully."); } if (createTables && (db != null)) { setWorkConnection(db); //Drop Tables (intentionally quiet) db.dropTables(m_setupBean.getDatabase()); db.clearErrors(); db.closeConnection(); // reopen the connection in order to display errors setWorkConnection(db); //Create Tables db.createTables(m_setupBean.getDatabase(), m_setupBean.getReplacer()); if (!db.noErrors()) { DBException ex = new DBException("Error occurred while creating the DB!", db.getErrors()); db.clearErrors(); throw ex; } db.closeConnection(); System.out.println("Tables created successfully."); } if (db != null) { db.closeConnection(); } System.out.println("Database setup was successful."); m_context.stepForward(); } }
public class class_name { public void setupDb(boolean createDb, boolean createTables, boolean dropDb) throws Exception { if (m_setupBean.isInitialized()) { System.out.println("Setup-Bean initialized successfully."); CmsSetupDb db = new CmsSetupDb(m_setupBean.getWebAppRfsPath()); try { // try to connect as the runtime user db.setConnection( m_setupBean.getDbDriver(), m_setupBean.getDbWorkConStr(), m_setupBean.getDbConStrParams(), m_setupBean.getDbWorkUser(), m_setupBean.getDbWorkPwd(), false); if (!db.noErrors()) { // try to connect as the setup user db.closeConnection(); // depends on control dependency: [if], data = [none] db.clearErrors(); // depends on control dependency: [if], data = [none] db.setConnection( m_setupBean.getDbDriver(), m_setupBean.getDbCreateConStr(), m_setupBean.getDbConStrParams(), m_setupBean.getDbCreateUser(), m_setupBean.getDbCreatePwd()); // depends on control dependency: [if], data = [none] } if (!db.noErrors() || !m_setupBean.validateJdbc()) { throw new DBException("DB connection test failed.", db.getErrors()); } } finally { db.clearErrors(); db.closeConnection(); } } System.out.println("DB connection tested successfully."); CmsSetupDb db = null; boolean dbExists = false; if (m_setupBean.isInitialized()) { if (createDb || createTables) { db = new CmsSetupDb(m_setupBean.getWebAppRfsPath()); // check if database exists if (m_setupBean.getDatabase().startsWith("oracle") || m_setupBean.getDatabase().startsWith("db2") || m_setupBean.getDatabase().startsWith("as400")) { setWorkConnection(db); } else { db.setConnection( m_setupBean.getDbDriver(), m_setupBean.getDbWorkConStr(), m_setupBean.getDbConStrParams(), m_setupBean.getDbCreateUser(), m_setupBean.getDbCreatePwd(), false); dbExists = db.noErrors(); if (dbExists) { db.closeConnection(); } else { db.clearErrors(); } } if (!dbExists || dropDb) { db.closeConnection(); if (!m_setupBean.getDatabase().startsWith("db2") && !m_setupBean.getDatabase().startsWith("as400")) { db.setConnection( m_setupBean.getDbDriver(), m_setupBean.getDbCreateConStr(), m_setupBean.getDbConStrParams(), m_setupBean.getDbCreateUser(), m_setupBean.getDbCreatePwd()); } } } } if (!createDb && !createTables && !dbExists) { throw new Exception("You have not created the Alkacon OpenCms database."); } if (dbExists && createTables && !dropDb && (db != null)) { throw new Exception("You have selected to not drop existing DBs, but a DB with the given name exists."); } if (dbExists && createDb && dropDb && (db != null)) { // drop the DB db.closeConnection(); db.setConnection( m_setupBean.getDbDriver(), m_setupBean.getDbCreateConStr(), m_setupBean.getDbConStrParams(), m_setupBean.getDbCreateUser(), m_setupBean.getDbCreatePwd()); db.dropDatabase(m_setupBean.getDatabase(), m_setupBean.getReplacer()); if (!db.noErrors()) { List<String> errors = new ArrayList<>(db.getErrors()); db.clearErrors(); throw new DBException("Error occurred while dropping the DB!", errors); } System.out.println("Database dropped successfully."); } if (createDb && (db != null)) { // Create Database db.createDatabase(m_setupBean.getDatabase(), m_setupBean.getReplacer()); if (!db.noErrors()) { DBException ex = new DBException("Error occurred while creating the DB!", db.getErrors()); db.clearErrors(); throw ex; } db.closeConnection(); System.out.println("Database created successfully."); } if (createTables && (db != null)) { setWorkConnection(db); //Drop Tables (intentionally quiet) db.dropTables(m_setupBean.getDatabase()); db.clearErrors(); db.closeConnection(); // reopen the connection in order to display errors setWorkConnection(db); //Create Tables db.createTables(m_setupBean.getDatabase(), m_setupBean.getReplacer()); if (!db.noErrors()) { DBException ex = new DBException("Error occurred while creating the DB!", db.getErrors()); db.clearErrors(); throw ex; } db.closeConnection(); System.out.println("Tables created successfully."); } if (db != null) { db.closeConnection(); } System.out.println("Database setup was successful."); m_context.stepForward(); } }
public class class_name { public void ensureCapacity(int requiredBits) { int requiredWords = wordIndex(requiredBits - 1) + 1; if (words.length < requiredWords) { long[] newWords = new long[requiredWords]; System.arraycopy(words, 0, newWords, 0, words.length); words = newWords; } } }
public class class_name { public void ensureCapacity(int requiredBits) { int requiredWords = wordIndex(requiredBits - 1) + 1; if (words.length < requiredWords) { long[] newWords = new long[requiredWords]; System.arraycopy(words, 0, newWords, 0, words.length); // depends on control dependency: [if], data = [none] words = newWords; // depends on control dependency: [if], data = [none] } } }
public class class_name { public String asString(Document doc) { try { DOMSource domSource = new DOMSource(doc); StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer = tf.newTransformer(); transformer.transform(domSource, result); return writer.toString(); } catch (TransformerException e) { throw new IllegalStateException(e); } } }
public class class_name { public String asString(Document doc) { try { DOMSource domSource = new DOMSource(doc); StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer = tf.newTransformer(); transformer.transform(domSource, result); // depends on control dependency: [try], data = [none] return writer.toString(); // depends on control dependency: [try], data = [none] } catch (TransformerException e) { throw new IllegalStateException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void showPools(PrintWriter out, boolean advancedView, Set<String> poolFilterSet) { ResourceReporter reporter = jobTracker.getResourceReporter(); synchronized (jobTracker) { synchronized(scheduler) { PoolManager poolManager = scheduler.getPoolManager(); out.print("<h2>Active Pools</h2>\n"); out.print("<table border=\"2\" cellpadding=\"5\" cellspacing=\"2\" " + "class=\"tablesorter\">\n"); out.print("<thead><tr><th>Pool</th><th>Running Jobs</th>" + "<th>Preparing Jobs</th>" + "<th>Min Maps</th><th>Min Reduces</th>" + "<th>Max Maps</th><th>Max Reduces</th>" + "<th>Initialized Tasks</th>" + "<th>Max Initialized Tasks</th>" + "<th>Running/Waiting Maps</th><th>Running/Waiting Reduces</th>" + (reporter != null ? "<th>CPU</th><th>Memory</th>" : "") + "<th>Map Avg Wait Seccond</th>" + "<th>Reduce Avg Wait Second</th>" + "</tr></thead><tbody>\n"); List<Pool> pools = new ArrayList<Pool>(poolManager.getPools()); Collections.sort(pools, new Comparator<Pool>() { public int compare(Pool p1, Pool p2) { if (p1.isDefaultPool()) return 1; else if (p2.isDefaultPool()) return -1; else return p1.getName().compareTo(p2.getName()); }}); int numActivePools = 0; int totalInitedTasks = 0; int totalMaxInitedTasks = 0; int totalRunningMaps = 0; int totalWaitingMaps = 0; int totalRunningReduces = 0; int totalWaitingReduces = 0; int totalMinReduces = 0; int totalMaxReduces = 0; int totalMinMaps = 0; int totalMaxMaps = 0; int totalRunningJobs = 0; long totalMapWaitTime = 0; long totalReduceWaitTime = 0; long totalNonConfiguredFirstMapWaitTime = 0; long totalNonConfiguredFirstReduceWaitTime = 0; long totalJobsInNonConfiguredPools = 0; int totalReduceTasks = 0; int totalMapTasks = 0; int totalPrepareJobs = 0; double totalCpu = 0; double totalMemory = 0; for (Pool pool: pools) { String poolName = pool.getName(); if ((poolFilterSet != null) && !poolFilterSet.contains(poolName)) { continue; } int initedTasks = 0; int runningMaps = 0; int waitingMaps = 0; int runningReduces = 0; int waitingReduces = 0; long poolMapWaitTime = 0; long poolReduceWaitTime = 0; int poolMapTasks = 0; int poolReduceTasks = 0; int poolPrepareJobs = 0; long poolFirstMapWaitTime = 0; long poolFirstReduceWaitTime = 0; boolean isConfiguredPool = pool.isConfiguredPool(); for (JobInProgress job: pool.getJobs()) { if (job.getStatus().getRunState() == JobStatus.PREP) { poolPrepareJobs += 1; } if (isConfiguredPool) { totalJobsInNonConfiguredPools++; totalNonConfiguredFirstMapWaitTime += job.getFirstMapWaitTime(); totalNonConfiguredFirstReduceWaitTime += job.getFirstReduceWaitTime(); } JobInfo info = scheduler.infos.get(job); if (info != null) { initedTasks += info.totalInitedTasks; runningMaps += info.runningMaps; runningReduces += info.runningReduces; waitingMaps += info.neededMaps; waitingReduces += info.neededReduces; poolMapWaitTime += job.getTotalMapWaitTime(); poolReduceWaitTime += job.getTotalReduceWaitTime(); poolMapTasks += job.desiredMaps(); poolReduceTasks += job.desiredReduces(); } } double poolMapAverageWaitTime = 0; double poolReduceAverageWaitTime = 0; if (poolMapTasks != 0) { poolMapAverageWaitTime = (double)poolMapWaitTime / poolMapTasks; totalMapWaitTime += poolMapWaitTime; totalMapTasks += poolMapTasks; } if (poolReduceTasks != 0) { poolReduceAverageWaitTime = (double)poolReduceWaitTime / poolReduceTasks; totalReduceWaitTime += poolReduceWaitTime; totalReduceTasks += poolReduceTasks; } int runningJobs = pool.getJobs().size(); int minMaps = poolManager.getMinSlots(poolName, TaskType.MAP); int minReduces = poolManager.getMinSlots(poolName, TaskType.REDUCE); int maxMaps = poolManager.getMaxSlots(poolName, TaskType.MAP); int maxReduces = poolManager.getMaxSlots(poolName, TaskType.REDUCE); int maxInitedTasks = poolManager.getPoolMaxInitedTasks(poolName); totalRunningJobs += runningJobs; totalInitedTasks += initedTasks; totalRunningMaps += runningMaps; totalWaitingMaps += waitingMaps; totalRunningReduces += runningReduces; totalWaitingReduces += waitingReduces; totalMinMaps += minMaps; totalMinReduces += minReduces; if (runningJobs == 0 && minMaps == 0 && minReduces == 0 && maxMaps == Integer.MAX_VALUE && maxReduces == Integer.MAX_VALUE && initedTasks == 0 && runningMaps == 0 && runningReduces == 0) { continue; } numActivePools++; out.print("<tr>\n"); out.printf("<td>%s</td>\n", poolName); out.printf("<td>%s</td>\n", runningJobs); out.printf("<td>%s</td>\n", poolPrepareJobs); out.printf("<td>%s</td>\n", minMaps); out.printf("<td>%s</td>\n", minReduces); if (maxMaps == Integer.MAX_VALUE) { out.printf("<td>-</td>\n"); } else { out.printf("<td>%s</td>\n", maxMaps); totalMaxMaps += maxMaps; } if (maxReduces == Integer.MAX_VALUE) { out.printf("<td>-</td>\n"); } else { out.printf("<td>%s</td>\n", maxReduces); totalMaxReduces += maxReduces; } out.printf("<td>%s</td>\n", initedTasks); if (maxInitedTasks == Integer.MAX_VALUE) { out.printf("<td>-</td>\n"); } else { out.printf("<td>%s</td>\n", maxInitedTasks); totalMaxInitedTasks += maxInitedTasks; } out.printf("<td>%s/%s</td>\n", runningMaps, waitingMaps); out.printf("<td>%s/%s</td>\n", runningReduces, waitingReduces); // Compute the CPU and memory usage double cpuUsage = 0; // in percentage double memoryUsage = 0; // in percentage if (reporter != null) { for (JobInProgress job : pool.getJobs()) { double cpu = reporter.getJobCpuPercentageOnCluster(job.getJobID()); double memory = reporter.getJobMemPercentageOnCluster(job.getJobID()); cpuUsage += cpu != ResourceReporter.UNAVAILABLE ? cpu : 0; memoryUsage += memory != ResourceReporter.UNAVAILABLE ? memory : 0; } out.printf("<td>%.1f%%</td>\n", cpuUsage); out.printf("<td>%.1f%%</td>\n", memoryUsage); } totalCpu += cpuUsage; totalMemory += memoryUsage; totalPrepareJobs += poolPrepareJobs; out.printf("<td>%.1f</td>\n", poolMapAverageWaitTime / 1000D); out.printf("<td>%.1f</td>\n", poolReduceAverageWaitTime / 1000D); out.print("</tr>\n"); } out.print("<tr>\n"); out.printf("<td>Total</td>\n"); out.printf("<td>%s</td>\n", totalRunningJobs); out.printf("<td>%s</td>\n", totalPrepareJobs); out.printf("<td>%s</td>\n", totalMinMaps); out.printf("<td>%s</td>\n", totalMinReduces); if (totalMaxMaps == 0) { out.printf("<td>-</td>\n"); } else { out.printf("<td>%s</td>\n", totalMaxMaps); } if (totalMaxReduces == 0) { out.printf("<td>-</td>\n"); } else { out.printf("<td>%s</td>\n", totalMaxReduces); } out.printf("<td>%s</td>\n", totalInitedTasks); out.printf("<td>%s</td>\n", totalMaxInitedTasks); out.printf("<td>%s/%s</td>\n", totalRunningMaps, totalWaitingMaps); out.printf("<td>%s/%s</td>\n", totalRunningReduces, totalWaitingReduces); if (reporter != null) { out.printf("<td>%.1f%%</td>\n", totalCpu); out.printf("<td>%.1f%%</td>\n", totalMemory); } double mapAverageWaitTime = totalMapTasks == 0 ? 0 : (double)totalMapWaitTime / totalMapTasks; double reduceAverageWaitTime = totalReduceTasks == 0 ? 0 : (double)totalReduceWaitTime / totalReduceTasks; out.printf("<td>%.1f</td>\n", mapAverageWaitTime); out.printf("<td>%.1f</td>\n", reduceAverageWaitTime); out.print("</tr>\n"); out.print("</tbody></table>\n"); out.printf("<p>Number of active/total pools : %d/%d</p>", numActivePools, pools.size()); double nonConfiguredAverageFirstMapWaitTime = totalJobsInNonConfiguredPools == 0 ? 0: (double)totalNonConfiguredFirstMapWaitTime / totalJobsInNonConfiguredPools; double nonConfiguredAverageFirstReduceWaitTime = totalJobsInNonConfiguredPools == 0 ? 0: (double)totalNonConfiguredFirstReduceWaitTime / totalJobsInNonConfiguredPools; // Non-configured == ad-hoc. out.printf("<p>Average first map wait time in ad-hoc pools: %f</p>", nonConfiguredAverageFirstMapWaitTime); out.printf("<p>Average first reduce wait time in ad-hoc pools: %f</p>", nonConfiguredAverageFirstReduceWaitTime); } } } }
public class class_name { private void showPools(PrintWriter out, boolean advancedView, Set<String> poolFilterSet) { ResourceReporter reporter = jobTracker.getResourceReporter(); synchronized (jobTracker) { synchronized(scheduler) { PoolManager poolManager = scheduler.getPoolManager(); out.print("<h2>Active Pools</h2>\n"); out.print("<table border=\"2\" cellpadding=\"5\" cellspacing=\"2\" " + "class=\"tablesorter\">\n"); out.print("<thead><tr><th>Pool</th><th>Running Jobs</th>" + "<th>Preparing Jobs</th>" + "<th>Min Maps</th><th>Min Reduces</th>" + "<th>Max Maps</th><th>Max Reduces</th>" + "<th>Initialized Tasks</th>" + "<th>Max Initialized Tasks</th>" + "<th>Running/Waiting Maps</th><th>Running/Waiting Reduces</th>" + (reporter != null ? "<th>CPU</th><th>Memory</th>" : "") + "<th>Map Avg Wait Seccond</th>" + "<th>Reduce Avg Wait Second</th>" + "</tr></thead><tbody>\n"); List<Pool> pools = new ArrayList<Pool>(poolManager.getPools()); Collections.sort(pools, new Comparator<Pool>() { public int compare(Pool p1, Pool p2) { if (p1.isDefaultPool()) return 1; else if (p2.isDefaultPool()) return -1; else return p1.getName().compareTo(p2.getName()); }}); int numActivePools = 0; int totalInitedTasks = 0; int totalMaxInitedTasks = 0; int totalRunningMaps = 0; int totalWaitingMaps = 0; int totalRunningReduces = 0; int totalWaitingReduces = 0; int totalMinReduces = 0; int totalMaxReduces = 0; int totalMinMaps = 0; int totalMaxMaps = 0; int totalRunningJobs = 0; long totalMapWaitTime = 0; long totalReduceWaitTime = 0; long totalNonConfiguredFirstMapWaitTime = 0; long totalNonConfiguredFirstReduceWaitTime = 0; long totalJobsInNonConfiguredPools = 0; int totalReduceTasks = 0; int totalMapTasks = 0; int totalPrepareJobs = 0; double totalCpu = 0; double totalMemory = 0; for (Pool pool: pools) { String poolName = pool.getName(); if ((poolFilterSet != null) && !poolFilterSet.contains(poolName)) { continue; } int initedTasks = 0; int runningMaps = 0; int waitingMaps = 0; int runningReduces = 0; int waitingReduces = 0; long poolMapWaitTime = 0; long poolReduceWaitTime = 0; int poolMapTasks = 0; int poolReduceTasks = 0; int poolPrepareJobs = 0; long poolFirstMapWaitTime = 0; long poolFirstReduceWaitTime = 0; boolean isConfiguredPool = pool.isConfiguredPool(); for (JobInProgress job: pool.getJobs()) { if (job.getStatus().getRunState() == JobStatus.PREP) { poolPrepareJobs += 1; // depends on control dependency: [if], data = [none] } if (isConfiguredPool) { totalJobsInNonConfiguredPools++; // depends on control dependency: [if], data = [none] totalNonConfiguredFirstMapWaitTime += job.getFirstMapWaitTime(); // depends on control dependency: [if], data = [none] totalNonConfiguredFirstReduceWaitTime += job.getFirstReduceWaitTime(); // depends on control dependency: [if], data = [none] } JobInfo info = scheduler.infos.get(job); if (info != null) { initedTasks += info.totalInitedTasks; // depends on control dependency: [if], data = [none] runningMaps += info.runningMaps; // depends on control dependency: [if], data = [none] runningReduces += info.runningReduces; // depends on control dependency: [if], data = [none] waitingMaps += info.neededMaps; // depends on control dependency: [if], data = [none] waitingReduces += info.neededReduces; // depends on control dependency: [if], data = [none] poolMapWaitTime += job.getTotalMapWaitTime(); // depends on control dependency: [if], data = [none] poolReduceWaitTime += job.getTotalReduceWaitTime(); // depends on control dependency: [if], data = [none] poolMapTasks += job.desiredMaps(); // depends on control dependency: [if], data = [none] poolReduceTasks += job.desiredReduces(); // depends on control dependency: [if], data = [none] } } double poolMapAverageWaitTime = 0; double poolReduceAverageWaitTime = 0; if (poolMapTasks != 0) { poolMapAverageWaitTime = (double)poolMapWaitTime / poolMapTasks; // depends on control dependency: [if], data = [none] totalMapWaitTime += poolMapWaitTime; // depends on control dependency: [if], data = [none] totalMapTasks += poolMapTasks; // depends on control dependency: [if], data = [none] } if (poolReduceTasks != 0) { poolReduceAverageWaitTime = (double)poolReduceWaitTime / poolReduceTasks; // depends on control dependency: [if], data = [none] totalReduceWaitTime += poolReduceWaitTime; // depends on control dependency: [if], data = [none] totalReduceTasks += poolReduceTasks; // depends on control dependency: [if], data = [none] } int runningJobs = pool.getJobs().size(); int minMaps = poolManager.getMinSlots(poolName, TaskType.MAP); int minReduces = poolManager.getMinSlots(poolName, TaskType.REDUCE); int maxMaps = poolManager.getMaxSlots(poolName, TaskType.MAP); int maxReduces = poolManager.getMaxSlots(poolName, TaskType.REDUCE); int maxInitedTasks = poolManager.getPoolMaxInitedTasks(poolName); totalRunningJobs += runningJobs; // depends on control dependency: [for], data = [none] totalInitedTasks += initedTasks; // depends on control dependency: [for], data = [none] totalRunningMaps += runningMaps; // depends on control dependency: [for], data = [none] totalWaitingMaps += waitingMaps; // depends on control dependency: [for], data = [none] totalRunningReduces += runningReduces; // depends on control dependency: [for], data = [none] totalWaitingReduces += waitingReduces; // depends on control dependency: [for], data = [none] totalMinMaps += minMaps; // depends on control dependency: [for], data = [none] totalMinReduces += minReduces; // depends on control dependency: [for], data = [none] if (runningJobs == 0 && minMaps == 0 && minReduces == 0 && maxMaps == Integer.MAX_VALUE && maxReduces == Integer.MAX_VALUE && initedTasks == 0 && runningMaps == 0 && runningReduces == 0) { continue; } numActivePools++; // depends on control dependency: [for], data = [none] out.print("<tr>\n"); // depends on control dependency: [for], data = [none] out.printf("<td>%s</td>\n", poolName); // depends on control dependency: [for], data = [pool] out.printf("<td>%s</td>\n", runningJobs); // depends on control dependency: [for], data = [none] out.printf("<td>%s</td>\n", poolPrepareJobs); // depends on control dependency: [for], data = [pool] out.printf("<td>%s</td>\n", minMaps); // depends on control dependency: [for], data = [none] out.printf("<td>%s</td>\n", minReduces); // depends on control dependency: [for], data = [none] if (maxMaps == Integer.MAX_VALUE) { out.printf("<td>-</td>\n"); // depends on control dependency: [if], data = [none] } else { out.printf("<td>%s</td>\n", maxMaps); // depends on control dependency: [if], data = [none] totalMaxMaps += maxMaps; // depends on control dependency: [if], data = [none] } if (maxReduces == Integer.MAX_VALUE) { out.printf("<td>-</td>\n"); // depends on control dependency: [if], data = [none] } else { out.printf("<td>%s</td>\n", maxReduces); // depends on control dependency: [if], data = [none] totalMaxReduces += maxReduces; // depends on control dependency: [if], data = [none] } out.printf("<td>%s</td>\n", initedTasks); // depends on control dependency: [for], data = [none] if (maxInitedTasks == Integer.MAX_VALUE) { out.printf("<td>-</td>\n"); // depends on control dependency: [if], data = [none] } else { out.printf("<td>%s</td>\n", maxInitedTasks); // depends on control dependency: [if], data = [none] totalMaxInitedTasks += maxInitedTasks; // depends on control dependency: [if], data = [none] } out.printf("<td>%s/%s</td>\n", runningMaps, waitingMaps); // depends on control dependency: [for], data = [none] out.printf("<td>%s/%s</td>\n", runningReduces, waitingReduces); // depends on control dependency: [for], data = [none] // Compute the CPU and memory usage double cpuUsage = 0; // in percentage double memoryUsage = 0; // in percentage if (reporter != null) { for (JobInProgress job : pool.getJobs()) { double cpu = reporter.getJobCpuPercentageOnCluster(job.getJobID()); double memory = reporter.getJobMemPercentageOnCluster(job.getJobID()); cpuUsage += cpu != ResourceReporter.UNAVAILABLE ? cpu : 0; // depends on control dependency: [for], data = [none] memoryUsage += memory != ResourceReporter.UNAVAILABLE ? memory : 0; // depends on control dependency: [for], data = [none] } out.printf("<td>%.1f%%</td>\n", cpuUsage); // depends on control dependency: [if], data = [none] out.printf("<td>%.1f%%</td>\n", memoryUsage); // depends on control dependency: [if], data = [none] } totalCpu += cpuUsage; // depends on control dependency: [for], data = [none] totalMemory += memoryUsage; // depends on control dependency: [for], data = [none] totalPrepareJobs += poolPrepareJobs; // depends on control dependency: [for], data = [pool] out.printf("<td>%.1f</td>\n", poolMapAverageWaitTime / 1000D); // depends on control dependency: [for], data = [pool] out.printf("<td>%.1f</td>\n", poolReduceAverageWaitTime / 1000D); // depends on control dependency: [for], data = [pool] out.print("</tr>\n"); // depends on control dependency: [for], data = [none] } out.print("<tr>\n"); out.printf("<td>Total</td>\n"); out.printf("<td>%s</td>\n", totalRunningJobs); out.printf("<td>%s</td>\n", totalPrepareJobs); out.printf("<td>%s</td>\n", totalMinMaps); out.printf("<td>%s</td>\n", totalMinReduces); if (totalMaxMaps == 0) { out.printf("<td>-</td>\n"); // depends on control dependency: [if], data = [none] } else { out.printf("<td>%s</td>\n", totalMaxMaps); // depends on control dependency: [if], data = [none] } if (totalMaxReduces == 0) { out.printf("<td>-</td>\n"); // depends on control dependency: [if], data = [none] } else { out.printf("<td>%s</td>\n", totalMaxReduces); // depends on control dependency: [if], data = [none] } out.printf("<td>%s</td>\n", totalInitedTasks); out.printf("<td>%s</td>\n", totalMaxInitedTasks); out.printf("<td>%s/%s</td>\n", totalRunningMaps, totalWaitingMaps); out.printf("<td>%s/%s</td>\n", totalRunningReduces, totalWaitingReduces); if (reporter != null) { out.printf("<td>%.1f%%</td>\n", totalCpu); // depends on control dependency: [if], data = [none] out.printf("<td>%.1f%%</td>\n", totalMemory); // depends on control dependency: [if], data = [none] } double mapAverageWaitTime = totalMapTasks == 0 ? 0 : (double)totalMapWaitTime / totalMapTasks; double reduceAverageWaitTime = totalReduceTasks == 0 ? 0 : (double)totalReduceWaitTime / totalReduceTasks; out.printf("<td>%.1f</td>\n", mapAverageWaitTime); out.printf("<td>%.1f</td>\n", reduceAverageWaitTime); out.print("</tr>\n"); out.print("</tbody></table>\n"); out.printf("<p>Number of active/total pools : %d/%d</p>", numActivePools, pools.size()); double nonConfiguredAverageFirstMapWaitTime = totalJobsInNonConfiguredPools == 0 ? 0: (double)totalNonConfiguredFirstMapWaitTime / totalJobsInNonConfiguredPools; double nonConfiguredAverageFirstReduceWaitTime = totalJobsInNonConfiguredPools == 0 ? 0: (double)totalNonConfiguredFirstReduceWaitTime / totalJobsInNonConfiguredPools; // Non-configured == ad-hoc. out.printf("<p>Average first map wait time in ad-hoc pools: %f</p>", nonConfiguredAverageFirstMapWaitTime); out.printf("<p>Average first reduce wait time in ad-hoc pools: %f</p>", nonConfiguredAverageFirstReduceWaitTime); } } } }
public class class_name { public static String arglistToJvm(String arglist) { if (!(arglist.startsWith("(") && arglist.endsWith(")"))) { throw new Error("Malformed arglist: " + arglist); } String result = "("; String commaSepArgs = arglist.substring(1, arglist.length() - 1); StringTokenizer argsTokenizer = new StringTokenizer(commaSepArgs, ",", false); while (argsTokenizer.hasMoreTokens()) { @SuppressWarnings("signature") // substring @BinaryName String arg = argsTokenizer.nextToken().trim(); result += binaryNameToFieldDescriptor(arg); } result += ")"; // System.out.println("arglistToJvm: " + arglist + " => " + result); return result; } }
public class class_name { public static String arglistToJvm(String arglist) { if (!(arglist.startsWith("(") && arglist.endsWith(")"))) { throw new Error("Malformed arglist: " + arglist); } String result = "("; String commaSepArgs = arglist.substring(1, arglist.length() - 1); StringTokenizer argsTokenizer = new StringTokenizer(commaSepArgs, ",", false); while (argsTokenizer.hasMoreTokens()) { @SuppressWarnings("signature") // substring @BinaryName String arg = argsTokenizer.nextToken().trim(); result += binaryNameToFieldDescriptor(arg); // depends on control dependency: [while], data = [none] } result += ")"; // System.out.println("arglistToJvm: " + arglist + " => " + result); return result; } }