code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { private void initializeFileData(String baseSitePath) throws CmsException { m_resultMap.clear(); m_siteRootLink = OpenCms.getLinkManager().getOnlineLink(m_siteGuestCms, "/"); m_siteRootLink = CmsFileUtil.removeTrailingSeparator(m_siteRootLink); m_detailPageInfos = OpenCms.getADEManager().getAllDetailPages(m_guestCms); for (CmsDetailPageInfo detailPageInfo : m_detailPageInfos) { String type = detailPageInfo.getType(); String path = detailPageInfo.getUri(); path = CmsFileUtil.removeTrailingSeparator(path); m_detailTypesByPage.put(path, type); } List<CmsAlias> siteAliases = OpenCms.getAliasManager().getAliasesForSite( m_siteGuestCms, m_siteGuestCms.getRequestContext().getSiteRoot()); for (CmsAlias alias : siteAliases) { if (isAliasBelowBaseFolder(alias) && (alias.getMode() == CmsAliasMode.page)) { CmsUUID aliasId = alias.getStructureId(); m_pageAliasesBelowBaseFolderByStructureId.put(aliasId, alias); } } } }
public class class_name { private void initializeFileData(String baseSitePath) throws CmsException { m_resultMap.clear(); m_siteRootLink = OpenCms.getLinkManager().getOnlineLink(m_siteGuestCms, "/"); m_siteRootLink = CmsFileUtil.removeTrailingSeparator(m_siteRootLink); m_detailPageInfos = OpenCms.getADEManager().getAllDetailPages(m_guestCms); for (CmsDetailPageInfo detailPageInfo : m_detailPageInfos) { String type = detailPageInfo.getType(); String path = detailPageInfo.getUri(); path = CmsFileUtil.removeTrailingSeparator(path); m_detailTypesByPage.put(path, type); } List<CmsAlias> siteAliases = OpenCms.getAliasManager().getAliasesForSite( m_siteGuestCms, m_siteGuestCms.getRequestContext().getSiteRoot()); for (CmsAlias alias : siteAliases) { if (isAliasBelowBaseFolder(alias) && (alias.getMode() == CmsAliasMode.page)) { CmsUUID aliasId = alias.getStructureId(); m_pageAliasesBelowBaseFolderByStructureId.put(aliasId, alias); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static InetSocketAddress replaceWithResolved( InetSocketAddress inetSocketAddress) { if (!inetSocketAddress.isUnresolved()) { return inetSocketAddress; } inetSocketAddress = replaceUnresolvedNumericIp(inetSocketAddress); if (!inetSocketAddress.isUnresolved()) { return inetSocketAddress; } else { return new InetSocketAddress(inetSocketAddress.getHostString(), inetSocketAddress.getPort()); } } }
public class class_name { public static InetSocketAddress replaceWithResolved( InetSocketAddress inetSocketAddress) { if (!inetSocketAddress.isUnresolved()) { return inetSocketAddress; // depends on control dependency: [if], data = [none] } inetSocketAddress = replaceUnresolvedNumericIp(inetSocketAddress); if (!inetSocketAddress.isUnresolved()) { return inetSocketAddress; // depends on control dependency: [if], data = [none] } else { return new InetSocketAddress(inetSocketAddress.getHostString(), inetSocketAddress.getPort()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean restoreAccessibilityFocus(CalendarDay day) { if ((day.year != mYear) || (day.month != mMonth) || (day.day > mNumCells)) { return false; } mTouchHelper.setFocusedVirtualView(day.day); return true; } }
public class class_name { public boolean restoreAccessibilityFocus(CalendarDay day) { if ((day.year != mYear) || (day.month != mMonth) || (day.day > mNumCells)) { return false; // depends on control dependency: [if], data = [none] } mTouchHelper.setFocusedVirtualView(day.day); return true; } }
public class class_name { private <K, V> List<Map.Entry<K, V>> sortedEntryList(Map<K, V> obj) { List<Map.Entry<K, V>> entryList = new ArrayList<Map.Entry<K, V>>(obj.entrySet()); Collections.sort(entryList, new Comparator<Map.Entry<K, V>>() { @Override @SuppressWarnings({ "unchecked", "rawtypes" }) public int compare(Entry<K, V> o1, Entry<K, V> o2) { K k1 = o1.getKey(); K k2 = o2.getKey(); if (k1 instanceof Comparable) { return ((Comparable) k1).compareTo(k2); } return k1.hashCode() - k2.hashCode(); } }); return entryList; } }
public class class_name { private <K, V> List<Map.Entry<K, V>> sortedEntryList(Map<K, V> obj) { List<Map.Entry<K, V>> entryList = new ArrayList<Map.Entry<K, V>>(obj.entrySet()); Collections.sort(entryList, new Comparator<Map.Entry<K, V>>() { @Override @SuppressWarnings({ "unchecked", "rawtypes" }) public int compare(Entry<K, V> o1, Entry<K, V> o2) { K k1 = o1.getKey(); K k2 = o2.getKey(); if (k1 instanceof Comparable) { return ((Comparable) k1).compareTo(k2); // depends on control dependency: [if], data = [none] } return k1.hashCode() - k2.hashCode(); } }); return entryList; } }
public class class_name { public FilterableSet<Entry<K,V>> allEntrySet() { if (setOfAllEntries == null) { setOfAllEntries = new AbstractFilterableSet<Entry<K,V>>() { @Override public Iterator<Entry<K,V>> iterator() { return new TransactionalBidiTreeMapIterator<Entry<K,V>>(KEY) { @Override protected Entry<K,V> doGetNext() { return lastReturnedNode; } @Override protected Node<K,V> getNextValidNode(Node<K,V> node, String thread_id) { return node; } }; } //cannot have contains or remove methods //as we have ALL the nodes and so may have duplicates //which are in the provess of being deleted @Override public boolean contains(Object o) { throw new UtilsjException("method not supported"); } @Override public boolean remove(Object o) { throw new UtilsjException("method not supported"); } @Override public int size() { return TransactionalBidiTreeMap.this.size(true); } @Override public void clear() { TransactionalBidiTreeMap.this.clear(); } }; } return setOfAllEntries; } }
public class class_name { public FilterableSet<Entry<K,V>> allEntrySet() { if (setOfAllEntries == null) { setOfAllEntries = new AbstractFilterableSet<Entry<K,V>>() { @Override public Iterator<Entry<K,V>> iterator() { return new TransactionalBidiTreeMapIterator<Entry<K,V>>(KEY) { @Override protected Entry<K,V> doGetNext() { return lastReturnedNode; } @Override protected Node<K,V> getNextValidNode(Node<K,V> node, String thread_id) { return node; } }; } //cannot have contains or remove methods //as we have ALL the nodes and so may have duplicates //which are in the provess of being deleted @Override public boolean contains(Object o) { throw new UtilsjException("method not supported"); } @Override public boolean remove(Object o) { throw new UtilsjException("method not supported"); } @Override public int size() { return TransactionalBidiTreeMap.this.size(true); } @Override public void clear() { TransactionalBidiTreeMap.this.clear(); } }; // depends on control dependency: [if], data = [none] } return setOfAllEntries; } }
public class class_name { public static <K,V> void reverse(Map<K,V> source, Map<V,K> target) { Iterator<K> i = source.keySet().iterator(); while (i.hasNext()) { K key = i.next(); V value = source.get(key); target.put(value, key); } } }
public class class_name { public static <K,V> void reverse(Map<K,V> source, Map<V,K> target) { Iterator<K> i = source.keySet().iterator(); while (i.hasNext()) { K key = i.next(); V value = source.get(key); target.put(value, key); // depends on control dependency: [while], data = [none] } } }
public class class_name { public Observable<ServiceResponse<Page<StorageAccountInformationInner>>> listByAccountWithServiceResponseAsync(final String resourceGroupName, final String accountName, final String filter, final Integer top, final Integer skip, final String select, final String orderby, final Boolean count) { return listByAccountSinglePageAsync(resourceGroupName, accountName, filter, top, skip, select, orderby, count) .concatMap(new Func1<ServiceResponse<Page<StorageAccountInformationInner>>, Observable<ServiceResponse<Page<StorageAccountInformationInner>>>>() { @Override public Observable<ServiceResponse<Page<StorageAccountInformationInner>>> call(ServiceResponse<Page<StorageAccountInformationInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByAccountNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public Observable<ServiceResponse<Page<StorageAccountInformationInner>>> listByAccountWithServiceResponseAsync(final String resourceGroupName, final String accountName, final String filter, final Integer top, final Integer skip, final String select, final String orderby, final Boolean count) { return listByAccountSinglePageAsync(resourceGroupName, accountName, filter, top, skip, select, orderby, count) .concatMap(new Func1<ServiceResponse<Page<StorageAccountInformationInner>>, Observable<ServiceResponse<Page<StorageAccountInformationInner>>>>() { @Override public Observable<ServiceResponse<Page<StorageAccountInformationInner>>> call(ServiceResponse<Page<StorageAccountInformationInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); // depends on control dependency: [if], data = [none] } return Observable.just(page).concatWith(listByAccountNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public static Resource[] listResources(Resource[] resources, ResourceFilter filter) { int count = 0; Resource[] children; ArrayList<Resource[]> list = new ArrayList<Resource[]>(); for (int i = 0; i < resources.length; i++) { children = filter == null ? resources[i].listResources() : resources[i].listResources(filter); if (children != null) { count += children.length; list.add(children); } else list.add(new Resource[0]); } Resource[] rtn = new Resource[count]; int index = 0; for (int i = 0; i < resources.length; i++) { children = list.get(i); for (int y = 0; y < children.length; y++) { rtn[index++] = children[y]; } } // print.out(rtn); return rtn; } }
public class class_name { public static Resource[] listResources(Resource[] resources, ResourceFilter filter) { int count = 0; Resource[] children; ArrayList<Resource[]> list = new ArrayList<Resource[]>(); for (int i = 0; i < resources.length; i++) { children = filter == null ? resources[i].listResources() : resources[i].listResources(filter); // depends on control dependency: [for], data = [i] if (children != null) { count += children.length; // depends on control dependency: [if], data = [none] list.add(children); // depends on control dependency: [if], data = [(children] } else list.add(new Resource[0]); } Resource[] rtn = new Resource[count]; int index = 0; for (int i = 0; i < resources.length; i++) { children = list.get(i); // depends on control dependency: [for], data = [i] for (int y = 0; y < children.length; y++) { rtn[index++] = children[y]; // depends on control dependency: [for], data = [y] } } // print.out(rtn); return rtn; } }
public class class_name { public void marshall(GetThirdPartyJobDetailsRequest getThirdPartyJobDetailsRequest, ProtocolMarshaller protocolMarshaller) { if (getThirdPartyJobDetailsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getThirdPartyJobDetailsRequest.getJobId(), JOBID_BINDING); protocolMarshaller.marshall(getThirdPartyJobDetailsRequest.getClientToken(), CLIENTTOKEN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetThirdPartyJobDetailsRequest getThirdPartyJobDetailsRequest, ProtocolMarshaller protocolMarshaller) { if (getThirdPartyJobDetailsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getThirdPartyJobDetailsRequest.getJobId(), JOBID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getThirdPartyJobDetailsRequest.getClientToken(), CLIENTTOKEN_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void getAttributes(TypedArray array) { Resources res = getContext().getResources(); cornerSize = array.getDimensionPixelSize(R.styleable.ChatBalloon_cb_corner_size, -1); if (cornerSize >= 0) { cornerSizeLeftBottom = cornerSize; cornerSizeLeftTop = cornerSize; cornerSizeRightBottom = cornerSize; cornerSizeRightTop = cornerSize; } else { // 默认 int size = res.getDimensionPixelOffset(R.dimen.hlklib_chat_balloon_corner_size); cornerSizeLeftBottom = array.getDimensionPixelSize(R.styleable.ChatBalloon_cb_corner_size_left_bottom, size); cornerSizeLeftTop = array.getDimensionPixelSize(R.styleable.ChatBalloon_cb_corner_size_left_top, size); cornerSizeRightBottom = array.getDimensionPixelSize(R.styleable.ChatBalloon_cb_corner_size_right_bottom, size); cornerSizeRightTop = array.getDimensionPixelSize(R.styleable.ChatBalloon_cb_corner_size_right_top, size); } arrowWidth = array.getDimensionPixelSize(R.styleable.ChatBalloon_cb_arrow_width, res.getDimensionPixelOffset(R.dimen.hlklib_chat_balloon_arrow_width)); arrowHeight = array.getDimensionPixelSize(R.styleable.ChatBalloon_cb_arrow_height, res.getDimensionPixelOffset(R.dimen.hlklib_chat_balloon_arrow_height)); // 箭头默认在右侧上方 arrowSide = array.getInteger(R.styleable.ChatBalloon_cb_arrow_side, RIGHT_TOP); arrowMargin = array.getDimensionPixelOffset(R.styleable.ChatBalloon_cb_arrow_margin, res.getDimensionPixelOffset(R.dimen.hlklib_chat_balloon_arrow_margin)); backgroundNormal = array.getColor(R.styleable.ChatBalloon_cb_background_normal, Color.WHITE); backgroundActive = array.getColor(R.styleable.ChatBalloon_cb_background_active, ContextCompat.getColor(getContext(), R.color.hlklib_chat_balloon_active_color)); borderSize = array.getDimensionPixelSize(R.styleable.ChatBalloon_cb_border_size, res.getDimensionPixelOffset(R.dimen.hlklib_chat_balloon_border_size)); borderNormal = array.getColor(R.styleable.ChatBalloon_cb_border_normal, ContextCompat.getColor(getContext(), R.color.hlklib_chat_balloon_active_color)); borderActive = array.getColor(R.styleable.ChatBalloon_cb_border_active, Color.WHITE); padding = gotExistedPadding(); } }
public class class_name { private void getAttributes(TypedArray array) { Resources res = getContext().getResources(); cornerSize = array.getDimensionPixelSize(R.styleable.ChatBalloon_cb_corner_size, -1); if (cornerSize >= 0) { cornerSizeLeftBottom = cornerSize; // depends on control dependency: [if], data = [none] cornerSizeLeftTop = cornerSize; // depends on control dependency: [if], data = [none] cornerSizeRightBottom = cornerSize; // depends on control dependency: [if], data = [none] cornerSizeRightTop = cornerSize; // depends on control dependency: [if], data = [none] } else { // 默认 int size = res.getDimensionPixelOffset(R.dimen.hlklib_chat_balloon_corner_size); cornerSizeLeftBottom = array.getDimensionPixelSize(R.styleable.ChatBalloon_cb_corner_size_left_bottom, size); // depends on control dependency: [if], data = [none] cornerSizeLeftTop = array.getDimensionPixelSize(R.styleable.ChatBalloon_cb_corner_size_left_top, size); // depends on control dependency: [if], data = [none] cornerSizeRightBottom = array.getDimensionPixelSize(R.styleable.ChatBalloon_cb_corner_size_right_bottom, size); // depends on control dependency: [if], data = [none] cornerSizeRightTop = array.getDimensionPixelSize(R.styleable.ChatBalloon_cb_corner_size_right_top, size); // depends on control dependency: [if], data = [none] } arrowWidth = array.getDimensionPixelSize(R.styleable.ChatBalloon_cb_arrow_width, res.getDimensionPixelOffset(R.dimen.hlklib_chat_balloon_arrow_width)); arrowHeight = array.getDimensionPixelSize(R.styleable.ChatBalloon_cb_arrow_height, res.getDimensionPixelOffset(R.dimen.hlklib_chat_balloon_arrow_height)); // 箭头默认在右侧上方 arrowSide = array.getInteger(R.styleable.ChatBalloon_cb_arrow_side, RIGHT_TOP); arrowMargin = array.getDimensionPixelOffset(R.styleable.ChatBalloon_cb_arrow_margin, res.getDimensionPixelOffset(R.dimen.hlklib_chat_balloon_arrow_margin)); backgroundNormal = array.getColor(R.styleable.ChatBalloon_cb_background_normal, Color.WHITE); backgroundActive = array.getColor(R.styleable.ChatBalloon_cb_background_active, ContextCompat.getColor(getContext(), R.color.hlklib_chat_balloon_active_color)); borderSize = array.getDimensionPixelSize(R.styleable.ChatBalloon_cb_border_size, res.getDimensionPixelOffset(R.dimen.hlklib_chat_balloon_border_size)); borderNormal = array.getColor(R.styleable.ChatBalloon_cb_border_normal, ContextCompat.getColor(getContext(), R.color.hlklib_chat_balloon_active_color)); borderActive = array.getColor(R.styleable.ChatBalloon_cb_border_active, Color.WHITE); padding = gotExistedPadding(); } }
public class class_name { public static UriComponentsBuilder fromHttpUrl(String httpUrl) { Assert.notNull(httpUrl, "'httpUrl' must not be null"); Matcher matcher = HTTP_URL_PATTERN.matcher(httpUrl); if (matcher.matches()) { UriComponentsBuilder builder = new UriComponentsBuilder(); String scheme = matcher.group(1); builder.scheme(scheme != null ? scheme.toLowerCase() : null); builder.userInfo(matcher.group(4)); String host = matcher.group(5); if (StringUtils.hasLength(scheme) && !StringUtils.hasLength(host)) { throw new IllegalArgumentException("[" + httpUrl + "] is not a valid HTTP URL"); } builder.host(host); String port = matcher.group(7); if (StringUtils.hasLength(port)) { builder.port(port); } builder.path(matcher.group(8)); builder.query(matcher.group(10)); return builder; } else { throw new IllegalArgumentException("[" + httpUrl + "] is not a valid HTTP URL"); } } }
public class class_name { public static UriComponentsBuilder fromHttpUrl(String httpUrl) { Assert.notNull(httpUrl, "'httpUrl' must not be null"); Matcher matcher = HTTP_URL_PATTERN.matcher(httpUrl); if (matcher.matches()) { UriComponentsBuilder builder = new UriComponentsBuilder(); String scheme = matcher.group(1); builder.scheme(scheme != null ? scheme.toLowerCase() : null); // depends on control dependency: [if], data = [none] builder.userInfo(matcher.group(4)); // depends on control dependency: [if], data = [none] String host = matcher.group(5); if (StringUtils.hasLength(scheme) && !StringUtils.hasLength(host)) { throw new IllegalArgumentException("[" + httpUrl + "] is not a valid HTTP URL"); } builder.host(host); // depends on control dependency: [if], data = [none] String port = matcher.group(7); if (StringUtils.hasLength(port)) { builder.port(port); // depends on control dependency: [if], data = [none] } builder.path(matcher.group(8)); // depends on control dependency: [if], data = [none] builder.query(matcher.group(10)); // depends on control dependency: [if], data = [none] return builder; // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("[" + httpUrl + "] is not a valid HTTP URL"); } } }
public class class_name { public static void addCookie( HttpServletRequest request, HttpServletResponse response, String cookieName, String value, String comment, int maxAge, boolean secure, boolean contextOnlyPath ) { Cookie newCookie = new Cookie(cookieName, value); if(comment!=null) newCookie.setComment(comment); newCookie.setMaxAge(maxAge); newCookie.setSecure(secure && request.isSecure()); String path; if(contextOnlyPath) { path = request.getContextPath() + "/"; //if(path.length()==0) path = "/"; } else { path = "/"; } newCookie.setPath(path); response.addCookie(newCookie); } }
public class class_name { public static void addCookie( HttpServletRequest request, HttpServletResponse response, String cookieName, String value, String comment, int maxAge, boolean secure, boolean contextOnlyPath ) { Cookie newCookie = new Cookie(cookieName, value); if(comment!=null) newCookie.setComment(comment); newCookie.setMaxAge(maxAge); newCookie.setSecure(secure && request.isSecure()); String path; if(contextOnlyPath) { path = request.getContextPath() + "/"; // depends on control dependency: [if], data = [none] //if(path.length()==0) path = "/"; } else { path = "/"; // depends on control dependency: [if], data = [none] } newCookie.setPath(path); response.addCookie(newCookie); } }
public class class_name { public IndexAttachment withIndexedAttributes(AttributeKeyAndValue... indexedAttributes) { if (this.indexedAttributes == null) { setIndexedAttributes(new java.util.ArrayList<AttributeKeyAndValue>(indexedAttributes.length)); } for (AttributeKeyAndValue ele : indexedAttributes) { this.indexedAttributes.add(ele); } return this; } }
public class class_name { public IndexAttachment withIndexedAttributes(AttributeKeyAndValue... indexedAttributes) { if (this.indexedAttributes == null) { setIndexedAttributes(new java.util.ArrayList<AttributeKeyAndValue>(indexedAttributes.length)); // depends on control dependency: [if], data = [none] } for (AttributeKeyAndValue ele : indexedAttributes) { this.indexedAttributes.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { protected void updateProgressNotification(@NonNull final NotificationCompat.Builder builder, final int progress) { // Add Abort action to the notification if (progress != PROGRESS_ABORTED && progress != PROGRESS_COMPLETED) { final Intent abortIntent = new Intent(BROADCAST_ACTION); abortIntent.putExtra(EXTRA_ACTION, ACTION_ABORT); final PendingIntent pendingAbortIntent = PendingIntent.getBroadcast(this, 1, abortIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.addAction(R.drawable.ic_action_notify_cancel, getString(R.string.dfu_action_abort), pendingAbortIntent); } } }
public class class_name { protected void updateProgressNotification(@NonNull final NotificationCompat.Builder builder, final int progress) { // Add Abort action to the notification if (progress != PROGRESS_ABORTED && progress != PROGRESS_COMPLETED) { final Intent abortIntent = new Intent(BROADCAST_ACTION); abortIntent.putExtra(EXTRA_ACTION, ACTION_ABORT); // depends on control dependency: [if], data = [none] final PendingIntent pendingAbortIntent = PendingIntent.getBroadcast(this, 1, abortIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.addAction(R.drawable.ic_action_notify_cancel, getString(R.string.dfu_action_abort), pendingAbortIntent); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean findInList(byte[] address) { int len = address.length; int a[] = new int[len]; for (int i = 0; i < len; i++) { // convert possible negative byte value to positive int a[i] = address[i] & 0x00FF; } return findInList(a); } }
public class class_name { public boolean findInList(byte[] address) { int len = address.length; int a[] = new int[len]; for (int i = 0; i < len; i++) { // convert possible negative byte value to positive int a[i] = address[i] & 0x00FF; // depends on control dependency: [for], data = [i] } return findInList(a); } }
public class class_name { public static Object getFieldValue(Field field, Object obj) { try { return field.get(obj); } catch (IllegalAccessException e) { throw new IllegalArgumentException(e); } } }
public class class_name { public static Object getFieldValue(Field field, Object obj) { try { return field.get(obj); // depends on control dependency: [try], data = [none] } catch (IllegalAccessException e) { throw new IllegalArgumentException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private Map<String,Object> getSeverityMetrics(AppdynamicsApplication application, String instanceUrl ) { long responseTimeSeverity = 0; long errorRateSeverity = 0; Map<String,Object> severityMetrics = new HashMap<>(); try { // NUMBER OF VIOLATIONS String url = joinURL(instanceUrl, String.format(HEALTH_VIOLATIONS_PATH, application.getAppID())); ResponseEntity<String> responseEntity = makeRestCall(url); String returnJSON = responseEntity.getBody(); JSONParser parser = new JSONParser(); JSONArray array = (JSONArray) parser.parse(returnJSON); for (Object entry : array) { JSONObject jsonEntry = (JSONObject) entry; JSONObject affEntityObj = (JSONObject) jsonEntry.get("affectedEntityDefinition"); String entityType = getString(affEntityObj, "entityType"); if (entityType.equals(BUSINESS_TRANSACTION)) { long severity = getString(jsonEntry, "severity").equals("CRITICAL") ? 2 : 1; if (getString(jsonEntry, "name").equals("Business Transaction error rate is much higher than normal")) { errorRateSeverity = Math.max(errorRateSeverity, severity); } else if (getString(jsonEntry, "name").equals("Business Transaction response time is much higher than normal")) { responseTimeSeverity = Math.max(responseTimeSeverity, severity); } } } } catch (MalformedURLException e) { LOG.error("client exception loading applications", e); } catch (ParseException e) { LOG.error("client exception loading applications", e); } severityMetrics.put(ERROR_RATE_SEVERITY,errorRateSeverity); severityMetrics.put(RESPONSE_TIME_SEVERITY,responseTimeSeverity); return severityMetrics; } }
public class class_name { private Map<String,Object> getSeverityMetrics(AppdynamicsApplication application, String instanceUrl ) { long responseTimeSeverity = 0; long errorRateSeverity = 0; Map<String,Object> severityMetrics = new HashMap<>(); try { // NUMBER OF VIOLATIONS String url = joinURL(instanceUrl, String.format(HEALTH_VIOLATIONS_PATH, application.getAppID())); ResponseEntity<String> responseEntity = makeRestCall(url); String returnJSON = responseEntity.getBody(); JSONParser parser = new JSONParser(); JSONArray array = (JSONArray) parser.parse(returnJSON); for (Object entry : array) { JSONObject jsonEntry = (JSONObject) entry; JSONObject affEntityObj = (JSONObject) jsonEntry.get("affectedEntityDefinition"); String entityType = getString(affEntityObj, "entityType"); if (entityType.equals(BUSINESS_TRANSACTION)) { long severity = getString(jsonEntry, "severity").equals("CRITICAL") ? 2 : 1; if (getString(jsonEntry, "name").equals("Business Transaction error rate is much higher than normal")) { errorRateSeverity = Math.max(errorRateSeverity, severity); // depends on control dependency: [if], data = [none] } else if (getString(jsonEntry, "name").equals("Business Transaction response time is much higher than normal")) { responseTimeSeverity = Math.max(responseTimeSeverity, severity); // depends on control dependency: [if], data = [none] } } } } catch (MalformedURLException e) { LOG.error("client exception loading applications", e); } catch (ParseException e) { // depends on control dependency: [catch], data = [none] LOG.error("client exception loading applications", e); } // depends on control dependency: [catch], data = [none] severityMetrics.put(ERROR_RATE_SEVERITY,errorRateSeverity); severityMetrics.put(RESPONSE_TIME_SEVERITY,responseTimeSeverity); return severityMetrics; } }
public class class_name { public static MediaTimer createTimer () { MediaTimer timer = null; for (String timerClass : PERF_TIMERS) { try { timer = (MediaTimer)Class.forName(timerClass).newInstance(); break; } catch (Throwable t) { // try the next one } } if (timer == null) { log.info("Can't use high performance timer, reverting to " + "System.currentTimeMillis() based timer."); timer = new MillisTimer(); } return timer; } }
public class class_name { public static MediaTimer createTimer () { MediaTimer timer = null; for (String timerClass : PERF_TIMERS) { try { timer = (MediaTimer)Class.forName(timerClass).newInstance(); // depends on control dependency: [try], data = [none] break; } catch (Throwable t) { // try the next one } // depends on control dependency: [catch], data = [none] } if (timer == null) { log.info("Can't use high performance timer, reverting to " + "System.currentTimeMillis() based timer."); // depends on control dependency: [if], data = [none] timer = new MillisTimer(); // depends on control dependency: [if], data = [none] } return timer; } }
public class class_name { private void overrideDatabaseTerminationToken(Map<Object, Object> props) { String overrideTermToken = null; String platformClassName = _dbMgr.getDatabasePlatformClassName(_pui); if (platformClassName != null) { overrideTermToken = platformTerminationToken.get(platformClassName); } if (overrideTermToken != null) { String existing = (String) props.get(PersistenceUnitProperties.TARGET_DATABASE_PROPERTIES); if (existing != null) { existing = existing + ","; } else { existing = ""; } existing = (existing + "StoredProcedureTerminationToken=" + overrideTermToken); props.put(PersistenceUnitProperties.TARGET_DATABASE_PROPERTIES, existing); } } }
public class class_name { private void overrideDatabaseTerminationToken(Map<Object, Object> props) { String overrideTermToken = null; String platformClassName = _dbMgr.getDatabasePlatformClassName(_pui); if (platformClassName != null) { overrideTermToken = platformTerminationToken.get(platformClassName); // depends on control dependency: [if], data = [(platformClassName] } if (overrideTermToken != null) { String existing = (String) props.get(PersistenceUnitProperties.TARGET_DATABASE_PROPERTIES); if (existing != null) { existing = existing + ","; // depends on control dependency: [if], data = [none] } else { existing = ""; // depends on control dependency: [if], data = [none] } existing = (existing + "StoredProcedureTerminationToken=" + overrideTermToken); // depends on control dependency: [if], data = [none] props.put(PersistenceUnitProperties.TARGET_DATABASE_PROPERTIES, existing); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void appendTo( CssFormatter formatter ) { try { switch( super.toString() ) { case "%": format( formatter ); return; case "escape": escape( formatter ); return; case "argb": double color = getDouble( 0, formatter ); int argb = argb( color ); formatter.append( '#' ); formatter.appendHex( argb, 8 ); return; case "svg-gradient": UrlUtils.svgGradient( formatter, parameters ); return; case "colorize-image": CustomFunctions.colorizeImage( formatter, parameters ); return; case "replace": String str = get( 0 ).stringValue( formatter ); formatter.setInlineMode( true ); String pattern = get( 1 ).stringValue( formatter ); String replacement = get( 2 ).stringValue( formatter ); String flags = parameters.size() > 3 ? get( 3 ).stringValue( formatter ) : ""; formatter.setInlineMode( false ); if( str.length() > 1 ) { char ch = str.charAt( 0 ); boolean quote = false; if( ch == '\'' || ch == '\"' ) { if( str.charAt( str.length() - 1 ) == ch ) { str = str.substring( 1, str.length() - 1 ); quote = true; } } str = new RegExp( pattern, flags ).replace( str, replacement ); if( quote ) { str = ch + str + ch; } } formatter.append( str ); return; case "get-unit": formatter.append( unit( formatter ) ); return; case "url": String url = get( 1 ).stringValue( formatter ); String urlStr = UrlUtils.removeQuote( url ); if( formatter.isRewriteUrl( urlStr ) ) { try { String relativeUrlStr = get( 0 ).stringValue( formatter ); URL relativeUrl = new URL( "file", null, relativeUrlStr ); relativeUrl = new URL( relativeUrl, urlStr ); boolean quote = url != urlStr; urlStr = relativeUrl.getPath(); url = quote ? url.charAt( 0 ) + urlStr + url.charAt( 0 ) : urlStr; } catch ( MalformedURLException ex ) { // ignore, occur with data: protocol } } formatter.append( "url(" ); formatter.append( url ); formatter.append( ")" ); return; case "data-uri": String baseUrl = get( 0 ).stringValue( formatter ); String type; if( parameters.size() >= 3 ) { type = get( 1 ).stringValue( formatter ); url = get( 2 ).stringValue( formatter ); } else { type = null; url = get( 1 ).stringValue( formatter ); } UrlUtils.dataUri( formatter, baseUrl, url, type ); return; case "extract": Expression expr = extract( formatter ); if( expr != null ) { expr.appendTo( formatter ); return; } break; case "range": range( formatter ).appendTo( formatter ); return; case "calc": formatter.append( super.toString() ).append( '(' ); SelectorUtils.appendToWithPlaceHolder( formatter, get( 0 ).stringValue( formatter ), 0, false, this ); formatter.append( ')' ); return; case "if": get( get( 0 ).booleanValue( formatter ) ? 1 : 2 ).appendTo( formatter ); return; } if( type == UNKNOWN ) { eval( formatter ); } if( type == STRING ) { if( super.toString().equals( "" ) ) { //parenthesis get( 0 ).appendTo( formatter ); } else { appendToCssFunction( formatter ); } return; } super.appendTo( formatter ); } catch ( Throwable th ) { throw createException( th ); } } }
public class class_name { @Override public void appendTo( CssFormatter formatter ) { try { switch( super.toString() ) { case "%": format( formatter ); return; case "escape": escape( formatter ); return; case "argb": double color = getDouble( 0, formatter ); int argb = argb( color ); formatter.append( '#' ); formatter.appendHex( argb, 8 ); return; case "svg-gradient": UrlUtils.svgGradient( formatter, parameters ); return; case "colorize-image": CustomFunctions.colorizeImage( formatter, parameters ); return; case "replace": String str = get( 0 ).stringValue( formatter ); formatter.setInlineMode( true ); String pattern = get( 1 ).stringValue( formatter ); String replacement = get( 2 ).stringValue( formatter ); String flags = parameters.size() > 3 ? get( 3 ).stringValue( formatter ) : ""; formatter.setInlineMode( false ); if( str.length() > 1 ) { char ch = str.charAt( 0 ); boolean quote = false; if( ch == '\'' || ch == '\"' ) { if( str.charAt( str.length() - 1 ) == ch ) { str = str.substring( 1, str.length() - 1 ); // depends on control dependency: [if], data = [none] quote = true; // depends on control dependency: [if], data = [none] } } str = new RegExp( pattern, flags ).replace( str, replacement ); // depends on control dependency: [if], data = [none] if( quote ) { str = ch + str + ch; // depends on control dependency: [if], data = [none] } } formatter.append( str ); return; case "get-unit": formatter.append( unit( formatter ) ); return; case "url": String url = get( 1 ).stringValue( formatter ); String urlStr = UrlUtils.removeQuote( url ); if( formatter.isRewriteUrl( urlStr ) ) { try { String relativeUrlStr = get( 0 ).stringValue( formatter ); URL relativeUrl = new URL( "file", null, relativeUrlStr ); relativeUrl = new URL( relativeUrl, urlStr ); // depends on control dependency: [try], data = [none] boolean quote = url != urlStr; urlStr = relativeUrl.getPath(); // depends on control dependency: [try], data = [none] url = quote ? url.charAt( 0 ) + urlStr + url.charAt( 0 ) : urlStr; // depends on control dependency: [try], data = [none] } catch ( MalformedURLException ex ) { // ignore, occur with data: protocol } // depends on control dependency: [catch], data = [none] } formatter.append( "url(" ); formatter.append( url ); formatter.append( ")" ); return; case "data-uri": String baseUrl = get( 0 ).stringValue( formatter ); String type; if( parameters.size() >= 3 ) { type = get( 1 ).stringValue( formatter ); // depends on control dependency: [if], data = [none] url = get( 2 ).stringValue( formatter ); // depends on control dependency: [if], data = [none] } else { type = null; // depends on control dependency: [if], data = [none] url = get( 1 ).stringValue( formatter ); // depends on control dependency: [if], data = [none] } UrlUtils.dataUri( formatter, baseUrl, url, type ); return; case "extract": Expression expr = extract( formatter ); if( expr != null ) { expr.appendTo( formatter ); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } break; case "range": range( formatter ).appendTo( formatter ); return; case "calc": formatter.append( super.toString() ).append( '(' ); SelectorUtils.appendToWithPlaceHolder( formatter, get( 0 ).stringValue( formatter ), 0, false, this ); formatter.append( ')' ); return; case "if": get( get( 0 ).booleanValue( formatter ) ? 1 : 2 ).appendTo( formatter ); return; } if( type == UNKNOWN ) { eval( formatter ); // depends on control dependency: [if], data = [none] } if( type == STRING ) { if( super.toString().equals( "" ) ) { //parenthesis get( 0 ).appendTo( formatter ); // depends on control dependency: [if], data = [none] } else { appendToCssFunction( formatter ); // depends on control dependency: [if], data = [none] } return; // depends on control dependency: [if], data = [none] } super.appendTo( formatter ); // depends on control dependency: [try], data = [none] } catch ( Throwable th ) { throw createException( th ); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static DbThreadSession getThreadSession() { DbThreadSession session = (DbThreadSession) ThreadDbSessionHolder.get(); if (session == null) { session = new DbThreadSession(); } return session; } }
public class class_name { public static DbThreadSession getThreadSession() { DbThreadSession session = (DbThreadSession) ThreadDbSessionHolder.get(); if (session == null) { session = new DbThreadSession(); // depends on control dependency: [if], data = [none] } return session; } }
public class class_name { public final void forVarControl() throws RecognitionException { int forVarControl_StartIndex = input.index(); Token id=null; ParserRuleReturnScope variableModifier14 =null; ParserRuleReturnScope type15 =null; try { if ( state.backtracking>0 && alreadyParsedRule(input, 102) ) { return; } // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1073:5: ( ( variableModifier )* type id= Identifier ':' expression ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1073:7: ( variableModifier )* type id= Identifier ':' expression { // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1073:7: ( variableModifier )* loop138: while (true) { int alt138=2; int LA138_0 = input.LA(1); if ( (LA138_0==58||LA138_0==83) ) { alt138=1; } switch (alt138) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1073:9: variableModifier { pushFollow(FOLLOW_variableModifier_in_forVarControl4678); variableModifier14=variableModifier(); state._fsp--; if (state.failed) return; if ( state.backtracking==0 ) { VarDecl_stack.peek().descr.updateStart( ((CommonToken)(variableModifier14!=null?(variableModifier14.start):null)).getStartIndex() - 1 ); VarDecl_stack.peek().descr.addModifier( (variableModifier14!=null?input.toString(variableModifier14.start,variableModifier14.stop):null) ); } } break; default : break loop138; } } pushFollow(FOLLOW_type_in_forVarControl4713); type15=type(); state._fsp--; if (state.failed) return; if ( state.backtracking==0 ) { VarDecl_stack.peek().descr.updateStart( ((CommonToken)(type15!=null?(type15.start):null)).getStartIndex() - 1 ); VarDecl_stack.peek().descr.setType( (type15!=null?input.toString(type15.start,type15.stop):null) ); VarDecl_stack.peek().descr.setEnd( ((CommonToken)(type15!=null?(type15.stop):null)).getStopIndex() ); } id=(Token)match(input,Identifier,FOLLOW_Identifier_in_forVarControl4735); if (state.failed) return; if ( state.backtracking==0 ) { JavaLocalDeclarationDescr.IdentifierDescr ident = new JavaLocalDeclarationDescr.IdentifierDescr(); ident.setIdentifier( (id!=null?id.getText():null) ); ident.setStart( ((CommonToken)id).getStartIndex() - 1 ); ident.setEnd( ((CommonToken)id).getStopIndex() ); VarDecl_stack.peek().descr.addIdentifier( ident ); } match(input,51,FOLLOW_51_in_forVarControl4756); if (state.failed) return; pushFollow(FOLLOW_expression_in_forVarControl4758); expression(); state._fsp--; if (state.failed) return; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 102, forVarControl_StartIndex); } } } }
public class class_name { public final void forVarControl() throws RecognitionException { int forVarControl_StartIndex = input.index(); Token id=null; ParserRuleReturnScope variableModifier14 =null; ParserRuleReturnScope type15 =null; try { if ( state.backtracking>0 && alreadyParsedRule(input, 102) ) { return; } // depends on control dependency: [if], data = [none] // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1073:5: ( ( variableModifier )* type id= Identifier ':' expression ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1073:7: ( variableModifier )* type id= Identifier ':' expression { // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1073:7: ( variableModifier )* loop138: while (true) { int alt138=2; int LA138_0 = input.LA(1); if ( (LA138_0==58||LA138_0==83) ) { alt138=1; // depends on control dependency: [if], data = [none] } switch (alt138) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1073:9: variableModifier { pushFollow(FOLLOW_variableModifier_in_forVarControl4678); variableModifier14=variableModifier(); state._fsp--; if (state.failed) return; if ( state.backtracking==0 ) { VarDecl_stack.peek().descr.updateStart( ((CommonToken)(variableModifier14!=null?(variableModifier14.start):null)).getStartIndex() - 1 ); // depends on control dependency: [if], data = [none] VarDecl_stack.peek().descr.addModifier( (variableModifier14!=null?input.toString(variableModifier14.start,variableModifier14.stop):null) ); // depends on control dependency: [if], data = [none] } } break; default : break loop138; } } pushFollow(FOLLOW_type_in_forVarControl4713); type15=type(); state._fsp--; if (state.failed) return; if ( state.backtracking==0 ) { VarDecl_stack.peek().descr.updateStart( ((CommonToken)(type15!=null?(type15.start):null)).getStartIndex() - 1 ); // depends on control dependency: [if], data = [none] VarDecl_stack.peek().descr.setType( (type15!=null?input.toString(type15.start,type15.stop):null) ); // depends on control dependency: [if], data = [none] VarDecl_stack.peek().descr.setEnd( ((CommonToken)(type15!=null?(type15.stop):null)).getStopIndex() ); // depends on control dependency: [if], data = [none] } id=(Token)match(input,Identifier,FOLLOW_Identifier_in_forVarControl4735); if (state.failed) return; if ( state.backtracking==0 ) { JavaLocalDeclarationDescr.IdentifierDescr ident = new JavaLocalDeclarationDescr.IdentifierDescr(); ident.setIdentifier( (id!=null?id.getText():null) ); // depends on control dependency: [if], data = [none] ident.setStart( ((CommonToken)id).getStartIndex() - 1 ); // depends on control dependency: [if], data = [none] ident.setEnd( ((CommonToken)id).getStopIndex() ); // depends on control dependency: [if], data = [none] VarDecl_stack.peek().descr.addIdentifier( ident ); // depends on control dependency: [if], data = [none] } match(input,51,FOLLOW_51_in_forVarControl4756); if (state.failed) return; pushFollow(FOLLOW_expression_in_forVarControl4758); expression(); state._fsp--; if (state.failed) return; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 102, forVarControl_StartIndex); } // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Serializer getSerializer(Class<?> type) { Class<?> serializable = lookupSerializableType(type); Serializer serializer = serializers.get(serializable); if (serializer == null) { serializer = getInstance().createSerializer(serializable); serializers.put(serializable, serializer); } return serializer; } }
public class class_name { public static Serializer getSerializer(Class<?> type) { Class<?> serializable = lookupSerializableType(type); Serializer serializer = serializers.get(serializable); if (serializer == null) { serializer = getInstance().createSerializer(serializable); // depends on control dependency: [if], data = [none] serializers.put(serializable, serializer); // depends on control dependency: [if], data = [none] } return serializer; } }
public class class_name { public JawrConfigManagerMBean getConfigMgr(String resourceType) { JawrConfigManagerMBean configMgr = null; if (resourceType.equals(JS_TYPE)) { configMgr = jsMBean; } else if (resourceType.equals(CSS_TYPE)) { configMgr = cssMBean; } else if (resourceType.equals(BINARY_TYPE)) { configMgr = binaryMBean; } return configMgr; } }
public class class_name { public JawrConfigManagerMBean getConfigMgr(String resourceType) { JawrConfigManagerMBean configMgr = null; if (resourceType.equals(JS_TYPE)) { configMgr = jsMBean; // depends on control dependency: [if], data = [none] } else if (resourceType.equals(CSS_TYPE)) { configMgr = cssMBean; // depends on control dependency: [if], data = [none] } else if (resourceType.equals(BINARY_TYPE)) { configMgr = binaryMBean; // depends on control dependency: [if], data = [none] } return configMgr; } }
public class class_name { private long getLastModified(URL url, boolean isRetry) throws DownloadFailedException { long timestamp = 0; //TODO use the obtain connection instead of this mostly duplicated code if ("file".equalsIgnoreCase(url.getProtocol())) { final File lastModifiedFile; try { lastModifiedFile = new File(url.toURI()); } catch (URISyntaxException ex) { final String msg = format("Unable to locate '%s'", url.toString()); throw new DownloadFailedException(msg, ex); } timestamp = lastModifiedFile.lastModified(); } else { final String httpMethod = determineHttpMethod(); HttpURLConnection conn = null; try { conn = connFactory.createHttpURLConnection(url); conn.setRequestMethod(httpMethod); conn.connect(); final int t = conn.getResponseCode(); if (t >= 200 && t < 300) { timestamp = conn.getLastModified(); } else { throw new DownloadFailedException(format("%s request returned a non-200 status code: %s", httpMethod, url)); } } catch (URLConnectionFailureException ex) { throw new DownloadFailedException(format("Error creating URL Connection for HTTP %s request: %s", httpMethod, url), ex); } catch (IOException ex) { checkForCommonExceptionTypes(ex); LOGGER.error(format("IO Exception connecting to %s: %s", url, ex.getMessage())); LOGGER.debug("Exception details", ex); if (ex.getCause() != null) { LOGGER.debug("IO Exception cause: " + ex.getCause().getMessage(), ex.getCause()); } try { //retry if (!isRetry && settings.getBoolean(Settings.KEYS.DOWNLOADER_QUICK_QUERY_TIMESTAMP)) { settings.setBoolean(Settings.KEYS.DOWNLOADER_QUICK_QUERY_TIMESTAMP, false); return getLastModified(url, true); } } catch (InvalidSettingException ex1) { LOGGER.debug("invalid setting?", ex1); } throw new DownloadFailedException(format("Error making HTTP %s request to %s", httpMethod, url), ex); } finally { if (conn != null) { try { conn.disconnect(); } finally { conn = null; } } } } return timestamp; } }
public class class_name { private long getLastModified(URL url, boolean isRetry) throws DownloadFailedException { long timestamp = 0; //TODO use the obtain connection instead of this mostly duplicated code if ("file".equalsIgnoreCase(url.getProtocol())) { final File lastModifiedFile; try { lastModifiedFile = new File(url.toURI()); // depends on control dependency: [try], data = [none] } catch (URISyntaxException ex) { final String msg = format("Unable to locate '%s'", url.toString()); throw new DownloadFailedException(msg, ex); } // depends on control dependency: [catch], data = [none] timestamp = lastModifiedFile.lastModified(); } else { final String httpMethod = determineHttpMethod(); HttpURLConnection conn = null; try { conn = connFactory.createHttpURLConnection(url); // depends on control dependency: [try], data = [none] conn.setRequestMethod(httpMethod); // depends on control dependency: [try], data = [none] conn.connect(); // depends on control dependency: [try], data = [none] final int t = conn.getResponseCode(); if (t >= 200 && t < 300) { timestamp = conn.getLastModified(); // depends on control dependency: [if], data = [none] } else { throw new DownloadFailedException(format("%s request returned a non-200 status code: %s", httpMethod, url)); } } catch (URLConnectionFailureException ex) { throw new DownloadFailedException(format("Error creating URL Connection for HTTP %s request: %s", httpMethod, url), ex); } catch (IOException ex) { // depends on control dependency: [catch], data = [none] checkForCommonExceptionTypes(ex); LOGGER.error(format("IO Exception connecting to %s: %s", url, ex.getMessage())); LOGGER.debug("Exception details", ex); if (ex.getCause() != null) { LOGGER.debug("IO Exception cause: " + ex.getCause().getMessage(), ex.getCause()); // depends on control dependency: [if], data = [none] } try { //retry if (!isRetry && settings.getBoolean(Settings.KEYS.DOWNLOADER_QUICK_QUERY_TIMESTAMP)) { settings.setBoolean(Settings.KEYS.DOWNLOADER_QUICK_QUERY_TIMESTAMP, false); // depends on control dependency: [if], data = [none] return getLastModified(url, true); // depends on control dependency: [if], data = [none] } } catch (InvalidSettingException ex1) { LOGGER.debug("invalid setting?", ex1); } // depends on control dependency: [catch], data = [none] throw new DownloadFailedException(format("Error making HTTP %s request to %s", httpMethod, url), ex); } finally { // depends on control dependency: [catch], data = [none] if (conn != null) { try { conn.disconnect(); // depends on control dependency: [try], data = [none] } finally { conn = null; } } } } return timestamp; } }
public class class_name { @Override public void onResult(SendResult result) { if (!result.isOK()) { logger.info("Web socket send failed. Skip send. : Reason={}", result.getException().getLocalizedMessage()); } } }
public class class_name { @Override public void onResult(SendResult result) { if (!result.isOK()) { logger.info("Web socket send failed. Skip send. : Reason={}", result.getException().getLocalizedMessage()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean isBeforeRange(final Range<T> other) { if (other == null) { return false; } return other.lowerEndpoint.isClosed ? isBefore(other.lowerEndpoint.value) : this.upperEndpoint.compareTo(other.lowerEndpoint.value) <= 0; } }
public class class_name { public boolean isBeforeRange(final Range<T> other) { if (other == null) { return false; // depends on control dependency: [if], data = [none] } return other.lowerEndpoint.isClosed ? isBefore(other.lowerEndpoint.value) : this.upperEndpoint.compareTo(other.lowerEndpoint.value) <= 0; } }
public class class_name { public void marshall(DeleteFacesRequest deleteFacesRequest, ProtocolMarshaller protocolMarshaller) { if (deleteFacesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteFacesRequest.getCollectionId(), COLLECTIONID_BINDING); protocolMarshaller.marshall(deleteFacesRequest.getFaceIds(), FACEIDS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteFacesRequest deleteFacesRequest, ProtocolMarshaller protocolMarshaller) { if (deleteFacesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteFacesRequest.getCollectionId(), COLLECTIONID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteFacesRequest.getFaceIds(), FACEIDS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private CmsSearchParameters getSearchParameters(Map<String, String> params) { CmsSearchParameters searchParams = new CmsSearchParameters(); searchParams.setQuery(params.get(PARAM_QUERY)); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(params.get(PARAM_SORT))) { searchParams.setSortName(params.get(PARAM_SORT)); } if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(params.get(PARAM_MINCREATIONDATE))) { searchParams.setMinDateCreated(Long.parseLong(params.get(PARAM_MINCREATIONDATE))); } if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(params.get(PARAM_MAXCREATIONDATE))) { searchParams.setMaxDateCreated(Long.parseLong(params.get(PARAM_MAXCREATIONDATE))); } if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(params.get(PARAM_MINLASTMODIFICATIONDATE))) { searchParams.setMinDateLastModified(Long.parseLong(params.get(PARAM_MINLASTMODIFICATIONDATE))); } if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(params.get(PARAM_MAXLASTMODIFICATIONDATE))) { searchParams.setMaxDateLastModified(Long.parseLong(params.get(PARAM_MAXLASTMODIFICATIONDATE))); } if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(params.get(PARAM_INDEXNAME))) { searchParams.setIndex(params.get(PARAM_INDEXNAME)); } List<String> fields = CmsStringUtil.splitAsList(params.get(PARAM_FIELDS), ','); searchParams.setFields(fields); searchParams.setSearchPage(Integer.parseInt(params.get(I_CmsListResourceCollector.PARAM_PAGE))); return searchParams; } }
public class class_name { private CmsSearchParameters getSearchParameters(Map<String, String> params) { CmsSearchParameters searchParams = new CmsSearchParameters(); searchParams.setQuery(params.get(PARAM_QUERY)); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(params.get(PARAM_SORT))) { searchParams.setSortName(params.get(PARAM_SORT)); // depends on control dependency: [if], data = [none] } if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(params.get(PARAM_MINCREATIONDATE))) { searchParams.setMinDateCreated(Long.parseLong(params.get(PARAM_MINCREATIONDATE))); // depends on control dependency: [if], data = [none] } if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(params.get(PARAM_MAXCREATIONDATE))) { searchParams.setMaxDateCreated(Long.parseLong(params.get(PARAM_MAXCREATIONDATE))); // depends on control dependency: [if], data = [none] } if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(params.get(PARAM_MINLASTMODIFICATIONDATE))) { searchParams.setMinDateLastModified(Long.parseLong(params.get(PARAM_MINLASTMODIFICATIONDATE))); // depends on control dependency: [if], data = [none] } if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(params.get(PARAM_MAXLASTMODIFICATIONDATE))) { searchParams.setMaxDateLastModified(Long.parseLong(params.get(PARAM_MAXLASTMODIFICATIONDATE))); // depends on control dependency: [if], data = [none] } if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(params.get(PARAM_INDEXNAME))) { searchParams.setIndex(params.get(PARAM_INDEXNAME)); // depends on control dependency: [if], data = [none] } List<String> fields = CmsStringUtil.splitAsList(params.get(PARAM_FIELDS), ','); searchParams.setFields(fields); searchParams.setSearchPage(Integer.parseInt(params.get(I_CmsListResourceCollector.PARAM_PAGE))); return searchParams; } }
public class class_name { protected ParserRuleContext getParentSourceElement(ParserRuleContext node) { if (node == null) return null; ParserRuleContext parent = node.getParent(); if (parent instanceof QueryParser.SourceElementContext) { return parent; } return getParentSourceElement(parent); } }
public class class_name { protected ParserRuleContext getParentSourceElement(ParserRuleContext node) { if (node == null) return null; ParserRuleContext parent = node.getParent(); if (parent instanceof QueryParser.SourceElementContext) { return parent; // depends on control dependency: [if], data = [none] } return getParentSourceElement(parent); } }
public class class_name { public static Map<String, CmsJspObjectValueWrapper> wrapSettings(CmsObject cms, Map<String, String> settings) { Map<String, CmsJspObjectValueWrapper> wrappedSettings = null; if (settings != null) { wrappedSettings = new HashMap<String, CmsJspObjectValueWrapper>(settings.size()); for (Entry<String, String> setting : settings.entrySet()) { wrappedSettings.put(setting.getKey(), CmsJspObjectValueWrapper.createWrapper(cms, setting.getValue())); } } return wrappedSettings; } }
public class class_name { public static Map<String, CmsJspObjectValueWrapper> wrapSettings(CmsObject cms, Map<String, String> settings) { Map<String, CmsJspObjectValueWrapper> wrappedSettings = null; if (settings != null) { wrappedSettings = new HashMap<String, CmsJspObjectValueWrapper>(settings.size()); // depends on control dependency: [if], data = [(settings] for (Entry<String, String> setting : settings.entrySet()) { wrappedSettings.put(setting.getKey(), CmsJspObjectValueWrapper.createWrapper(cms, setting.getValue())); // depends on control dependency: [for], data = [setting] } } return wrappedSettings; } }
public class class_name { public static TableModel[] entity2EditableModels(Class<?>... entityClasses) { List<TableModel> l = new ArrayList<TableModel>(); for (Class<?> clazz : entityClasses) { l.add(entity2EditableModel(clazz)); } return l.toArray(new TableModel[l.size()]); } }
public class class_name { public static TableModel[] entity2EditableModels(Class<?>... entityClasses) { List<TableModel> l = new ArrayList<TableModel>(); for (Class<?> clazz : entityClasses) { l.add(entity2EditableModel(clazz)); // depends on control dependency: [for], data = [clazz] } return l.toArray(new TableModel[l.size()]); } }
public class class_name { public EClass getIfcProjectionCurve() { if (ifcProjectionCurveEClass == null) { ifcProjectionCurveEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(395); } return ifcProjectionCurveEClass; } }
public class class_name { public EClass getIfcProjectionCurve() { if (ifcProjectionCurveEClass == null) { ifcProjectionCurveEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(395); // depends on control dependency: [if], data = [none] } return ifcProjectionCurveEClass; } }
public class class_name { public Duration getWorkVariance() { Duration variance = (Duration) getCachedValue(ResourceField.WORK_VARIANCE); if (variance == null) { Duration work = getWork(); Duration baselineWork = getBaselineWork(); if (work != null && baselineWork != null) { variance = Duration.getInstance(work.getDuration() - baselineWork.convertUnits(work.getUnits(), getParentFile().getProjectProperties()).getDuration(), work.getUnits()); set(ResourceField.WORK_VARIANCE, variance); } } return (variance); } }
public class class_name { public Duration getWorkVariance() { Duration variance = (Duration) getCachedValue(ResourceField.WORK_VARIANCE); if (variance == null) { Duration work = getWork(); Duration baselineWork = getBaselineWork(); if (work != null && baselineWork != null) { variance = Duration.getInstance(work.getDuration() - baselineWork.convertUnits(work.getUnits(), getParentFile().getProjectProperties()).getDuration(), work.getUnits()); // depends on control dependency: [if], data = [(work] set(ResourceField.WORK_VARIANCE, variance); // depends on control dependency: [if], data = [none] } } return (variance); } }
public class class_name { private void registerRequirement(RuntimeRequirementRegistration requirement) { assert writeLock.isHeldByCurrentThread(); CapabilityId dependentId = requirement.getDependentId(); if (!capabilities.containsKey(dependentId)) { throw ControllerLogger.MGMT_OP_LOGGER.unknownCapabilityInContext(dependentId.getName(), dependentId.getScope().getName()); } Map<CapabilityId, Map<String, RuntimeRequirementRegistration>> requirementMap = requirement.isRuntimeOnly() ? runtimeOnlyRequirements : requirements; Map<String, RuntimeRequirementRegistration> dependents = requirementMap.get(dependentId); if (dependents == null) { dependents = new HashMap<>(); requirementMap.put(dependentId, dependents); } RuntimeRequirementRegistration existing = dependents.get(requirement.getRequiredName()); if (existing == null) { dependents.put(requirement.getRequiredName(), requirement); } else { existing.addRegistrationPoint(requirement.getOldestRegistrationPoint()); } modified = true; } }
public class class_name { private void registerRequirement(RuntimeRequirementRegistration requirement) { assert writeLock.isHeldByCurrentThread(); CapabilityId dependentId = requirement.getDependentId(); if (!capabilities.containsKey(dependentId)) { throw ControllerLogger.MGMT_OP_LOGGER.unknownCapabilityInContext(dependentId.getName(), dependentId.getScope().getName()); } Map<CapabilityId, Map<String, RuntimeRequirementRegistration>> requirementMap = requirement.isRuntimeOnly() ? runtimeOnlyRequirements : requirements; Map<String, RuntimeRequirementRegistration> dependents = requirementMap.get(dependentId); if (dependents == null) { dependents = new HashMap<>(); // depends on control dependency: [if], data = [none] requirementMap.put(dependentId, dependents); // depends on control dependency: [if], data = [none] } RuntimeRequirementRegistration existing = dependents.get(requirement.getRequiredName()); if (existing == null) { dependents.put(requirement.getRequiredName(), requirement); // depends on control dependency: [if], data = [none] } else { existing.addRegistrationPoint(requirement.getOldestRegistrationPoint()); // depends on control dependency: [if], data = [none] } modified = true; } }
public class class_name { public synchronized String apply(GenericMediaElement shaper, MediaType type) throws OpenViduException { String id = shaper.getId(); if (id == null) { throw new OpenViduException(Code.MEDIA_WEBRTC_ENDPOINT_ERROR_CODE, "Unable to connect media element with null id"); } if (elements.containsKey(id)) { throw new OpenViduException(Code.MEDIA_WEBRTC_ENDPOINT_ERROR_CODE, "This endpoint already has a media element with id " + id); } MediaElement first = null; if (!elementIds.isEmpty()) { first = elements.get(elementIds.getFirst()); } if (connected) { if (first != null) { internalSinkConnect(first, shaper, type); } else { internalSinkConnect(this.getEndpoint(), shaper, type); } internalSinkConnect(shaper, passThru, type); } elementIds.addFirst(id); elements.put(id, shaper); this.filter = shaper; elementsErrorSubscriptions.put(id, registerElemErrListener(shaper)); return id; } }
public class class_name { public synchronized String apply(GenericMediaElement shaper, MediaType type) throws OpenViduException { String id = shaper.getId(); if (id == null) { throw new OpenViduException(Code.MEDIA_WEBRTC_ENDPOINT_ERROR_CODE, "Unable to connect media element with null id"); } if (elements.containsKey(id)) { throw new OpenViduException(Code.MEDIA_WEBRTC_ENDPOINT_ERROR_CODE, "This endpoint already has a media element with id " + id); } MediaElement first = null; if (!elementIds.isEmpty()) { first = elements.get(elementIds.getFirst()); } if (connected) { if (first != null) { internalSinkConnect(first, shaper, type); // depends on control dependency: [if], data = [(first] } else { internalSinkConnect(this.getEndpoint(), shaper, type); // depends on control dependency: [if], data = [none] } internalSinkConnect(shaper, passThru, type); } elementIds.addFirst(id); elements.put(id, shaper); this.filter = shaper; elementsErrorSubscriptions.put(id, registerElemErrListener(shaper)); return id; } }
public class class_name { public static void multColumns(DMatrixSparseCSC A , double []values , int offset) { if( values.length+offset < A.numCols ) throw new IllegalArgumentException("Array is too small. "+values.length+" < "+A.numCols); for (int i = 0; i < A.numCols; i++) { int idx0 = A.col_idx[i]; int idx1 = A.col_idx[i+1]; double v = values[offset+i]; for (int j = idx0; j < idx1; j++) { A.nz_values[j] *= v; } } } }
public class class_name { public static void multColumns(DMatrixSparseCSC A , double []values , int offset) { if( values.length+offset < A.numCols ) throw new IllegalArgumentException("Array is too small. "+values.length+" < "+A.numCols); for (int i = 0; i < A.numCols; i++) { int idx0 = A.col_idx[i]; int idx1 = A.col_idx[i+1]; double v = values[offset+i]; for (int j = idx0; j < idx1; j++) { A.nz_values[j] *= v; // depends on control dependency: [for], data = [j] } } } }
public class class_name { public boolean isStop() { if (this.scannerParam.getMaxScanDurationInMins() > 0) { if (System.currentTimeMillis() - this.hostProcessStartTime > TimeUnit.MINUTES.toMillis(this.scannerParam.getMaxScanDurationInMins())) { this.stopReason = Constant.messages.getString("ascan.progress.label.skipped.reason.maxScan"); this.stop(); } } return (isStop || parentScanner.isStop()); } }
public class class_name { public boolean isStop() { if (this.scannerParam.getMaxScanDurationInMins() > 0) { if (System.currentTimeMillis() - this.hostProcessStartTime > TimeUnit.MINUTES.toMillis(this.scannerParam.getMaxScanDurationInMins())) { this.stopReason = Constant.messages.getString("ascan.progress.label.skipped.reason.maxScan"); this.stop(); // depends on control dependency: [if], data = [none] } } return (isStop || parentScanner.isStop()); } }
public class class_name { protected void bindViewHelper(BaseViewHolder viewHolder) { Context ctx = viewHolder.itemView.getContext(); //set the identifier from the drawerItem here. It can be used to run tests viewHolder.itemView.setId(hashCode()); //set the item selected if it is viewHolder.itemView.setSelected(isSelected()); //set the item enabled if it is viewHolder.itemView.setEnabled(isEnabled()); //get the correct color for the background int selectedColor = getSelectedColor(ctx); //get the correct color for the text int color = getColor(ctx); ColorStateList selectedTextColor = getTextColorStateList(color, getSelectedTextColor(ctx)); //get the correct color for the icon int iconColor = getIconColor(ctx); int selectedIconColor = getSelectedIconColor(ctx); //set the background for the item themeDrawerItem(ctx, viewHolder.view, selectedColor, isSelectedBackgroundAnimated()); //set the text for the name StringHolder.applyTo(this.getName(), viewHolder.name); //set the text for the description or hide StringHolder.applyToOrHide(this.getDescription(), viewHolder.description); //set the colors for textViews viewHolder.name.setTextColor(selectedTextColor); //set the description text color ColorHolder.applyToOr(getDescriptionTextColor(), viewHolder.description, selectedTextColor); //define the typeface for our textViews if (getTypeface() != null) { viewHolder.name.setTypeface(getTypeface()); viewHolder.description.setTypeface(getTypeface()); } //get the drawables for our icon and set it Drawable icon = ImageHolder.decideIcon(getIcon(), ctx, iconColor, isIconTinted(), 1); if (icon != null) { Drawable selectedIcon = ImageHolder.decideIcon(getSelectedIcon(), ctx, selectedIconColor, isIconTinted(), 1); ImageHolder.applyMultiIconTo(icon, iconColor, selectedIcon, selectedIconColor, isIconTinted(), viewHolder.icon); } else { ImageHolder.applyDecidedIconOrSetGone(getIcon(), viewHolder.icon, iconColor, isIconTinted(), 1); } //for android API 17 --> Padding not applied via xml DrawerUIUtils.setDrawerVerticalPadding(viewHolder.view, level); } }
public class class_name { protected void bindViewHelper(BaseViewHolder viewHolder) { Context ctx = viewHolder.itemView.getContext(); //set the identifier from the drawerItem here. It can be used to run tests viewHolder.itemView.setId(hashCode()); //set the item selected if it is viewHolder.itemView.setSelected(isSelected()); //set the item enabled if it is viewHolder.itemView.setEnabled(isEnabled()); //get the correct color for the background int selectedColor = getSelectedColor(ctx); //get the correct color for the text int color = getColor(ctx); ColorStateList selectedTextColor = getTextColorStateList(color, getSelectedTextColor(ctx)); //get the correct color for the icon int iconColor = getIconColor(ctx); int selectedIconColor = getSelectedIconColor(ctx); //set the background for the item themeDrawerItem(ctx, viewHolder.view, selectedColor, isSelectedBackgroundAnimated()); //set the text for the name StringHolder.applyTo(this.getName(), viewHolder.name); //set the text for the description or hide StringHolder.applyToOrHide(this.getDescription(), viewHolder.description); //set the colors for textViews viewHolder.name.setTextColor(selectedTextColor); //set the description text color ColorHolder.applyToOr(getDescriptionTextColor(), viewHolder.description, selectedTextColor); //define the typeface for our textViews if (getTypeface() != null) { viewHolder.name.setTypeface(getTypeface()); // depends on control dependency: [if], data = [(getTypeface()] viewHolder.description.setTypeface(getTypeface()); // depends on control dependency: [if], data = [(getTypeface()] } //get the drawables for our icon and set it Drawable icon = ImageHolder.decideIcon(getIcon(), ctx, iconColor, isIconTinted(), 1); if (icon != null) { Drawable selectedIcon = ImageHolder.decideIcon(getSelectedIcon(), ctx, selectedIconColor, isIconTinted(), 1); ImageHolder.applyMultiIconTo(icon, iconColor, selectedIcon, selectedIconColor, isIconTinted(), viewHolder.icon); // depends on control dependency: [if], data = [(icon] } else { ImageHolder.applyDecidedIconOrSetGone(getIcon(), viewHolder.icon, iconColor, isIconTinted(), 1); // depends on control dependency: [if], data = [none] } //for android API 17 --> Padding not applied via xml DrawerUIUtils.setDrawerVerticalPadding(viewHolder.view, level); } }
public class class_name { private BaseDescr lhsOr(final CEDescrBuilder<?, ?> ce, boolean allowOr) throws RecognitionException { BaseDescr result = null; if (allowOr && input.LA(1) == DRL6Lexer.LEFT_PAREN && helper.validateLT(2, DroolsSoftKeywords.OR)) { // prefixed OR CEDescrBuilder<?, OrDescr> or = null; if (state.backtracking == 0) { or = ce.or(); result = or.getDescr(); helper.start(or, CEDescrBuilder.class, null); } try { match(input, DRL6Lexer.LEFT_PAREN, null, null, DroolsEditorType.SYMBOL); if (state.failed) return null; match(input, DRL6Lexer.ID, DroolsSoftKeywords.OR, null, DroolsEditorType.KEYWORD); if (state.failed) return null; if (state.backtracking == 0) { helper.emit(Location.LOCATION_LHS_BEGIN_OF_CONDITION_AND_OR); } while (input.LA(1) != DRL6Lexer.RIGHT_PAREN) { lhsAnd(or, allowOr); if (state.failed) return null; } match(input, DRL6Lexer.RIGHT_PAREN, null, null, DroolsEditorType.SYMBOL); if (state.failed) return null; } finally { if (state.backtracking == 0) { helper.end(CEDescrBuilder.class, or); } } } else { // infix OR // create an OR anyway, as if it is not an OR we remove it later CEDescrBuilder<?, OrDescr> or = null; if (state.backtracking == 0) { or = ce.or(); result = or.getDescr(); helper.start(or, CEDescrBuilder.class, null); } try { lhsAnd(or, allowOr); if (state.failed) return null; if (allowOr && (helper.validateIdentifierKey(DroolsSoftKeywords.OR) || input.LA(1) == DRL6Lexer.DOUBLE_PIPE)) { while (helper.validateIdentifierKey(DroolsSoftKeywords.OR) || input.LA(1) == DRL6Lexer.DOUBLE_PIPE) { if (input.LA(1) == DRL6Lexer.DOUBLE_PIPE) { match(input, DRL6Lexer.DOUBLE_PIPE, null, null, DroolsEditorType.SYMBOL); } else { match(input, DRL6Lexer.ID, DroolsSoftKeywords.OR, null, DroolsEditorType.KEYWORD); } if (state.failed) return null; if (state.backtracking == 0) { helper.emit(Location.LOCATION_LHS_BEGIN_OF_CONDITION_AND_OR); } lhsAnd(or, allowOr); if (state.failed) return null; } } else if (allowOr) { if (state.backtracking == 0) { // if no OR present, then remove it and add children to parent ((ConditionalElementDescr) ce.getDescr()).getDescrs().remove(or.getDescr()); for (BaseDescr base : or.getDescr().getDescrs()) { ((ConditionalElementDescr) ce.getDescr()).addDescr(base); } result = ce.getDescr(); } } } finally { if (state.backtracking == 0) { helper.end(CEDescrBuilder.class, or); } } } return result; } }
public class class_name { private BaseDescr lhsOr(final CEDescrBuilder<?, ?> ce, boolean allowOr) throws RecognitionException { BaseDescr result = null; if (allowOr && input.LA(1) == DRL6Lexer.LEFT_PAREN && helper.validateLT(2, DroolsSoftKeywords.OR)) { // prefixed OR CEDescrBuilder<?, OrDescr> or = null; if (state.backtracking == 0) { or = ce.or(); // depends on control dependency: [if], data = [none] result = or.getDescr(); // depends on control dependency: [if], data = [none] helper.start(or, CEDescrBuilder.class, null); // depends on control dependency: [if], data = [none] } try { match(input, DRL6Lexer.LEFT_PAREN, null, null, DroolsEditorType.SYMBOL); // depends on control dependency: [try], data = [none] if (state.failed) return null; match(input, DRL6Lexer.ID, DroolsSoftKeywords.OR, null, DroolsEditorType.KEYWORD); // depends on control dependency: [try], data = [none] if (state.failed) return null; if (state.backtracking == 0) { helper.emit(Location.LOCATION_LHS_BEGIN_OF_CONDITION_AND_OR); // depends on control dependency: [if], data = [none] } while (input.LA(1) != DRL6Lexer.RIGHT_PAREN) { lhsAnd(or, allowOr); // depends on control dependency: [while], data = [none] if (state.failed) return null; } match(input, DRL6Lexer.RIGHT_PAREN, null, null, DroolsEditorType.SYMBOL); // depends on control dependency: [try], data = [none] if (state.failed) return null; } finally { if (state.backtracking == 0) { helper.end(CEDescrBuilder.class, or); // depends on control dependency: [if], data = [none] } } } else { // infix OR // create an OR anyway, as if it is not an OR we remove it later CEDescrBuilder<?, OrDescr> or = null; if (state.backtracking == 0) { or = ce.or(); // depends on control dependency: [if], data = [none] result = or.getDescr(); // depends on control dependency: [if], data = [none] helper.start(or, CEDescrBuilder.class, null); // depends on control dependency: [if], data = [none] } try { lhsAnd(or, allowOr); // depends on control dependency: [try], data = [none] if (state.failed) return null; if (allowOr && (helper.validateIdentifierKey(DroolsSoftKeywords.OR) || input.LA(1) == DRL6Lexer.DOUBLE_PIPE)) { while (helper.validateIdentifierKey(DroolsSoftKeywords.OR) || input.LA(1) == DRL6Lexer.DOUBLE_PIPE) { if (input.LA(1) == DRL6Lexer.DOUBLE_PIPE) { match(input, DRL6Lexer.DOUBLE_PIPE, null, null, DroolsEditorType.SYMBOL); // depends on control dependency: [if], data = [none] } else { match(input, DRL6Lexer.ID, DroolsSoftKeywords.OR, null, DroolsEditorType.KEYWORD); // depends on control dependency: [if], data = [none] } if (state.failed) return null; if (state.backtracking == 0) { helper.emit(Location.LOCATION_LHS_BEGIN_OF_CONDITION_AND_OR); // depends on control dependency: [if], data = [none] } lhsAnd(or, allowOr); // depends on control dependency: [while], data = [none] if (state.failed) return null; } } else if (allowOr) { if (state.backtracking == 0) { // if no OR present, then remove it and add children to parent ((ConditionalElementDescr) ce.getDescr()).getDescrs().remove(or.getDescr()); // depends on control dependency: [if], data = [none] for (BaseDescr base : or.getDescr().getDescrs()) { ((ConditionalElementDescr) ce.getDescr()).addDescr(base); // depends on control dependency: [for], data = [base] } result = ce.getDescr(); // depends on control dependency: [if], data = [none] } } } finally { if (state.backtracking == 0) { helper.end(CEDescrBuilder.class, or); // depends on control dependency: [if], data = [none] } } } return result; } }
public class class_name { private UpdateResult insert(V item, Node node) { UpdateResult result; if (node == null) { // This is the right location for the item, but there's no node. Create one. result = new UpdateResult(); result.node = new Node(item); this.size++; this.modCount++; } else { long itemKey = item.key(); long nodeKey = node.item.key(); if (itemKey < nodeKey) { // New item is smaller than the current node's item; move to the left child. result = insert(item, node.left); node.left = result.node; } else if (itemKey > nodeKey) { // New item is larger than the current node's item; move to the right child. result = insert(item, node.right); node.right = result.node; } else { // Node already exists. Save the existing node's item and return it. result = new UpdateResult(); result.updatedItem = node.item; node.item = item; } // Rebalance the sub-tree, if necessary. result.node = balance(node); } return result; } }
public class class_name { private UpdateResult insert(V item, Node node) { UpdateResult result; if (node == null) { // This is the right location for the item, but there's no node. Create one. result = new UpdateResult(); // depends on control dependency: [if], data = [none] result.node = new Node(item); // depends on control dependency: [if], data = [none] this.size++; // depends on control dependency: [if], data = [none] this.modCount++; // depends on control dependency: [if], data = [none] } else { long itemKey = item.key(); long nodeKey = node.item.key(); if (itemKey < nodeKey) { // New item is smaller than the current node's item; move to the left child. result = insert(item, node.left); // depends on control dependency: [if], data = [none] node.left = result.node; // depends on control dependency: [if], data = [none] } else if (itemKey > nodeKey) { // New item is larger than the current node's item; move to the right child. result = insert(item, node.right); // depends on control dependency: [if], data = [none] node.right = result.node; // depends on control dependency: [if], data = [none] } else { // Node already exists. Save the existing node's item and return it. result = new UpdateResult(); // depends on control dependency: [if], data = [none] result.updatedItem = node.item; // depends on control dependency: [if], data = [none] node.item = item; // depends on control dependency: [if], data = [none] } // Rebalance the sub-tree, if necessary. result.node = balance(node); // depends on control dependency: [if], data = [(node] } return result; } }
public class class_name { public GridBagLayoutBuilder appendSeparator(String labelKey) { if (this.currentRowList.size() > 0) { nextLine(); } final JComponent separator = getComponentFactory().createLabeledSeparator(labelKey); return append(separator, 1, 1, true, false).nextLine(); } }
public class class_name { public GridBagLayoutBuilder appendSeparator(String labelKey) { if (this.currentRowList.size() > 0) { nextLine(); // depends on control dependency: [if], data = [none] } final JComponent separator = getComponentFactory().createLabeledSeparator(labelKey); return append(separator, 1, 1, true, false).nextLine(); } }
public class class_name { public void generateOutput() throws IOException { HttpServletResponse res = CmsFlexController.getController(getJsp().getRequest()).getTopResponse(); res.setContentType("application/octet-stream"); res.setHeader( "Content-Disposition", new StringBuffer("attachment; filename=\"").append(getDownloadFile().getName()).append("\"").toString()); res.setContentLength((int)getDownloadFile().length()); // getOutputStream() throws IllegalStateException if the jsp directive buffer="none" is set. ServletOutputStream outStream = res.getOutputStream(); InputStream in = new BufferedInputStream(new FileInputStream(getDownloadFile())); try { // don't write the last '-1' int bit = in.read(); while ((bit) >= 0) { outStream.write(bit); bit = in.read(); } } catch (SocketException soe) { // this is the case for ie if cancel in download window is chosen: // "Connection reset by peer: socket write error". But not for firefox -> don't care } finally { if (outStream != null) { try { outStream.flush(); outStream.close(); } catch (SocketException soe) { // ignore } } in.close(); } } }
public class class_name { public void generateOutput() throws IOException { HttpServletResponse res = CmsFlexController.getController(getJsp().getRequest()).getTopResponse(); res.setContentType("application/octet-stream"); res.setHeader( "Content-Disposition", new StringBuffer("attachment; filename=\"").append(getDownloadFile().getName()).append("\"").toString()); res.setContentLength((int)getDownloadFile().length()); // getOutputStream() throws IllegalStateException if the jsp directive buffer="none" is set. ServletOutputStream outStream = res.getOutputStream(); InputStream in = new BufferedInputStream(new FileInputStream(getDownloadFile())); try { // don't write the last '-1' int bit = in.read(); while ((bit) >= 0) { outStream.write(bit); // depends on control dependency: [while], data = [none] bit = in.read(); // depends on control dependency: [while], data = [none] } } catch (SocketException soe) { // this is the case for ie if cancel in download window is chosen: // "Connection reset by peer: socket write error". But not for firefox -> don't care } finally { if (outStream != null) { try { outStream.flush(); // depends on control dependency: [try], data = [none] outStream.close(); // depends on control dependency: [try], data = [none] } catch (SocketException soe) { // ignore } // depends on control dependency: [catch], data = [none] } in.close(); } } }
public class class_name { public Boolean findBooleanValue(JvmAnnotationTarget op, Class<? extends Annotation> annotationType) { final JvmAnnotationReference reference = this.lookup.findAnnotation(op, annotationType); if (reference != null) { return findBooleanValue(reference); } return null; } }
public class class_name { public Boolean findBooleanValue(JvmAnnotationTarget op, Class<? extends Annotation> annotationType) { final JvmAnnotationReference reference = this.lookup.findAnnotation(op, annotationType); if (reference != null) { return findBooleanValue(reference); // depends on control dependency: [if], data = [(reference] } return null; } }
public class class_name { public int crawl(String catUrl, CancelTask task, PrintWriter out, Object context) { InvCatalogFactory catFactory = InvCatalogFactory.getDefaultFactory(true); InvCatalogImpl cat = catFactory.readXML(catUrl); StringBuilder buff = new StringBuilder(); boolean isValid = cat.check(buff, false); if (out != null) { out.println("catalog <" + cat.getName() + "> " + (isValid ? "is" : "is not") + " valid"); out.println(" validation output=\n" + buff); } if (isValid) return crawl(cat, task, out, context); return 0; } }
public class class_name { public int crawl(String catUrl, CancelTask task, PrintWriter out, Object context) { InvCatalogFactory catFactory = InvCatalogFactory.getDefaultFactory(true); InvCatalogImpl cat = catFactory.readXML(catUrl); StringBuilder buff = new StringBuilder(); boolean isValid = cat.check(buff, false); if (out != null) { out.println("catalog <" + cat.getName() + "> " + (isValid ? "is" : "is not") + " valid"); // depends on control dependency: [if], data = [none] out.println(" validation output=\n" + buff); // depends on control dependency: [if], data = [none] } if (isValid) return crawl(cat, task, out, context); return 0; } }
public class class_name { public boolean removeAnycastInputHandlerAndRCD(String key) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "removeAnycastInputHandlerAndRCD", key); AnycastInputHandler aih = _anycastInputHandlers.get(key); AIContainerItemStream aiContainerItemStream = _aiContainerItemStreams.get(key); PtoPMessageItemStream rcdItemStream = _rcdItemStreams.get(key); boolean removed = true; if (aih != null) { boolean removeAIH = true; try { LocalTransaction tran = null; // 216208 Need to remove the RCD's item stream in case there are unassigned // messages; the transaction needs to commit to allow the AIMessageItems to // reject on postCommitRemove called by reallocateMsgs if (rcdItemStream != null) { /** // not really reallocate, just remove all items // this should actually not find any items to remove if (rcdItemStream.reallocateMsgs()) { siTran = txManager.createLocalTransaction(); rcdItemStream.remove(siTran, NO_LOCK_ID); siTran.commit(); // only now is it safe to remove the table entry rcdItemStreams.remove(dmeId); } else { removeAIH = false; removed = false; } */ tran = _baseDestinationHandler.getTransactionManager().createLocalTransaction(true); rcdItemStream.remove((Transaction) tran, AbstractItem.NO_LOCK_ID); tran.commit(); // only now is it safe to remove the table entry _rcdItemStreams.remove(key); } if (removeAIH) { /** This is not necessary any more, as our callers call either * aih.forceFlushAtTarget or aih.destinationDeleted first, which * will result in aih.delete called // At this point there should not be any messages and thus no V/U aih.delete(); */ if (aiContainerItemStream != null) { tran = _baseDestinationHandler.getTransactionManager().createLocalTransaction(true); // aih.delete removed the completed prefix and protocol item stream inside of aiContainerItemStream // so it's ok to remove the container item stream now aiContainerItemStream.remove((Transaction) tran, AbstractItem.NO_LOCK_ID); tran.commit(); // only now is it safe to remove the table entry _aiContainerItemStreams.remove(key); } // only now is it safe to remove the table entry _anycastInputHandlers.remove(key); } } catch (Exception e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.destination.AbstractRemoteSupport.removeAnycastInputHandlerAndRCD", "1:1096:1.25", this); SibTr.exception(tc, e); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeAnycastInputHandlerAndRCD", e); throw new SIResourceException(e); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeAnycastInputHandlerAndRCD", Boolean.valueOf(removed)); return removed; } }
public class class_name { public boolean removeAnycastInputHandlerAndRCD(String key) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "removeAnycastInputHandlerAndRCD", key); AnycastInputHandler aih = _anycastInputHandlers.get(key); AIContainerItemStream aiContainerItemStream = _aiContainerItemStreams.get(key); PtoPMessageItemStream rcdItemStream = _rcdItemStreams.get(key); boolean removed = true; if (aih != null) { boolean removeAIH = true; try { LocalTransaction tran = null; // 216208 Need to remove the RCD's item stream in case there are unassigned // messages; the transaction needs to commit to allow the AIMessageItems to // reject on postCommitRemove called by reallocateMsgs if (rcdItemStream != null) { /** // not really reallocate, just remove all items // this should actually not find any items to remove if (rcdItemStream.reallocateMsgs()) { siTran = txManager.createLocalTransaction(); rcdItemStream.remove(siTran, NO_LOCK_ID); siTran.commit(); // only now is it safe to remove the table entry rcdItemStreams.remove(dmeId); } else { removeAIH = false; removed = false; } */ tran = _baseDestinationHandler.getTransactionManager().createLocalTransaction(true); // depends on control dependency: [if], data = [none] rcdItemStream.remove((Transaction) tran, AbstractItem.NO_LOCK_ID); // depends on control dependency: [if], data = [none] tran.commit(); // depends on control dependency: [if], data = [none] // only now is it safe to remove the table entry _rcdItemStreams.remove(key); // depends on control dependency: [if], data = [none] } if (removeAIH) { /** This is not necessary any more, as our callers call either * aih.forceFlushAtTarget or aih.destinationDeleted first, which * will result in aih.delete called // At this point there should not be any messages and thus no V/U aih.delete(); */ if (aiContainerItemStream != null) { tran = _baseDestinationHandler.getTransactionManager().createLocalTransaction(true); // depends on control dependency: [if], data = [none] // aih.delete removed the completed prefix and protocol item stream inside of aiContainerItemStream // so it's ok to remove the container item stream now aiContainerItemStream.remove((Transaction) tran, AbstractItem.NO_LOCK_ID); // depends on control dependency: [if], data = [none] tran.commit(); // depends on control dependency: [if], data = [none] // only now is it safe to remove the table entry _aiContainerItemStreams.remove(key); // depends on control dependency: [if], data = [none] } // only now is it safe to remove the table entry _anycastInputHandlers.remove(key); // depends on control dependency: [if], data = [none] } } catch (Exception e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.destination.AbstractRemoteSupport.removeAnycastInputHandlerAndRCD", "1:1096:1.25", this); SibTr.exception(tc, e); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeAnycastInputHandlerAndRCD", e); throw new SIResourceException(e); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeAnycastInputHandlerAndRCD", Boolean.valueOf(removed)); return removed; } }
public class class_name { public Stamp allocateTimestamp() { synchronized (this) { Preconditions.checkState(!closed, "tracker closed "); if (node == null) { Preconditions.checkState(allocationsInProgress == 0, "expected allocationsInProgress == 0 when node == null"); Preconditions.checkState(!updatingZk, "unexpected concurrent ZK update"); createZkNode(getTimestamp().getTxTimestamp()); } allocationsInProgress++; } try { Stamp ts = getTimestamp(); synchronized (this) { timestamps.add(ts.getTxTimestamp()); } return ts; } catch (RuntimeException re) { synchronized (this) { allocationsInProgress--; } throw re; } } }
public class class_name { public Stamp allocateTimestamp() { synchronized (this) { Preconditions.checkState(!closed, "tracker closed "); if (node == null) { Preconditions.checkState(allocationsInProgress == 0, "expected allocationsInProgress == 0 when node == null"); // depends on control dependency: [if], data = [none] Preconditions.checkState(!updatingZk, "unexpected concurrent ZK update"); // depends on control dependency: [if], data = [none] createZkNode(getTimestamp().getTxTimestamp()); // depends on control dependency: [if], data = [none] } allocationsInProgress++; } try { Stamp ts = getTimestamp(); synchronized (this) { // depends on control dependency: [try], data = [none] timestamps.add(ts.getTxTimestamp()); } return ts; // depends on control dependency: [try], data = [none] } catch (RuntimeException re) { synchronized (this) { allocationsInProgress--; } throw re; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void calcInsolation( double lambda, WritableRaster demWR, WritableRaster gradientWR, WritableRaster insolationWR, int day, double dx ) { // calculating the day angle // double dayang = 2 * Math.PI * (day - 1) / 365.0; double dayangb = (360 / 365.25) * (day - 79.436); dayangb = Math.toRadians(dayangb); // Evaluate the declination of the sun. delta = getDeclination(dayangb); // Evaluate the radiation in this day. double ss = Math.acos(-Math.tan(delta) * Math.tan(lambda)); double hour = -ss + (Math.PI / 48.0); while( hour <= ss - (Math.PI / 48) ) { omega = hour; // calculating the vector related to the sun double sunVector[] = calcSunVector(); double zenith = calcZenith(sunVector[2]); double[] inverseSunVector = calcInverseSunVector(sunVector); double[] normalSunVector = calcNormalSunVector(sunVector); int height = demWR.getHeight(); int width = demWR.getWidth(); WritableRaster sOmbraWR = calculateFactor(height, width, sunVector, inverseSunVector, normalSunVector, demWR, dx); double mr = 1 / (sunVector[2] + 0.15 * Math.pow((93.885 - zenith), (-1.253))); for( int j = 0; j < height; j++ ) { for( int i = 0; i < width; i++ ) { // evaluate the radiation. calcRadiation(i, j, demWR, sOmbraWR, insolationWR, sunVector, gradientWR, mr); } } hour = hour + Math.PI / 24.0; } } }
public class class_name { private void calcInsolation( double lambda, WritableRaster demWR, WritableRaster gradientWR, WritableRaster insolationWR, int day, double dx ) { // calculating the day angle // double dayang = 2 * Math.PI * (day - 1) / 365.0; double dayangb = (360 / 365.25) * (day - 79.436); dayangb = Math.toRadians(dayangb); // Evaluate the declination of the sun. delta = getDeclination(dayangb); // Evaluate the radiation in this day. double ss = Math.acos(-Math.tan(delta) * Math.tan(lambda)); double hour = -ss + (Math.PI / 48.0); while( hour <= ss - (Math.PI / 48) ) { omega = hour; // depends on control dependency: [while], data = [none] // calculating the vector related to the sun double sunVector[] = calcSunVector(); double zenith = calcZenith(sunVector[2]); double[] inverseSunVector = calcInverseSunVector(sunVector); double[] normalSunVector = calcNormalSunVector(sunVector); int height = demWR.getHeight(); int width = demWR.getWidth(); WritableRaster sOmbraWR = calculateFactor(height, width, sunVector, inverseSunVector, normalSunVector, demWR, dx); double mr = 1 / (sunVector[2] + 0.15 * Math.pow((93.885 - zenith), (-1.253))); for( int j = 0; j < height; j++ ) { for( int i = 0; i < width; i++ ) { // evaluate the radiation. calcRadiation(i, j, demWR, sOmbraWR, insolationWR, sunVector, gradientWR, mr); // depends on control dependency: [for], data = [i] } } hour = hour + Math.PI / 24.0; // depends on control dependency: [while], data = [none] } } }
public class class_name { Type generateReturnConstraints(JCTree tree, Attr.ResultInfo resultInfo, MethodType mt, InferenceContext inferenceContext) { InferenceContext rsInfoInfContext = resultInfo.checkContext.inferenceContext(); Type from = mt.getReturnType(); if (mt.getReturnType().containsAny(inferenceContext.inferencevars) && rsInfoInfContext != emptyContext) { from = types.capture(from); //add synthetic captured ivars for (Type t : from.getTypeArguments()) { if (t.hasTag(TYPEVAR) && ((TypeVar)t).isCaptured()) { inferenceContext.addVar((TypeVar)t); } } } Type qtype = inferenceContext.asUndetVar(from); Type to = resultInfo.pt; if (qtype.hasTag(VOID)) { to = syms.voidType; } else if (to.hasTag(NONE)) { to = from.isPrimitive() ? from : syms.objectType; } else if (qtype.hasTag(UNDETVAR)) { if (resultInfo.pt.isReference()) { to = generateReturnConstraintsUndetVarToReference( tree, (UndetVar)qtype, to, resultInfo, inferenceContext); } else { if (to.isPrimitive()) { to = generateReturnConstraintsPrimitive(tree, (UndetVar)qtype, to, resultInfo, inferenceContext); } } } Assert.check(allowGraphInference || !rsInfoInfContext.free(to), "legacy inference engine cannot handle constraints on both sides of a subtyping assertion"); //we need to skip capture? Warner retWarn = new Warner(); if (!resultInfo.checkContext.compatible(qtype, rsInfoInfContext.asUndetVar(to), retWarn) || //unchecked conversion is not allowed in source 7 mode (!allowGraphInference && retWarn.hasLint(Lint.LintCategory.UNCHECKED))) { throw inferenceException .setMessage("infer.no.conforming.instance.exists", inferenceContext.restvars(), mt.getReturnType(), to); } return from; } }
public class class_name { Type generateReturnConstraints(JCTree tree, Attr.ResultInfo resultInfo, MethodType mt, InferenceContext inferenceContext) { InferenceContext rsInfoInfContext = resultInfo.checkContext.inferenceContext(); Type from = mt.getReturnType(); if (mt.getReturnType().containsAny(inferenceContext.inferencevars) && rsInfoInfContext != emptyContext) { from = types.capture(from); // depends on control dependency: [if], data = [none] //add synthetic captured ivars for (Type t : from.getTypeArguments()) { if (t.hasTag(TYPEVAR) && ((TypeVar)t).isCaptured()) { inferenceContext.addVar((TypeVar)t); // depends on control dependency: [if], data = [none] } } } Type qtype = inferenceContext.asUndetVar(from); Type to = resultInfo.pt; if (qtype.hasTag(VOID)) { to = syms.voidType; // depends on control dependency: [if], data = [none] } else if (to.hasTag(NONE)) { to = from.isPrimitive() ? from : syms.objectType; // depends on control dependency: [if], data = [none] } else if (qtype.hasTag(UNDETVAR)) { if (resultInfo.pt.isReference()) { to = generateReturnConstraintsUndetVarToReference( tree, (UndetVar)qtype, to, resultInfo, inferenceContext); // depends on control dependency: [if], data = [none] } else { if (to.isPrimitive()) { to = generateReturnConstraintsPrimitive(tree, (UndetVar)qtype, to, resultInfo, inferenceContext); // depends on control dependency: [if], data = [none] } } } Assert.check(allowGraphInference || !rsInfoInfContext.free(to), "legacy inference engine cannot handle constraints on both sides of a subtyping assertion"); //we need to skip capture? Warner retWarn = new Warner(); if (!resultInfo.checkContext.compatible(qtype, rsInfoInfContext.asUndetVar(to), retWarn) || //unchecked conversion is not allowed in source 7 mode (!allowGraphInference && retWarn.hasLint(Lint.LintCategory.UNCHECKED))) { throw inferenceException .setMessage("infer.no.conforming.instance.exists", inferenceContext.restvars(), mt.getReturnType(), to); } return from; } }
public class class_name { @Override public CompletableFuture<Tuple2<List<TypedMap>, ExecutionInfo>> getTypedMapsAsyncWithStats() { final RuntimeEngine rte = getRte(); final CassandraOptions options = getOptions(); final StatementWrapper statementWrapper = getInternalBoundStatementWrapper(); if (LOGGER.isTraceEnabled()) { LOGGER.trace(format("Select async with execution info : %s", statementWrapper.getBoundStatement().preparedStatement().getQueryString())); } CompletableFuture<ResultSet> futureRS = rte.execute(statementWrapper); return futureRS .thenApply(options::resultSetAsyncListener) .thenApply(x -> statementWrapper.logReturnResults(x, options.computeMaxDisplayedResults(rte.configContext))) .thenApply(statementWrapper::logTrace) .thenApply(x -> Tuple2.of(mapResultSetToTypedMaps(x), x.getExecutionInfo())); } }
public class class_name { @Override public CompletableFuture<Tuple2<List<TypedMap>, ExecutionInfo>> getTypedMapsAsyncWithStats() { final RuntimeEngine rte = getRte(); final CassandraOptions options = getOptions(); final StatementWrapper statementWrapper = getInternalBoundStatementWrapper(); if (LOGGER.isTraceEnabled()) { LOGGER.trace(format("Select async with execution info : %s", statementWrapper.getBoundStatement().preparedStatement().getQueryString())); // depends on control dependency: [if], data = [none] } CompletableFuture<ResultSet> futureRS = rte.execute(statementWrapper); return futureRS .thenApply(options::resultSetAsyncListener) .thenApply(x -> statementWrapper.logReturnResults(x, options.computeMaxDisplayedResults(rte.configContext))) .thenApply(statementWrapper::logTrace) .thenApply(x -> Tuple2.of(mapResultSetToTypedMaps(x), x.getExecutionInfo())); } }
public class class_name { public boolean isValidSignedResponse(AuthenticatedUser authenticatedUser, String signedResponse) throws GuacamoleException { SignedDuoCookie duoCookie; SignedDuoCookie appCookie; // Retrieve username from externally-authenticated user String username = authenticatedUser.getIdentifier(); // Retrieve Duo-specific keys from configuration String applicationKey = confService.getApplicationKey(); String integrationKey = confService.getIntegrationKey(); String secretKey = confService.getSecretKey(); try { // Verify format of response Matcher matcher = RESPONSE_FORMAT.matcher(signedResponse); if (!matcher.matches()) { logger.debug("Duo response is not in correct format."); return false; } // Parse signed cookie defining the user verified by Duo duoCookie = SignedDuoCookie.parseSignedDuoCookie(secretKey, matcher.group(DUO_COOKIE_GROUP)); // Parse signed cookie defining the user this application // originally requested appCookie = SignedDuoCookie.parseSignedDuoCookie(applicationKey, matcher.group(APP_COOKIE_GROUP)); } // Simply return false if signature fails to verify catch (GuacamoleException e) { logger.debug("Duo signature verification failed.", e); return false; } // Verify neither cookie is expired if (duoCookie.isExpired() || appCookie.isExpired()) { logger.debug("Duo response contained expired cookie(s)."); return false; } // Verify the cookies in the response have the correct types if (duoCookie.getType() != SignedDuoCookie.Type.DUO_RESPONSE || appCookie.getType() != SignedDuoCookie.Type.APPLICATION) { logger.debug("Duo response did not contain correct cookie type(s)."); return false; } // Verify integration key matches both cookies if (!duoCookie.getIntegrationKey().equals(integrationKey) || !appCookie.getIntegrationKey().equals(integrationKey)) { logger.debug("Integration key of Duo response is incorrect."); return false; } // Verify both cookies are for the current user if (!duoCookie.getUsername().equals(username) || !appCookie.getUsername().equals(username)) { logger.debug("Username of Duo response is incorrect."); return false; } // All verifications tests pass return true; } }
public class class_name { public boolean isValidSignedResponse(AuthenticatedUser authenticatedUser, String signedResponse) throws GuacamoleException { SignedDuoCookie duoCookie; SignedDuoCookie appCookie; // Retrieve username from externally-authenticated user String username = authenticatedUser.getIdentifier(); // Retrieve Duo-specific keys from configuration String applicationKey = confService.getApplicationKey(); String integrationKey = confService.getIntegrationKey(); String secretKey = confService.getSecretKey(); try { // Verify format of response Matcher matcher = RESPONSE_FORMAT.matcher(signedResponse); if (!matcher.matches()) { logger.debug("Duo response is not in correct format."); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } // Parse signed cookie defining the user verified by Duo duoCookie = SignedDuoCookie.parseSignedDuoCookie(secretKey, matcher.group(DUO_COOKIE_GROUP)); // Parse signed cookie defining the user this application // originally requested appCookie = SignedDuoCookie.parseSignedDuoCookie(applicationKey, matcher.group(APP_COOKIE_GROUP)); } // Simply return false if signature fails to verify catch (GuacamoleException e) { logger.debug("Duo signature verification failed.", e); return false; } // Verify neither cookie is expired if (duoCookie.isExpired() || appCookie.isExpired()) { logger.debug("Duo response contained expired cookie(s)."); return false; } // Verify the cookies in the response have the correct types if (duoCookie.getType() != SignedDuoCookie.Type.DUO_RESPONSE || appCookie.getType() != SignedDuoCookie.Type.APPLICATION) { logger.debug("Duo response did not contain correct cookie type(s)."); return false; } // Verify integration key matches both cookies if (!duoCookie.getIntegrationKey().equals(integrationKey) || !appCookie.getIntegrationKey().equals(integrationKey)) { logger.debug("Integration key of Duo response is incorrect."); return false; } // Verify both cookies are for the current user if (!duoCookie.getUsername().equals(username) || !appCookie.getUsername().equals(username)) { logger.debug("Username of Duo response is incorrect."); return false; } // All verifications tests pass return true; } }
public class class_name { public String getXYvalueStr(ProjectionPoint loc) { if ((lastGrid == null) || (geodata == null)) return ""; // convert to dataProjection, where x and y are orthogonal if (!sameProjection) { LatLonPoint llpt = drawProjection.projToLatLon(loc); loc = dataProjection.latLonToProj(llpt); } // find the grid indexes HorizCoordSys hcs = lastGrid.getCoordSys().getHorizCoordSys(); Optional<HorizCoordSys.CoordReturn> opt = hcs.findXYindexFromCoord(loc.getX(), loc.getY()); // get value, construct the string if (!opt.isPresent()) return opt.getErrorMessage(); else { HorizCoordSys.CoordReturn cr = opt.get(); try { Index imaH = geodata.getIndex(); double dataValue = geodata.getDouble(imaH.set(cr.y, cr.x)); // int wantz = (geocs.getZAxis() == null) ? -1 : lastLevel; return makeXYZvalueStr(dataValue, cr); } catch (Exception e) { return "error " + cr.x + " " + cr.y; } } } }
public class class_name { public String getXYvalueStr(ProjectionPoint loc) { if ((lastGrid == null) || (geodata == null)) return ""; // convert to dataProjection, where x and y are orthogonal if (!sameProjection) { LatLonPoint llpt = drawProjection.projToLatLon(loc); loc = dataProjection.latLonToProj(llpt); // depends on control dependency: [if], data = [none] } // find the grid indexes HorizCoordSys hcs = lastGrid.getCoordSys().getHorizCoordSys(); Optional<HorizCoordSys.CoordReturn> opt = hcs.findXYindexFromCoord(loc.getX(), loc.getY()); // get value, construct the string if (!opt.isPresent()) return opt.getErrorMessage(); else { HorizCoordSys.CoordReturn cr = opt.get(); try { Index imaH = geodata.getIndex(); double dataValue = geodata.getDouble(imaH.set(cr.y, cr.x)); // int wantz = (geocs.getZAxis() == null) ? -1 : lastLevel; return makeXYZvalueStr(dataValue, cr); // depends on control dependency: [try], data = [none] } catch (Exception e) { return "error " + cr.x + " " + cr.y; } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public void marshall(VPCConfigResponse vPCConfigResponse, ProtocolMarshaller protocolMarshaller) { if (vPCConfigResponse == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(vPCConfigResponse.getSubnets(), SUBNETS_BINDING); protocolMarshaller.marshall(vPCConfigResponse.getSecurityGroups(), SECURITYGROUPS_BINDING); protocolMarshaller.marshall(vPCConfigResponse.getVpcId(), VPCID_BINDING); protocolMarshaller.marshall(vPCConfigResponse.getAssignPublicIp(), ASSIGNPUBLICIP_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(VPCConfigResponse vPCConfigResponse, ProtocolMarshaller protocolMarshaller) { if (vPCConfigResponse == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(vPCConfigResponse.getSubnets(), SUBNETS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(vPCConfigResponse.getSecurityGroups(), SECURITYGROUPS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(vPCConfigResponse.getVpcId(), VPCID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(vPCConfigResponse.getAssignPublicIp(), ASSIGNPUBLICIP_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void notifyChunkSize() { if (chunkSize > 0 && livePipe != null) { OOBControlMessage setChunkSize = new OOBControlMessage(); setChunkSize.setTarget("ConnectionConsumer"); setChunkSize.setServiceName("chunkSize"); if (setChunkSize.getServiceParamMap() == null) { setChunkSize.setServiceParamMap(new HashMap<String, Object>()); } setChunkSize.getServiceParamMap().put("chunkSize", chunkSize); livePipe.sendOOBControlMessage(getProvider(), setChunkSize); } } }
public class class_name { private void notifyChunkSize() { if (chunkSize > 0 && livePipe != null) { OOBControlMessage setChunkSize = new OOBControlMessage(); setChunkSize.setTarget("ConnectionConsumer"); // depends on control dependency: [if], data = [none] setChunkSize.setServiceName("chunkSize"); // depends on control dependency: [if], data = [none] if (setChunkSize.getServiceParamMap() == null) { setChunkSize.setServiceParamMap(new HashMap<String, Object>()); // depends on control dependency: [if], data = [none] } setChunkSize.getServiceParamMap().put("chunkSize", chunkSize); // depends on control dependency: [if], data = [none] livePipe.sendOOBControlMessage(getProvider(), setChunkSize); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void writeAndClose(Writer writer, CharSequence cs) { try { write(writer, cs); } catch (IOException e) { throw Lang.wrapThrow(e); } finally { safeClose(writer); } } }
public class class_name { public static void writeAndClose(Writer writer, CharSequence cs) { try { write(writer, cs); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw Lang.wrapThrow(e); } // depends on control dependency: [catch], data = [none] finally { safeClose(writer); } } }
public class class_name { protected List<FileMeta> handleGetEntityMetaFiles(Class<? extends FileEntity> type, Integer entityId) { Map<String, String> uriVariables = restUriVariablesFactory.getUriVariablesForGetEntityMetaFiles( BullhornEntityInfo.getTypesRestEntityName(type), entityId); String url = restUrlFactory.assembleGetEntityMetaFilesUrl(); String jsonString = this.performGetRequest(url, String.class, uriVariables); EntityMetaFiles<? extends FileMeta> entityMetaFiles = restJsonConverter.jsonToEntityDoNotUnwrapRoot(jsonString, StandardEntityMetaFiles.class); if (entityMetaFiles == null || entityMetaFiles.getFileMetas() == null) { return Collections.emptyList(); } return (List<FileMeta>) entityMetaFiles.getFileMetas(); } }
public class class_name { protected List<FileMeta> handleGetEntityMetaFiles(Class<? extends FileEntity> type, Integer entityId) { Map<String, String> uriVariables = restUriVariablesFactory.getUriVariablesForGetEntityMetaFiles( BullhornEntityInfo.getTypesRestEntityName(type), entityId); String url = restUrlFactory.assembleGetEntityMetaFilesUrl(); String jsonString = this.performGetRequest(url, String.class, uriVariables); EntityMetaFiles<? extends FileMeta> entityMetaFiles = restJsonConverter.jsonToEntityDoNotUnwrapRoot(jsonString, StandardEntityMetaFiles.class); if (entityMetaFiles == null || entityMetaFiles.getFileMetas() == null) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } return (List<FileMeta>) entityMetaFiles.getFileMetas(); } }
public class class_name { private void checkPrefix(String uri, String qName) { int index = qName.indexOf(':'); if (index != -1) { String prefix = qName.substring(0, index); pageInfo.addPrefix(prefix); if ("jsp".equals(prefix) && !JSP_URI.equals(uri)) { pageInfo.setIsJspPrefixHijacked(true); } } } }
public class class_name { private void checkPrefix(String uri, String qName) { int index = qName.indexOf(':'); if (index != -1) { String prefix = qName.substring(0, index); pageInfo.addPrefix(prefix); // depends on control dependency: [if], data = [none] if ("jsp".equals(prefix) && !JSP_URI.equals(uri)) { pageInfo.setIsJspPrefixHijacked(true); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private static Long[] extractBasicFeatures(Configuration configuration, int length) { Long[] featureMap = new Long[length]; State state = configuration.state; Sentence sentence = configuration.sentence; int b0Position = 0; int b1Position = 0; int b2Position = 0; int s0Position = 0; long b0w = 0; long b0p = 0; long b1w = 0; long b1p = 0; long b2w = 0; long b2p = 0; long s0w = 0; long s0p = 0; long bl0p = 0; long sr0p = 0; long sh0p = 0; long sl0p = 0; int[] words = sentence.getWords(); int[] tags = sentence.getTags(); if (0 < state.bufferSize()) { b0Position = state.bufferHead(); b0w = b0Position == 0 ? 0 : words[b0Position - 1]; b0w += 2; b0p = b0Position == 0 ? 0 : tags[b0Position - 1]; b0p += 2; int leftMost = state.leftMostModifier(state.getBufferItem(0)); if (leftMost >= 0) { bl0p = leftMost == 0 ? 0 : tags[leftMost - 1]; bl0p += 2; } if (1 < state.bufferSize()) { b1Position = state.getBufferItem(1); b1w = b1Position == 0 ? 0 : words[b1Position - 1]; b1w += 2; b1p = b1Position == 0 ? 0 : tags[b1Position - 1]; b1p += 2; if (2 < state.bufferSize()) { b2Position = state.getBufferItem(2); b2w = b2Position == 0 ? 0 : words[b2Position - 1]; b2w += 2; b2p = b2Position == 0 ? 0 : tags[b2Position - 1]; b2p += 2; } } } if (0 < state.stackSize()) { s0Position = state.stackTop(); s0w = s0Position == 0 ? 0 : words[s0Position - 1]; s0w += 2; s0p = s0Position == 0 ? 0 : tags[s0Position - 1]; s0p += 2; int leftMost = state.leftMostModifier(s0Position); if (leftMost >= 0) { sl0p = leftMost == 0 ? 0 : tags[leftMost - 1]; sl0p += 2; } int rightMost = state.rightMostModifier(s0Position); if (rightMost >= 0) { sr0p = rightMost == 0 ? 0 : tags[rightMost - 1]; sr0p += 2; } int headIndex = state.getHead(s0Position); if (headIndex >= 0) { sh0p = headIndex == 0 ? 0 : tags[headIndex - 1]; sh0p += 2; } } int index = 0; long b0wp = b0p; b0wp |= (b0w << 8); long b1wp = b1p; b1wp |= (b1w << 8); long s0wp = s0p; s0wp |= (s0w << 8); long b2wp = b2p; b2wp |= (b2w << 8); /** * From single words */ if (s0w != 1) { featureMap[index++] = s0wp; featureMap[index++] = s0w; } else { featureMap[index++] = null; featureMap[index++] = null; } featureMap[index++] = s0p; if (b0w != 1) { featureMap[index++] = b0wp; featureMap[index++] = b0w; } else { featureMap[index++] = null; featureMap[index++] = null; } featureMap[index++] = b0p; if (b1w != 1) { featureMap[index++] = b1wp; featureMap[index++] = b1w; } else { featureMap[index++] = null; featureMap[index++] = null; } featureMap[index++] = b1p; if (b2w != 1) { featureMap[index++] = b2wp; featureMap[index++] = b2w; } else { featureMap[index++] = null; featureMap[index++] = null; } featureMap[index++] = b2p; /** * from word pairs */ if (s0w != 1 && b0w != 1) { featureMap[index++] = (s0wp << 28) | b0wp; featureMap[index++] = (s0wp << 20) | b0w; featureMap[index++] = (s0w << 28) | b0wp; } else { featureMap[index++] = null; featureMap[index++] = null; featureMap[index++] = null; } if (s0w != 1) { featureMap[index++] = (s0wp << 8) | b0p; } else { featureMap[index++] = null; } if (b0w != 1) { featureMap[index++] = (s0p << 28) | b0wp; } else { featureMap[index++] = null; } if (s0w != 1 && b0w != 1) { featureMap[index++] = (s0w << 20) | b0w; } else { featureMap[index++] = null; } featureMap[index++] = (s0p << 8) | b0p; featureMap[index++] = (b0p << 8) | b1p; /** * from three words */ featureMap[index++] = (b0p << 16) | (b1p << 8) | b2p; featureMap[index++] = (s0p << 16) | (b0p << 8) | b1p; featureMap[index++] = (sh0p << 16) | (s0p << 8) | b0p; featureMap[index++] = (s0p << 16) | (sl0p << 8) | b0p; featureMap[index++] = (s0p << 16) | (sr0p << 8) | b0p; featureMap[index++] = (s0p << 16) | (b0p << 8) | bl0p; return featureMap; } }
public class class_name { private static Long[] extractBasicFeatures(Configuration configuration, int length) { Long[] featureMap = new Long[length]; State state = configuration.state; Sentence sentence = configuration.sentence; int b0Position = 0; int b1Position = 0; int b2Position = 0; int s0Position = 0; long b0w = 0; long b0p = 0; long b1w = 0; long b1p = 0; long b2w = 0; long b2p = 0; long s0w = 0; long s0p = 0; long bl0p = 0; long sr0p = 0; long sh0p = 0; long sl0p = 0; int[] words = sentence.getWords(); int[] tags = sentence.getTags(); if (0 < state.bufferSize()) { b0Position = state.bufferHead(); // depends on control dependency: [if], data = [none] b0w = b0Position == 0 ? 0 : words[b0Position - 1]; // depends on control dependency: [if], data = [none] b0w += 2; // depends on control dependency: [if], data = [none] b0p = b0Position == 0 ? 0 : tags[b0Position - 1]; // depends on control dependency: [if], data = [none] b0p += 2; // depends on control dependency: [if], data = [none] int leftMost = state.leftMostModifier(state.getBufferItem(0)); if (leftMost >= 0) { bl0p = leftMost == 0 ? 0 : tags[leftMost - 1]; // depends on control dependency: [if], data = [none] bl0p += 2; // depends on control dependency: [if], data = [none] } if (1 < state.bufferSize()) { b1Position = state.getBufferItem(1); // depends on control dependency: [if], data = [(1] b1w = b1Position == 0 ? 0 : words[b1Position - 1]; // depends on control dependency: [if], data = [none] b1w += 2; // depends on control dependency: [if], data = [none] b1p = b1Position == 0 ? 0 : tags[b1Position - 1]; // depends on control dependency: [if], data = [none] b1p += 2; // depends on control dependency: [if], data = [none] if (2 < state.bufferSize()) { b2Position = state.getBufferItem(2); // depends on control dependency: [if], data = [(2] b2w = b2Position == 0 ? 0 : words[b2Position - 1]; // depends on control dependency: [if], data = [none] b2w += 2; // depends on control dependency: [if], data = [none] b2p = b2Position == 0 ? 0 : tags[b2Position - 1]; // depends on control dependency: [if], data = [none] b2p += 2; // depends on control dependency: [if], data = [none] } } } if (0 < state.stackSize()) { s0Position = state.stackTop(); // depends on control dependency: [if], data = [none] s0w = s0Position == 0 ? 0 : words[s0Position - 1]; // depends on control dependency: [if], data = [none] s0w += 2; // depends on control dependency: [if], data = [none] s0p = s0Position == 0 ? 0 : tags[s0Position - 1]; // depends on control dependency: [if], data = [none] s0p += 2; // depends on control dependency: [if], data = [none] int leftMost = state.leftMostModifier(s0Position); if (leftMost >= 0) { sl0p = leftMost == 0 ? 0 : tags[leftMost - 1]; // depends on control dependency: [if], data = [none] sl0p += 2; // depends on control dependency: [if], data = [none] } int rightMost = state.rightMostModifier(s0Position); if (rightMost >= 0) { sr0p = rightMost == 0 ? 0 : tags[rightMost - 1]; // depends on control dependency: [if], data = [none] sr0p += 2; // depends on control dependency: [if], data = [none] } int headIndex = state.getHead(s0Position); if (headIndex >= 0) { sh0p = headIndex == 0 ? 0 : tags[headIndex - 1]; // depends on control dependency: [if], data = [none] sh0p += 2; // depends on control dependency: [if], data = [none] } } int index = 0; long b0wp = b0p; b0wp |= (b0w << 8); long b1wp = b1p; b1wp |= (b1w << 8); long s0wp = s0p; s0wp |= (s0w << 8); long b2wp = b2p; b2wp |= (b2w << 8); /** * From single words */ if (s0w != 1) { featureMap[index++] = s0wp; // depends on control dependency: [if], data = [none] featureMap[index++] = s0w; // depends on control dependency: [if], data = [none] } else { featureMap[index++] = null; // depends on control dependency: [if], data = [none] featureMap[index++] = null; // depends on control dependency: [if], data = [none] } featureMap[index++] = s0p; if (b0w != 1) { featureMap[index++] = b0wp; // depends on control dependency: [if], data = [none] featureMap[index++] = b0w; // depends on control dependency: [if], data = [none] } else { featureMap[index++] = null; // depends on control dependency: [if], data = [none] featureMap[index++] = null; // depends on control dependency: [if], data = [none] } featureMap[index++] = b0p; if (b1w != 1) { featureMap[index++] = b1wp; // depends on control dependency: [if], data = [none] featureMap[index++] = b1w; // depends on control dependency: [if], data = [none] } else { featureMap[index++] = null; // depends on control dependency: [if], data = [none] featureMap[index++] = null; // depends on control dependency: [if], data = [none] } featureMap[index++] = b1p; if (b2w != 1) { featureMap[index++] = b2wp; // depends on control dependency: [if], data = [none] featureMap[index++] = b2w; // depends on control dependency: [if], data = [none] } else { featureMap[index++] = null; // depends on control dependency: [if], data = [none] featureMap[index++] = null; // depends on control dependency: [if], data = [none] } featureMap[index++] = b2p; /** * from word pairs */ if (s0w != 1 && b0w != 1) { featureMap[index++] = (s0wp << 28) | b0wp; // depends on control dependency: [if], data = [(s0w] featureMap[index++] = (s0wp << 20) | b0w; // depends on control dependency: [if], data = [(s0w] featureMap[index++] = (s0w << 28) | b0wp; // depends on control dependency: [if], data = [(s0w] } else { featureMap[index++] = null; // depends on control dependency: [if], data = [none] featureMap[index++] = null; // depends on control dependency: [if], data = [none] featureMap[index++] = null; // depends on control dependency: [if], data = [none] } if (s0w != 1) { featureMap[index++] = (s0wp << 8) | b0p; // depends on control dependency: [if], data = [(s0w] } else { featureMap[index++] = null; // depends on control dependency: [if], data = [none] } if (b0w != 1) { featureMap[index++] = (s0p << 28) | b0wp; // depends on control dependency: [if], data = [none] } else { featureMap[index++] = null; // depends on control dependency: [if], data = [none] } if (s0w != 1 && b0w != 1) { featureMap[index++] = (s0w << 20) | b0w; // depends on control dependency: [if], data = [(s0w] } else { featureMap[index++] = null; // depends on control dependency: [if], data = [none] } featureMap[index++] = (s0p << 8) | b0p; featureMap[index++] = (b0p << 8) | b1p; /** * from three words */ featureMap[index++] = (b0p << 16) | (b1p << 8) | b2p; featureMap[index++] = (s0p << 16) | (b0p << 8) | b1p; featureMap[index++] = (sh0p << 16) | (s0p << 8) | b0p; featureMap[index++] = (s0p << 16) | (sl0p << 8) | b0p; featureMap[index++] = (s0p << 16) | (sr0p << 8) | b0p; featureMap[index++] = (s0p << 16) | (b0p << 8) | bl0p; return featureMap; } }
public class class_name { @SuppressWarnings( "unchecked" ) protected void processModifiersOfTypeDeclaration( AbstractTypeDeclaration typeDeclaration, TypeMetadata classMetadata ) { List<IExtendedModifier> modifiers = typeDeclaration.modifiers(); for (IExtendedModifier extendedModifier : modifiers) { if (extendedModifier.isAnnotation()) { if (extendedModifier instanceof MarkerAnnotation) { MarkerAnnotation marker = (MarkerAnnotation)extendedModifier; classMetadata.getAnnotations().add(AnnotationMetadata.markerAnnotation(JavaMetadataUtil.getName(marker.getTypeName()))); } } else { Modifier modifier = (Modifier)extendedModifier; classMetadata.getModifiers().add(new ModifierMetadata(modifier.getKeyword().toString())); } } } }
public class class_name { @SuppressWarnings( "unchecked" ) protected void processModifiersOfTypeDeclaration( AbstractTypeDeclaration typeDeclaration, TypeMetadata classMetadata ) { List<IExtendedModifier> modifiers = typeDeclaration.modifiers(); for (IExtendedModifier extendedModifier : modifiers) { if (extendedModifier.isAnnotation()) { if (extendedModifier instanceof MarkerAnnotation) { MarkerAnnotation marker = (MarkerAnnotation)extendedModifier; classMetadata.getAnnotations().add(AnnotationMetadata.markerAnnotation(JavaMetadataUtil.getName(marker.getTypeName()))); // depends on control dependency: [if], data = [none] } } else { Modifier modifier = (Modifier)extendedModifier; classMetadata.getModifiers().add(new ModifierMetadata(modifier.getKeyword().toString())); // depends on control dependency: [if], data = [none] } } } }
public class class_name { protected void commitResponse(final SecurityContext securityContext, final HttpServletRequest request, final HttpServletResponse response, final RestMethodResult result, final boolean wrapSingleResultInArray) { final String outputDepthSrc = request.getParameter(REQUEST_PARAMTER_OUTPUT_DEPTH); final int outputDepth = Services.parseInt(outputDepthSrc, config.getOutputNestingDepth()); final String baseUrl = request.getRequestURI(); final Map<String, String> headers = result.getHeaders(); // set headers for (final Entry<String, String> header : headers.entrySet()) { response.setHeader(header.getKey(), header.getValue()); } // set response code response.setStatus(result.getResponseCode()); try { final List<Object> content = result.getContent(); if (content != null) { writeJson(securityContext, response, new PagingIterable(content), baseUrl, outputDepth, wrapSingleResultInArray); } else { final String message = result.getMessage(); if (message != null) { writeStatus(response, result.getResponseCode(), message); } else { final Object nonGraphObjectResult = result.getNonGraphObjectResult(); writeJson(securityContext, response, new PagingIterable(Arrays.asList(nonGraphObjectResult)), baseUrl, outputDepth, wrapSingleResultInArray); } } } catch (JsonIOException | IOException t) { logger.warn("Unable to commit HttpServletResponse", t); } } }
public class class_name { protected void commitResponse(final SecurityContext securityContext, final HttpServletRequest request, final HttpServletResponse response, final RestMethodResult result, final boolean wrapSingleResultInArray) { final String outputDepthSrc = request.getParameter(REQUEST_PARAMTER_OUTPUT_DEPTH); final int outputDepth = Services.parseInt(outputDepthSrc, config.getOutputNestingDepth()); final String baseUrl = request.getRequestURI(); final Map<String, String> headers = result.getHeaders(); // set headers for (final Entry<String, String> header : headers.entrySet()) { response.setHeader(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header] } // set response code response.setStatus(result.getResponseCode()); try { final List<Object> content = result.getContent(); if (content != null) { writeJson(securityContext, response, new PagingIterable(content), baseUrl, outputDepth, wrapSingleResultInArray); // depends on control dependency: [if], data = [(content] } else { final String message = result.getMessage(); if (message != null) { writeStatus(response, result.getResponseCode(), message); // depends on control dependency: [if], data = [none] } else { final Object nonGraphObjectResult = result.getNonGraphObjectResult(); writeJson(securityContext, response, new PagingIterable(Arrays.asList(nonGraphObjectResult)), baseUrl, outputDepth, wrapSingleResultInArray); // depends on control dependency: [if], data = [none] } } } catch (JsonIOException | IOException t) { logger.warn("Unable to commit HttpServletResponse", t); } // depends on control dependency: [catch], data = [none] } }
public class class_name { void initAndSplit(int leadingNulls, @NonNull List<T> multiPageList, int trailingNulls, int positionOffset, int pageSize, @NonNull Callback callback) { int pageCount = (multiPageList.size() + (pageSize - 1)) / pageSize; for (int i = 0; i < pageCount; i++) { int beginInclusive = i * pageSize; int endExclusive = Math.min(multiPageList.size(), (i + 1) * pageSize); List<T> sublist = multiPageList.subList(beginInclusive, endExclusive); if (i == 0) { // Trailing nulls for first page includes other pages in multiPageList int initialTrailingNulls = trailingNulls + multiPageList.size() - sublist.size(); init(leadingNulls, sublist, initialTrailingNulls, positionOffset); } else { int insertPosition = leadingNulls + beginInclusive; insertPage(insertPosition, sublist, null); } } callback.onInitialized(size()); } }
public class class_name { void initAndSplit(int leadingNulls, @NonNull List<T> multiPageList, int trailingNulls, int positionOffset, int pageSize, @NonNull Callback callback) { int pageCount = (multiPageList.size() + (pageSize - 1)) / pageSize; for (int i = 0; i < pageCount; i++) { int beginInclusive = i * pageSize; int endExclusive = Math.min(multiPageList.size(), (i + 1) * pageSize); List<T> sublist = multiPageList.subList(beginInclusive, endExclusive); if (i == 0) { // Trailing nulls for first page includes other pages in multiPageList int initialTrailingNulls = trailingNulls + multiPageList.size() - sublist.size(); init(leadingNulls, sublist, initialTrailingNulls, positionOffset); // depends on control dependency: [if], data = [none] } else { int insertPosition = leadingNulls + beginInclusive; insertPage(insertPosition, sublist, null); // depends on control dependency: [if], data = [(i] } } callback.onInitialized(size()); } }
public class class_name { public Point3d getCoordinatesFromGridPoint(int gridPoint) { int dimCounter = 0; Point3d point = new Point3d(0, 0, 0); for (int z = 0; z < grid[0][0].length; z++) { for (int y = 0; y < grid[0].length; y++) { for (int x = 0; x < grid.length; x++) { if (dimCounter == gridPoint) { point.x = minx + latticeConstant * x; point.y = miny + latticeConstant * y; point.z = minz + latticeConstant * z; return point; } dimCounter++; } } } return point; } }
public class class_name { public Point3d getCoordinatesFromGridPoint(int gridPoint) { int dimCounter = 0; Point3d point = new Point3d(0, 0, 0); for (int z = 0; z < grid[0][0].length; z++) { for (int y = 0; y < grid[0].length; y++) { for (int x = 0; x < grid.length; x++) { if (dimCounter == gridPoint) { point.x = minx + latticeConstant * x; // depends on control dependency: [if], data = [none] point.y = miny + latticeConstant * y; // depends on control dependency: [if], data = [none] point.z = minz + latticeConstant * z; // depends on control dependency: [if], data = [none] return point; // depends on control dependency: [if], data = [none] } dimCounter++; // depends on control dependency: [for], data = [none] } } } return point; } }
public class class_name { public void setReferenceValue(final double VALUE) { if (null == referenceValue) { _referenceValue = VALUE; fireTileEvent(REDRAW_EVENT); } else { referenceValue.set(VALUE); } } }
public class class_name { public void setReferenceValue(final double VALUE) { if (null == referenceValue) { _referenceValue = VALUE; // depends on control dependency: [if], data = [none] fireTileEvent(REDRAW_EVENT); // depends on control dependency: [if], data = [none] } else { referenceValue.set(VALUE); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void send(Message message, String destinationName, TestContext context) { if (log.isDebugEnabled()) { log.debug("Sending JMS message to destination: '" + destinationName + "'"); } endpointConfiguration.getJmsTemplate().send(destinationName, session -> { javax.jms.Message jmsMessage = endpointConfiguration.getMessageConverter().createJmsMessage(message, session, endpointConfiguration, context); endpointConfiguration.getMessageConverter().convertOutbound(jmsMessage, message, endpointConfiguration, context); return jmsMessage; }); log.info("Message was sent to JMS destination: '" + destinationName + "'"); } }
public class class_name { private void send(Message message, String destinationName, TestContext context) { if (log.isDebugEnabled()) { log.debug("Sending JMS message to destination: '" + destinationName + "'"); // depends on control dependency: [if], data = [none] } endpointConfiguration.getJmsTemplate().send(destinationName, session -> { javax.jms.Message jmsMessage = endpointConfiguration.getMessageConverter().createJmsMessage(message, session, endpointConfiguration, context); endpointConfiguration.getMessageConverter().convertOutbound(jmsMessage, message, endpointConfiguration, context); return jmsMessage; }); log.info("Message was sent to JMS destination: '" + destinationName + "'"); } }
public class class_name { public List getMatches(String path) { Map.Entry entry; Object entries=null; if (path==null) return LazyList.getList(entries); int l=path.indexOf(';'); if (l<0) { l=path.indexOf('?'); if (l<0) l=path.length(); } // try exact match entry=_exactMap.getEntry(path,0,l); if (entry!=null) entries=LazyList.add(entries,entry.getValue()); // prefix search int i=l-1; while((i=path.lastIndexOf('/',i-1))>=0) { entry=_prefixMap.getEntry(path,0,i); if (entry!=null) entries=LazyList.add(entries,entry.getValue()); } // Prefix Default if (_prefixDefault!=null) entries=LazyList.add(entries,_prefixDefault); // Extension search i=0; while ((i=path.indexOf('.',i+1))>0) { entry=_suffixMap.getEntry(path,i+1,l-i-1); if (entry!=null) entries=LazyList.add(entries,entry.getValue()); } // Default if (_default!=null) { // Optimization for just the default if (entries==null) return _defaultSingletonList; entries=LazyList.add(entries,_default); } return LazyList.getList(entries); } }
public class class_name { public List getMatches(String path) { Map.Entry entry; Object entries=null; if (path==null) return LazyList.getList(entries); int l=path.indexOf(';'); if (l<0) { l=path.indexOf('?'); // depends on control dependency: [if], data = [none] if (l<0) l=path.length(); } // try exact match entry=_exactMap.getEntry(path,0,l); if (entry!=null) entries=LazyList.add(entries,entry.getValue()); // prefix search int i=l-1; while((i=path.lastIndexOf('/',i-1))>=0) { entry=_prefixMap.getEntry(path,0,i); // depends on control dependency: [while], data = [none] if (entry!=null) entries=LazyList.add(entries,entry.getValue()); } // Prefix Default if (_prefixDefault!=null) entries=LazyList.add(entries,_prefixDefault); // Extension search i=0; while ((i=path.indexOf('.',i+1))>0) { entry=_suffixMap.getEntry(path,i+1,l-i-1); // depends on control dependency: [while], data = [none] if (entry!=null) entries=LazyList.add(entries,entry.getValue()); } // Default if (_default!=null) { // Optimization for just the default if (entries==null) return _defaultSingletonList; entries=LazyList.add(entries,_default); // depends on control dependency: [if], data = [none] } return LazyList.getList(entries); } }
public class class_name { public static boolean isDAOGeneratorAnnotation(Annotation annotation) { // Si lm'annotation est nulle if(annotation == null) { // On retourne false return false; } // Obtention de la classe de cette annotation Class<?> annotationClass = annotation.annotationType(); // Recherchje de l'annotation de validation DAOGeneratorManager logicAnnotation = annotationClass.getAnnotation(DAOGeneratorManager.class); // On retourne le resultat return logicAnnotation != null; } }
public class class_name { public static boolean isDAOGeneratorAnnotation(Annotation annotation) { // Si lm'annotation est nulle if(annotation == null) { // On retourne false return false; // depends on control dependency: [if], data = [none] } // Obtention de la classe de cette annotation Class<?> annotationClass = annotation.annotationType(); // Recherchje de l'annotation de validation DAOGeneratorManager logicAnnotation = annotationClass.getAnnotation(DAOGeneratorManager.class); // On retourne le resultat return logicAnnotation != null; } }
public class class_name { public static String dsnLookup() { String dsn = Lookup.lookup("dsn"); if (Util.isNullOrEmpty(dsn)) { // check if the user accidentally set "dns" instead of "dsn" dsn = Lookup.lookup("dns"); } if (Util.isNullOrEmpty(dsn)) { logger.warn("*** Couldn't find a suitable DSN, Sentry operations will do nothing!" + " See documentation: https://docs.sentry.io/clients/java/ ***"); dsn = DEFAULT_DSN; } return dsn; } }
public class class_name { public static String dsnLookup() { String dsn = Lookup.lookup("dsn"); if (Util.isNullOrEmpty(dsn)) { // check if the user accidentally set "dns" instead of "dsn" dsn = Lookup.lookup("dns"); // depends on control dependency: [if], data = [none] } if (Util.isNullOrEmpty(dsn)) { logger.warn("*** Couldn't find a suitable DSN, Sentry operations will do nothing!" + " See documentation: https://docs.sentry.io/clients/java/ ***"); dsn = DEFAULT_DSN; // depends on control dependency: [if], data = [none] } return dsn; } }
public class class_name { @Override public final Status status() { Status result=Status.PUBLISHED; if(this.endpoint.deleted()!=null) { return Status.GONE; } return result; } }
public class class_name { @Override public final Status status() { Status result=Status.PUBLISHED; if(this.endpoint.deleted()!=null) { return Status.GONE; // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public static String getLimitPartitionRowsDeleteStmt(Table table) { CatalogMap<Statement> map = table.getTuplelimitdeletestmt(); if (map.isEmpty()) { return null; } assert (map.size() == 1); return map.iterator().next().getSqltext(); } }
public class class_name { public static String getLimitPartitionRowsDeleteStmt(Table table) { CatalogMap<Statement> map = table.getTuplelimitdeletestmt(); if (map.isEmpty()) { return null; // depends on control dependency: [if], data = [none] } assert (map.size() == 1); return map.iterator().next().getSqltext(); } }
public class class_name { @Override public void write(final int udpPort, final String records) { initialDatagramSocket(); byte[] bytes = records.getBytes(StandardCharsets.UTF_8); try { datagramSocket.send(new DatagramPacket(bytes, bytes.length, new InetSocketAddress(hostName, udpPort))); } catch (IOException e) { throw new InfluxDBIOException(e); } } }
public class class_name { @Override public void write(final int udpPort, final String records) { initialDatagramSocket(); byte[] bytes = records.getBytes(StandardCharsets.UTF_8); try { datagramSocket.send(new DatagramPacket(bytes, bytes.length, new InetSocketAddress(hostName, udpPort))); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new InfluxDBIOException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public long getDoneSaving(Configuration conf) { try { DFSClient dfs = ((DistributedFileSystem)FileSystem.get(conf)).getClient(); Counters raidedCounters = stateToSourceCounters.get(RaidState.RAIDED); Counters shouldRaidCounters = stateToSourceCounters.get(RaidState.NOT_RAIDED_BUT_SHOULD); long physical = estimatedDoneSourceSize + estimatedDoneParitySize; long logical = raidedCounters.getNumLogical() + shouldRaidCounters.getNumLogical(); return logical * dfs.getDefaultReplication() - physical; } catch (Exception e) { return -1; } } }
public class class_name { public long getDoneSaving(Configuration conf) { try { DFSClient dfs = ((DistributedFileSystem)FileSystem.get(conf)).getClient(); Counters raidedCounters = stateToSourceCounters.get(RaidState.RAIDED); Counters shouldRaidCounters = stateToSourceCounters.get(RaidState.NOT_RAIDED_BUT_SHOULD); long physical = estimatedDoneSourceSize + estimatedDoneParitySize; long logical = raidedCounters.getNumLogical() + shouldRaidCounters.getNumLogical(); return logical * dfs.getDefaultReplication() - physical; // depends on control dependency: [try], data = [none] } catch (Exception e) { return -1; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public long convertLocalToUTC(long instantLocal, boolean strict, long originalInstantUTC) { int offsetOriginal = getOffset(originalInstantUTC); long instantUTC = instantLocal - offsetOriginal; int offsetLocalFromOriginal = getOffset(instantUTC); if (offsetLocalFromOriginal == offsetOriginal) { return instantUTC; } return convertLocalToUTC(instantLocal, strict); } }
public class class_name { public long convertLocalToUTC(long instantLocal, boolean strict, long originalInstantUTC) { int offsetOriginal = getOffset(originalInstantUTC); long instantUTC = instantLocal - offsetOriginal; int offsetLocalFromOriginal = getOffset(instantUTC); if (offsetLocalFromOriginal == offsetOriginal) { return instantUTC; // depends on control dependency: [if], data = [none] } return convertLocalToUTC(instantLocal, strict); } }
public class class_name { private ClassLoaderHandlerRegistryEntry getRegistryEntry(final ClassLoader classLoader) { ClassLoaderHandlerRegistryEntry entry = classLoaderToClassLoaderHandlerRegistryEntry.get(classLoader); if (entry == null) { // Find a ClassLoaderHandler that can handle the ClassLoader for (final ClassLoaderHandlerRegistryEntry handler : ClassLoaderHandlerRegistry.CLASS_LOADER_HANDLERS) { if (handler.canHandle(classLoader)) { // This ClassLoaderHandler can handle the ClassLoader entry = handler; break; } } if (entry == null) { // Use fallback handler entry = ClassLoaderHandlerRegistry.FALLBACK_HANDLER; } classLoaderToClassLoaderHandlerRegistryEntry.put(classLoader, entry); } return entry; } }
public class class_name { private ClassLoaderHandlerRegistryEntry getRegistryEntry(final ClassLoader classLoader) { ClassLoaderHandlerRegistryEntry entry = classLoaderToClassLoaderHandlerRegistryEntry.get(classLoader); if (entry == null) { // Find a ClassLoaderHandler that can handle the ClassLoader for (final ClassLoaderHandlerRegistryEntry handler : ClassLoaderHandlerRegistry.CLASS_LOADER_HANDLERS) { if (handler.canHandle(classLoader)) { // This ClassLoaderHandler can handle the ClassLoader entry = handler; // depends on control dependency: [if], data = [none] break; } } if (entry == null) { // Use fallback handler entry = ClassLoaderHandlerRegistry.FALLBACK_HANDLER; // depends on control dependency: [if], data = [none] } classLoaderToClassLoaderHandlerRegistryEntry.put(classLoader, entry); // depends on control dependency: [if], data = [none] } return entry; } }
public class class_name { public void marshall(MessageResponse messageResponse, ProtocolMarshaller protocolMarshaller) { if (messageResponse == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(messageResponse.getApplicationId(), APPLICATIONID_BINDING); protocolMarshaller.marshall(messageResponse.getEndpointResult(), ENDPOINTRESULT_BINDING); protocolMarshaller.marshall(messageResponse.getRequestId(), REQUESTID_BINDING); protocolMarshaller.marshall(messageResponse.getResult(), RESULT_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(MessageResponse messageResponse, ProtocolMarshaller protocolMarshaller) { if (messageResponse == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(messageResponse.getApplicationId(), APPLICATIONID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(messageResponse.getEndpointResult(), ENDPOINTRESULT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(messageResponse.getRequestId(), REQUESTID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(messageResponse.getResult(), RESULT_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected void _generate(SarlBehaviorUnit handler, PyAppendable it, IExtraLanguageGeneratorContext context) { final JvmTypeReference event = handler.getName(); final String handleName = it.declareUniqueNameVariable(handler, "__on_" + event.getSimpleName() + "__"); //$NON-NLS-1$ //$NON-NLS-2$ it.append("def ").append(handleName).append("(self, occurrence):"); //$NON-NLS-1$ //$NON-NLS-2$ it.increaseIndentation().newLine(); generateDocString(getTypeBuilder().getDocumentation(handler), it); if (handler.getExpression() != null) { generate(handler.getExpression(), null, it, context); } else { it.append("pass"); //$NON-NLS-1$ } it.decreaseIndentation().newLine(); final String key = this.qualifiedNameProvider.getFullyQualifiedName(handler.getDeclaringType()).toString(); final Map<String, Map<String, List<Pair<XExpression, String>>>> map = context.getMapData(EVENT_GUARDS_MEMENTO); Map<String, List<Pair<XExpression, String>>> submap = map.get(key); if (submap == null) { submap = new HashMap<>(); map.put(key, submap); } final String eventId = event.getIdentifier(); List<Pair<XExpression, String>> guards = submap.get(eventId); if (guards == null) { guards = new ArrayList<>(); submap.put(eventId, guards); } guards.add(new Pair<>(handler.getGuard(), handleName)); } }
public class class_name { protected void _generate(SarlBehaviorUnit handler, PyAppendable it, IExtraLanguageGeneratorContext context) { final JvmTypeReference event = handler.getName(); final String handleName = it.declareUniqueNameVariable(handler, "__on_" + event.getSimpleName() + "__"); //$NON-NLS-1$ //$NON-NLS-2$ it.append("def ").append(handleName).append("(self, occurrence):"); //$NON-NLS-1$ //$NON-NLS-2$ it.increaseIndentation().newLine(); generateDocString(getTypeBuilder().getDocumentation(handler), it); if (handler.getExpression() != null) { generate(handler.getExpression(), null, it, context); // depends on control dependency: [if], data = [(handler.getExpression()] } else { it.append("pass"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none] } it.decreaseIndentation().newLine(); final String key = this.qualifiedNameProvider.getFullyQualifiedName(handler.getDeclaringType()).toString(); final Map<String, Map<String, List<Pair<XExpression, String>>>> map = context.getMapData(EVENT_GUARDS_MEMENTO); Map<String, List<Pair<XExpression, String>>> submap = map.get(key); if (submap == null) { submap = new HashMap<>(); // depends on control dependency: [if], data = [none] map.put(key, submap); // depends on control dependency: [if], data = [none] } final String eventId = event.getIdentifier(); List<Pair<XExpression, String>> guards = submap.get(eventId); if (guards == null) { guards = new ArrayList<>(); // depends on control dependency: [if], data = [none] submap.put(eventId, guards); // depends on control dependency: [if], data = [none] } guards.add(new Pair<>(handler.getGuard(), handleName)); } }
public class class_name { public static int sum (int[] list) { int total = 0, lsize = list.length; for (int ii = 0; ii < lsize; ii++) { total += list[ii]; } return total; } }
public class class_name { public static int sum (int[] list) { int total = 0, lsize = list.length; for (int ii = 0; ii < lsize; ii++) { total += list[ii]; // depends on control dependency: [for], data = [ii] } return total; } }
public class class_name { public MapSchema.MessageFactory getEnumMapFactory() { MapSchema.MessageFactory enumMapFactory = this.enumMapFactory; if (enumMapFactory == null) { synchronized (this) { if ((enumMapFactory = this.enumMapFactory) == null) this.enumMapFactory = enumMapFactory = newEnumMapFactory(this); } } return enumMapFactory; } }
public class class_name { public MapSchema.MessageFactory getEnumMapFactory() { MapSchema.MessageFactory enumMapFactory = this.enumMapFactory; if (enumMapFactory == null) { synchronized (this) // depends on control dependency: [if], data = [none] { if ((enumMapFactory = this.enumMapFactory) == null) this.enumMapFactory = enumMapFactory = newEnumMapFactory(this); } } return enumMapFactory; } }
public class class_name { protected boolean isRestoreGoalPresent() { Plugin ekstaziPlugin = lookupPlugin(EKSTAZI_PLUGIN_KEY); if (ekstaziPlugin == null) { return false; } for (Object execution : ekstaziPlugin.getExecutions()) { for (Object goal : ((PluginExecution) execution).getGoals()) { if (((String) goal).equals("restore")) { return true; } } } return false; } }
public class class_name { protected boolean isRestoreGoalPresent() { Plugin ekstaziPlugin = lookupPlugin(EKSTAZI_PLUGIN_KEY); if (ekstaziPlugin == null) { return false; // depends on control dependency: [if], data = [none] } for (Object execution : ekstaziPlugin.getExecutions()) { for (Object goal : ((PluginExecution) execution).getGoals()) { if (((String) goal).equals("restore")) { return true; // depends on control dependency: [if], data = [none] } } } return false; } }
public class class_name { @SuppressWarnings("unchecked") public <T> List<T> get(PropertyListKey<T> property) { if (contains(property)) { return (List<T>) properties.get(property.getName()); } else { return new ArrayList<T>(); } } }
public class class_name { @SuppressWarnings("unchecked") public <T> List<T> get(PropertyListKey<T> property) { if (contains(property)) { return (List<T>) properties.get(property.getName()); // depends on control dependency: [if], data = [none] } else { return new ArrayList<T>(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void emitArrayNew(Code dest) { Type typeCode; typeCode = getTypeCode(); if (typeCode.id == T_REFERENCE) { dest.emit(ANEWARRAY, this); } else { dest.emit(NEWARRAY, typeCode.id); } } }
public class class_name { public void emitArrayNew(Code dest) { Type typeCode; typeCode = getTypeCode(); if (typeCode.id == T_REFERENCE) { dest.emit(ANEWARRAY, this); // depends on control dependency: [if], data = [none] } else { dest.emit(NEWARRAY, typeCode.id); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean isParent(RegistryEntry registryEntry) { RegistryEntry parentRegistryEntry = getParentRegistryEntry(); while (parentRegistryEntry != null) { if (parentRegistryEntry.equals(registryEntry)) { return true; } parentRegistryEntry = parentRegistryEntry.getParentRegistryEntry(); } return false; } }
public class class_name { public boolean isParent(RegistryEntry registryEntry) { RegistryEntry parentRegistryEntry = getParentRegistryEntry(); while (parentRegistryEntry != null) { if (parentRegistryEntry.equals(registryEntry)) { return true; // depends on control dependency: [if], data = [none] } parentRegistryEntry = parentRegistryEntry.getParentRegistryEntry(); // depends on control dependency: [while], data = [none] } return false; } }
public class class_name { public static void startActivity(@NonNull Context context, @Nullable JSONObject jsonObject) { Intent intent = new Intent(context, JSONViewerActivity.class); Bundle bundle = new Bundle(); if (jsonObject != null) { bundle.putString(JSON_OBJECT_STATE, jsonObject.toString()); } intent.putExtras(bundle); context.startActivity(intent); } }
public class class_name { public static void startActivity(@NonNull Context context, @Nullable JSONObject jsonObject) { Intent intent = new Intent(context, JSONViewerActivity.class); Bundle bundle = new Bundle(); if (jsonObject != null) { bundle.putString(JSON_OBJECT_STATE, jsonObject.toString()); // depends on control dependency: [if], data = [none] } intent.putExtras(bundle); context.startActivity(intent); } }
public class class_name { public static Collection<String> filterClassesBasedOnBeansXML(BeansXml beansXml, final ResourceLoader resourceLoader, Set<String> classes) { if (beansXml != null && beansXml.getBeanDiscoveryMode().equals(BeanDiscoveryMode.NONE)) { // if the integrator for some reason ignored the "none" flag make sure we do not process the archive return Collections.emptySet(); } Function<Metadata<Filter>, Predicate<String>> filterToPredicateFunction = new Function<Metadata<Filter>, Predicate<String>>() { @Override public Predicate<String> apply(Metadata<Filter> from) { return new FilterPredicate(from, resourceLoader); } }; Collection<String> classNames; if (beansXml != null && beansXml.getScanning() != null) { Collection<Metadata<Filter>> includeFilters; if (beansXml.getScanning().getIncludes() != null) { includeFilters = beansXml.getScanning().getIncludes(); } else { includeFilters = Collections.emptyList(); } Collection<Metadata<Filter>> excludeFilters; if (beansXml.getScanning().getExcludes() != null) { excludeFilters = beansXml.getScanning().getExcludes(); } else { excludeFilters = Collections.emptyList(); } /* * Take a copy of the transformed collection, this means that the * filter predicate is only built once per filter predicate */ Collection<Predicate<String>> includes; if (includeFilters.isEmpty()) { includes = Collections.emptyList(); } else { includes = new ArrayList<Predicate<String>>(includeFilters.size()); for (Metadata<Filter> includeFilter : includeFilters) { includes.add(filterToPredicateFunction.apply(includeFilter)); } } Collection<Predicate<String>> excludes; if (excludeFilters.isEmpty()) { excludes = Collections.emptyList(); } else { excludes = new ArrayList<Predicate<String>>(excludeFilters.size()); for (Metadata<Filter> excludeFilter : excludeFilters) { excludes.add(filterToPredicateFunction.apply(excludeFilter)); } } Predicate<String> filters = new ScanningPredicate<String>(includes, excludes); classNames = new HashSet<>(); for (String beanClass : classes) { if (filters.test(beanClass)) { classNames.add(beanClass); } } } else { classNames = classes; } return classNames; } }
public class class_name { public static Collection<String> filterClassesBasedOnBeansXML(BeansXml beansXml, final ResourceLoader resourceLoader, Set<String> classes) { if (beansXml != null && beansXml.getBeanDiscoveryMode().equals(BeanDiscoveryMode.NONE)) { // if the integrator for some reason ignored the "none" flag make sure we do not process the archive return Collections.emptySet(); // depends on control dependency: [if], data = [none] } Function<Metadata<Filter>, Predicate<String>> filterToPredicateFunction = new Function<Metadata<Filter>, Predicate<String>>() { @Override public Predicate<String> apply(Metadata<Filter> from) { return new FilterPredicate(from, resourceLoader); } }; Collection<String> classNames; if (beansXml != null && beansXml.getScanning() != null) { Collection<Metadata<Filter>> includeFilters; if (beansXml.getScanning().getIncludes() != null) { includeFilters = beansXml.getScanning().getIncludes(); // depends on control dependency: [if], data = [none] } else { includeFilters = Collections.emptyList(); // depends on control dependency: [if], data = [none] } Collection<Metadata<Filter>> excludeFilters; if (beansXml.getScanning().getExcludes() != null) { excludeFilters = beansXml.getScanning().getExcludes(); // depends on control dependency: [if], data = [none] } else { excludeFilters = Collections.emptyList(); // depends on control dependency: [if], data = [none] } /* * Take a copy of the transformed collection, this means that the * filter predicate is only built once per filter predicate */ Collection<Predicate<String>> includes; if (includeFilters.isEmpty()) { includes = Collections.emptyList(); // depends on control dependency: [if], data = [none] } else { includes = new ArrayList<Predicate<String>>(includeFilters.size()); // depends on control dependency: [if], data = [none] for (Metadata<Filter> includeFilter : includeFilters) { includes.add(filterToPredicateFunction.apply(includeFilter)); // depends on control dependency: [for], data = [includeFilter] } } Collection<Predicate<String>> excludes; if (excludeFilters.isEmpty()) { excludes = Collections.emptyList(); // depends on control dependency: [if], data = [none] } else { excludes = new ArrayList<Predicate<String>>(excludeFilters.size()); // depends on control dependency: [if], data = [none] for (Metadata<Filter> excludeFilter : excludeFilters) { excludes.add(filterToPredicateFunction.apply(excludeFilter)); // depends on control dependency: [for], data = [excludeFilter] } } Predicate<String> filters = new ScanningPredicate<String>(includes, excludes); classNames = new HashSet<>(); // depends on control dependency: [if], data = [none] for (String beanClass : classes) { if (filters.test(beanClass)) { classNames.add(beanClass); // depends on control dependency: [if], data = [none] } } } else { classNames = classes; // depends on control dependency: [if], data = [none] } return classNames; } }
public class class_name { private boolean isVisible() { // Root is always visible if (getParent() == null) { return true; } TableTreeNode parent = (TableTreeNode) getParent(); return parent.isVisible() && parent.isExpanded(); } }
public class class_name { private boolean isVisible() { // Root is always visible if (getParent() == null) { return true; // depends on control dependency: [if], data = [none] } TableTreeNode parent = (TableTreeNode) getParent(); return parent.isVisible() && parent.isExpanded(); } }
public class class_name { public static PyExpr maybeProtect(PyExpr expr, int minSafePrecedence) { // all python operators are left associative, so if this has equivalent precedence we don't need // to wrap if (expr.getPrecedence() >= minSafePrecedence) { return expr; } else { return new PyExpr("(" + expr.getText() + ")", Integer.MAX_VALUE); } } }
public class class_name { public static PyExpr maybeProtect(PyExpr expr, int minSafePrecedence) { // all python operators are left associative, so if this has equivalent precedence we don't need // to wrap if (expr.getPrecedence() >= minSafePrecedence) { return expr; // depends on control dependency: [if], data = [none] } else { return new PyExpr("(" + expr.getText() + ")", Integer.MAX_VALUE); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void parse(final String... parameters) { // Manage red composite if (parameters.length >= 1) { redProperty().set(readInteger(parameters[0], 0, 255)); } // Manage green composite if (parameters.length >= 2) { greenProperty().set(readInteger(parameters[1], 0, 255)); } // Manage blue composite if (parameters.length >= 3) { blueProperty().set(readInteger(parameters[2], 0, 255)); } // Manage opacity if (parameters.length >= 4) { opacityProperty().set(readDouble(parameters[3], 0.0, 1.0)); } } }
public class class_name { @Override public void parse(final String... parameters) { // Manage red composite if (parameters.length >= 1) { redProperty().set(readInteger(parameters[0], 0, 255)); // depends on control dependency: [if], data = [none] } // Manage green composite if (parameters.length >= 2) { greenProperty().set(readInteger(parameters[1], 0, 255)); // depends on control dependency: [if], data = [none] } // Manage blue composite if (parameters.length >= 3) { blueProperty().set(readInteger(parameters[2], 0, 255)); // depends on control dependency: [if], data = [none] } // Manage opacity if (parameters.length >= 4) { opacityProperty().set(readDouble(parameters[3], 0.0, 1.0)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static double lag1(double[] vals) { double mean = mean(vals); int size = vals.length; double r1; double q = 0; double v = (vals[0] - mean) * (vals[0] - mean); for (int i = 1; i < size; i++) { double delta0 = (vals[i - 1] - mean); double delta1 = (vals[i] - mean); q += (delta0 * delta1 - q) / (i + 1); v += (delta1 * delta1 - v) / (i + 1); } r1 = q / v; return r1; } }
public class class_name { public static double lag1(double[] vals) { double mean = mean(vals); int size = vals.length; double r1; double q = 0; double v = (vals[0] - mean) * (vals[0] - mean); for (int i = 1; i < size; i++) { double delta0 = (vals[i - 1] - mean); double delta1 = (vals[i] - mean); q += (delta0 * delta1 - q) / (i + 1); // depends on control dependency: [for], data = [i] v += (delta1 * delta1 - v) / (i + 1); // depends on control dependency: [for], data = [i] } r1 = q / v; return r1; } }
public class class_name { public List<String> getDirectoryEntries(VirtualFile mountPoint, VirtualFile target) { final VirtualFile assemblyFile = assembly.getFile(mountPoint, target); if (assemblyFile == null) { return new ArrayList<String>(assembly.getChildNames(mountPoint, target)); } final List<String> directoryEntries = new LinkedList<String>(); for (VirtualFile child : assemblyFile.getChildren()) { directoryEntries.add(child.getName()); } return directoryEntries; } }
public class class_name { public List<String> getDirectoryEntries(VirtualFile mountPoint, VirtualFile target) { final VirtualFile assemblyFile = assembly.getFile(mountPoint, target); if (assemblyFile == null) { return new ArrayList<String>(assembly.getChildNames(mountPoint, target)); // depends on control dependency: [if], data = [none] } final List<String> directoryEntries = new LinkedList<String>(); for (VirtualFile child : assemblyFile.getChildren()) { directoryEntries.add(child.getName()); // depends on control dependency: [for], data = [child] } return directoryEntries; } }
public class class_name { public static void setHeader(Message message, String name, String value) { if (name.equals(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER)) { message.setHeader(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, Integer.valueOf(value)); } else if (name.equals(IntegrationMessageHeaderAccessor.SEQUENCE_SIZE)) { message.setHeader(IntegrationMessageHeaderAccessor.SEQUENCE_SIZE, Integer.valueOf(value)); } else if (name.equals(IntegrationMessageHeaderAccessor.PRIORITY)) { message.setHeader(IntegrationMessageHeaderAccessor.PRIORITY, Integer.valueOf(value)); } else { message.setHeader(name, value); } } }
public class class_name { public static void setHeader(Message message, String name, String value) { if (name.equals(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER)) { message.setHeader(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, Integer.valueOf(value)); // depends on control dependency: [if], data = [none] } else if (name.equals(IntegrationMessageHeaderAccessor.SEQUENCE_SIZE)) { message.setHeader(IntegrationMessageHeaderAccessor.SEQUENCE_SIZE, Integer.valueOf(value)); // depends on control dependency: [if], data = [none] } else if (name.equals(IntegrationMessageHeaderAccessor.PRIORITY)) { message.setHeader(IntegrationMessageHeaderAccessor.PRIORITY, Integer.valueOf(value)); // depends on control dependency: [if], data = [none] } else { message.setHeader(name, value); // depends on control dependency: [if], data = [none] } } }
public class class_name { public List<InstanceStateChangeType> stopInstances(final Set<String> instanceIDs) { List<InstanceStateChangeType> ret = new ArrayList<InstanceStateChangeType>(); Collection<AbstractMockEc2Instance> instances = getInstances(instanceIDs); for (AbstractMockEc2Instance instance : instances) { if (null != instance) { InstanceStateChangeType stateChange = new InstanceStateChangeType(); stateChange.setInstanceId(instance.getInstanceID()); InstanceStateType previousState = new InstanceStateType(); previousState.setCode(instance.getInstanceState().getCode()); previousState.setName(instance.getInstanceState().getName()); stateChange.setPreviousState(previousState); instance.stop(); InstanceStateType newState = new InstanceStateType(); newState.setCode(instance.getInstanceState().getCode()); newState.setName(instance.getInstanceState().getName()); stateChange.setCurrentState(newState); ret.add(stateChange); } } return ret; } }
public class class_name { public List<InstanceStateChangeType> stopInstances(final Set<String> instanceIDs) { List<InstanceStateChangeType> ret = new ArrayList<InstanceStateChangeType>(); Collection<AbstractMockEc2Instance> instances = getInstances(instanceIDs); for (AbstractMockEc2Instance instance : instances) { if (null != instance) { InstanceStateChangeType stateChange = new InstanceStateChangeType(); stateChange.setInstanceId(instance.getInstanceID()); // depends on control dependency: [if], data = [none] InstanceStateType previousState = new InstanceStateType(); previousState.setCode(instance.getInstanceState().getCode()); // depends on control dependency: [if], data = [none] previousState.setName(instance.getInstanceState().getName()); // depends on control dependency: [if], data = [none] stateChange.setPreviousState(previousState); // depends on control dependency: [if], data = [none] instance.stop(); // depends on control dependency: [if], data = [none] InstanceStateType newState = new InstanceStateType(); newState.setCode(instance.getInstanceState().getCode()); // depends on control dependency: [if], data = [none] newState.setName(instance.getInstanceState().getName()); // depends on control dependency: [if], data = [none] stateChange.setCurrentState(newState); // depends on control dependency: [if], data = [none] ret.add(stateChange); // depends on control dependency: [if], data = [none] } } return ret; } }
public class class_name { protected void decideAttributeReleaseBasedOnServiceAttributePolicy(final Map<String, List<Object>> attributes, final String attributeValue, final String attributeName, final RegisteredService service, final boolean doesAttributePolicyAllow) { if (StringUtils.isNotBlank(attributeValue)) { LOGGER.debug("Obtained [{}] as an authentication attribute", attributeName); if (doesAttributePolicyAllow) { LOGGER.debug("Obtained [{}] is passed to the CAS validation payload", attributeName); attributes.put(attributeName, CollectionUtils.wrap(attributeValue)); } else { LOGGER.debug("Attribute release policy for [{}] does not authorize the release of [{}]", service.getServiceId(), attributeName); attributes.remove(attributeName); } } else { LOGGER.trace("[{}] is not available and will not be released to the validation response.", attributeName); } } }
public class class_name { protected void decideAttributeReleaseBasedOnServiceAttributePolicy(final Map<String, List<Object>> attributes, final String attributeValue, final String attributeName, final RegisteredService service, final boolean doesAttributePolicyAllow) { if (StringUtils.isNotBlank(attributeValue)) { LOGGER.debug("Obtained [{}] as an authentication attribute", attributeName); // depends on control dependency: [if], data = [none] if (doesAttributePolicyAllow) { LOGGER.debug("Obtained [{}] is passed to the CAS validation payload", attributeName); // depends on control dependency: [if], data = [none] attributes.put(attributeName, CollectionUtils.wrap(attributeValue)); // depends on control dependency: [if], data = [none] } else { LOGGER.debug("Attribute release policy for [{}] does not authorize the release of [{}]", service.getServiceId(), attributeName); // depends on control dependency: [if], data = [none] attributes.remove(attributeName); // depends on control dependency: [if], data = [none] } } else { LOGGER.trace("[{}] is not available and will not be released to the validation response.", attributeName); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String defaultTostring(Object input, Object... appends) { if (null == input) { return NULL_STR; } StringBuilder bul = new StringBuilder(input.getClass().getName()); bul.append("@").append(Integer.toHexString(input.hashCode())); for (Object a : appends) { bul.append(null != a ? a.toString() : NULL_STR); } return bul.toString(); } }
public class class_name { public static String defaultTostring(Object input, Object... appends) { if (null == input) { return NULL_STR; } // depends on control dependency: [if], data = [none] StringBuilder bul = new StringBuilder(input.getClass().getName()); bul.append("@").append(Integer.toHexString(input.hashCode())); for (Object a : appends) { bul.append(null != a ? a.toString() : NULL_STR); // depends on control dependency: [for], data = [a] } return bul.toString(); } }
public class class_name { private void recordVisitField(Object object, Field objectField, Field field) { Map<String, Set<String>> bag = visitedFields.get(object); if (bag == null) { bag = new HashMap<>(); visitedFields.put(object, bag); } Set<String> fields = bag.get(objectField); String objectFiledKey = objectField == null ? "" : objectField.toGenericString(); if (fields == null) { fields = new HashSet<>(); bag.put(objectFiledKey, fields); } fields.add(field.toGenericString()); } }
public class class_name { private void recordVisitField(Object object, Field objectField, Field field) { Map<String, Set<String>> bag = visitedFields.get(object); if (bag == null) { bag = new HashMap<>(); // depends on control dependency: [if], data = [none] visitedFields.put(object, bag); // depends on control dependency: [if], data = [none] } Set<String> fields = bag.get(objectField); String objectFiledKey = objectField == null ? "" : objectField.toGenericString(); if (fields == null) { fields = new HashSet<>(); // depends on control dependency: [if], data = [none] bag.put(objectFiledKey, fields); // depends on control dependency: [if], data = [none] } fields.add(field.toGenericString()); } }
public class class_name { public static void closeConnection( Connection conn, Logger logger ) { try { if( conn != null ) conn.close(); } catch( SQLException e ) { // Not important. Utils.logException( logger, e ); } } }
public class class_name { public static void closeConnection( Connection conn, Logger logger ) { try { if( conn != null ) conn.close(); } catch( SQLException e ) { // Not important. Utils.logException( logger, e ); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override protected void onFinishInflate() { super.onFinishInflate(); // checks the appropriate radio button as requested in the XML file if (mCheckedId != -1) { mProtectFromCheckedChange = true; setCheckedStateForView(mCheckedId, true); mProtectFromCheckedChange = false; setCheckedId(mCheckedId); } } }
public class class_name { @Override protected void onFinishInflate() { super.onFinishInflate(); // checks the appropriate radio button as requested in the XML file if (mCheckedId != -1) { mProtectFromCheckedChange = true; // depends on control dependency: [if], data = [none] setCheckedStateForView(mCheckedId, true); // depends on control dependency: [if], data = [(mCheckedId] mProtectFromCheckedChange = false; // depends on control dependency: [if], data = [none] setCheckedId(mCheckedId); // depends on control dependency: [if], data = [(mCheckedId] } } }
public class class_name { private void runForEachK(String prefix, int mink, int maxk, IntFunction<OutlierResult> runner, BiConsumer<String, OutlierResult> out) { if(isDisabled(prefix)) { LOG.verbose("Skipping (disabled): " + prefix); return; // Disabled } LOG.verbose("Running " + prefix); final int digits = (int) FastMath.ceil(FastMath.log10(krange.getMax() + 1)); final String format = "%s-%0" + digits + "d"; krange.forEach(k -> { if(k >= mink && k <= maxk) { Duration time = LOG.newDuration(this.getClass().getCanonicalName() + "." + prefix + ".k" + k + ".runtime").begin(); OutlierResult result = runner.apply(k); LOG.statistics(time.end()); if(result != null) { out.accept(String.format(Locale.ROOT, format, prefix, k), result); result.getHierarchy().removeSubtree(result); } } }); } }
public class class_name { private void runForEachK(String prefix, int mink, int maxk, IntFunction<OutlierResult> runner, BiConsumer<String, OutlierResult> out) { if(isDisabled(prefix)) { LOG.verbose("Skipping (disabled): " + prefix); // depends on control dependency: [if], data = [none] return; // Disabled // depends on control dependency: [if], data = [none] } LOG.verbose("Running " + prefix); final int digits = (int) FastMath.ceil(FastMath.log10(krange.getMax() + 1)); final String format = "%s-%0" + digits + "d"; krange.forEach(k -> { if(k >= mink && k <= maxk) { Duration time = LOG.newDuration(this.getClass().getCanonicalName() + "." + prefix + ".k" + k + ".runtime").begin(); OutlierResult result = runner.apply(k); LOG.statistics(time.end()); if(result != null) { out.accept(String.format(Locale.ROOT, format, prefix, k), result); // depends on control dependency: [if], data = [none] result.getHierarchy().removeSubtree(result); // depends on control dependency: [if], data = [(result] } } }); } }
public class class_name { private static int hash(char []key, int length) { int hash = 17; for (int i = length - 1; i >= 0; i--) { char a = key[i]; if ('A' <= a && a <= 'Z') a += 'a' - 'A'; hash = 65537 * hash + a; } return hash; } }
public class class_name { private static int hash(char []key, int length) { int hash = 17; for (int i = length - 1; i >= 0; i--) { char a = key[i]; if ('A' <= a && a <= 'Z') a += 'a' - 'A'; hash = 65537 * hash + a; // depends on control dependency: [for], data = [none] } return hash; } }
public class class_name { private static boolean indexesAreDups(Index idx1, Index idx2) { // same attributes? if (idx1.getType() != idx2.getType()) { return false; } if (idx1.getCountable() != idx2.getCountable()) { return false; } if (idx1.getUnique() != idx2.getUnique()) { return false; } if (idx1.getAssumeunique() != idx2.getAssumeunique()) { return false; } // same column count? if (idx1.getColumns().size() != idx2.getColumns().size()) { return false; } //TODO: For index types like HASH that support only random access vs. scanned ranges, indexes on different // permutations of the same list of columns/expressions could be considered dupes. This code skips that edge // case optimization in favor of using a simpler more exact permutation-sensitive algorithm for all indexes. if ( ! (idx1.getExpressionsjson().equals(idx2.getExpressionsjson()))) { return false; } // Simple column indexes have identical empty expression strings so need to be distinguished other ways. // More complex expression indexes that have the same expression strings always have the same set of (base) // columns referenced in the same order, but we fall through and check them, anyway. // sort in index order the columns of idx1, each identified by its index in the base table int[] idx1baseTableOrder = new int[idx1.getColumns().size()]; for (ColumnRef cref : idx1.getColumns()) { int index = cref.getIndex(); int baseTableIndex = cref.getColumn().getIndex(); idx1baseTableOrder[index] = baseTableIndex; } // sort in index order the columns of idx2, each identified by its index in the base table int[] idx2baseTableOrder = new int[idx2.getColumns().size()]; for (ColumnRef cref : idx2.getColumns()) { int index = cref.getIndex(); int baseTableIndex = cref.getColumn().getIndex(); idx2baseTableOrder[index] = baseTableIndex; } // Duplicate indexes have identical columns in identical order. if ( ! Arrays.equals(idx1baseTableOrder, idx2baseTableOrder) ) { return false; } // Check the predicates if (idx1.getPredicatejson().length() > 0) { return idx1.getPredicatejson().equals(idx2.getPredicatejson()); } if (idx2.getPredicatejson().length() > 0) { return idx2.getPredicatejson().equals(idx1.getPredicatejson()); } return true; } }
public class class_name { private static boolean indexesAreDups(Index idx1, Index idx2) { // same attributes? if (idx1.getType() != idx2.getType()) { return false; // depends on control dependency: [if], data = [none] } if (idx1.getCountable() != idx2.getCountable()) { return false; // depends on control dependency: [if], data = [none] } if (idx1.getUnique() != idx2.getUnique()) { return false; // depends on control dependency: [if], data = [none] } if (idx1.getAssumeunique() != idx2.getAssumeunique()) { return false; // depends on control dependency: [if], data = [none] } // same column count? if (idx1.getColumns().size() != idx2.getColumns().size()) { return false; // depends on control dependency: [if], data = [none] } //TODO: For index types like HASH that support only random access vs. scanned ranges, indexes on different // permutations of the same list of columns/expressions could be considered dupes. This code skips that edge // case optimization in favor of using a simpler more exact permutation-sensitive algorithm for all indexes. if ( ! (idx1.getExpressionsjson().equals(idx2.getExpressionsjson()))) { return false; // depends on control dependency: [if], data = [none] } // Simple column indexes have identical empty expression strings so need to be distinguished other ways. // More complex expression indexes that have the same expression strings always have the same set of (base) // columns referenced in the same order, but we fall through and check them, anyway. // sort in index order the columns of idx1, each identified by its index in the base table int[] idx1baseTableOrder = new int[idx1.getColumns().size()]; for (ColumnRef cref : idx1.getColumns()) { int index = cref.getIndex(); int baseTableIndex = cref.getColumn().getIndex(); idx1baseTableOrder[index] = baseTableIndex; // depends on control dependency: [for], data = [none] } // sort in index order the columns of idx2, each identified by its index in the base table int[] idx2baseTableOrder = new int[idx2.getColumns().size()]; for (ColumnRef cref : idx2.getColumns()) { int index = cref.getIndex(); int baseTableIndex = cref.getColumn().getIndex(); idx2baseTableOrder[index] = baseTableIndex; // depends on control dependency: [for], data = [none] } // Duplicate indexes have identical columns in identical order. if ( ! Arrays.equals(idx1baseTableOrder, idx2baseTableOrder) ) { return false; // depends on control dependency: [if], data = [none] } // Check the predicates if (idx1.getPredicatejson().length() > 0) { return idx1.getPredicatejson().equals(idx2.getPredicatejson()); // depends on control dependency: [if], data = [none] } if (idx2.getPredicatejson().length() > 0) { return idx2.getPredicatejson().equals(idx1.getPredicatejson()); // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public static StackTrace from(Throwable exception) { checkNotNull(exception); StackTrace cause = null; Throwable realCause = exception.getCause(); if (realCause != null && realCause != exception) { cause = from(realCause); } Deque<Element> elements = new ArrayDeque<>(); for (StackTraceElement element : exception.getStackTrace()) { elements.add(Element.from(element)); } String className = exception.getClass().getCanonicalName(); String message = exception.getMessage(); return new StackTrace(className, message, elements, cause); } }
public class class_name { public static StackTrace from(Throwable exception) { checkNotNull(exception); StackTrace cause = null; Throwable realCause = exception.getCause(); if (realCause != null && realCause != exception) { cause = from(realCause); // depends on control dependency: [if], data = [(realCause] } Deque<Element> elements = new ArrayDeque<>(); for (StackTraceElement element : exception.getStackTrace()) { elements.add(Element.from(element)); // depends on control dependency: [for], data = [element] } String className = exception.getClass().getCanonicalName(); String message = exception.getMessage(); return new StackTrace(className, message, elements, cause); } }
public class class_name { public static File getFile(Context context, Uri uri) { if (uri != null) { String path = getPath(context, uri); if (path != null && isLocal(path)) { return new File(path); } } return null; } }
public class class_name { public static File getFile(Context context, Uri uri) { if (uri != null) { String path = getPath(context, uri); if (path != null && isLocal(path)) { return new File(path); // depends on control dependency: [if], data = [(path] } } return null; } }