code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { @Nullable public static Long parseLongObj (@Nullable final String sStr, @Nonnegative final int nRadix, @Nullable final Long aDefault) { if (sStr != null && sStr.length () > 0) try { return Long.valueOf (sStr, nRadix); } catch (final NumberFormatException ex) { // Fall through } return aDefault; } }
public class class_name { @Nullable public static Long parseLongObj (@Nullable final String sStr, @Nonnegative final int nRadix, @Nullable final Long aDefault) { if (sStr != null && sStr.length () > 0) try { return Long.valueOf (sStr, nRadix); // depends on control dependency: [try], data = [none] } catch (final NumberFormatException ex) { // Fall through } // depends on control dependency: [catch], data = [none] return aDefault; } }
public class class_name { private List processProperties(List properties, CmsContentCheckResource testResource) { List results = new ArrayList(); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key(Messages.LOG_DEBUG_PROPERTY_RESOURCE_1, testResource.getResourceName())); } //loop through all property tests for (int i = 0; i < properties.size(); i++) { try { CmsContentCheckPropertyObject propObject = (CmsContentCheckPropertyObject)properties.get(i); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key(Messages.LOG_DEBUG_PROPERTY_PROPERTY_1, propObject.toString())); } // check if this test must be done for thies kind of resource if ((propObject.getType().equals(CmsContentCheckPropertyObject.TYPE_BOTH)) || ((propObject.getType().equals(CmsContentCheckPropertyObject.TYPE_FILE) && (testResource.getResource().isFile()))) || ((propObject.getType().equals(CmsContentCheckPropertyObject.TYPE_FOLDER) && (testResource.getResource().isFolder()))) ) { // read the property String prop = m_cms.readPropertyObject( testResource.getResource(), propObject.getPropertyname(), false).getValue(); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_DEBUG_PROPERTY_VALUE_1, prop)); } if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_DEBUG_PROPERTY_ISEMPTYCHECK_1, Boolean.valueOf(propObject.isEmpty()))); } // test if the property is empty if (propObject.isEmpty() && CmsStringUtil.isEmpty(prop)) { results.add( Messages.get().getBundle().key( Messages.ERR_CHECK_NO_PROPERTYNAME_1, propObject.getPropertyname())); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.ERR_CHECK_NO_PROPERTYNAME_1, propObject.getPropertyname())); } } if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_DEBUG_PROPERTY_ISFILENAME_1, Boolean.valueOf(propObject.isFilename()))); } // test if the property does not start with the filename if (!CmsStringUtil.isEmpty(prop)) { if (propObject.isFilename() && testResource.getResource().getName().toLowerCase().startsWith(prop.toLowerCase())) { results.add( Messages.get().getBundle().key( Messages.ERR_CHECK_CONTAINS_FILENAME_2, propObject.getPropertyname(), prop)); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.ERR_CHECK_CONTAINS_FILENAME_2, propObject.getPropertyname(), prop)); } } if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_DEBUG_PROPERTY_CHECKLENGTH_2, new Integer(propObject.getLength()), new Integer(prop.length()))); } // test if the minmal property length is valid if (propObject.getLength() > -1) { if (prop.length() < propObject.getLength()) { results.add( Messages.get().getBundle().key( Messages.ERR_CHECK_TOO_SHORT_3, propObject.getPropertyname(), prop, new Integer(prop.length()))); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.ERR_CHECK_TOO_SHORT_3, propObject.getPropertyname(), prop, new Integer(prop.length()))); } } } // test if the value matches a regex if (propObject.getValue().size() > 0) { for (int j = 0; j < propObject.getValue().size(); j++) { String regex = (String)propObject.getValue().get(j); boolean matchResult = true; if (regex.charAt(0) == '!') { // negate the pattern matchResult = false; regex = regex.substring(1); } String matchValue = prop; boolean match = Pattern.matches(regex, matchValue); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_DEBUG_PROPERTY_MATCHPATTERN_2, regex, matchValue)); } if (matchResult != match) { results.add( Messages.get().getBundle().key( Messages.ERR_CHECK_MATCH_3, propObject.getPropertyname(), prop, propObject.getValue().get(j))); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.ERR_CHECK_MATCH_3, propObject.getPropertyname(), prop, propObject.getValue().get(j))); } } } } } } } catch (CmsException e) { LOG.error( Messages.get().getBundle().key( Messages.LOG_ERROR_PROCESSING_PROPERTIES_2, testResource.getResourceName(), e)); } } return results; } }
public class class_name { private List processProperties(List properties, CmsContentCheckResource testResource) { List results = new ArrayList(); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key(Messages.LOG_DEBUG_PROPERTY_RESOURCE_1, testResource.getResourceName())); // depends on control dependency: [if], data = [none] } //loop through all property tests for (int i = 0; i < properties.size(); i++) { try { CmsContentCheckPropertyObject propObject = (CmsContentCheckPropertyObject)properties.get(i); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key(Messages.LOG_DEBUG_PROPERTY_PROPERTY_1, propObject.toString())); // depends on control dependency: [if], data = [none] } // check if this test must be done for thies kind of resource if ((propObject.getType().equals(CmsContentCheckPropertyObject.TYPE_BOTH)) || ((propObject.getType().equals(CmsContentCheckPropertyObject.TYPE_FILE) && (testResource.getResource().isFile()))) || ((propObject.getType().equals(CmsContentCheckPropertyObject.TYPE_FOLDER) && (testResource.getResource().isFolder()))) ) { // read the property String prop = m_cms.readPropertyObject( testResource.getResource(), propObject.getPropertyname(), false).getValue(); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_DEBUG_PROPERTY_VALUE_1, prop)); // depends on control dependency: [if], data = [none] } if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_DEBUG_PROPERTY_ISEMPTYCHECK_1, Boolean.valueOf(propObject.isEmpty()))); // depends on control dependency: [if], data = [none] } // test if the property is empty if (propObject.isEmpty() && CmsStringUtil.isEmpty(prop)) { results.add( Messages.get().getBundle().key( Messages.ERR_CHECK_NO_PROPERTYNAME_1, propObject.getPropertyname())); // depends on control dependency: [if], data = [none] if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.ERR_CHECK_NO_PROPERTYNAME_1, propObject.getPropertyname())); // depends on control dependency: [if], data = [none] } } if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_DEBUG_PROPERTY_ISFILENAME_1, Boolean.valueOf(propObject.isFilename()))); // depends on control dependency: [if], data = [none] } // test if the property does not start with the filename if (!CmsStringUtil.isEmpty(prop)) { if (propObject.isFilename() && testResource.getResource().getName().toLowerCase().startsWith(prop.toLowerCase())) { results.add( Messages.get().getBundle().key( Messages.ERR_CHECK_CONTAINS_FILENAME_2, propObject.getPropertyname(), prop)); // depends on control dependency: [if], data = [none] if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.ERR_CHECK_CONTAINS_FILENAME_2, propObject.getPropertyname(), prop)); // depends on control dependency: [if], data = [none] } } if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_DEBUG_PROPERTY_CHECKLENGTH_2, new Integer(propObject.getLength()), new Integer(prop.length()))); // depends on control dependency: [if], data = [none] } // test if the minmal property length is valid if (propObject.getLength() > -1) { if (prop.length() < propObject.getLength()) { results.add( Messages.get().getBundle().key( Messages.ERR_CHECK_TOO_SHORT_3, propObject.getPropertyname(), prop, new Integer(prop.length()))); // depends on control dependency: [if], data = [none] if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.ERR_CHECK_TOO_SHORT_3, propObject.getPropertyname(), prop, new Integer(prop.length()))); // depends on control dependency: [if], data = [none] } } } // test if the value matches a regex if (propObject.getValue().size() > 0) { for (int j = 0; j < propObject.getValue().size(); j++) { String regex = (String)propObject.getValue().get(j); boolean matchResult = true; if (regex.charAt(0) == '!') { // negate the pattern matchResult = false; // depends on control dependency: [if], data = [none] regex = regex.substring(1); // depends on control dependency: [if], data = [none] } String matchValue = prop; boolean match = Pattern.matches(regex, matchValue); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_DEBUG_PROPERTY_MATCHPATTERN_2, regex, matchValue)); // depends on control dependency: [if], data = [none] } if (matchResult != match) { results.add( Messages.get().getBundle().key( Messages.ERR_CHECK_MATCH_3, propObject.getPropertyname(), prop, propObject.getValue().get(j))); // depends on control dependency: [if], data = [none] if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.ERR_CHECK_MATCH_3, propObject.getPropertyname(), prop, propObject.getValue().get(j))); // depends on control dependency: [if], data = [none] } } } } } } } catch (CmsException e) { LOG.error( Messages.get().getBundle().key( Messages.LOG_ERROR_PROCESSING_PROPERTIES_2, testResource.getResourceName(), e)); } // depends on control dependency: [catch], data = [none] } return results; } }
public class class_name { private void setHandshakeFailure(ChannelHandlerContext ctx, Throwable cause, boolean closeInbound, boolean notify, boolean alwaysFlushAndClose) { try { // Release all resources such as internal buffers that SSLEngine // is managing. outboundClosed = true; engine.closeOutbound(); if (closeInbound) { try { engine.closeInbound(); } catch (SSLException e) { if (logger.isDebugEnabled()) { // only log in debug mode as it most likely harmless and latest chrome still trigger // this all the time. // // See https://github.com/netty/netty/issues/1340 String msg = e.getMessage(); if (msg == null || !(msg.contains("possible truncation attack") || msg.contains("closing inbound before receiving peer's close_notify"))) { logger.debug("{} SSLEngine.closeInbound() raised an exception.", ctx.channel(), e); } } } } if (handshakePromise.tryFailure(cause) || alwaysFlushAndClose) { SslUtils.handleHandshakeFailure(ctx, cause, notify); } } finally { // Ensure we remove and fail all pending writes in all cases and so release memory quickly. releaseAndFailAll(cause); } } }
public class class_name { private void setHandshakeFailure(ChannelHandlerContext ctx, Throwable cause, boolean closeInbound, boolean notify, boolean alwaysFlushAndClose) { try { // Release all resources such as internal buffers that SSLEngine // is managing. outboundClosed = true; // depends on control dependency: [try], data = [none] engine.closeOutbound(); // depends on control dependency: [try], data = [none] if (closeInbound) { try { engine.closeInbound(); // depends on control dependency: [try], data = [none] } catch (SSLException e) { if (logger.isDebugEnabled()) { // only log in debug mode as it most likely harmless and latest chrome still trigger // this all the time. // // See https://github.com/netty/netty/issues/1340 String msg = e.getMessage(); if (msg == null || !(msg.contains("possible truncation attack") || msg.contains("closing inbound before receiving peer's close_notify"))) { logger.debug("{} SSLEngine.closeInbound() raised an exception.", ctx.channel(), e); // depends on control dependency: [if], data = [none] } } } // depends on control dependency: [catch], data = [none] } if (handshakePromise.tryFailure(cause) || alwaysFlushAndClose) { SslUtils.handleHandshakeFailure(ctx, cause, notify); // depends on control dependency: [if], data = [none] } } finally { // Ensure we remove and fail all pending writes in all cases and so release memory quickly. releaseAndFailAll(cause); } } }
public class class_name { public void close() { if (blk != null) { tx.bufferMgr().unpin(currentBuff); blk = null; currentBuff = null; } } }
public class class_name { public void close() { if (blk != null) { tx.bufferMgr().unpin(currentBuff); // depends on control dependency: [if], data = [none] blk = null; // depends on control dependency: [if], data = [none] currentBuff = null; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void handleLangs(final Map<String, Object> dataModel) { final Locale locale = Latkes.getLocale(); final String language = locale.getLanguage(); final String country = locale.getCountry(); final String variant = locale.getVariant(); final StringBuilder keyBuilder = new StringBuilder(language); if (StringUtils.isNotBlank(country)) { keyBuilder.append("_").append(country); } if (StringUtils.isNotBlank(variant)) { keyBuilder.append("_").append(variant); } final String localKey = keyBuilder.toString(); final Properties props = langs.get(localKey); if (null == props) { return; } final Set<Object> keySet = props.keySet(); for (final Object key : keySet) { dataModel.put((String) key, props.getProperty((String) key)); } } }
public class class_name { private void handleLangs(final Map<String, Object> dataModel) { final Locale locale = Latkes.getLocale(); final String language = locale.getLanguage(); final String country = locale.getCountry(); final String variant = locale.getVariant(); final StringBuilder keyBuilder = new StringBuilder(language); if (StringUtils.isNotBlank(country)) { keyBuilder.append("_").append(country); // depends on control dependency: [if], data = [none] } if (StringUtils.isNotBlank(variant)) { keyBuilder.append("_").append(variant); // depends on control dependency: [if], data = [none] } final String localKey = keyBuilder.toString(); final Properties props = langs.get(localKey); if (null == props) { return; // depends on control dependency: [if], data = [none] } final Set<Object> keySet = props.keySet(); for (final Object key : keySet) { dataModel.put((String) key, props.getProperty((String) key)); // depends on control dependency: [for], data = [key] } } }
public class class_name { public static double of(double... data) { double sum = 0.; for(double v : data) { sum += v; } return sum / data.length; } }
public class class_name { public static double of(double... data) { double sum = 0.; for(double v : data) { sum += v; // depends on control dependency: [for], data = [v] } return sum / data.length; } }
public class class_name { protected boolean shouldAddContentPart(String key) { boolean addPart=true; if(key.equals(FaxJob2HTTPRequestConverterConfigurationConstants.IGNORE_PARAMETER_KEY.toString())) { addPart=false; } return addPart; } }
public class class_name { protected boolean shouldAddContentPart(String key) { boolean addPart=true; if(key.equals(FaxJob2HTTPRequestConverterConfigurationConstants.IGNORE_PARAMETER_KEY.toString())) { addPart=false; // depends on control dependency: [if], data = [none] } return addPart; } }
public class class_name { public void marshall(CreateModelRequest createModelRequest, ProtocolMarshaller protocolMarshaller) { if (createModelRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createModelRequest.getApiId(), APIID_BINDING); protocolMarshaller.marshall(createModelRequest.getContentType(), CONTENTTYPE_BINDING); protocolMarshaller.marshall(createModelRequest.getDescription(), DESCRIPTION_BINDING); protocolMarshaller.marshall(createModelRequest.getName(), NAME_BINDING); protocolMarshaller.marshall(createModelRequest.getSchema(), SCHEMA_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(CreateModelRequest createModelRequest, ProtocolMarshaller protocolMarshaller) { if (createModelRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createModelRequest.getApiId(), APIID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createModelRequest.getContentType(), CONTENTTYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createModelRequest.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createModelRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createModelRequest.getSchema(), SCHEMA_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 BasicTimeChecker getBasicTimeChecker(final Map<String, ConditionChecker> checkers) { for (final ConditionChecker checker : checkers.values()) { if (checker.getType().equals(BasicTimeChecker.type)) { return (BasicTimeChecker) checker; } } return null; } }
public class class_name { private BasicTimeChecker getBasicTimeChecker(final Map<String, ConditionChecker> checkers) { for (final ConditionChecker checker : checkers.values()) { if (checker.getType().equals(BasicTimeChecker.type)) { return (BasicTimeChecker) checker; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public void consolidate(List targets) { if (tc.isEntryEnabled()) SibTr.entry(tc, "consolidate", targets); Iterator itr = targets.iterator(); // Reset the lists for this level levelUsersAllowedToSubscribe.clear(); levelUsersAllowedToPublish.clear(); levelGroupAllowedToSubscribe.clear(); levelGroupAllowedToPublish.clear(); while (itr.hasNext()) { Object target = itr.next(); if (target instanceof TopicAcl) { // Extract the principal Principal principal = ((TopicAcl)target).getPrincipal(); // Check the operation type if(((TopicAcl)target).getOperationType() == 1) { if(principal == null) { // This is an inheritance blocker accumUsersAllowedToPublish.clear(); accumGroupAllowedToPublish.clear(); } else if(principal instanceof Group) { levelGroupAllowedToPublish.add(principal); } else { levelUsersAllowedToPublish.add(principal); } } else { if(principal == null) { // This is an inheritance blocker accumUsersAllowedToSubscribe.clear(); accumGroupAllowedToSubscribe.clear(); } else if(principal instanceof Group) { levelGroupAllowedToSubscribe.add(principal); } else { levelUsersAllowedToSubscribe.add(principal); } } } } if(!levelUsersAllowedToSubscribe.isEmpty()) { accumUsersAllowedToSubscribe.addAll(levelUsersAllowedToSubscribe); } if(!levelUsersAllowedToPublish.isEmpty()) { accumUsersAllowedToPublish.addAll(levelUsersAllowedToPublish); } if(!levelGroupAllowedToSubscribe.isEmpty()) { accumGroupAllowedToSubscribe.addAll(levelGroupAllowedToSubscribe); } if(!levelGroupAllowedToPublish.isEmpty()) { accumGroupAllowedToPublish.addAll(levelGroupAllowedToPublish); } if (tc.isEntryEnabled()) SibTr.exit(tc, "consolidate"); } }
public class class_name { public void consolidate(List targets) { if (tc.isEntryEnabled()) SibTr.entry(tc, "consolidate", targets); Iterator itr = targets.iterator(); // Reset the lists for this level levelUsersAllowedToSubscribe.clear(); levelUsersAllowedToPublish.clear(); levelGroupAllowedToSubscribe.clear(); levelGroupAllowedToPublish.clear(); while (itr.hasNext()) { Object target = itr.next(); if (target instanceof TopicAcl) { // Extract the principal Principal principal = ((TopicAcl)target).getPrincipal(); // Check the operation type if(((TopicAcl)target).getOperationType() == 1) { if(principal == null) { // This is an inheritance blocker accumUsersAllowedToPublish.clear(); // depends on control dependency: [if], data = [none] accumGroupAllowedToPublish.clear(); // depends on control dependency: [if], data = [none] } else if(principal instanceof Group) { levelGroupAllowedToPublish.add(principal); // depends on control dependency: [if], data = [none] } else { levelUsersAllowedToPublish.add(principal); // depends on control dependency: [if], data = [none] } } else { if(principal == null) { // This is an inheritance blocker accumUsersAllowedToSubscribe.clear(); // depends on control dependency: [if], data = [none] accumGroupAllowedToSubscribe.clear(); // depends on control dependency: [if], data = [none] } else if(principal instanceof Group) { levelGroupAllowedToSubscribe.add(principal); // depends on control dependency: [if], data = [none] } else { levelUsersAllowedToSubscribe.add(principal); // depends on control dependency: [if], data = [none] } } } } if(!levelUsersAllowedToSubscribe.isEmpty()) { accumUsersAllowedToSubscribe.addAll(levelUsersAllowedToSubscribe); // depends on control dependency: [if], data = [none] } if(!levelUsersAllowedToPublish.isEmpty()) { accumUsersAllowedToPublish.addAll(levelUsersAllowedToPublish); // depends on control dependency: [if], data = [none] } if(!levelGroupAllowedToSubscribe.isEmpty()) { accumGroupAllowedToSubscribe.addAll(levelGroupAllowedToSubscribe); // depends on control dependency: [if], data = [none] } if(!levelGroupAllowedToPublish.isEmpty()) { accumGroupAllowedToPublish.addAll(levelGroupAllowedToPublish); // depends on control dependency: [if], data = [none] } if (tc.isEntryEnabled()) SibTr.exit(tc, "consolidate"); } }
public class class_name { @GET @Path("/{dataSourceName}/handoffComplete") @Produces(MediaType.APPLICATION_JSON) @ResourceFilters(DatasourceResourceFilter.class) public Response isHandOffComplete( @PathParam("dataSourceName") String dataSourceName, @QueryParam("interval") final String interval, @QueryParam("partitionNumber") final int partitionNumber, @QueryParam("version") final String version ) { try { final List<Rule> rules = databaseRuleManager.getRulesWithDefault(dataSourceName); final Interval theInterval = Intervals.of(interval); final SegmentDescriptor descriptor = new SegmentDescriptor(theInterval, version, partitionNumber); final DateTime now = DateTimes.nowUtc(); // dropped means a segment will never be handed off, i.e it completed hand off // init to true, reset to false only if this segment can be loaded by rules boolean dropped = true; for (Rule rule : rules) { if (rule.appliesTo(theInterval, now)) { if (rule instanceof LoadRule) { dropped = false; } break; } } if (dropped) { return Response.ok(true).build(); } TimelineLookup<String, SegmentLoadInfo> timeline = serverInventoryView.getTimeline( new TableDataSource(dataSourceName) ); if (timeline == null) { log.debug("No timeline found for datasource[%s]", dataSourceName); return Response.ok(false).build(); } Iterable<TimelineObjectHolder<String, SegmentLoadInfo>> lookup = timeline.lookupWithIncompletePartitions( theInterval); FunctionalIterable<ImmutableSegmentLoadInfo> loadInfoIterable = FunctionalIterable .create(lookup).transformCat( (TimelineObjectHolder<String, SegmentLoadInfo> input) -> Iterables.transform( input.getObject(), (PartitionChunk<SegmentLoadInfo> chunk) -> chunk.getObject().toImmutableSegmentLoadInfo() ) ); if (isSegmentLoaded(loadInfoIterable, descriptor)) { return Response.ok(true).build(); } return Response.ok(false).build(); } catch (Exception e) { log.error(e, "Error while handling hand off check request"); return Response.serverError().entity(ImmutableMap.of("error", e.toString())).build(); } } }
public class class_name { @GET @Path("/{dataSourceName}/handoffComplete") @Produces(MediaType.APPLICATION_JSON) @ResourceFilters(DatasourceResourceFilter.class) public Response isHandOffComplete( @PathParam("dataSourceName") String dataSourceName, @QueryParam("interval") final String interval, @QueryParam("partitionNumber") final int partitionNumber, @QueryParam("version") final String version ) { try { final List<Rule> rules = databaseRuleManager.getRulesWithDefault(dataSourceName); final Interval theInterval = Intervals.of(interval); final SegmentDescriptor descriptor = new SegmentDescriptor(theInterval, version, partitionNumber); final DateTime now = DateTimes.nowUtc(); // dropped means a segment will never be handed off, i.e it completed hand off // init to true, reset to false only if this segment can be loaded by rules boolean dropped = true; for (Rule rule : rules) { if (rule.appliesTo(theInterval, now)) { if (rule instanceof LoadRule) { dropped = false; // depends on control dependency: [if], data = [none] } break; } } if (dropped) { return Response.ok(true).build(); // depends on control dependency: [if], data = [none] } TimelineLookup<String, SegmentLoadInfo> timeline = serverInventoryView.getTimeline( new TableDataSource(dataSourceName) ); if (timeline == null) { log.debug("No timeline found for datasource[%s]", dataSourceName); // depends on control dependency: [if], data = [none] return Response.ok(false).build(); // depends on control dependency: [if], data = [none] } Iterable<TimelineObjectHolder<String, SegmentLoadInfo>> lookup = timeline.lookupWithIncompletePartitions( theInterval); FunctionalIterable<ImmutableSegmentLoadInfo> loadInfoIterable = FunctionalIterable .create(lookup).transformCat( (TimelineObjectHolder<String, SegmentLoadInfo> input) -> Iterables.transform( input.getObject(), (PartitionChunk<SegmentLoadInfo> chunk) -> chunk.getObject().toImmutableSegmentLoadInfo() ) ); if (isSegmentLoaded(loadInfoIterable, descriptor)) { return Response.ok(true).build(); // depends on control dependency: [if], data = [none] } return Response.ok(false).build(); // depends on control dependency: [try], data = [none] } catch (Exception e) { log.error(e, "Error while handling hand off check request"); return Response.serverError().entity(ImmutableMap.of("error", e.toString())).build(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public boolean isIdentifier(String... values) { if (values.length == 0) { return is(TokenType.ID); } for (String value : values) { if (matches(TokenType.ID, value)) { return true; } } return false; } }
public class class_name { public boolean isIdentifier(String... values) { if (values.length == 0) { return is(TokenType.ID); // depends on control dependency: [if], data = [none] } for (String value : values) { if (matches(TokenType.ID, value)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { private NodeUsageReport getReportUnprotected(String trackerName) { NodeUsageReport usageReport = usageReports.get(trackerName); if (usageReport == null) { usageReport = new NodeUsageReport(trackerName, 0, 0, 0, 0, 0, 0, 0); usageReports.put(trackerName, usageReport); } return usageReport; } }
public class class_name { private NodeUsageReport getReportUnprotected(String trackerName) { NodeUsageReport usageReport = usageReports.get(trackerName); if (usageReport == null) { usageReport = new NodeUsageReport(trackerName, 0, 0, 0, 0, 0, 0, 0); // depends on control dependency: [if], data = [none] usageReports.put(trackerName, usageReport); // depends on control dependency: [if], data = [none] } return usageReport; } }
public class class_name { public void setExcludeList(List<String> urls) { if (urls == null || urls.isEmpty()) { excludeList = Collections.emptyList(); return; } this.excludeList = urls; } }
public class class_name { public void setExcludeList(List<String> urls) { if (urls == null || urls.isEmpty()) { excludeList = Collections.emptyList(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.excludeList = urls; } }
public class class_name { public Integer getDay() { String dateValue = getValue(); if (dateValue != null && dateValue.length() == DAY_END) { return parseDateComponent(dateValue.substring(DAY_START, DAY_END), getPaddingChar()); } else { return null; } } }
public class class_name { public Integer getDay() { String dateValue = getValue(); if (dateValue != null && dateValue.length() == DAY_END) { return parseDateComponent(dateValue.substring(DAY_START, DAY_END), getPaddingChar()); // depends on control dependency: [if], data = [DAY_END)] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public LocalTime withSecond(int second) { if (this.second == second) { return this; } SECOND_OF_MINUTE.checkValidValue(second); return create(hour, minute, second, nano); } }
public class class_name { public LocalTime withSecond(int second) { if (this.second == second) { return this; // depends on control dependency: [if], data = [none] } SECOND_OF_MINUTE.checkValidValue(second); return create(hour, minute, second, nano); } }
public class class_name { public boolean matchIgnoredPropertyTypes(final Class propertyType, final boolean excludeMaps, final boolean include) { if (!include) { return false; } if (propertyType != null) { if (!jsonSerializer.deep) { ClassDescriptor propertyTypeClassDescriptor = ClassIntrospector.get().lookup(propertyType); if (propertyTypeClassDescriptor.isArray()) { return false; } if (propertyTypeClassDescriptor.isCollection()) { return false; } if (excludeMaps) { if (propertyTypeClassDescriptor.isMap()) { return false; } } } // still not excluded, continue with excluded types and type names // + excluded types if (jsonSerializer.excludedTypes != null) { for (Class excludedType : jsonSerializer.excludedTypes) { if (ClassUtil.isTypeOf(propertyType, excludedType)) { return false; } } } // + exclude type names final String propertyTypeName = propertyType.getName(); if (jsonSerializer.excludedTypeNames != null) { for (String excludedTypeName : jsonSerializer.excludedTypeNames) { if (Wildcard.match(propertyTypeName, excludedTypeName)) { return false; } } } } return true; } }
public class class_name { public boolean matchIgnoredPropertyTypes(final Class propertyType, final boolean excludeMaps, final boolean include) { if (!include) { return false; // depends on control dependency: [if], data = [none] } if (propertyType != null) { if (!jsonSerializer.deep) { ClassDescriptor propertyTypeClassDescriptor = ClassIntrospector.get().lookup(propertyType); if (propertyTypeClassDescriptor.isArray()) { return false; // depends on control dependency: [if], data = [none] } if (propertyTypeClassDescriptor.isCollection()) { return false; // depends on control dependency: [if], data = [none] } if (excludeMaps) { if (propertyTypeClassDescriptor.isMap()) { return false; // depends on control dependency: [if], data = [none] } } } // still not excluded, continue with excluded types and type names // + excluded types if (jsonSerializer.excludedTypes != null) { for (Class excludedType : jsonSerializer.excludedTypes) { if (ClassUtil.isTypeOf(propertyType, excludedType)) { return false; // depends on control dependency: [if], data = [none] } } } // + exclude type names final String propertyTypeName = propertyType.getName(); if (jsonSerializer.excludedTypeNames != null) { for (String excludedTypeName : jsonSerializer.excludedTypeNames) { if (Wildcard.match(propertyTypeName, excludedTypeName)) { return false; // depends on control dependency: [if], data = [none] } } } } return true; } }
public class class_name { private static Set<Attr> collectAttributes(Element element, boolean includeCssClass) { Set<Attr> attributes = new HashSet<Attr>(); Attr cssClass = null; boolean foundDataCssClass = false; for (Attr attr : element.getAttrs()) { final AttrImpl attrImpl = new AttrImpl(attr); if (includeCssClass) { attributes.add(attrImpl); continue; } // logic for variant with CSS class exclusion if (!"class".equalsIgnoreCase(attr.getName())) { attributes.add(attrImpl); } else { cssClass = attrImpl; } if ("data-css-class".equalsIgnoreCase(attr.getName())) { foundDataCssClass = true; } } if (!foundDataCssClass && cssClass != null) { // takes care to preserve static CSS class if CSS_CLASS operator is not present attributes.add(cssClass); } return attributes; } }
public class class_name { private static Set<Attr> collectAttributes(Element element, boolean includeCssClass) { Set<Attr> attributes = new HashSet<Attr>(); Attr cssClass = null; boolean foundDataCssClass = false; for (Attr attr : element.getAttrs()) { final AttrImpl attrImpl = new AttrImpl(attr); if (includeCssClass) { attributes.add(attrImpl); // depends on control dependency: [if], data = [none] continue; } // logic for variant with CSS class exclusion if (!"class".equalsIgnoreCase(attr.getName())) { attributes.add(attrImpl); // depends on control dependency: [if], data = [none] } else { cssClass = attrImpl; // depends on control dependency: [if], data = [none] } if ("data-css-class".equalsIgnoreCase(attr.getName())) { foundDataCssClass = true; // depends on control dependency: [if], data = [none] } } if (!foundDataCssClass && cssClass != null) { // takes care to preserve static CSS class if CSS_CLASS operator is not present attributes.add(cssClass); // depends on control dependency: [if], data = [none] } return attributes; } }
public class class_name { private void simulateCommitBean(BeanO beanO, ContainerTx containerTx) { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "simulateCommitBean"); // React to exceptions the same as afterCompletion, insure // both commit and commitBean are called. F743-22462.CR try { beanO.commit(containerTx); } catch (Throwable ex) { FFDCFilter.processException(ex, CLASS_NAME + ".simulateCommitBean", "5300", new Object[] { this, beanO }); if (isTraceOn && tc.isEventEnabled()) Tr.event(tc, "Exception thrown from BeanO.commit()", new Object[] { beanO, ex }); } try { activator.commitBean(containerTx, beanO); } catch (Throwable ex) { FFDCFilter.processException(ex, CLASS_NAME + ".simulateCommitBean", "5313", new Object[] { this, beanO }); if (isTraceOn && tc.isEventEnabled()) Tr.event(tc, "Exception thrown from commitBean()", new Object[] { beanO, ex }); } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "simulateCommitBean"); } }
public class class_name { private void simulateCommitBean(BeanO beanO, ContainerTx containerTx) { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "simulateCommitBean"); // React to exceptions the same as afterCompletion, insure // both commit and commitBean are called. F743-22462.CR try { beanO.commit(containerTx); // depends on control dependency: [try], data = [none] } catch (Throwable ex) { FFDCFilter.processException(ex, CLASS_NAME + ".simulateCommitBean", "5300", new Object[] { this, beanO }); if (isTraceOn && tc.isEventEnabled()) Tr.event(tc, "Exception thrown from BeanO.commit()", new Object[] { beanO, ex }); } // depends on control dependency: [catch], data = [none] try { activator.commitBean(containerTx, beanO); // depends on control dependency: [try], data = [none] } catch (Throwable ex) { FFDCFilter.processException(ex, CLASS_NAME + ".simulateCommitBean", "5313", new Object[] { this, beanO }); if (isTraceOn && tc.isEventEnabled()) Tr.event(tc, "Exception thrown from commitBean()", new Object[] { beanO, ex }); } // depends on control dependency: [catch], data = [none] if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "simulateCommitBean"); } }
public class class_name { @Override public <E> List<E> sort(final List<E> elements) { int position = elements.size(); do { int lastSwapPosition = 0; for (int index = 1; index < position; index++) { if (getOrderBy().compare(elements.get(index - 1), elements.get(index)) > 0) { swap(elements, index - 1, index); lastSwapPosition = index; } } position = lastSwapPosition; } while (position != 0); return elements; } }
public class class_name { @Override public <E> List<E> sort(final List<E> elements) { int position = elements.size(); do { int lastSwapPosition = 0; for (int index = 1; index < position; index++) { if (getOrderBy().compare(elements.get(index - 1), elements.get(index)) > 0) { swap(elements, index - 1, index); // depends on control dependency: [if], data = [none] lastSwapPosition = index; // depends on control dependency: [if], data = [none] } } position = lastSwapPosition; } while (position != 0); return elements; } }
public class class_name { private ISFSArray parseObjectArray(ClassUnwrapper unwrapper, Object[] array) { ISFSArray result = new SFSArray(); for(Object obj : array) { result.addSFSObject(object2params(unwrapper, obj)); } return result; } }
public class class_name { private ISFSArray parseObjectArray(ClassUnwrapper unwrapper, Object[] array) { ISFSArray result = new SFSArray(); for(Object obj : array) { result.addSFSObject(object2params(unwrapper, obj)); // depends on control dependency: [for], data = [obj] } return result; } }
public class class_name { public List<Query> shard(SortedSet<ByteString> splitPoints) { Preconditions.checkState(builder.getRowsLimit() == 0, "Can't shard a query with a row limit"); List<RowSet> shardedRowSets = RowSetUtil.shard(builder.getRows(), splitPoints); List<Query> shards = Lists.newArrayListWithCapacity(shardedRowSets.size()); for (RowSet rowSet : shardedRowSets) { Query queryShard = new Query(tableId); queryShard.builder.mergeFrom(this.builder.build()); queryShard.builder.setRows(rowSet); shards.add(queryShard); } return shards; } }
public class class_name { public List<Query> shard(SortedSet<ByteString> splitPoints) { Preconditions.checkState(builder.getRowsLimit() == 0, "Can't shard a query with a row limit"); List<RowSet> shardedRowSets = RowSetUtil.shard(builder.getRows(), splitPoints); List<Query> shards = Lists.newArrayListWithCapacity(shardedRowSets.size()); for (RowSet rowSet : shardedRowSets) { Query queryShard = new Query(tableId); queryShard.builder.mergeFrom(this.builder.build()); // depends on control dependency: [for], data = [none] queryShard.builder.setRows(rowSet); // depends on control dependency: [for], data = [rowSet] shards.add(queryShard); // depends on control dependency: [for], data = [none] } return shards; } }
public class class_name { public int getDistance(final NetworkNode networkNode) { int steps = 0; NetworkNode tmp = this; while (tmp != null) { final int distance = tmp.isPredecessorOrSelfOf(networkNode); if (distance >= 0) { return (steps + distance); } tmp = tmp.getParentNode(); ++steps; } return Integer.MAX_VALUE; } }
public class class_name { public int getDistance(final NetworkNode networkNode) { int steps = 0; NetworkNode tmp = this; while (tmp != null) { final int distance = tmp.isPredecessorOrSelfOf(networkNode); if (distance >= 0) { return (steps + distance); // depends on control dependency: [if], data = [none] } tmp = tmp.getParentNode(); // depends on control dependency: [while], data = [none] ++steps; // depends on control dependency: [while], data = [none] } return Integer.MAX_VALUE; } }
public class class_name { private void initialize() { frmSsTraceParser = new JFrame(); frmSsTraceParser.setTitle("SS7 Trace Parser"); frmSsTraceParser.setResizable(false); frmSsTraceParser.setBounds(100, 100, 569, 716); frmSsTraceParser.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); frmSsTraceParser.getContentPane().add(panel, BorderLayout.SOUTH); btnStart = new JButton("Start"); btnStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (tfFilePath.getText() == null || tfFilePath.getText().equals("")) { JOptionPane.showMessageDialog(null, "The FilePath must be set"); return; } // saving parameters Ss7ParseParameters newPar = new Ss7ParseParameters(); if (rdbtnTpActerna.isSelected()) newPar.setFileTypeN(ParseDriverType.Acterna); if (rdbtnTpSimpleSeq.isSelected()) newPar.setFileTypeN(ParseDriverType.SimpleSeq); if (rdbtnTpPcap.isSelected()) newPar.setFileTypeN(ParseDriverType.Pcap); if (rdbtnHexStream.isSelected()) newPar.setFileTypeN(ParseDriverType.HexStream); if (rdbtnMap.isSelected()) newPar.setParseProtocol(ParseProtocol.Map); if (rdbtnCap.isSelected()) newPar.setParseProtocol(ParseProtocol.Cap); if (rdbtnIsup.isSelected()) newPar.setParseProtocol(ParseProtocol.Isup); if (rdbtnITU.isSelected()) newPar.setSccpProtocolVersion(SccpProtocolVersion.ITU); if (rdbtnANSI.isSelected()) newPar.setSccpProtocolVersion(SccpProtocolVersion.ANSI); newPar.setSourceFilePath(tfFilePath.getText()); if (cbApplicationContextFilter.isSelected()) { try { newPar.setApplicationContextFilter(Integer.parseInt(tfApplicationContextFilter.getText())); } catch (NumberFormatException ee) { JOptionPane .showMessageDialog(null, "Can not parse ApplicationContextFilter the value. \nIt should be an Integer.\nParsing without ApplicationContextFilter"); } } if (cbDialogIdFilter.isSelected()) { try { if (!tfDialogIdFilter.getText().equals("")) newPar.setDialogIdFilter(Long.parseLong(tfDialogIdFilter.getText())); } catch (NumberFormatException ee) { JOptionPane .showMessageDialog(null, "Can not parse ApplicationContextFilter the value. \nIt should be an Integer.\nParsing without ApplicationContextFilter"); } try { if (!tfDialogIdFilter2.getText().equals("")) newPar.setDialogIdFilter2(Long.parseLong(tfDialogIdFilter2.getText())); } catch (NumberFormatException ee) { JOptionPane .showMessageDialog(null, "Can not parse ApplicationContextFilter2 the value. \nIt should be an Integer.\nParsing without ApplicationContextFilter2"); } } if (cbOpcDpcFilter.isSelected()) { try { String[] ss = tfOpcDpcFilter.getText().split(","); int ii1 = ss.length; Integer[] ires = new Integer[ii1]; for (int i1 = 0; i1 < ii1; i1++) { String s = ss[i1]; s = s.trim(); ires[i1] = Integer.parseInt(s); } newPar.setOpcDpcFilter(ires); } catch (NumberFormatException ee) { JOptionPane.showMessageDialog(null, "Can not parse OpcDpcFilter the value. \nIt should be a set of Integers.\nParsing without OpcDpcFilter"); } } if (cbMsgLog.isSelected()) { newPar.setMsgLogFilePath(tfMsgLog.getText()); } if (cbTcapData.isSelected()) { newPar.setTcapMsgData(true); } if (cbDialogDet.isSelected()) { newPar.setDetailedDialog(true); } if (cbCompDet.isSelected()) { newPar.setDetailedComponents(true); } if (cbRecordingDialogMessageChain.isSelected()) { newPar.setMessageChainFilePath(tfRecordingDialogMessageChain.getText()); } try { BufferedOutputStream bis = new BufferedOutputStream(new FileOutputStream(persistFile)); XMLEncoder d = new XMLEncoder(bis); d.writeObject(newPar); d.close(); } catch (Exception ee) { ee.printStackTrace(); JOptionPane.showMessageDialog(null, "Failed when saving the parameter file Ss7ParseParameters.xml: " + ee.getMessage()); } btnStart.setEnabled(false); btnGetStatisticInfo.setEnabled(false); btnStop.setEnabled(true); // starting parsing task = new SS7TraceParser(persistDir, newPar); task.parse(); } }); panel.add(btnStart); btnStop = new JButton("Stop"); btnStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (task != null) task.interrupt(); } }); btnStop.setEnabled(false); panel.add(btnStop); btnGetStatisticInfo = new JButton("Get statistic info"); btnGetStatisticInfo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { getStatisticInfo(); } }); panel.add(btnGetStatisticInfo); JPanel panel_1 = new JPanel(); frmSsTraceParser.getContentPane().add(panel_1, BorderLayout.CENTER); panel_1.setLayout(null); JPanel panel_2 = new JPanel(); panel_2.setBorder(new LineBorder(new Color(0, 0, 0))); panel_2.setBounds(10, 11, 543, 58); panel_1.add(panel_2); panel_2.setLayout(null); rdbtnTpActerna = new JRadioButton("Acterna"); rdbtnTpActerna.setSelected(true); buttonGroup.add(rdbtnTpActerna); rdbtnTpActerna.setBounds(6, 28, 109, 23); panel_2.add(rdbtnTpActerna); JLabel lblSelectAFile = new JLabel("Trace file type"); lblSelectAFile.setBounds(15, 11, 154, 14); panel_2.add(lblSelectAFile); rdbtnTpSimpleSeq = new JRadioButton("Simple sequence"); buttonGroup.add(rdbtnTpSimpleSeq); rdbtnTpSimpleSeq.setBounds(137, 28, 126, 23); panel_2.add(rdbtnTpSimpleSeq); rdbtnTpPcap = new JRadioButton("Pcap"); buttonGroup.add(rdbtnTpPcap); rdbtnTpPcap.setBounds(275, 28, 101, 23); panel_2.add(rdbtnTpPcap); rdbtnHexStream = new JRadioButton("Hex stream"); buttonGroup.add(rdbtnHexStream); rdbtnHexStream.setBounds(380, 27, 127, 25); panel_2.add(rdbtnHexStream); tfFilePath = new JTextField(); tfFilePath.setBounds(20, 187, 481, 20); panel_1.add(tfFilePath); tfFilePath.setColumns(10); JButton btnFilePath = new JButton(". . ."); btnFilePath.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); String filterName = null; if (rdbtnTpActerna.isSelected()) filterName = "Acterna"; if (rdbtnTpSimpleSeq.isSelected()) filterName = "Simple"; if (rdbtnTpPcap.isSelected()) filterName = "Pcap"; if (rdbtnHexStream.isSelected()) filterName = "HexStream"; TraceFileFilter filter = new TraceFileFilter(filterName); chooser.setFileFilter(filter); chooser.addChoosableFileFilter(filter); File f = new File(tfFilePath.getText()); chooser.setSelectedFile(f); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); int returnVal = chooser.showOpenDialog(frmSsTraceParser); if (returnVal == JFileChooser.APPROVE_OPTION) { File f2 = chooser.getSelectedFile(); if (f2 != null && f2.exists()) tfFilePath.setText(f2.getPath()); else JOptionPane.showMessageDialog(null, "File does not exists - try again"); } } }); btnFilePath.setBounds(511, 186, 52, 23); panel_1.add(btnFilePath); JLabel lblPathToThe = new JLabel("Trace file path"); lblPathToThe.setBounds(20, 172, 153, 14); panel_1.add(lblPathToThe); this.cbApplicationContextFilter = new JCheckBox("ApplicationContext filter"); cbApplicationContextFilter.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { tfApplicationContextFilter.setEnabled(cbApplicationContextFilter.isSelected()); } }); cbApplicationContextFilter.setBounds(20, 216, 210, 23); panel_1.add(cbApplicationContextFilter); cbMsgLog = new JCheckBox("Messages logging"); cbMsgLog.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { btnMsgLog.setEnabled(cbMsgLog.isSelected()); tfMsgLog.setEnabled(cbMsgLog.isSelected()); cbTcapData.setEnabled(cbMsgLog.isSelected()); cbDialogDet.setEnabled(cbMsgLog.isSelected()); cbCompDet.setEnabled(cbMsgLog.isSelected()); } }); cbMsgLog.setBounds(20, 308, 210, 23); panel_1.add(cbMsgLog); tfApplicationContextFilter = new JTextField(); tfApplicationContextFilter.setEnabled(false); tfApplicationContextFilter.setBounds(236, 217, 153, 20); panel_1.add(tfApplicationContextFilter); tfApplicationContextFilter.setColumns(10); cbDialogIdFilter = new JCheckBox("DialogId filter"); cbDialogIdFilter.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { tfDialogIdFilter.setEnabled(cbDialogIdFilter.isSelected()); tfDialogIdFilter2.setEnabled(cbDialogIdFilter.isSelected()); } }); cbDialogIdFilter.setBounds(20, 247, 210, 23); panel_1.add(cbDialogIdFilter); tfDialogIdFilter = new JTextField(); tfDialogIdFilter.setEnabled(false); tfDialogIdFilter.setColumns(10); tfDialogIdFilter.setBounds(236, 248, 153, 20); panel_1.add(tfDialogIdFilter); pnMsgLog = new JPanel(); pnMsgLog.setBorder(new LineBorder(new Color(0, 0, 0))); pnMsgLog.setBounds(10, 338, 553, 136); panel_1.add(pnMsgLog); pnMsgLog.setLayout(null); tfMsgLog = new JTextField(); tfMsgLog.setBounds(10, 27, 433, 20); pnMsgLog.add(tfMsgLog); tfMsgLog.setEnabled(false); tfMsgLog.setColumns(10); JLabel lblMessageLogFile = new JLabel("Message log file path"); lblMessageLogFile.setBounds(10, 11, 153, 14); pnMsgLog.add(lblMessageLogFile); timer = new javax.swing.Timer(100, new ActionListener() { public void actionPerformed(ActionEvent e) { if (task != null) { if (curMsgCount != task.getMsgCount()) { curMsgCount = task.getMsgCount(); String s1 = ((Integer) curMsgCount).toString(); tfMsgCnt.setText(s1); } if (task.isFinished()) { String errorMsg = task.getErrorMessage(); btnStart.setEnabled(true); btnGetStatisticInfo.setEnabled(true); btnStop.setEnabled(false); parseData = task.getStatisticData(); task = null; if (errorMsg != null) JOptionPane.showMessageDialog(null, "Error: " + errorMsg); else JOptionPane.showMessageDialog(null, "Success"); } } } }); timer.start(); btnMsgLog = new JButton(". . ."); btnMsgLog.setEnabled(false); btnMsgLog.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); File f = new File(tfMsgLog.getText()); chooser.setSelectedFile(f); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); int returnVal = chooser.showOpenDialog(frmSsTraceParser); if (returnVal == JFileChooser.APPROVE_OPTION) { File f2 = chooser.getSelectedFile(); tfMsgLog.setText(f2.getPath()); } } }); btnMsgLog.setBounds(453, 26, 52, 23); pnMsgLog.add(btnMsgLog); cbTcapData = new JCheckBox("Store in the log TCAP message source data"); // cbTcapData.addItemListener(new ItemListener() { // public void itemStateChanged(ItemEvent e) { // cbDialogDet.setEnabled(cbTcapData.isSelected()); // cbCompDet.setEnabled(cbTcapData.isSelected()); // } // }); cbTcapData.setBounds(10, 50, 296, 23); pnMsgLog.add(cbTcapData); cbDialogDet = new JCheckBox("Write dialog portion details"); cbDialogDet.setBounds(10, 76, 296, 23); pnMsgLog.add(cbDialogDet); cbCompDet = new JCheckBox("Write components portion details"); cbCompDet.setBounds(10, 102, 296, 23); pnMsgLog.add(cbCompDet); lblMessagesPerformed = new JLabel("Messages performed"); lblMessagesPerformed.setBounds(10, 592, 140, 14); panel_1.add(lblMessagesPerformed); tfMsgCnt = new JTextField(); tfMsgCnt.setEditable(false); tfMsgCnt.setBounds(160, 589, 86, 20); panel_1.add(tfMsgCnt); tfMsgCnt.setColumns(10); tfDialogIdFilter2 = new JTextField(); tfDialogIdFilter2.setEnabled(false); tfDialogIdFilter2.setColumns(10); tfDialogIdFilter2.setBounds(399, 248, 153, 20); panel_1.add(tfDialogIdFilter2); panel_3 = new JPanel(); panel_3.setBorder(new LineBorder(new Color(0, 0, 0))); panel_3.setLayout(null); panel_3.setBounds(10, 69, 543, 58); panel_1.add(panel_3); rdbtnMap = new JRadioButton("MAP"); buttonGroup_1.add(rdbtnMap); rdbtnMap.setSelected(true); rdbtnMap.setBounds(6, 28, 109, 23); panel_3.add(rdbtnMap); lblProtocol = new JLabel("Protocol"); lblProtocol.setBounds(15, 11, 154, 14); panel_3.add(lblProtocol); rdbtnCap = new JRadioButton("CAP"); buttonGroup_1.add(rdbtnCap); rdbtnCap.setBounds(119, 28, 99, 23); panel_3.add(rdbtnCap); rdbtnIsup = new JRadioButton("ISUP"); buttonGroup_1.add(rdbtnIsup); rdbtnIsup.setBounds(228, 28, 99, 23); panel_3.add(rdbtnIsup); cbOpcDpcFilter = new JCheckBox("Opc / Dpc filter (Ex: \"120,130\")"); cbOpcDpcFilter.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent arg0) { tfOpcDpcFilter.setEnabled(cbOpcDpcFilter.isSelected()); } }); cbOpcDpcFilter.setBounds(20, 278, 210, 23); panel_1.add(cbOpcDpcFilter); tfOpcDpcFilter = new JTextField(); tfOpcDpcFilter.setEnabled(false); tfOpcDpcFilter.setColumns(10); tfOpcDpcFilter.setBounds(236, 279, 317, 20); panel_1.add(tfOpcDpcFilter); cbRecordingDialogMessageChain = new JCheckBox("Recording of dialog message chains log"); cbRecordingDialogMessageChain.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { tfRecordingDialogMessageChain.setEnabled(cbRecordingDialogMessageChain.isSelected()); btnRecordingDialogMessageChain.setEnabled(cbRecordingDialogMessageChain.isSelected()); } }); cbRecordingDialogMessageChain.setBounds(20, 486, 338, 23); panel_1.add(cbRecordingDialogMessageChain); JPanel pnDialogMessageMessage = new JPanel(); pnDialogMessageMessage.setBorder(new LineBorder(new Color(0, 0, 0))); pnDialogMessageMessage.setBounds(10, 516, 553, 65); panel_1.add(pnDialogMessageMessage); pnDialogMessageMessage.setLayout(null); JLabel lblDialogMessageMessage = new JLabel("Dialog message message chains log file path"); lblDialogMessageMessage.setBounds(10, 11, 265, 14); pnDialogMessageMessage.add(lblDialogMessageMessage); tfRecordingDialogMessageChain = new JTextField(); tfRecordingDialogMessageChain.setBounds(10, 27, 433, 20); pnDialogMessageMessage.add(tfRecordingDialogMessageChain); tfRecordingDialogMessageChain.setEnabled(false); tfRecordingDialogMessageChain.setColumns(10); btnRecordingDialogMessageChain = new JButton(". . ."); btnRecordingDialogMessageChain.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { JFileChooser chooser = new JFileChooser(); File f = new File(tfRecordingDialogMessageChain.getText()); chooser.setSelectedFile(f); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); int returnVal = chooser.showOpenDialog(frmSsTraceParser); if (returnVal == JFileChooser.APPROVE_OPTION) { File f2 = chooser.getSelectedFile(); tfRecordingDialogMessageChain.setText(f2.getPath()); } } }); btnRecordingDialogMessageChain.setBounds(453, 26, 52, 23); pnDialogMessageMessage.add(btnRecordingDialogMessageChain); btnRecordingDialogMessageChain.setEnabled(false); JPanel panel_4 = new JPanel(); panel_4.setLayout(null); panel_4.setBorder(new LineBorder(new Color(0, 0, 0))); panel_4.setBounds(10, 128, 543, 37); panel_1.add(panel_4); rdbtnITU = new JRadioButton("ITU-T"); buttonGroup_2.add(rdbtnITU); rdbtnITU.setSelected(true); rdbtnITU.setBounds(200, 7, 109, 23); panel_4.add(rdbtnITU); JLabel lblProtocolMua = new JLabel("Protocol M3ua / SCCP"); lblProtocolMua.setBounds(15, 11, 154, 14); panel_4.add(lblProtocolMua); rdbtnANSI = new JRadioButton("ANSI"); buttonGroup_2.add(rdbtnANSI); rdbtnANSI.setBounds(313, 7, 99, 23); panel_4.add(rdbtnANSI); } }
public class class_name { private void initialize() { frmSsTraceParser = new JFrame(); frmSsTraceParser.setTitle("SS7 Trace Parser"); frmSsTraceParser.setResizable(false); frmSsTraceParser.setBounds(100, 100, 569, 716); frmSsTraceParser.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); frmSsTraceParser.getContentPane().add(panel, BorderLayout.SOUTH); btnStart = new JButton("Start"); btnStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (tfFilePath.getText() == null || tfFilePath.getText().equals("")) { JOptionPane.showMessageDialog(null, "The FilePath must be set"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // saving parameters Ss7ParseParameters newPar = new Ss7ParseParameters(); if (rdbtnTpActerna.isSelected()) newPar.setFileTypeN(ParseDriverType.Acterna); if (rdbtnTpSimpleSeq.isSelected()) newPar.setFileTypeN(ParseDriverType.SimpleSeq); if (rdbtnTpPcap.isSelected()) newPar.setFileTypeN(ParseDriverType.Pcap); if (rdbtnHexStream.isSelected()) newPar.setFileTypeN(ParseDriverType.HexStream); if (rdbtnMap.isSelected()) newPar.setParseProtocol(ParseProtocol.Map); if (rdbtnCap.isSelected()) newPar.setParseProtocol(ParseProtocol.Cap); if (rdbtnIsup.isSelected()) newPar.setParseProtocol(ParseProtocol.Isup); if (rdbtnITU.isSelected()) newPar.setSccpProtocolVersion(SccpProtocolVersion.ITU); if (rdbtnANSI.isSelected()) newPar.setSccpProtocolVersion(SccpProtocolVersion.ANSI); newPar.setSourceFilePath(tfFilePath.getText()); if (cbApplicationContextFilter.isSelected()) { try { newPar.setApplicationContextFilter(Integer.parseInt(tfApplicationContextFilter.getText())); // depends on control dependency: [try], data = [none] } catch (NumberFormatException ee) { JOptionPane .showMessageDialog(null, "Can not parse ApplicationContextFilter the value. \nIt should be an Integer.\nParsing without ApplicationContextFilter"); } // depends on control dependency: [catch], data = [none] } if (cbDialogIdFilter.isSelected()) { try { if (!tfDialogIdFilter.getText().equals("")) newPar.setDialogIdFilter(Long.parseLong(tfDialogIdFilter.getText())); } catch (NumberFormatException ee) { JOptionPane .showMessageDialog(null, "Can not parse ApplicationContextFilter the value. \nIt should be an Integer.\nParsing without ApplicationContextFilter"); } // depends on control dependency: [catch], data = [none] try { if (!tfDialogIdFilter2.getText().equals("")) newPar.setDialogIdFilter2(Long.parseLong(tfDialogIdFilter2.getText())); } catch (NumberFormatException ee) { JOptionPane .showMessageDialog(null, "Can not parse ApplicationContextFilter2 the value. \nIt should be an Integer.\nParsing without ApplicationContextFilter2"); } // depends on control dependency: [catch], data = [none] } if (cbOpcDpcFilter.isSelected()) { try { String[] ss = tfOpcDpcFilter.getText().split(","); int ii1 = ss.length; Integer[] ires = new Integer[ii1]; for (int i1 = 0; i1 < ii1; i1++) { String s = ss[i1]; s = s.trim(); // depends on control dependency: [for], data = [none] ires[i1] = Integer.parseInt(s); // depends on control dependency: [for], data = [i1] } newPar.setOpcDpcFilter(ires); // depends on control dependency: [try], data = [none] } catch (NumberFormatException ee) { JOptionPane.showMessageDialog(null, "Can not parse OpcDpcFilter the value. \nIt should be a set of Integers.\nParsing without OpcDpcFilter"); } // depends on control dependency: [catch], data = [none] } if (cbMsgLog.isSelected()) { newPar.setMsgLogFilePath(tfMsgLog.getText()); // depends on control dependency: [if], data = [none] } if (cbTcapData.isSelected()) { newPar.setTcapMsgData(true); // depends on control dependency: [if], data = [none] } if (cbDialogDet.isSelected()) { newPar.setDetailedDialog(true); // depends on control dependency: [if], data = [none] } if (cbCompDet.isSelected()) { newPar.setDetailedComponents(true); // depends on control dependency: [if], data = [none] } if (cbRecordingDialogMessageChain.isSelected()) { newPar.setMessageChainFilePath(tfRecordingDialogMessageChain.getText()); // depends on control dependency: [if], data = [none] } try { BufferedOutputStream bis = new BufferedOutputStream(new FileOutputStream(persistFile)); XMLEncoder d = new XMLEncoder(bis); d.writeObject(newPar); // depends on control dependency: [try], data = [none] d.close(); // depends on control dependency: [try], data = [none] } catch (Exception ee) { ee.printStackTrace(); JOptionPane.showMessageDialog(null, "Failed when saving the parameter file Ss7ParseParameters.xml: " + ee.getMessage()); } // depends on control dependency: [catch], data = [none] btnStart.setEnabled(false); btnGetStatisticInfo.setEnabled(false); btnStop.setEnabled(true); // starting parsing task = new SS7TraceParser(persistDir, newPar); task.parse(); } }); panel.add(btnStart); btnStop = new JButton("Stop"); btnStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (task != null) task.interrupt(); } }); btnStop.setEnabled(false); panel.add(btnStop); btnGetStatisticInfo = new JButton("Get statistic info"); btnGetStatisticInfo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { getStatisticInfo(); } }); panel.add(btnGetStatisticInfo); JPanel panel_1 = new JPanel(); frmSsTraceParser.getContentPane().add(panel_1, BorderLayout.CENTER); panel_1.setLayout(null); JPanel panel_2 = new JPanel(); panel_2.setBorder(new LineBorder(new Color(0, 0, 0))); panel_2.setBounds(10, 11, 543, 58); panel_1.add(panel_2); panel_2.setLayout(null); rdbtnTpActerna = new JRadioButton("Acterna"); rdbtnTpActerna.setSelected(true); buttonGroup.add(rdbtnTpActerna); rdbtnTpActerna.setBounds(6, 28, 109, 23); panel_2.add(rdbtnTpActerna); JLabel lblSelectAFile = new JLabel("Trace file type"); lblSelectAFile.setBounds(15, 11, 154, 14); panel_2.add(lblSelectAFile); rdbtnTpSimpleSeq = new JRadioButton("Simple sequence"); buttonGroup.add(rdbtnTpSimpleSeq); rdbtnTpSimpleSeq.setBounds(137, 28, 126, 23); panel_2.add(rdbtnTpSimpleSeq); rdbtnTpPcap = new JRadioButton("Pcap"); buttonGroup.add(rdbtnTpPcap); rdbtnTpPcap.setBounds(275, 28, 101, 23); panel_2.add(rdbtnTpPcap); rdbtnHexStream = new JRadioButton("Hex stream"); buttonGroup.add(rdbtnHexStream); rdbtnHexStream.setBounds(380, 27, 127, 25); panel_2.add(rdbtnHexStream); tfFilePath = new JTextField(); tfFilePath.setBounds(20, 187, 481, 20); panel_1.add(tfFilePath); tfFilePath.setColumns(10); JButton btnFilePath = new JButton(". . ."); btnFilePath.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); String filterName = null; if (rdbtnTpActerna.isSelected()) filterName = "Acterna"; if (rdbtnTpSimpleSeq.isSelected()) filterName = "Simple"; if (rdbtnTpPcap.isSelected()) filterName = "Pcap"; if (rdbtnHexStream.isSelected()) filterName = "HexStream"; TraceFileFilter filter = new TraceFileFilter(filterName); chooser.setFileFilter(filter); chooser.addChoosableFileFilter(filter); File f = new File(tfFilePath.getText()); chooser.setSelectedFile(f); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); int returnVal = chooser.showOpenDialog(frmSsTraceParser); if (returnVal == JFileChooser.APPROVE_OPTION) { File f2 = chooser.getSelectedFile(); if (f2 != null && f2.exists()) tfFilePath.setText(f2.getPath()); else JOptionPane.showMessageDialog(null, "File does not exists - try again"); } } }); btnFilePath.setBounds(511, 186, 52, 23); panel_1.add(btnFilePath); JLabel lblPathToThe = new JLabel("Trace file path"); lblPathToThe.setBounds(20, 172, 153, 14); panel_1.add(lblPathToThe); this.cbApplicationContextFilter = new JCheckBox("ApplicationContext filter"); cbApplicationContextFilter.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { tfApplicationContextFilter.setEnabled(cbApplicationContextFilter.isSelected()); } }); cbApplicationContextFilter.setBounds(20, 216, 210, 23); panel_1.add(cbApplicationContextFilter); cbMsgLog = new JCheckBox("Messages logging"); cbMsgLog.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { btnMsgLog.setEnabled(cbMsgLog.isSelected()); tfMsgLog.setEnabled(cbMsgLog.isSelected()); cbTcapData.setEnabled(cbMsgLog.isSelected()); cbDialogDet.setEnabled(cbMsgLog.isSelected()); cbCompDet.setEnabled(cbMsgLog.isSelected()); } }); cbMsgLog.setBounds(20, 308, 210, 23); panel_1.add(cbMsgLog); tfApplicationContextFilter = new JTextField(); tfApplicationContextFilter.setEnabled(false); tfApplicationContextFilter.setBounds(236, 217, 153, 20); panel_1.add(tfApplicationContextFilter); tfApplicationContextFilter.setColumns(10); cbDialogIdFilter = new JCheckBox("DialogId filter"); cbDialogIdFilter.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { tfDialogIdFilter.setEnabled(cbDialogIdFilter.isSelected()); tfDialogIdFilter2.setEnabled(cbDialogIdFilter.isSelected()); } }); cbDialogIdFilter.setBounds(20, 247, 210, 23); panel_1.add(cbDialogIdFilter); tfDialogIdFilter = new JTextField(); tfDialogIdFilter.setEnabled(false); tfDialogIdFilter.setColumns(10); tfDialogIdFilter.setBounds(236, 248, 153, 20); panel_1.add(tfDialogIdFilter); pnMsgLog = new JPanel(); pnMsgLog.setBorder(new LineBorder(new Color(0, 0, 0))); pnMsgLog.setBounds(10, 338, 553, 136); panel_1.add(pnMsgLog); pnMsgLog.setLayout(null); tfMsgLog = new JTextField(); tfMsgLog.setBounds(10, 27, 433, 20); pnMsgLog.add(tfMsgLog); tfMsgLog.setEnabled(false); tfMsgLog.setColumns(10); JLabel lblMessageLogFile = new JLabel("Message log file path"); lblMessageLogFile.setBounds(10, 11, 153, 14); pnMsgLog.add(lblMessageLogFile); timer = new javax.swing.Timer(100, new ActionListener() { public void actionPerformed(ActionEvent e) { if (task != null) { if (curMsgCount != task.getMsgCount()) { curMsgCount = task.getMsgCount(); String s1 = ((Integer) curMsgCount).toString(); tfMsgCnt.setText(s1); } if (task.isFinished()) { String errorMsg = task.getErrorMessage(); btnStart.setEnabled(true); btnGetStatisticInfo.setEnabled(true); btnStop.setEnabled(false); parseData = task.getStatisticData(); task = null; if (errorMsg != null) JOptionPane.showMessageDialog(null, "Error: " + errorMsg); else JOptionPane.showMessageDialog(null, "Success"); } } } }); timer.start(); btnMsgLog = new JButton(". . ."); btnMsgLog.setEnabled(false); btnMsgLog.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); File f = new File(tfMsgLog.getText()); chooser.setSelectedFile(f); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); int returnVal = chooser.showOpenDialog(frmSsTraceParser); if (returnVal == JFileChooser.APPROVE_OPTION) { File f2 = chooser.getSelectedFile(); tfMsgLog.setText(f2.getPath()); } } }); btnMsgLog.setBounds(453, 26, 52, 23); pnMsgLog.add(btnMsgLog); cbTcapData = new JCheckBox("Store in the log TCAP message source data"); // cbTcapData.addItemListener(new ItemListener() { // public void itemStateChanged(ItemEvent e) { // cbDialogDet.setEnabled(cbTcapData.isSelected()); // cbCompDet.setEnabled(cbTcapData.isSelected()); // } // }); cbTcapData.setBounds(10, 50, 296, 23); pnMsgLog.add(cbTcapData); cbDialogDet = new JCheckBox("Write dialog portion details"); cbDialogDet.setBounds(10, 76, 296, 23); pnMsgLog.add(cbDialogDet); cbCompDet = new JCheckBox("Write components portion details"); cbCompDet.setBounds(10, 102, 296, 23); pnMsgLog.add(cbCompDet); lblMessagesPerformed = new JLabel("Messages performed"); lblMessagesPerformed.setBounds(10, 592, 140, 14); panel_1.add(lblMessagesPerformed); tfMsgCnt = new JTextField(); tfMsgCnt.setEditable(false); tfMsgCnt.setBounds(160, 589, 86, 20); panel_1.add(tfMsgCnt); tfMsgCnt.setColumns(10); tfDialogIdFilter2 = new JTextField(); tfDialogIdFilter2.setEnabled(false); tfDialogIdFilter2.setColumns(10); tfDialogIdFilter2.setBounds(399, 248, 153, 20); panel_1.add(tfDialogIdFilter2); panel_3 = new JPanel(); panel_3.setBorder(new LineBorder(new Color(0, 0, 0))); panel_3.setLayout(null); panel_3.setBounds(10, 69, 543, 58); panel_1.add(panel_3); rdbtnMap = new JRadioButton("MAP"); buttonGroup_1.add(rdbtnMap); rdbtnMap.setSelected(true); rdbtnMap.setBounds(6, 28, 109, 23); panel_3.add(rdbtnMap); lblProtocol = new JLabel("Protocol"); lblProtocol.setBounds(15, 11, 154, 14); panel_3.add(lblProtocol); rdbtnCap = new JRadioButton("CAP"); buttonGroup_1.add(rdbtnCap); rdbtnCap.setBounds(119, 28, 99, 23); panel_3.add(rdbtnCap); rdbtnIsup = new JRadioButton("ISUP"); buttonGroup_1.add(rdbtnIsup); rdbtnIsup.setBounds(228, 28, 99, 23); panel_3.add(rdbtnIsup); cbOpcDpcFilter = new JCheckBox("Opc / Dpc filter (Ex: \"120,130\")"); cbOpcDpcFilter.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent arg0) { tfOpcDpcFilter.setEnabled(cbOpcDpcFilter.isSelected()); } }); cbOpcDpcFilter.setBounds(20, 278, 210, 23); panel_1.add(cbOpcDpcFilter); tfOpcDpcFilter = new JTextField(); tfOpcDpcFilter.setEnabled(false); tfOpcDpcFilter.setColumns(10); tfOpcDpcFilter.setBounds(236, 279, 317, 20); panel_1.add(tfOpcDpcFilter); cbRecordingDialogMessageChain = new JCheckBox("Recording of dialog message chains log"); cbRecordingDialogMessageChain.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { tfRecordingDialogMessageChain.setEnabled(cbRecordingDialogMessageChain.isSelected()); btnRecordingDialogMessageChain.setEnabled(cbRecordingDialogMessageChain.isSelected()); } }); cbRecordingDialogMessageChain.setBounds(20, 486, 338, 23); panel_1.add(cbRecordingDialogMessageChain); JPanel pnDialogMessageMessage = new JPanel(); pnDialogMessageMessage.setBorder(new LineBorder(new Color(0, 0, 0))); pnDialogMessageMessage.setBounds(10, 516, 553, 65); panel_1.add(pnDialogMessageMessage); pnDialogMessageMessage.setLayout(null); JLabel lblDialogMessageMessage = new JLabel("Dialog message message chains log file path"); lblDialogMessageMessage.setBounds(10, 11, 265, 14); pnDialogMessageMessage.add(lblDialogMessageMessage); tfRecordingDialogMessageChain = new JTextField(); tfRecordingDialogMessageChain.setBounds(10, 27, 433, 20); pnDialogMessageMessage.add(tfRecordingDialogMessageChain); tfRecordingDialogMessageChain.setEnabled(false); tfRecordingDialogMessageChain.setColumns(10); btnRecordingDialogMessageChain = new JButton(". . ."); btnRecordingDialogMessageChain.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { JFileChooser chooser = new JFileChooser(); File f = new File(tfRecordingDialogMessageChain.getText()); chooser.setSelectedFile(f); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); int returnVal = chooser.showOpenDialog(frmSsTraceParser); if (returnVal == JFileChooser.APPROVE_OPTION) { File f2 = chooser.getSelectedFile(); tfRecordingDialogMessageChain.setText(f2.getPath()); } } }); btnRecordingDialogMessageChain.setBounds(453, 26, 52, 23); pnDialogMessageMessage.add(btnRecordingDialogMessageChain); btnRecordingDialogMessageChain.setEnabled(false); JPanel panel_4 = new JPanel(); panel_4.setLayout(null); panel_4.setBorder(new LineBorder(new Color(0, 0, 0))); panel_4.setBounds(10, 128, 543, 37); panel_1.add(panel_4); rdbtnITU = new JRadioButton("ITU-T"); buttonGroup_2.add(rdbtnITU); rdbtnITU.setSelected(true); rdbtnITU.setBounds(200, 7, 109, 23); panel_4.add(rdbtnITU); JLabel lblProtocolMua = new JLabel("Protocol M3ua / SCCP"); lblProtocolMua.setBounds(15, 11, 154, 14); panel_4.add(lblProtocolMua); rdbtnANSI = new JRadioButton("ANSI"); buttonGroup_2.add(rdbtnANSI); rdbtnANSI.setBounds(313, 7, 99, 23); panel_4.add(rdbtnANSI); } }
public class class_name { public static IScope findRoot(IScope from) { IScope current = from; while (current.hasParent()) { current = current.getParent(); } return current; } }
public class class_name { public static IScope findRoot(IScope from) { IScope current = from; while (current.hasParent()) { current = current.getParent(); // depends on control dependency: [while], data = [none] } return current; } }
public class class_name { @Override public void startContentLine(ChainWriter out, WebSiteRequest req, HttpServletResponse resp, int colspan, String align, String width) { out.print(" <tr>\n" + " <td"); if(width!=null && width.length()>0) { out.append(" style='width:"); out.append(width); out.append('\''); } out.print(" valign='top'"); if(colspan!=1) out.print(" colspan='").print(colspan).print('\''); if(align!=null && !align.equalsIgnoreCase("left")) out.print(" align='").print(align).print('\''); out.print('>'); } }
public class class_name { @Override public void startContentLine(ChainWriter out, WebSiteRequest req, HttpServletResponse resp, int colspan, String align, String width) { out.print(" <tr>\n" + " <td"); if(width!=null && width.length()>0) { out.append(" style='width:"); out.append(width); out.append('\''); // depends on control dependency: [if], data = [none] } out.print(" valign='top'"); if(colspan!=1) out.print(" colspan='").print(colspan).print('\''); if(align!=null && !align.equalsIgnoreCase("left")) out.print(" align='").print(align).print('\''); out.print('>'); } }
public class class_name { private void writeHydraVariableMapping(JsonGenerator jgen, @Nullable ActionDescriptor annotatedParameters, Collection<String> variableNames) throws IOException { if (annotatedParameters != null) { for (String variableName : variableNames) { // TODO: find also @Input ActionInputParameter annotatedParameter = annotatedParameters.getActionInputParameter(variableName); // TODO access @Input parameter, too // only unsatisfied parameters become hydra variables if (annotatedParameter != null && annotatedParameter.getValue() == null) { jgen.writeStartObject(); jgen.writeStringField("@type", "hydra:IriTemplateMapping"); jgen.writeStringField("hydra:variable", annotatedParameter.getParameterName()); jgen.writeBooleanField("hydra:required", annotatedParameter .isRequired()); jgen.writeStringField("hydra:property", getExposedPropertyOrParamName(annotatedParameter)); jgen.writeEndObject(); } } } } }
public class class_name { private void writeHydraVariableMapping(JsonGenerator jgen, @Nullable ActionDescriptor annotatedParameters, Collection<String> variableNames) throws IOException { if (annotatedParameters != null) { for (String variableName : variableNames) { // TODO: find also @Input ActionInputParameter annotatedParameter = annotatedParameters.getActionInputParameter(variableName); // TODO access @Input parameter, too // only unsatisfied parameters become hydra variables if (annotatedParameter != null && annotatedParameter.getValue() == null) { jgen.writeStartObject(); // depends on control dependency: [if], data = [none] jgen.writeStringField("@type", "hydra:IriTemplateMapping"); // depends on control dependency: [if], data = [none] jgen.writeStringField("hydra:variable", annotatedParameter.getParameterName()); // depends on control dependency: [if], data = [none] jgen.writeBooleanField("hydra:required", annotatedParameter .isRequired()); // depends on control dependency: [if], data = [none] jgen.writeStringField("hydra:property", getExposedPropertyOrParamName(annotatedParameter)); // depends on control dependency: [if], data = [none] jgen.writeEndObject(); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public static Predicate<InetAddress> ofExact(InetAddress address) { requireNonNull(address, "address"); if (address instanceof Inet4Address) { return ofCidr(address, 32); } if (address instanceof Inet6Address) { return ofCidr(address, 128); } throw new IllegalArgumentException("Invalid InetAddress type: " + address.getClass().getName()); } }
public class class_name { public static Predicate<InetAddress> ofExact(InetAddress address) { requireNonNull(address, "address"); if (address instanceof Inet4Address) { return ofCidr(address, 32); // depends on control dependency: [if], data = [none] } if (address instanceof Inet6Address) { return ofCidr(address, 128); // depends on control dependency: [if], data = [none] } throw new IllegalArgumentException("Invalid InetAddress type: " + address.getClass().getName()); } }
public class class_name { FormattedListBuilder format(Collection<?> items, int index) { Iterator<?> it = items.iterator(); int count = items.size(); switch (count) { case 0: return new FormattedListBuilder("", false); case 1: return new FormattedListBuilder(it.next(), index == 0); case 2: return new FormattedListBuilder(it.next(), index == 0).append(two, it.next(), index == 1); } FormattedListBuilder builder = new FormattedListBuilder(it.next(), index == 0); builder.append(start, it.next(), index == 1); for (int idx = 2; idx < count - 1; ++idx) { builder.append(middle, it.next(), index == idx); } return builder.append(end, it.next(), index == count - 1); } }
public class class_name { FormattedListBuilder format(Collection<?> items, int index) { Iterator<?> it = items.iterator(); int count = items.size(); switch (count) { case 0: return new FormattedListBuilder("", false); case 1: return new FormattedListBuilder(it.next(), index == 0); case 2: return new FormattedListBuilder(it.next(), index == 0).append(two, it.next(), index == 1); } FormattedListBuilder builder = new FormattedListBuilder(it.next(), index == 0); builder.append(start, it.next(), index == 1); for (int idx = 2; idx < count - 1; ++idx) { builder.append(middle, it.next(), index == idx); // depends on control dependency: [for], data = [idx] } return builder.append(end, it.next(), index == count - 1); } }
public class class_name { public void updateFragementWithSelectedCorpus(Set<String> corpora) { if (corpora != null && !corpora.isEmpty()) { String fragment = "_c=" + Helper.encodeBase64URL(StringUtils. join(corpora, ",")); UI.getCurrent().getPage().setUriFragment(fragment); } else { UI.getCurrent().getPage().setUriFragment(""); } } }
public class class_name { public void updateFragementWithSelectedCorpus(Set<String> corpora) { if (corpora != null && !corpora.isEmpty()) { String fragment = "_c=" + Helper.encodeBase64URL(StringUtils. join(corpora, ",")); UI.getCurrent().getPage().setUriFragment(fragment); // depends on control dependency: [if], data = [none] } else { UI.getCurrent().getPage().setUriFragment(""); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static StringBuilder generateIdPrefix(String template, String prefix) { NullArgumentException.checkNotNull(template, "template"); NullArgumentException.checkNotNull(prefix, "prefix"); assert isValidId(prefix); final int len = template.length(); // First character must be [A-Za-z] int pos = 0; while(pos < len) { char ch = template.charAt(pos); if( (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') ) { break; } pos++; } StringBuilder idPrefix; if(pos == len) { // No usable characters from label idPrefix = new StringBuilder(prefix); } else { // Get remaining usable characters from label idPrefix = new StringBuilder(len - pos); //idPrefix.append(template.charAt(pos)); //pos++; // Remaining must match [A-Za-z0-9:_.-] while(pos < len) { char ch = template.charAt(pos); pos++; // Convert space to '-' if(ch == ' ') { idPrefix.append('-'); } else if( (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9') || ch == ':' || ch == '_' || ch == '.' || ch == '-' ) { if(ch >= 'A' && ch <= 'Z') { // Works since we're only using ASCII range: ch = (char)(ch + ('a' - 'A')); // Would support Unicode, but id's don't have Unicode: // ch = Character.toLowerCase(ch); } idPrefix.append(ch); } } } assert isValidId(idPrefix.toString()); return idPrefix; } }
public class class_name { public static StringBuilder generateIdPrefix(String template, String prefix) { NullArgumentException.checkNotNull(template, "template"); NullArgumentException.checkNotNull(prefix, "prefix"); assert isValidId(prefix); final int len = template.length(); // First character must be [A-Za-z] int pos = 0; while(pos < len) { char ch = template.charAt(pos); if( (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') ) { break; } pos++; // depends on control dependency: [while], data = [none] } StringBuilder idPrefix; if(pos == len) { // No usable characters from label idPrefix = new StringBuilder(prefix); // depends on control dependency: [if], data = [none] } else { // Get remaining usable characters from label idPrefix = new StringBuilder(len - pos); // depends on control dependency: [if], data = [none] //idPrefix.append(template.charAt(pos)); //pos++; // Remaining must match [A-Za-z0-9:_.-] while(pos < len) { char ch = template.charAt(pos); pos++; // depends on control dependency: [while], data = [none] // Convert space to '-' if(ch == ' ') { idPrefix.append('-'); // depends on control dependency: [if], data = [none] } else if( (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9') || ch == ':' || ch == '_' || ch == '.' || ch == '-' ) { if(ch >= 'A' && ch <= 'Z') { // Works since we're only using ASCII range: ch = (char)(ch + ('a' - 'A')); // depends on control dependency: [if], data = [(ch] // Would support Unicode, but id's don't have Unicode: // ch = Character.toLowerCase(ch); } idPrefix.append(ch); // depends on control dependency: [if], data = [] } } } assert isValidId(idPrefix.toString()); return idPrefix; } }
public class class_name { private static void addOrder(Criteria c, String sort, String order, boolean ignoreCase) { if (ORDER_DESC.equals(order)) { c.addOrder(ignoreCase ? Order.desc(sort).ignoreCase() : Order.desc(sort)); } else { c.addOrder(ignoreCase ? Order.asc(sort).ignoreCase() : Order.asc(sort)); } } }
public class class_name { private static void addOrder(Criteria c, String sort, String order, boolean ignoreCase) { if (ORDER_DESC.equals(order)) { c.addOrder(ignoreCase ? Order.desc(sort).ignoreCase() : Order.desc(sort)); // depends on control dependency: [if], data = [none] } else { c.addOrder(ignoreCase ? Order.asc(sort).ignoreCase() : Order.asc(sort)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public ResolvableType getSuperType() { Class<?> resolved = resolve(); if (resolved == null || resolved.getGenericSuperclass() == null) { return NONE; } if (this.superType == null) { this.superType = forType(SerializableTypeWrapper.forGenericSuperclass(resolved), asVariableResolver()); } return this.superType; } }
public class class_name { public ResolvableType getSuperType() { Class<?> resolved = resolve(); if (resolved == null || resolved.getGenericSuperclass() == null) { return NONE; // depends on control dependency: [if], data = [none] } if (this.superType == null) { this.superType = forType(SerializableTypeWrapper.forGenericSuperclass(resolved), asVariableResolver()); // depends on control dependency: [if], data = [none] } return this.superType; } }
public class class_name { @Nullable private StringBuilder getQualifiedNameForGetProp(int reserve) { String propName = getLastChild().getString(); reserve += 1 + propName.length(); // +1 for the '.' StringBuilder builder; if (first.isGetProp()) { builder = first.getQualifiedNameForGetProp(reserve); if (builder == null) { return null; } } else { String left = first.getQualifiedName(); if (left == null) { return null; } builder = new StringBuilder(left.length() + reserve); builder.append(left); } builder.append('.').append(propName); return builder; } }
public class class_name { @Nullable private StringBuilder getQualifiedNameForGetProp(int reserve) { String propName = getLastChild().getString(); reserve += 1 + propName.length(); // +1 for the '.' StringBuilder builder; if (first.isGetProp()) { builder = first.getQualifiedNameForGetProp(reserve); // depends on control dependency: [if], data = [none] if (builder == null) { return null; // depends on control dependency: [if], data = [none] } } else { String left = first.getQualifiedName(); if (left == null) { return null; // depends on control dependency: [if], data = [none] } builder = new StringBuilder(left.length() + reserve); // depends on control dependency: [if], data = [none] builder.append(left); // depends on control dependency: [if], data = [none] } builder.append('.').append(propName); return builder; } }
public class class_name { public SimpleFeatureCollection toFeatureCollection( List<MonitoringPoint> monitoringPointsList ) { // create the feature type SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); // set the name b.setName("monitoringpoints"); // add a geometry property b.add("the_geom", Point.class); // add some properties b.add("id", Integer.class); b.add("relatedid", Integer.class); b.add("pfaf", String.class); // build the type SimpleFeatureType type = b.buildFeatureType(); // create the feature SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); GeometryFactory gF = new GeometryFactory(); /* * insert them in inverse order to get them out of the collection in the same order as the * list */ DefaultFeatureCollection newCollection = new DefaultFeatureCollection(); for( int i = 0; i < monitoringPointsList.size(); i++ ) { MonitoringPoint mp = monitoringPointsList.get(monitoringPointsList.size() - i - 1); Object[] values = new Object[]{gF.createPoint(mp.getPosition()), mp.getID(), mp.getRelatedID(), mp.getPfatstetterNumber().toString()}; // add the values builder.addAll(values); // build the feature with provided ID SimpleFeature feature = builder.buildFeature(type.getTypeName() + "." + i); newCollection.add(feature); } return newCollection; } }
public class class_name { public SimpleFeatureCollection toFeatureCollection( List<MonitoringPoint> monitoringPointsList ) { // create the feature type SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); // set the name b.setName("monitoringpoints"); // add a geometry property b.add("the_geom", Point.class); // add some properties b.add("id", Integer.class); b.add("relatedid", Integer.class); b.add("pfaf", String.class); // build the type SimpleFeatureType type = b.buildFeatureType(); // create the feature SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); GeometryFactory gF = new GeometryFactory(); /* * insert them in inverse order to get them out of the collection in the same order as the * list */ DefaultFeatureCollection newCollection = new DefaultFeatureCollection(); for( int i = 0; i < monitoringPointsList.size(); i++ ) { MonitoringPoint mp = monitoringPointsList.get(monitoringPointsList.size() - i - 1); Object[] values = new Object[]{gF.createPoint(mp.getPosition()), mp.getID(), mp.getRelatedID(), mp.getPfatstetterNumber().toString()}; // add the values builder.addAll(values); // depends on control dependency: [for], data = [none] // build the feature with provided ID SimpleFeature feature = builder.buildFeature(type.getTypeName() + "." + i); newCollection.add(feature); // depends on control dependency: [for], data = [none] } return newCollection; } }
public class class_name { @SuppressWarnings("fallthrough") List<JCStatement> blockStatements() { //todo: skip to anchor on error(?) int lastErrPos = -1; ListBuffer<JCStatement> stats = new ListBuffer<>(); while (true) { List<JCStatement> stat = blockStatement(); if (stat.isEmpty()) { return stats.toList(); } else { // error recovery if (token.pos == lastErrPos) return stats.toList(); if (token.pos <= endPosTable.errorEndPos) { skip(false, true, true, true); lastErrPos = token.pos; } stats.addAll(stat); } } } }
public class class_name { @SuppressWarnings("fallthrough") List<JCStatement> blockStatements() { //todo: skip to anchor on error(?) int lastErrPos = -1; ListBuffer<JCStatement> stats = new ListBuffer<>(); while (true) { List<JCStatement> stat = blockStatement(); if (stat.isEmpty()) { return stats.toList(); // depends on control dependency: [if], data = [none] } else { // error recovery if (token.pos == lastErrPos) return stats.toList(); if (token.pos <= endPosTable.errorEndPos) { skip(false, true, true, true); // depends on control dependency: [if], data = [none] lastErrPos = token.pos; // depends on control dependency: [if], data = [none] } stats.addAll(stat); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private I_CmsSearchFieldMapping createSearchFieldMapping( CmsXmlContentDefinition contentDefinition, Element element, Locale locale) throws CmsXmlException { I_CmsSearchFieldMapping fieldMapping = null; String typeAsString = element.attributeValue(APPINFO_ATTR_TYPE); CmsSearchFieldMappingType type = CmsSearchFieldMappingType.valueOf(typeAsString); switch (type.getMode()) { case 0: // content case 3: // item // localized String param = locale.toString() + "|" + element.getStringValue(); fieldMapping = new CmsSearchFieldMapping(type, param); break; case 1: // property case 2: // property-search case 5: // attribute // not localized fieldMapping = new CmsSearchFieldMapping(type, element.getStringValue()); break; case 4: // dynamic String mappingClass = element.attributeValue(APPINFO_ATTR_CLASS); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(mappingClass)) { try { fieldMapping = (I_CmsSearchFieldMapping)Class.forName(mappingClass).newInstance(); fieldMapping.setType(CmsSearchFieldMappingType.DYNAMIC); fieldMapping.setParam(element.getStringValue()); } catch (Exception e) { throw new CmsXmlException( Messages.get().container( Messages.ERR_XML_SCHEMA_MAPPING_CLASS_NOT_EXIST_3, mappingClass, contentDefinition.getTypeName(), contentDefinition.getSchemaLocation())); } } break; default: // NOOP } if (fieldMapping != null) { fieldMapping.setDefaultValue(element.attributeValue(APPINFO_ATTR_DEFAULT)); } return fieldMapping; } }
public class class_name { private I_CmsSearchFieldMapping createSearchFieldMapping( CmsXmlContentDefinition contentDefinition, Element element, Locale locale) throws CmsXmlException { I_CmsSearchFieldMapping fieldMapping = null; String typeAsString = element.attributeValue(APPINFO_ATTR_TYPE); CmsSearchFieldMappingType type = CmsSearchFieldMappingType.valueOf(typeAsString); switch (type.getMode()) { case 0: // content case 3: // item // localized String param = locale.toString() + "|" + element.getStringValue(); fieldMapping = new CmsSearchFieldMapping(type, param); break; case 1: // property case 2: // property-search case 5: // attribute // not localized fieldMapping = new CmsSearchFieldMapping(type, element.getStringValue()); break; case 4: // dynamic String mappingClass = element.attributeValue(APPINFO_ATTR_CLASS); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(mappingClass)) { try { fieldMapping = (I_CmsSearchFieldMapping)Class.forName(mappingClass).newInstance(); // depends on control dependency: [try], data = [none] fieldMapping.setType(CmsSearchFieldMappingType.DYNAMIC); // depends on control dependency: [try], data = [none] fieldMapping.setParam(element.getStringValue()); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new CmsXmlException( Messages.get().container( Messages.ERR_XML_SCHEMA_MAPPING_CLASS_NOT_EXIST_3, mappingClass, contentDefinition.getTypeName(), contentDefinition.getSchemaLocation())); } // depends on control dependency: [catch], data = [none] } break; default: // NOOP } if (fieldMapping != null) { fieldMapping.setDefaultValue(element.attributeValue(APPINFO_ATTR_DEFAULT)); } return fieldMapping; } }
public class class_name { public static Field get(final long _id) { Field ret = null; final Cache<Long, Field> cache = InfinispanCache.get().<Long, Field>getCache(Field.IDCACHE); if (cache.containsKey(_id)) { ret = cache.get(_id); } else { AbstractCollection col = null; try { final QueryBuilder queryBldr = new QueryBuilder(CIAdminUserInterface.Field); queryBldr.addWhereAttrEqValue(CIAdminUserInterface.Field.ID, _id); final MultiPrintQuery multi = queryBldr.getPrint(); multi.addAttribute(CIAdminUserInterface.Field.Collection); multi.executeWithoutAccessCheck(); if (multi.next()) { final Long colId = multi.<Long> getAttribute(CIAdminUserInterface.Field.Collection); col = Form.get(colId); if (col == null) { col = Table.get(colId); } } } catch (final EFapsException e) { Field.LOG.error("get(long)", e); } if (col != null) { ret = col.getFieldsMap().get(_id); if (ret != null) { cache.put(_id, ret); } } } return ret; } }
public class class_name { public static Field get(final long _id) { Field ret = null; final Cache<Long, Field> cache = InfinispanCache.get().<Long, Field>getCache(Field.IDCACHE); if (cache.containsKey(_id)) { ret = cache.get(_id); // depends on control dependency: [if], data = [none] } else { AbstractCollection col = null; try { final QueryBuilder queryBldr = new QueryBuilder(CIAdminUserInterface.Field); queryBldr.addWhereAttrEqValue(CIAdminUserInterface.Field.ID, _id); // depends on control dependency: [try], data = [none] final MultiPrintQuery multi = queryBldr.getPrint(); multi.addAttribute(CIAdminUserInterface.Field.Collection); // depends on control dependency: [try], data = [none] multi.executeWithoutAccessCheck(); // depends on control dependency: [try], data = [none] if (multi.next()) { final Long colId = multi.<Long> getAttribute(CIAdminUserInterface.Field.Collection); col = Form.get(colId); // depends on control dependency: [if], data = [none] if (col == null) { col = Table.get(colId); // depends on control dependency: [if], data = [(col] } } } catch (final EFapsException e) { Field.LOG.error("get(long)", e); } // depends on control dependency: [catch], data = [none] if (col != null) { ret = col.getFieldsMap().get(_id); // depends on control dependency: [if], data = [none] if (ret != null) { cache.put(_id, ret); // depends on control dependency: [if], data = [none] } } } return ret; } }
public class class_name { public static <T, IV> int countWith( Iterable<T> iterable, Predicate2<? super T, ? super IV> predicate, IV injectedValue) { if (iterable instanceof MutableCollection) { return ((MutableCollection<T>) iterable).countWith(predicate, injectedValue); } if (iterable instanceof ArrayList) { return ArrayListIterate.countWith((ArrayList<T>) iterable, predicate, injectedValue); } if (iterable instanceof List) { return ListIterate.countWith((List<T>) iterable, predicate, injectedValue); } if (iterable != null) { return IterableIterate.countWith(iterable, predicate, injectedValue); } throw new IllegalArgumentException("Cannot get a count from null"); } }
public class class_name { public static <T, IV> int countWith( Iterable<T> iterable, Predicate2<? super T, ? super IV> predicate, IV injectedValue) { if (iterable instanceof MutableCollection) { return ((MutableCollection<T>) iterable).countWith(predicate, injectedValue); // depends on control dependency: [if], data = [none] } if (iterable instanceof ArrayList) { return ArrayListIterate.countWith((ArrayList<T>) iterable, predicate, injectedValue); // depends on control dependency: [if], data = [none] } if (iterable instanceof List) { return ListIterate.countWith((List<T>) iterable, predicate, injectedValue); // depends on control dependency: [if], data = [none] } if (iterable != null) { return IterableIterate.countWith(iterable, predicate, injectedValue); // depends on control dependency: [if], data = [(iterable] } throw new IllegalArgumentException("Cannot get a count from null"); } }
public class class_name { public static void loadWords( JcsegTaskConfig config, ADictionary dic, InputStream is, List<String[]> buffer ) throws NumberFormatException, IOException { boolean isFirstLine = true; int t = -1; String line = null, gEntity = null; BufferedReader buffReader = new BufferedReader(new InputStreamReader(is, "UTF-8")); while ( (line = buffReader.readLine()) != null ) { line = line.trim(); if ( "".equals(line) ) continue; if ( line.charAt(0) == '#' && line.length() > 1 ) { //skip the comments continue; } //the first line for the lexicon file. if ( isFirstLine == true ) { t = ADictionary.getIndex(line); isFirstLine = false; if ( t >= 0 ) { continue; } } /* * @Note: added at 2016/11/14 * dictionary directive compile and apply */ if ( line.charAt(0) == ':' && line.length() > 1 ) { String[] directive = line.substring(1).toLowerCase().split("\\s+"); if ( directive[0].equals("entity") ) { //@since 2.0.1 if ( directive.length > 1 ) { String args = directive[1].trim(); gEntity = "null".equals(args) ? null : Entity.get(args); } } continue; } IWord tword = null; String[] wd = null; switch ( t ) { case ILexicon.CN_SNAME: case ILexicon.CN_LNAME: case ILexicon.CN_DNAME_1: case ILexicon.CN_DNAME_2: if ( line.length() == 1 ) { dic.add(t, line, IWord.T_CJK_WORD); } break; case ILexicon.NUMBER_UNIT: wd = line.split("\\s*/\\s*"); IWord uw = dic.add(t, wd[0], IWord.T_CJK_WORD); if ( wd.length == 1 ) { dic.add(ILexicon.CJK_WORD, uw); } else if ( wd.length == 2 ) { String entity = "null".equals(wd[1]) ? null : Entity.get(wd[1]); uw.addEntity(entity); dic.add(ILexicon.CJK_CHAR, uw); } break; case ILexicon.CJK_UNIT: /* * for the entity recognition * we may need the unit to help to * define the numeric entity in front of it * @date 2016/11/12 */ wd = line.split("\\s*/\\s*"); IWord w = dic.add(t, wd[0], IWord.T_CJK_WORD); if ( wd.length == 1 ) { dic.add(ILexicon.CJK_WORD, w); } else if ( wd.length == 2 ) { String entity = "null".equals(wd[1]) ? null : Entity.get(wd[1]); w.addEntity(entity); dic.add(ILexicon.CJK_WORD, w).addEntity(entity);; } else if ( wd.length > 3 ) { String entity = "null".equals(wd[3]) ? null : Entity.get(wd[3]); w.addEntity(entity); /* * @Note: added at 2018/03/15 * check and set the word parameter override the original one * if the current one with parameter set up */ if ( config.LOAD_PARAMETER && wd.length > 4 && ! wd[4].equals("null") ) { w.setParameter(wd[4]); } dic.add(ILexicon.CJK_WORD, w).addEntity(entity);; tword = w; } else { dic.add(ILexicon.CJK_WORD, w); tword = w; } break; case ILexicon.CN_LNAME_ADORN: dic.add(t, line, IWord.T_CJK_WORD); break; case ILexicon.STOP_WORD: /*char fChar = line.charAt(0); if ( fChar <= 127 || (fChar > 127 && line.length() <= config.MAX_LENGTH) ) { dic.add(ILexicon.STOP_WORD, line, IWord.T_CJK_WORD); }*/ dic.add(ILexicon.STOP_WORD, line, IWord.T_CJK_WORD); break; case ILexicon.DOMAIN_SUFFIX: wd = line.split("\\s*/\\s*"); dic.add(t, wd[0], IWord.T_BASIC_LATIN); //@Note access the explanation through wd[1] break; case ILexicon.CJK_SYN: wd = line.split("\\s*,\\s*"); if ( wd.length > 1 && buffer != null ) { buffer.add(wd); } wd = null; break; case ILexicon.CJK_WORD: case ILexicon.CJK_CHAR: wd = line.split("\\s*/\\s*", 5); if ( wd.length < 4 ) { //format check System.out.println("Word: \"" + wd[0] + "\" format error. -ignored"); continue; } if ( t == ILexicon.CJK_CHAR ) { //single word degree check if ( ! StringUtil.isDigit(wd[4]) ) { System.out.println("Word: \"" + wd[0] + "\" format error(single word degree should be an integer). -ignored"); continue; } } //length limit(CJK_WORD only) int latinIndex = StringUtil.latinIndexOf(wd[0]); //added at 2017/06/11 //here we clear the length filter for we may change the config.MAX_LENGTH // at token analysis run time ///if ( latinIndex == -1 && wd[0].length() > config.MAX_LENGTH ) { /// continue; ///} tword = dic.get(t, wd[0]); if ( tword == null ) { if ( t == ILexicon.CJK_CHAR ) { tword = dic.add(ILexicon.CJK_WORD, wd[0], Integer.parseInt(wd[4]), IWord.T_CJK_WORD); } else { tword = dic.add(t, wd[0], IWord.T_CJK_WORD); } } /* * @Note: added at 2016/11/14 * update the entity string for CJK and English words only */ if ( config.LOAD_CJK_ENTITY && t != ILexicon.CJK_CHAR ) { if ( wd.length > 3 ) { if ( "unset".equals(wd[3]) ) { tword.setEntity(null); } else if ( "extend".equals(wd[3]) ) { tword.addEntity(gEntity); } else if ( "null".equals(wd[3]) ) { tword.addEntity(gEntity); } else { tword.addEntity(Entity.get(wd[3])); } } else if ( gEntity != null ) { tword.addEntity(gEntity); } } /* * @Note: added at 2017/10/02 * check and set the word parameter override the original one * if the current one with parameter set up */ if ( config.LOAD_PARAMETER && t != ILexicon.CJK_CHAR ) { if ( wd.length > 4 && ! wd[4].equals("null") ) { tword.setParameter(wd[4]); } } /* * check and build the MIX_ASSIST_WORD dictionary * @Note added at 2016/11/22 */ if ( latinIndex >= 0 ) { if ( latinIndex > 0 ) { resetPrefixLength(config, dic, latinIndex); dic.add(ILexicon.MIX_ASSIST_WORD, wd[0].substring(0, latinIndex), IWord.T_CJK_WORD); } int cjkIndex = StringUtil.CJKIndexOf(wd[0], latinIndex + 1); if ( cjkIndex > -1 ) { resetSuffixLength(config, dic, wd[0].length() - cjkIndex); dic.add(ILexicon.MIX_ASSIST_WORD, wd[0].substring(cjkIndex), IWord.T_CJK_WORD); } if ( latinIndex > 0 && cjkIndex > -1 ) { dic.add(ILexicon.MIX_ASSIST_WORD, wd[0].substring(0, cjkIndex), IWord.T_BASIC_LATIN); } } break; } /* * check and append the attributes of tword * like the pinyin and the part of speech */ if ( tword != null ) { //set the Pinyin of the word. if ( config.LOAD_CJK_PINYIN && ! "null".equals(wd[2]) ) { tword.setPinyin(wd[2]); } //update the synonym of the word. //@Deprecated at 2017/06/10 /*String[] arr = tword.getSyn(); if ( config.LOAD_CJK_SYN && ! "null".equals(wd[3]) ) { String[] syns = wd[3].split(","); for ( int j = 0; j < syns.length; j++ ) { syns[j] = syns[j].trim(); Here: * filter the synonym that its length * is greater than config.MAX_LENGTH if ( t == ILexicon.CJK_WORD && syns[j].length() > config.MAX_LENGTH ) { continue; } Here: * check the synonym is not exists, make sure * the same synonym won't appended. (dictionary reload) * * @date 2013-09-02 boolean add = true; if ( arr != null ) { for ( int i = 0; i < arr.length; i++ ) { if ( syns[j].equals(arr[i]) ) { add = false; break; } } } if ( add ) { tword.addSyn(syns[j]); } } }*/ //update the word's part of speech String[] arr = tword.getPartSpeech(); if ( config.LOAD_CJK_POS && ! "null".equals(wd[1]) ) { String[] pos = wd[1].split(","); for ( int j = 0; j < pos.length; j++ ) { pos[j] = pos[j].trim(); /* Here: * check the part of speech is not exists, make sure * the same part of speech won't appended.(dictionary reload) * * @date 2013-09-02 */ boolean add = true; if ( arr != null ) { for ( int i = 0; i < arr.length; i++ ) { if ( pos[j].equals(arr[i]) ) { add = false; break; } } } if ( add ) { tword.addPartSpeech(pos[j].trim()); } } } } } buffReader.close(); buffReader = null; } }
public class class_name { public static void loadWords( JcsegTaskConfig config, ADictionary dic, InputStream is, List<String[]> buffer ) throws NumberFormatException, IOException { boolean isFirstLine = true; int t = -1; String line = null, gEntity = null; BufferedReader buffReader = new BufferedReader(new InputStreamReader(is, "UTF-8")); while ( (line = buffReader.readLine()) != null ) { line = line.trim(); if ( "".equals(line) ) continue; if ( line.charAt(0) == '#' && line.length() > 1 ) { //skip the comments continue; } //the first line for the lexicon file. if ( isFirstLine == true ) { t = ADictionary.getIndex(line); // depends on control dependency: [if], data = [none] isFirstLine = false; // depends on control dependency: [if], data = [none] if ( t >= 0 ) { continue; } } /* * @Note: added at 2016/11/14 * dictionary directive compile and apply */ if ( line.charAt(0) == ':' && line.length() > 1 ) { String[] directive = line.substring(1).toLowerCase().split("\\s+"); if ( directive[0].equals("entity") ) { //@since 2.0.1 if ( directive.length > 1 ) { String args = directive[1].trim(); gEntity = "null".equals(args) ? null : Entity.get(args); // depends on control dependency: [if], data = [none] } } continue; } IWord tword = null; String[] wd = null; switch ( t ) { case ILexicon.CN_SNAME: case ILexicon.CN_LNAME: case ILexicon.CN_DNAME_1: case ILexicon.CN_DNAME_2: if ( line.length() == 1 ) { dic.add(t, line, IWord.T_CJK_WORD); // depends on control dependency: [if], data = [none] } break; case ILexicon.NUMBER_UNIT: wd = line.split("\\s*/\\s*"); IWord uw = dic.add(t, wd[0], IWord.T_CJK_WORD); if ( wd.length == 1 ) { dic.add(ILexicon.CJK_WORD, uw); // depends on control dependency: [if], data = [none] } else if ( wd.length == 2 ) { String entity = "null".equals(wd[1]) ? null : Entity.get(wd[1]); uw.addEntity(entity); // depends on control dependency: [if], data = [none] dic.add(ILexicon.CJK_CHAR, uw); // depends on control dependency: [if], data = [none] } break; case ILexicon.CJK_UNIT: /* * for the entity recognition * we may need the unit to help to * define the numeric entity in front of it * @date 2016/11/12 */ wd = line.split("\\s*/\\s*"); IWord w = dic.add(t, wd[0], IWord.T_CJK_WORD); if ( wd.length == 1 ) { dic.add(ILexicon.CJK_WORD, w); // depends on control dependency: [if], data = [none] } else if ( wd.length == 2 ) { String entity = "null".equals(wd[1]) ? null : Entity.get(wd[1]); w.addEntity(entity); // depends on control dependency: [if], data = [none] dic.add(ILexicon.CJK_WORD, w).addEntity(entity);; // depends on control dependency: [if], data = [none] } else if ( wd.length > 3 ) { String entity = "null".equals(wd[3]) ? null : Entity.get(wd[3]); w.addEntity(entity); // depends on control dependency: [if], data = [none] /* * @Note: added at 2018/03/15 * check and set the word parameter override the original one * if the current one with parameter set up */ if ( config.LOAD_PARAMETER && wd.length > 4 && ! wd[4].equals("null") ) { w.setParameter(wd[4]); // depends on control dependency: [if], data = [none] } dic.add(ILexicon.CJK_WORD, w).addEntity(entity);; // depends on control dependency: [if], data = [none] tword = w; // depends on control dependency: [if], data = [none] } else { dic.add(ILexicon.CJK_WORD, w); // depends on control dependency: [if], data = [none] tword = w; // depends on control dependency: [if], data = [none] } break; case ILexicon.CN_LNAME_ADORN: dic.add(t, line, IWord.T_CJK_WORD); break; case ILexicon.STOP_WORD: /*char fChar = line.charAt(0); if ( fChar <= 127 || (fChar > 127 && line.length() <= config.MAX_LENGTH) ) { dic.add(ILexicon.STOP_WORD, line, IWord.T_CJK_WORD); }*/ dic.add(ILexicon.STOP_WORD, line, IWord.T_CJK_WORD); break; case ILexicon.DOMAIN_SUFFIX: wd = line.split("\\s*/\\s*"); dic.add(t, wd[0], IWord.T_BASIC_LATIN); //@Note access the explanation through wd[1] break; case ILexicon.CJK_SYN: wd = line.split("\\s*,\\s*"); if ( wd.length > 1 && buffer != null ) { buffer.add(wd); // depends on control dependency: [if], data = [none] } wd = null; break; case ILexicon.CJK_WORD: case ILexicon.CJK_CHAR: wd = line.split("\\s*/\\s*", 5); if ( wd.length < 4 ) { //format check System.out.println("Word: \"" + wd[0] + "\" format error. -ignored"); // depends on control dependency: [if], data = [none] continue; } if ( t == ILexicon.CJK_CHAR ) { //single word degree check if ( ! StringUtil.isDigit(wd[4]) ) { System.out.println("Word: \"" + wd[0] + "\" format error(single word degree should be an integer). -ignored"); // depends on control dependency: [if], data = [none] continue; } } //length limit(CJK_WORD only) int latinIndex = StringUtil.latinIndexOf(wd[0]); //added at 2017/06/11 //here we clear the length filter for we may change the config.MAX_LENGTH // at token analysis run time ///if ( latinIndex == -1 && wd[0].length() > config.MAX_LENGTH ) { /// continue; ///} tword = dic.get(t, wd[0]); if ( tword == null ) { if ( t == ILexicon.CJK_CHAR ) { tword = dic.add(ILexicon.CJK_WORD, wd[0], Integer.parseInt(wd[4]), IWord.T_CJK_WORD); // depends on control dependency: [if], data = [none] } else { tword = dic.add(t, wd[0], IWord.T_CJK_WORD); // depends on control dependency: [if], data = [none] } } /* * @Note: added at 2016/11/14 * update the entity string for CJK and English words only */ if ( config.LOAD_CJK_ENTITY && t != ILexicon.CJK_CHAR ) { if ( wd.length > 3 ) { if ( "unset".equals(wd[3]) ) { tword.setEntity(null); // depends on control dependency: [if], data = [none] } else if ( "extend".equals(wd[3]) ) { tword.addEntity(gEntity); // depends on control dependency: [if], data = [none] } else if ( "null".equals(wd[3]) ) { tword.addEntity(gEntity); // depends on control dependency: [if], data = [none] } else { tword.addEntity(Entity.get(wd[3])); // depends on control dependency: [if], data = [none] } } else if ( gEntity != null ) { tword.addEntity(gEntity); // depends on control dependency: [if], data = [none] } } /* * @Note: added at 2017/10/02 * check and set the word parameter override the original one * if the current one with parameter set up */ if ( config.LOAD_PARAMETER && t != ILexicon.CJK_CHAR ) { if ( wd.length > 4 && ! wd[4].equals("null") ) { tword.setParameter(wd[4]); // depends on control dependency: [if], data = [none] } } /* * check and build the MIX_ASSIST_WORD dictionary * @Note added at 2016/11/22 */ if ( latinIndex >= 0 ) { if ( latinIndex > 0 ) { resetPrefixLength(config, dic, latinIndex); // depends on control dependency: [if], data = [none] dic.add(ILexicon.MIX_ASSIST_WORD, wd[0].substring(0, latinIndex), IWord.T_CJK_WORD); // depends on control dependency: [if], data = [none] } int cjkIndex = StringUtil.CJKIndexOf(wd[0], latinIndex + 1); if ( cjkIndex > -1 ) { resetSuffixLength(config, dic, wd[0].length() - cjkIndex); // depends on control dependency: [if], data = [none] dic.add(ILexicon.MIX_ASSIST_WORD, wd[0].substring(cjkIndex), IWord.T_CJK_WORD); // depends on control dependency: [if], data = [none] } if ( latinIndex > 0 && cjkIndex > -1 ) { dic.add(ILexicon.MIX_ASSIST_WORD, wd[0].substring(0, cjkIndex), IWord.T_BASIC_LATIN); // depends on control dependency: [if], data = [none] } } break; } /* * check and append the attributes of tword * like the pinyin and the part of speech */ if ( tword != null ) { //set the Pinyin of the word. if ( config.LOAD_CJK_PINYIN && ! "null".equals(wd[2]) ) { tword.setPinyin(wd[2]); // depends on control dependency: [if], data = [none] } //update the synonym of the word. //@Deprecated at 2017/06/10 /*String[] arr = tword.getSyn(); if ( config.LOAD_CJK_SYN && ! "null".equals(wd[3]) ) { String[] syns = wd[3].split(","); for ( int j = 0; j < syns.length; j++ ) { syns[j] = syns[j].trim(); Here: * filter the synonym that its length * is greater than config.MAX_LENGTH if ( t == ILexicon.CJK_WORD && syns[j].length() > config.MAX_LENGTH ) { continue; } Here: * check the synonym is not exists, make sure * the same synonym won't appended. (dictionary reload) * * @date 2013-09-02 boolean add = true; if ( arr != null ) { for ( int i = 0; i < arr.length; i++ ) { if ( syns[j].equals(arr[i]) ) { add = false; break; } } } if ( add ) { tword.addSyn(syns[j]); } } }*/ //update the word's part of speech String[] arr = tword.getPartSpeech(); if ( config.LOAD_CJK_POS && ! "null".equals(wd[1]) ) { String[] pos = wd[1].split(","); for ( int j = 0; j < pos.length; j++ ) { pos[j] = pos[j].trim(); // depends on control dependency: [for], data = [j] /* Here: * check the part of speech is not exists, make sure * the same part of speech won't appended.(dictionary reload) * * @date 2013-09-02 */ boolean add = true; if ( arr != null ) { for ( int i = 0; i < arr.length; i++ ) { if ( pos[j].equals(arr[i]) ) { add = false; // depends on control dependency: [if], data = [none] break; } } } if ( add ) { tword.addPartSpeech(pos[j].trim()); // depends on control dependency: [if], data = [none] } } } } } buffReader.close(); buffReader = null; } }
public class class_name { public boolean isTeiidSupport() { String result = properties.getProperty(LocalJcrDriver.TEIID_SUPPORT_PROPERTY_NAME); if (result == null) { return false; } return result.equalsIgnoreCase(Boolean.TRUE.toString()); } }
public class class_name { public boolean isTeiidSupport() { String result = properties.getProperty(LocalJcrDriver.TEIID_SUPPORT_PROPERTY_NAME); if (result == null) { return false; // depends on control dependency: [if], data = [none] } return result.equalsIgnoreCase(Boolean.TRUE.toString()); } }
public class class_name { void foldExpressions() throws ClassParseException { // we also populate a second list of expressions held between headTail.head and headTail.tail for (Instruction instruction = pcHead; instruction != null; instruction = instruction.getNextPC()) { // Here we are going to extract loop/if/structure from the list that we have collected so far in the roots list // We are looking for a new instruction which is the target of a forward branch (this is why we collected forward branch counts) we only enter this loop // however if roots list is not empty and it's tail is not a forward branch. expressionList.foldComposite(instruction); // If we find a DUP then we need to txform the DUP into a set of clones on the xpressionlist if (instruction instanceof DUP) { txFormDups(expressionList, instruction); } else { if (instruction.consumesStack()) { // If instruction consumes n operands, then walk back until we find n roots on the xpressionlist that produce stack. // we will user this cursor to track our progress Instruction cursor = expressionList.getTail(); // set this flag if we pass something that does not produce stack boolean foundNonStackProducer = false; // operandStart will points to the beginning of the list of consumed operands Instruction operandStart = null; // back up from root tail past each instruction expecting to create a consumed operand for this instruction for (int i = 0; i < instruction.getStackConsumeCount();) { if (!cursor.producesStack()) { foundNonStackProducer = true; // we spotted an instruction that does not consume stack. So we need to analyze this } else { i++; } operandStart = cursor; cursor = cursor.getPrevExpr(); } // if we found something that did not consume stack we probably have an expression with a side effect if (foundNonStackProducer) { // Something like // a = b++; // foo(i++); // return(a++); // so we need to check for common transformations applyTransformations(expressionList, instruction, operandStart); } // cut the tail off and give it to instruction final Instruction childTail = expressionList.getTail(); final Instruction childHead = expressionList.createList(cursor); instruction.setChildren(childHead, childTail); } // add this instruction to the tail of roots expressionList.add(instruction); } } } }
public class class_name { void foldExpressions() throws ClassParseException { // we also populate a second list of expressions held between headTail.head and headTail.tail for (Instruction instruction = pcHead; instruction != null; instruction = instruction.getNextPC()) { // Here we are going to extract loop/if/structure from the list that we have collected so far in the roots list // We are looking for a new instruction which is the target of a forward branch (this is why we collected forward branch counts) we only enter this loop // however if roots list is not empty and it's tail is not a forward branch. expressionList.foldComposite(instruction); // If we find a DUP then we need to txform the DUP into a set of clones on the xpressionlist if (instruction instanceof DUP) { txFormDups(expressionList, instruction); } else { if (instruction.consumesStack()) { // If instruction consumes n operands, then walk back until we find n roots on the xpressionlist that produce stack. // we will user this cursor to track our progress Instruction cursor = expressionList.getTail(); // set this flag if we pass something that does not produce stack boolean foundNonStackProducer = false; // operandStart will points to the beginning of the list of consumed operands Instruction operandStart = null; // back up from root tail past each instruction expecting to create a consumed operand for this instruction for (int i = 0; i < instruction.getStackConsumeCount();) { if (!cursor.producesStack()) { foundNonStackProducer = true; // we spotted an instruction that does not consume stack. So we need to analyze this // depends on control dependency: [if], data = [none] } else { i++; // depends on control dependency: [if], data = [none] } operandStart = cursor; // depends on control dependency: [for], data = [none] cursor = cursor.getPrevExpr(); // depends on control dependency: [for], data = [none] } // if we found something that did not consume stack we probably have an expression with a side effect if (foundNonStackProducer) { // Something like // a = b++; // foo(i++); // return(a++); // so we need to check for common transformations applyTransformations(expressionList, instruction, operandStart); // depends on control dependency: [if], data = [none] } // cut the tail off and give it to instruction final Instruction childTail = expressionList.getTail(); final Instruction childHead = expressionList.createList(cursor); instruction.setChildren(childHead, childTail); // depends on control dependency: [if], data = [none] } // add this instruction to the tail of roots expressionList.add(instruction); } } } }
public class class_name { @PublicEvolving @Deprecated public <ACC, R> SingleOutputStreamOperator<R> fold(ACC initialValue, FoldFunction<T, ACC> foldFunction, AllWindowFunction<ACC, R, W> function, TypeInformation<ACC> foldAccumulatorType, TypeInformation<R> resultType) { if (foldFunction instanceof RichFunction) { throw new UnsupportedOperationException("FoldFunction of fold can not be a RichFunction."); } if (windowAssigner instanceof MergingWindowAssigner) { throw new UnsupportedOperationException("Fold cannot be used with a merging WindowAssigner."); } //clean the closures function = input.getExecutionEnvironment().clean(function); foldFunction = input.getExecutionEnvironment().clean(foldFunction); String callLocation = Utils.getCallLocationName(); String udfName = "AllWindowedStream." + callLocation; String opName; KeySelector<T, Byte> keySel = input.getKeySelector(); OneInputStreamOperator<T, R> operator; if (evictor != null) { @SuppressWarnings({"unchecked", "rawtypes"}) TypeSerializer<StreamRecord<T>> streamRecordSerializer = (TypeSerializer<StreamRecord<T>>) new StreamElementSerializer(input.getType().createSerializer(getExecutionEnvironment().getConfig())); ListStateDescriptor<StreamRecord<T>> stateDesc = new ListStateDescriptor<>("window-contents", streamRecordSerializer); opName = "TriggerWindow(" + windowAssigner + ", " + stateDesc + ", " + trigger + ", " + evictor + ", " + udfName + ")"; operator = new EvictingWindowOperator<>(windowAssigner, windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()), keySel, input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()), stateDesc, new InternalIterableAllWindowFunction<>(new FoldApplyAllWindowFunction<>(initialValue, foldFunction, function, foldAccumulatorType)), trigger, evictor, allowedLateness, lateDataOutputTag); } else { FoldingStateDescriptor<T, ACC> stateDesc = new FoldingStateDescriptor<>("window-contents", initialValue, foldFunction, foldAccumulatorType.createSerializer(getExecutionEnvironment().getConfig())); opName = "TriggerWindow(" + windowAssigner + ", " + stateDesc + ", " + trigger + ", " + udfName + ")"; operator = new WindowOperator<>(windowAssigner, windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()), keySel, input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()), stateDesc, new InternalSingleValueAllWindowFunction<>(function), trigger, allowedLateness, lateDataOutputTag); } return input.transform(opName, resultType, operator).forceNonParallel(); } }
public class class_name { @PublicEvolving @Deprecated public <ACC, R> SingleOutputStreamOperator<R> fold(ACC initialValue, FoldFunction<T, ACC> foldFunction, AllWindowFunction<ACC, R, W> function, TypeInformation<ACC> foldAccumulatorType, TypeInformation<R> resultType) { if (foldFunction instanceof RichFunction) { throw new UnsupportedOperationException("FoldFunction of fold can not be a RichFunction."); } if (windowAssigner instanceof MergingWindowAssigner) { throw new UnsupportedOperationException("Fold cannot be used with a merging WindowAssigner."); } //clean the closures function = input.getExecutionEnvironment().clean(function); foldFunction = input.getExecutionEnvironment().clean(foldFunction); String callLocation = Utils.getCallLocationName(); String udfName = "AllWindowedStream." + callLocation; String opName; KeySelector<T, Byte> keySel = input.getKeySelector(); OneInputStreamOperator<T, R> operator; if (evictor != null) { @SuppressWarnings({"unchecked", "rawtypes"}) TypeSerializer<StreamRecord<T>> streamRecordSerializer = (TypeSerializer<StreamRecord<T>>) new StreamElementSerializer(input.getType().createSerializer(getExecutionEnvironment().getConfig())); ListStateDescriptor<StreamRecord<T>> stateDesc = new ListStateDescriptor<>("window-contents", streamRecordSerializer); opName = "TriggerWindow(" + windowAssigner + ", " + stateDesc + ", " + trigger + ", " + evictor + ", " + udfName + ")"; operator = new EvictingWindowOperator<>(windowAssigner, windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()), keySel, input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()), stateDesc, new InternalIterableAllWindowFunction<>(new FoldApplyAllWindowFunction<>(initialValue, foldFunction, function, foldAccumulatorType)), trigger, evictor, allowedLateness, lateDataOutputTag); // depends on control dependency: [if], data = [none] } else { FoldingStateDescriptor<T, ACC> stateDesc = new FoldingStateDescriptor<>("window-contents", initialValue, foldFunction, foldAccumulatorType.createSerializer(getExecutionEnvironment().getConfig())); opName = "TriggerWindow(" + windowAssigner + ", " + stateDesc + ", " + trigger + ", " + udfName + ")"; operator = new WindowOperator<>(windowAssigner, windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()), keySel, input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()), stateDesc, new InternalSingleValueAllWindowFunction<>(function), trigger, allowedLateness, lateDataOutputTag); // depends on control dependency: [if], data = [none] } return input.transform(opName, resultType, operator).forceNonParallel(); } }
public class class_name { public static int exit(ApplicationContext context, ExitCodeGenerator... exitCodeGenerators) { Assert.notNull(context, "Context must not be null"); int exitCode = 0; try { try { ExitCodeGenerators generators = new ExitCodeGenerators(); Collection<ExitCodeGenerator> beans = context .getBeansOfType(ExitCodeGenerator.class).values(); generators.addAll(exitCodeGenerators); generators.addAll(beans); exitCode = generators.getExitCode(); if (exitCode != 0) { context.publishEvent(new ExitCodeEvent(context, exitCode)); } } finally { close(context); } } catch (Exception ex) { ex.printStackTrace(); exitCode = (exitCode != 0) ? exitCode : 1; } return exitCode; } }
public class class_name { public static int exit(ApplicationContext context, ExitCodeGenerator... exitCodeGenerators) { Assert.notNull(context, "Context must not be null"); int exitCode = 0; try { try { ExitCodeGenerators generators = new ExitCodeGenerators(); Collection<ExitCodeGenerator> beans = context .getBeansOfType(ExitCodeGenerator.class).values(); generators.addAll(exitCodeGenerators); // depends on control dependency: [try], data = [none] generators.addAll(beans); // depends on control dependency: [try], data = [none] exitCode = generators.getExitCode(); // depends on control dependency: [try], data = [none] if (exitCode != 0) { context.publishEvent(new ExitCodeEvent(context, exitCode)); // depends on control dependency: [if], data = [none] } } finally { close(context); } } catch (Exception ex) { ex.printStackTrace(); exitCode = (exitCode != 0) ? exitCode : 1; } // depends on control dependency: [catch], data = [none] return exitCode; } }
public class class_name { protected boolean validateForRequired() { if(isRequired() && isInputEmpty()) { errors.createFieldError(fieldName, getMessageKeyRequired()) .address(getPosition()) .label(getLabel()) .variables("validatedValue", getValue()) .buildAndAddError(); return false; } return true; } }
public class class_name { protected boolean validateForRequired() { if(isRequired() && isInputEmpty()) { errors.createFieldError(fieldName, getMessageKeyRequired()) .address(getPosition()) .label(getLabel()) .variables("validatedValue", getValue()) .buildAndAddError(); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public B importContext(AbstractContext context, boolean overwriteDuplicates){ for (Map.Entry<String, Object> en : context.data.entrySet()) { if (overwriteDuplicates) { this.data.put(en.getKey(), en.getValue()); }else{ this.data.putIfAbsent(en.getKey(), en.getValue()); } } return (B) this; } }
public class class_name { public B importContext(AbstractContext context, boolean overwriteDuplicates){ for (Map.Entry<String, Object> en : context.data.entrySet()) { if (overwriteDuplicates) { this.data.put(en.getKey(), en.getValue()); // depends on control dependency: [if], data = [none] }else{ this.data.putIfAbsent(en.getKey(), en.getValue()); // depends on control dependency: [if], data = [none] } } return (B) this; } }
public class class_name { public HierarchicalProperty getProperty(String name) throws RepositoryException { if ("jcr:primaryType".equals(name) || "jcr:mixinTypes".equals(name)) return null; if (content == null) return null; if (content.getProperty(name) != null) { return content.getProperty(name); } try { String value; Property p = node.getProperty(name); if (p.getDefinition().isMultiple()) { if (p.getValues().length == 0) value = ""; else value = p.getValues()[0].getString(); } else { value = p.getString(); } //String value = node.getProperty(name).getString(); String ns = ((ExtendedSession)node.getSession()).getLocationFactory().parseJCRName(name).getNamespace(); return new HierarchicalProperty(name, value, ns); } catch (PathNotFoundException e) { return null; } } }
public class class_name { public HierarchicalProperty getProperty(String name) throws RepositoryException { if ("jcr:primaryType".equals(name) || "jcr:mixinTypes".equals(name)) return null; if (content == null) return null; if (content.getProperty(name) != null) { return content.getProperty(name); } try { String value; Property p = node.getProperty(name); if (p.getDefinition().isMultiple()) { if (p.getValues().length == 0) value = ""; else value = p.getValues()[0].getString(); } else { value = p.getString(); // depends on control dependency: [if], data = [none] } //String value = node.getProperty(name).getString(); String ns = ((ExtendedSession)node.getSession()).getLocationFactory().parseJCRName(name).getNamespace(); return new HierarchicalProperty(name, value, ns); } catch (PathNotFoundException e) { return null; } } }
public class class_name { public static ForkThrowableHolder getForkThrowableHolder(SharedResourcesBroker<GobblinScopeTypes> broker) { try { return broker.getSharedResource(new ForkThrowableHolderFactory(), EmptyKey.INSTANCE); } catch (NotConfiguredException e) { LOG.error("Fail to get fork throwable holder instance from broker. Will not track fork exception.", e); throw new RuntimeException(e); } } }
public class class_name { public static ForkThrowableHolder getForkThrowableHolder(SharedResourcesBroker<GobblinScopeTypes> broker) { try { return broker.getSharedResource(new ForkThrowableHolderFactory(), EmptyKey.INSTANCE); // depends on control dependency: [try], data = [none] } catch (NotConfiguredException e) { LOG.error("Fail to get fork throwable holder instance from broker. Will not track fork exception.", e); throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public boolean release() { if (refcnt != null && refcnt.decrementAndGet() <= 0 && controller != null) { controller.setMode(ServiceController.Mode.REMOVE); return true; } return false; } }
public class class_name { public boolean release() { if (refcnt != null && refcnt.decrementAndGet() <= 0 && controller != null) { controller.setMode(ServiceController.Mode.REMOVE); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { protected QueryParameters[] getQueryParams(Object[][] params) { QueryParameters[] result = new QueryParameters[params.length]; for (int i = 0; i < params.length; i++) { result[i] = new QueryParameters(params[i]); } return result; } }
public class class_name { protected QueryParameters[] getQueryParams(Object[][] params) { QueryParameters[] result = new QueryParameters[params.length]; for (int i = 0; i < params.length; i++) { result[i] = new QueryParameters(params[i]); // depends on control dependency: [for], data = [i] } return result; } }
public class class_name { public EClass getIfcCoolingTowerType() { if (ifcCoolingTowerTypeEClass == null) { ifcCoolingTowerTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(120); } return ifcCoolingTowerTypeEClass; } }
public class class_name { public EClass getIfcCoolingTowerType() { if (ifcCoolingTowerTypeEClass == null) { ifcCoolingTowerTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(120); // depends on control dependency: [if], data = [none] } return ifcCoolingTowerTypeEClass; } }
public class class_name { public Point interpolate(double distance) { if (distance < 0) { return null; } for (LineSegment segment : this.segments) { double length = segment.length(); if (distance <= length) { return segment.pointAlongLineSegment(distance); } distance -= length; } return null; } }
public class class_name { public Point interpolate(double distance) { if (distance < 0) { return null; // depends on control dependency: [if], data = [none] } for (LineSegment segment : this.segments) { double length = segment.length(); if (distance <= length) { return segment.pointAlongLineSegment(distance); // depends on control dependency: [if], data = [(distance] } distance -= length; // depends on control dependency: [for], data = [none] } return null; } }
public class class_name { private void addLeafDelta(Segment10 segment, int pid, int nextPid, int address, int length) { Page10 page = _pageMap.get(pid); if (page != null && page.sequence() < segment.sequence()) { return; } if (page != null) { page.addDelta(address, length); } } }
public class class_name { private void addLeafDelta(Segment10 segment, int pid, int nextPid, int address, int length) { Page10 page = _pageMap.get(pid); if (page != null && page.sequence() < segment.sequence()) { return; // depends on control dependency: [if], data = [none] } if (page != null) { page.addDelta(address, length); // depends on control dependency: [if], data = [none] } } }
public class class_name { void initBaseCoord() { baseCoords = new double[dimension + 1][]; for (int i = 0; i < baseCoords.length; i++) { baseCoords[i] = lowerBound.clone(); if (i > 0) { baseCoords[i][i - 1] = upperBound[i - 1]; } } } }
public class class_name { void initBaseCoord() { baseCoords = new double[dimension + 1][]; for (int i = 0; i < baseCoords.length; i++) { baseCoords[i] = lowerBound.clone(); // depends on control dependency: [for], data = [i] if (i > 0) { baseCoords[i][i - 1] = upperBound[i - 1]; // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public byte[] get(byte[] key) { if (key == null) { return null; } byte[] value = null; Jedis jedis = getJedis(); try { value = jedis.get(key); } finally { jedis.close(); } return value; } }
public class class_name { @Override public byte[] get(byte[] key) { if (key == null) { return null; // depends on control dependency: [if], data = [none] } byte[] value = null; Jedis jedis = getJedis(); try { value = jedis.get(key); // depends on control dependency: [try], data = [none] } finally { jedis.close(); } return value; } }
public class class_name { public void _predict(Dataframe newData) { //load all trainables on the bundles initBundle(); //set the parallized flag to all algorithms bundle.setParallelized(isParallelized()); //run the pipeline for(String step : pipeline) { switch (step) { case NS_KEY: AbstractScaler numericalScaler = (AbstractScaler) bundle.get(NS_KEY); if(numericalScaler != null) { numericalScaler.transform(newData); } break; case CE_KEY: AbstractEncoder categoricalEncoder = (AbstractEncoder) bundle.get(CE_KEY); if(categoricalEncoder != null) { categoricalEncoder.transform(newData); } break; case FS_KEY: int numOfFS = getTrainingParameters().getFeatureSelectorTrainingParametersList().size(); for(int i=0;i<numOfFS;i++) { AbstractFeatureSelector featureSelector = (AbstractFeatureSelector) bundle.get(FS_KEY+i); featureSelector.transform(newData); } break; case ML_KEY: AbstractModeler modeler = (AbstractModeler) bundle.get(ML_KEY); modeler.predict(newData); break; default: throw new RuntimeException("Invalid Pipeline Step"); } } } }
public class class_name { public void _predict(Dataframe newData) { //load all trainables on the bundles initBundle(); //set the parallized flag to all algorithms bundle.setParallelized(isParallelized()); //run the pipeline for(String step : pipeline) { switch (step) { case NS_KEY: AbstractScaler numericalScaler = (AbstractScaler) bundle.get(NS_KEY); if(numericalScaler != null) { numericalScaler.transform(newData); // depends on control dependency: [if], data = [none] } break; case CE_KEY: AbstractEncoder categoricalEncoder = (AbstractEncoder) bundle.get(CE_KEY); if(categoricalEncoder != null) { categoricalEncoder.transform(newData); // depends on control dependency: [if], data = [none] } break; case FS_KEY: int numOfFS = getTrainingParameters().getFeatureSelectorTrainingParametersList().size(); for(int i=0;i<numOfFS;i++) { AbstractFeatureSelector featureSelector = (AbstractFeatureSelector) bundle.get(FS_KEY+i); featureSelector.transform(newData); // depends on control dependency: [for], data = [none] } break; case ML_KEY: AbstractModeler modeler = (AbstractModeler) bundle.get(ML_KEY); modeler.predict(newData); break; default: throw new RuntimeException("Invalid Pipeline Step"); } } } }
public class class_name { public Vector getVector(String word) { SemanticVector v = wordToMeaning.get(word); if (v == null) { return null; } return Vectors.immutable(v); } }
public class class_name { public Vector getVector(String word) { SemanticVector v = wordToMeaning.get(word); if (v == null) { return null; // depends on control dependency: [if], data = [none] } return Vectors.immutable(v); } }
public class class_name { private void homogeneousUnion(final HLL other) { switch(type) { case EMPTY: // union of empty and empty is empty return; case EXPLICIT: for(final long value : other.explicitStorage) { addRaw(value); } // NOTE: #addRaw() will handle promotion, if necessary return; case SPARSE: for(final int registerIndex : other.sparseProbabilisticStorage.keySet()) { final byte registerValue = other.sparseProbabilisticStorage.get(registerIndex); final byte currentRegisterValue = sparseProbabilisticStorage.get(registerIndex); if(registerValue > currentRegisterValue) { sparseProbabilisticStorage.put(registerIndex, registerValue); } } // promotion, if necessary if(sparseProbabilisticStorage.size() > sparseThreshold) { initializeStorage(HLLType.FULL); for(final int registerIndex : sparseProbabilisticStorage.keySet()) { final byte registerValue = sparseProbabilisticStorage.get(registerIndex); probabilisticStorage.setMaxRegister(registerIndex, registerValue); } sparseProbabilisticStorage = null; } return; case FULL: for(int i=0; i<m; i++) { final long registerValue = other.probabilisticStorage.getRegister(i); probabilisticStorage.setMaxRegister(i, registerValue); } return; default: throw new RuntimeException("Unsupported HLL type " + type); } } }
public class class_name { private void homogeneousUnion(final HLL other) { switch(type) { case EMPTY: // union of empty and empty is empty return; case EXPLICIT: for(final long value : other.explicitStorage) { addRaw(value); // depends on control dependency: [for], data = [value] } // NOTE: #addRaw() will handle promotion, if necessary return; case SPARSE: for(final int registerIndex : other.sparseProbabilisticStorage.keySet()) { final byte registerValue = other.sparseProbabilisticStorage.get(registerIndex); final byte currentRegisterValue = sparseProbabilisticStorage.get(registerIndex); if(registerValue > currentRegisterValue) { sparseProbabilisticStorage.put(registerIndex, registerValue); // depends on control dependency: [if], data = [none] } } // promotion, if necessary if(sparseProbabilisticStorage.size() > sparseThreshold) { initializeStorage(HLLType.FULL); // depends on control dependency: [if], data = [none] for(final int registerIndex : sparseProbabilisticStorage.keySet()) { final byte registerValue = sparseProbabilisticStorage.get(registerIndex); probabilisticStorage.setMaxRegister(registerIndex, registerValue); // depends on control dependency: [for], data = [registerIndex] } sparseProbabilisticStorage = null; // depends on control dependency: [if], data = [none] } return; case FULL: for(int i=0; i<m; i++) { final long registerValue = other.probabilisticStorage.getRegister(i); probabilisticStorage.setMaxRegister(i, registerValue); // depends on control dependency: [for], data = [i] } return; default: throw new RuntimeException("Unsupported HLL type " + type); } } }
public class class_name { public String getString(int columnIndex) { if (columnIndex < 0 || columnIndex >= data.length) { throw new IllegalArgumentException("Invalid index field: (" + columnIndex+"). Valid range is 0 to " + (data.length - 1)); } Object fieldValue = data[columnIndex]; if (fieldValue == null) { return null; } if (fieldValue instanceof String) { return (String) fieldValue; } return fieldValue.toString(); } }
public class class_name { public String getString(int columnIndex) { if (columnIndex < 0 || columnIndex >= data.length) { throw new IllegalArgumentException("Invalid index field: (" + columnIndex+"). Valid range is 0 to " + (data.length - 1)); } Object fieldValue = data[columnIndex]; if (fieldValue == null) { return null; // depends on control dependency: [if], data = [none] } if (fieldValue instanceof String) { return (String) fieldValue; // depends on control dependency: [if], data = [none] } return fieldValue.toString(); } }
public class class_name { private X509Certificate[] getCerts(SSLSessionInfo session) { try { javax.security.cert.X509Certificate[] javaxCerts = session.getPeerCertificateChain(); if (javaxCerts == null || javaxCerts.length == 0) { return null; } X509Certificate[] javaCerts = new X509Certificate[javaxCerts.length]; java.security.cert.CertificateFactory cf = java.security.cert.CertificateFactory.getInstance("X.509"); for (int i = 0; i < javaxCerts.length; i++) { byte[] bytes = javaxCerts[i].getEncoded(); ByteArrayInputStream stream = new ByteArrayInputStream(bytes); javaCerts[i] = (X509Certificate) cf.generateCertificate(stream); } return javaCerts; } catch (Exception e) { return null; } } }
public class class_name { private X509Certificate[] getCerts(SSLSessionInfo session) { try { javax.security.cert.X509Certificate[] javaxCerts = session.getPeerCertificateChain(); if (javaxCerts == null || javaxCerts.length == 0) { return null; // depends on control dependency: [if], data = [none] } X509Certificate[] javaCerts = new X509Certificate[javaxCerts.length]; java.security.cert.CertificateFactory cf = java.security.cert.CertificateFactory.getInstance("X.509"); for (int i = 0; i < javaxCerts.length; i++) { byte[] bytes = javaxCerts[i].getEncoded(); ByteArrayInputStream stream = new ByteArrayInputStream(bytes); javaCerts[i] = (X509Certificate) cf.generateCertificate(stream); // depends on control dependency: [for], data = [i] } return javaCerts; // depends on control dependency: [try], data = [none] } catch (Exception e) { return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void layoutForPredictiveAnimationsExpose(RecyclerView.Recycler recycler, RecyclerView.State state, int startOffset, int endOffset) { // If there are scrap children that we did not layout, we need to find where they did go // and layout them accordingly so that animations can work as expected. // This case may happen if new views are added or an existing view expands and pushes // another view out of bounds. if (!state.willRunPredictiveAnimations() || getChildCount() == 0 || state.isPreLayout() || !supportsPredictiveItemAnimations()) { return; } // to make the logic simpler, we calculate the size of children and call fill. int scrapExtraStart = 0, scrapExtraEnd = 0; final List<RecyclerView.ViewHolder> scrapList = recycler.getScrapList(); final int scrapSize = scrapList.size(); final int firstChildPos = getPosition(getChildAt(0)); for (int i = 0; i < scrapSize; i++) { RecyclerView.ViewHolder scrap = scrapList.get(i); final int position = scrap.getPosition(); final int direction = position < firstChildPos != mShouldReverseLayoutExpose ? LayoutState.LAYOUT_START : LayoutState.LAYOUT_END; if (direction == LayoutState.LAYOUT_START) { scrapExtraStart += mOrientationHelper.getDecoratedMeasurement(scrap.itemView); } else { scrapExtraEnd += mOrientationHelper.getDecoratedMeasurement(scrap.itemView); } } if (DEBUG) { Log.d(TAG, "for unused scrap, decided to add " + scrapExtraStart + " towards start and " + scrapExtraEnd + " towards end"); } mLayoutState.mScrapList = scrapList; if (scrapExtraStart > 0) { View anchor = getChildClosestToStartExpose(); updateLayoutStateToFillStartExpose(getPosition(anchor), startOffset); mLayoutState.mExtra = scrapExtraStart; mLayoutState.mAvailable = 0; mLayoutState.mCurrentPosition += mShouldReverseLayoutExpose ? 1 : -1; mLayoutState.mOnRefresLayout = true; fill(recycler, mLayoutState, state, false); } if (scrapExtraEnd > 0) { View anchor = getChildClosestToEndExpose(); updateLayoutStateToFillEndExpose(getPosition(anchor), endOffset); mLayoutState.mExtra = scrapExtraEnd; mLayoutState.mAvailable = 0; mLayoutState.mCurrentPosition += mShouldReverseLayoutExpose ? -1 : 1; mLayoutState.mOnRefresLayout = true; fill(recycler, mLayoutState, state, false); } mLayoutState.mScrapList = null; } }
public class class_name { private void layoutForPredictiveAnimationsExpose(RecyclerView.Recycler recycler, RecyclerView.State state, int startOffset, int endOffset) { // If there are scrap children that we did not layout, we need to find where they did go // and layout them accordingly so that animations can work as expected. // This case may happen if new views are added or an existing view expands and pushes // another view out of bounds. if (!state.willRunPredictiveAnimations() || getChildCount() == 0 || state.isPreLayout() || !supportsPredictiveItemAnimations()) { return; // depends on control dependency: [if], data = [none] } // to make the logic simpler, we calculate the size of children and call fill. int scrapExtraStart = 0, scrapExtraEnd = 0; final List<RecyclerView.ViewHolder> scrapList = recycler.getScrapList(); final int scrapSize = scrapList.size(); final int firstChildPos = getPosition(getChildAt(0)); for (int i = 0; i < scrapSize; i++) { RecyclerView.ViewHolder scrap = scrapList.get(i); final int position = scrap.getPosition(); final int direction = position < firstChildPos != mShouldReverseLayoutExpose ? LayoutState.LAYOUT_START : LayoutState.LAYOUT_END; if (direction == LayoutState.LAYOUT_START) { scrapExtraStart += mOrientationHelper.getDecoratedMeasurement(scrap.itemView); // depends on control dependency: [if], data = [none] } else { scrapExtraEnd += mOrientationHelper.getDecoratedMeasurement(scrap.itemView); // depends on control dependency: [if], data = [none] } } if (DEBUG) { Log.d(TAG, "for unused scrap, decided to add " + scrapExtraStart + " towards start and " + scrapExtraEnd + " towards end"); // depends on control dependency: [if], data = [none] } mLayoutState.mScrapList = scrapList; if (scrapExtraStart > 0) { View anchor = getChildClosestToStartExpose(); updateLayoutStateToFillStartExpose(getPosition(anchor), startOffset); // depends on control dependency: [if], data = [none] mLayoutState.mExtra = scrapExtraStart; // depends on control dependency: [if], data = [none] mLayoutState.mAvailable = 0; // depends on control dependency: [if], data = [none] mLayoutState.mCurrentPosition += mShouldReverseLayoutExpose ? 1 : -1; // depends on control dependency: [if], data = [none] mLayoutState.mOnRefresLayout = true; // depends on control dependency: [if], data = [none] fill(recycler, mLayoutState, state, false); // depends on control dependency: [if], data = [none] } if (scrapExtraEnd > 0) { View anchor = getChildClosestToEndExpose(); updateLayoutStateToFillEndExpose(getPosition(anchor), endOffset); // depends on control dependency: [if], data = [none] mLayoutState.mExtra = scrapExtraEnd; // depends on control dependency: [if], data = [none] mLayoutState.mAvailable = 0; // depends on control dependency: [if], data = [none] mLayoutState.mCurrentPosition += mShouldReverseLayoutExpose ? -1 : 1; // depends on control dependency: [if], data = [none] mLayoutState.mOnRefresLayout = true; // depends on control dependency: [if], data = [none] fill(recycler, mLayoutState, state, false); // depends on control dependency: [if], data = [none] } mLayoutState.mScrapList = null; } }
public class class_name { private static Collection<Writer> getAllWriters(final Collection<Writer>[][] matrix) { Collection<Writer> writers = Collections.newSetFromMap(new IdentityHashMap<Writer, Boolean>()); for (int i = 0; i < matrix.length; ++i) { for (int j = 0; j < matrix[i].length; ++j) { writers.addAll(matrix[i][j]); } } return writers; } }
public class class_name { private static Collection<Writer> getAllWriters(final Collection<Writer>[][] matrix) { Collection<Writer> writers = Collections.newSetFromMap(new IdentityHashMap<Writer, Boolean>()); for (int i = 0; i < matrix.length; ++i) { for (int j = 0; j < matrix[i].length; ++j) { writers.addAll(matrix[i][j]); // depends on control dependency: [for], data = [j] } } return writers; } }
public class class_name { private void storeTagAnnotation(Annotation anno) { Class<? extends Annotation> annoType = anno.annotationType(); Annotation[] tags = annoType.getAnnotations(); for (Annotation tag : tags) { Class<? extends Annotation> tagType = tag.annotationType(); if (WAIVE_TAG_TYPES.contains(tagType)) { continue; } Set<Annotation> tagged = tagAnnotations.get(tagType); if (null == tagged) { tagged = new HashSet<>(); tagAnnotations.put(tagType, tagged); } tagged.add(anno); } } }
public class class_name { private void storeTagAnnotation(Annotation anno) { Class<? extends Annotation> annoType = anno.annotationType(); Annotation[] tags = annoType.getAnnotations(); for (Annotation tag : tags) { Class<? extends Annotation> tagType = tag.annotationType(); if (WAIVE_TAG_TYPES.contains(tagType)) { continue; } Set<Annotation> tagged = tagAnnotations.get(tagType); if (null == tagged) { tagged = new HashSet<>(); // depends on control dependency: [if], data = [none] tagAnnotations.put(tagType, tagged); // depends on control dependency: [if], data = [tagged)] } tagged.add(anno); // depends on control dependency: [for], data = [tag] } } }
public class class_name { public PutObjectResponse putObject(String bucketName, String key, byte[] value, ObjectMetadata metadata) { if (metadata.getContentLength() == -1) { metadata.setContentLength(value.length); } return this.putObject(new PutObjectRequest(bucketName, key, RestartableInputStream.wrap(value), metadata)); } }
public class class_name { public PutObjectResponse putObject(String bucketName, String key, byte[] value, ObjectMetadata metadata) { if (metadata.getContentLength() == -1) { metadata.setContentLength(value.length); // depends on control dependency: [if], data = [none] } return this.putObject(new PutObjectRequest(bucketName, key, RestartableInputStream.wrap(value), metadata)); } }
public class class_name { public FacesConfigFlowDefinitionType<FacesConfigType<T>> getOrCreateFlowDefinition() { List<Node> nodeList = childNode.get("flow-definition"); if (nodeList != null && nodeList.size() > 0) { return new FacesConfigFlowDefinitionTypeImpl<FacesConfigType<T>>(this, "flow-definition", childNode, nodeList.get(0)); } return createFlowDefinition(); } }
public class class_name { public FacesConfigFlowDefinitionType<FacesConfigType<T>> getOrCreateFlowDefinition() { List<Node> nodeList = childNode.get("flow-definition"); if (nodeList != null && nodeList.size() > 0) { return new FacesConfigFlowDefinitionTypeImpl<FacesConfigType<T>>(this, "flow-definition", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none] } return createFlowDefinition(); } }
public class class_name { @Override @LogarithmicTime(amortized = true) public void meld(MergeableAddressableHeap<K, V> other) { PairingHeap<K, V> h = (PairingHeap<K, V>) other; // check same comparator if (comparator != null) { if (h.comparator == null || !h.comparator.equals(comparator)) { throw new IllegalArgumentException("Cannot meld heaps using different comparators!"); } } else if (h.comparator != null) { throw new IllegalArgumentException("Cannot meld heaps using different comparators!"); } if (h.other != h) { throw new IllegalStateException("A heap cannot be used after a meld."); } // perform the meld size += h.size; if (comparator == null) { root = link(root, h.root); } else { root = linkWithComparator(root, h.root); } // clear other h.size = 0; h.root = null; // take ownership h.other = this; } }
public class class_name { @Override @LogarithmicTime(amortized = true) public void meld(MergeableAddressableHeap<K, V> other) { PairingHeap<K, V> h = (PairingHeap<K, V>) other; // check same comparator if (comparator != null) { if (h.comparator == null || !h.comparator.equals(comparator)) { throw new IllegalArgumentException("Cannot meld heaps using different comparators!"); } } else if (h.comparator != null) { throw new IllegalArgumentException("Cannot meld heaps using different comparators!"); } if (h.other != h) { throw new IllegalStateException("A heap cannot be used after a meld."); } // perform the meld size += h.size; if (comparator == null) { root = link(root, h.root); // depends on control dependency: [if], data = [none] } else { root = linkWithComparator(root, h.root); // depends on control dependency: [if], data = [none] } // clear other h.size = 0; h.root = null; // take ownership h.other = this; } }
public class class_name { public static boolean checkURIs(URI[] uriFiles, URI[] uriArchives){ if ((uriFiles == null) && (uriArchives == null)){ return true; } if (uriFiles != null){ for (int i = 0; i < uriFiles.length; i++){ String frag1 = uriFiles[i].getFragment(); if (frag1 == null) return false; for (int j=i+1; j < uriFiles.length; j++){ String frag2 = uriFiles[j].getFragment(); if (frag2 == null) return false; if (frag1.equalsIgnoreCase(frag2)) return false; } if (uriArchives != null){ for (int j = 0; j < uriArchives.length; j++){ String frag2 = uriArchives[j].getFragment(); if (frag2 == null){ return false; } if (frag1.equalsIgnoreCase(frag2)) return false; for (int k=j+1; k < uriArchives.length; k++){ String frag3 = uriArchives[k].getFragment(); if (frag3 == null) return false; if (frag2.equalsIgnoreCase(frag3)) return false; } } } } } return true; } }
public class class_name { public static boolean checkURIs(URI[] uriFiles, URI[] uriArchives){ if ((uriFiles == null) && (uriArchives == null)){ return true; // depends on control dependency: [if], data = [none] } if (uriFiles != null){ for (int i = 0; i < uriFiles.length; i++){ String frag1 = uriFiles[i].getFragment(); if (frag1 == null) return false; for (int j=i+1; j < uriFiles.length; j++){ String frag2 = uriFiles[j].getFragment(); if (frag2 == null) return false; if (frag1.equalsIgnoreCase(frag2)) return false; } if (uriArchives != null){ for (int j = 0; j < uriArchives.length; j++){ String frag2 = uriArchives[j].getFragment(); if (frag2 == null){ return false; // depends on control dependency: [if], data = [none] } if (frag1.equalsIgnoreCase(frag2)) return false; for (int k=j+1; k < uriArchives.length; k++){ String frag3 = uriArchives[k].getFragment(); if (frag3 == null) return false; if (frag2.equalsIgnoreCase(frag3)) return false; } } } } } return true; } }
public class class_name { protected List<CmsDetailPageInfo> updateUris(List<CmsDetailPageInfo> detailPages) { List<CmsDetailPageInfo> result = new ArrayList<CmsDetailPageInfo>(); for (CmsDetailPageInfo page : detailPages) { CmsUUID structureId = page.getId(); try { String rootPath = OpenCms.getADEManager().getRootPath( structureId, getCms().getRequestContext().getCurrentProject().isOnlineProject()); String iconClasses; if (page.getType().startsWith(CmsDetailPageInfo.FUNCTION_PREFIX)) { iconClasses = CmsIconUtil.getIconClasses(CmsXmlDynamicFunctionHandler.TYPE_FUNCTION, null, false); } else { iconClasses = CmsIconUtil.getIconClasses(page.getType(), null, false); } CmsDetailPageInfo correctedPage = new CmsDetailPageInfo( structureId, rootPath, page.getType(), iconClasses); result.add(page.isInherited() ? correctedPage.copyAsInherited() : correctedPage); } catch (CmsException e) { LOG.warn(e.getLocalizedMessage(), e); } } return result; } }
public class class_name { protected List<CmsDetailPageInfo> updateUris(List<CmsDetailPageInfo> detailPages) { List<CmsDetailPageInfo> result = new ArrayList<CmsDetailPageInfo>(); for (CmsDetailPageInfo page : detailPages) { CmsUUID structureId = page.getId(); try { String rootPath = OpenCms.getADEManager().getRootPath( structureId, getCms().getRequestContext().getCurrentProject().isOnlineProject()); String iconClasses; if (page.getType().startsWith(CmsDetailPageInfo.FUNCTION_PREFIX)) { iconClasses = CmsIconUtil.getIconClasses(CmsXmlDynamicFunctionHandler.TYPE_FUNCTION, null, false); // depends on control dependency: [if], data = [none] } else { iconClasses = CmsIconUtil.getIconClasses(page.getType(), null, false); // depends on control dependency: [if], data = [none] } CmsDetailPageInfo correctedPage = new CmsDetailPageInfo( structureId, rootPath, page.getType(), iconClasses); result.add(page.isInherited() ? correctedPage.copyAsInherited() : correctedPage); // depends on control dependency: [try], data = [none] } catch (CmsException e) { LOG.warn(e.getLocalizedMessage(), e); } // depends on control dependency: [catch], data = [none] } return result; } }
public class class_name { private double checkThreshold(int value) { double threshold = (double) value; try { if (threshold < 0 || threshold > 100) { throw new NumberFormatException(); } LOG.info("Using a threshold of " + threshold); } catch (NumberFormatException e) { System.err.println("Expect a double parameter in the range of [0, 100]: " + value); throw e; } return threshold; } }
public class class_name { private double checkThreshold(int value) { double threshold = (double) value; try { if (threshold < 0 || threshold > 100) { throw new NumberFormatException(); } LOG.info("Using a threshold of " + threshold); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { System.err.println("Expect a double parameter in the range of [0, 100]: " + value); throw e; } // depends on control dependency: [catch], data = [none] return threshold; } }
public class class_name { public void generate(Execution execution) { createEmptyDocument(); Element element = dom.createElement(DOCUMENT); root.appendChild(element); if (execution.getSections() != null) { Element sections = dom.createElement( SECTIONS ); root.appendChild(sections); StringTokenizer st = new StringTokenizer(execution.getSections(), ",", false); while (st.hasMoreTokens()) { addTextValue( sections, SECTION, st.nextToken(), true); } } Element stats = dom.createElement(STATISTICS); element.appendChild(stats); addTextValue(element, RESULTS, execution.getResults(), true); addIntValue(stats, SUCCESS, execution.getSuccess()); addIntValue(stats, FAILURE, execution.getFailures()); addIntValue(stats, ERROR, execution.getErrors()); addIntValue(stats, IGNORED, execution.getIgnored()); } }
public class class_name { public void generate(Execution execution) { createEmptyDocument(); Element element = dom.createElement(DOCUMENT); root.appendChild(element); if (execution.getSections() != null) { Element sections = dom.createElement( SECTIONS ); root.appendChild(sections); // depends on control dependency: [if], data = [none] StringTokenizer st = new StringTokenizer(execution.getSections(), ",", false); while (st.hasMoreTokens()) { addTextValue( sections, SECTION, st.nextToken(), true); // depends on control dependency: [while], data = [none] } } Element stats = dom.createElement(STATISTICS); element.appendChild(stats); addTextValue(element, RESULTS, execution.getResults(), true); addIntValue(stats, SUCCESS, execution.getSuccess()); addIntValue(stats, FAILURE, execution.getFailures()); addIntValue(stats, ERROR, execution.getErrors()); addIntValue(stats, IGNORED, execution.getIgnored()); } }
public class class_name { List<JCExpression> typeArguments(boolean diamondAllowed) { if (token.kind == LT) { nextToken(); if (token.kind == GT && diamondAllowed) { checkDiamond(); mode |= DIAMOND; nextToken(); return List.nil(); } else { ListBuffer<JCExpression> args = new ListBuffer<>(); args.append(((mode & EXPR) == 0) ? typeArgument() : parseType()); while (token.kind == COMMA) { nextToken(); args.append(((mode & EXPR) == 0) ? typeArgument() : parseType()); } switch (token.kind) { case GTGTGTEQ: case GTGTEQ: case GTEQ: case GTGTGT: case GTGT: token = S.split(); break; case GT: nextToken(); break; default: args.append(syntaxError(token.pos, "expected", GT)); break; } return args.toList(); } } else { return List.<JCExpression>of(syntaxError(token.pos, "expected", LT)); } } }
public class class_name { List<JCExpression> typeArguments(boolean diamondAllowed) { if (token.kind == LT) { nextToken(); // depends on control dependency: [if], data = [none] if (token.kind == GT && diamondAllowed) { checkDiamond(); // depends on control dependency: [if], data = [none] mode |= DIAMOND; // depends on control dependency: [if], data = [none] nextToken(); // depends on control dependency: [if], data = [none] return List.nil(); // depends on control dependency: [if], data = [none] } else { ListBuffer<JCExpression> args = new ListBuffer<>(); args.append(((mode & EXPR) == 0) ? typeArgument() : parseType()); // depends on control dependency: [if], data = [none] while (token.kind == COMMA) { nextToken(); // depends on control dependency: [while], data = [none] args.append(((mode & EXPR) == 0) ? typeArgument() : parseType()); // depends on control dependency: [while], data = [none] } switch (token.kind) { case GTGTGTEQ: case GTGTEQ: case GTEQ: case GTGTGT: case GTGT: token = S.split(); break; case GT: nextToken(); break; default: args.append(syntaxError(token.pos, "expected", GT)); break; } return args.toList(); // depends on control dependency: [if], data = [none] } } else { return List.<JCExpression>of(syntaxError(token.pos, "expected", LT)); // depends on control dependency: [if], data = [LT)] } } }
public class class_name { @Override public boolean hasLink(String name1, String name2, String... domain) { if (domain.length == 1) { name1 = domain[0] + "::" + name1; name2 = domain[0] + "::" + name2; } else if (domain.length > 1) { throw new Error("error: domain should be 1 parameter"); } if (name1.equals(name2)) { return true; } if (!hasRole(name1) || !hasRole(name2)) { return false; } Role role1 = createRole(name1); return role1.hasRole(name2, maxHierarchyLevel); } }
public class class_name { @Override public boolean hasLink(String name1, String name2, String... domain) { if (domain.length == 1) { name1 = domain[0] + "::" + name1; // depends on control dependency: [if], data = [none] name2 = domain[0] + "::" + name2; // depends on control dependency: [if], data = [none] } else if (domain.length > 1) { throw new Error("error: domain should be 1 parameter"); } if (name1.equals(name2)) { return true; // depends on control dependency: [if], data = [none] } if (!hasRole(name1) || !hasRole(name2)) { return false; // depends on control dependency: [if], data = [none] } Role role1 = createRole(name1); return role1.hasRole(name2, maxHierarchyLevel); } }
public class class_name { public static byte[] stringToId(final String branch_id) { if (branch_id == null || branch_id.isEmpty()) { throw new IllegalArgumentException("Branch ID was empty"); } if (branch_id.length() < 4) { throw new IllegalArgumentException("Branch ID was too short"); } String id = branch_id; if (id.length() % 2 != 0) { id = "0" + id; } return DatatypeConverter.parseHexBinary(id); } }
public class class_name { public static byte[] stringToId(final String branch_id) { if (branch_id == null || branch_id.isEmpty()) { throw new IllegalArgumentException("Branch ID was empty"); } if (branch_id.length() < 4) { throw new IllegalArgumentException("Branch ID was too short"); } String id = branch_id; if (id.length() % 2 != 0) { id = "0" + id; // depends on control dependency: [if], data = [none] } return DatatypeConverter.parseHexBinary(id); } }
public class class_name { private static StringBuilder toBase64(long value) { StringBuilder result = new StringBuilder(23); // Initialize with the size of ID if using Base64 for(int shift=60; shift>=0; shift-=6) { result.append(Base64[(int)((value >> shift) & 0x3F)]); } return result; } }
public class class_name { private static StringBuilder toBase64(long value) { StringBuilder result = new StringBuilder(23); // Initialize with the size of ID if using Base64 for(int shift=60; shift>=0; shift-=6) { result.append(Base64[(int)((value >> shift) & 0x3F)]); // depends on control dependency: [for], data = [shift] } return result; } }
public class class_name { public DeviceData command_inout_reply(final DeviceProxy deviceProxy, final AsyncCallObject aco, final int timeout) throws DevFailed { DeviceData argout = null; final int ms_to_sleep = 10; DevFailed except = null; final long t0 = System.currentTimeMillis(); long t1 = t0; while ((t1 - t0 < timeout || timeout == 0) && argout == null) { try { argout = command_inout_reply(deviceProxy, aco); } catch (final AsynReplyNotArrived na) { except = na; // Wait a bit before retry try { Thread.sleep(ms_to_sleep); } catch (final InterruptedException e) { /* */ } t1 = System.currentTimeMillis(); } } // If reply not arrived throw last exception if (argout == null) { ApiUtil.remove_async_request(aco.id); throw except; } return argout; } }
public class class_name { public DeviceData command_inout_reply(final DeviceProxy deviceProxy, final AsyncCallObject aco, final int timeout) throws DevFailed { DeviceData argout = null; final int ms_to_sleep = 10; DevFailed except = null; final long t0 = System.currentTimeMillis(); long t1 = t0; while ((t1 - t0 < timeout || timeout == 0) && argout == null) { try { argout = command_inout_reply(deviceProxy, aco); // depends on control dependency: [try], data = [none] } catch (final AsynReplyNotArrived na) { except = na; // Wait a bit before retry try { Thread.sleep(ms_to_sleep); } catch (final InterruptedException e) { /* */ } // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none] t1 = System.currentTimeMillis(); } // depends on control dependency: [catch], data = [none] } // If reply not arrived throw last exception if (argout == null) { ApiUtil.remove_async_request(aco.id); throw except; } return argout; } }
public class class_name { public void setPurchase(java.util.Collection<Purchase> purchase) { if (purchase == null) { this.purchase = null; return; } this.purchase = new com.amazonaws.internal.SdkInternalList<Purchase>(purchase); } }
public class class_name { public void setPurchase(java.util.Collection<Purchase> purchase) { if (purchase == null) { this.purchase = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.purchase = new com.amazonaws.internal.SdkInternalList<Purchase>(purchase); } }
public class class_name { @Override public IPortletUrlBuilder getPortletUrlBuilder(IPortletWindowId portletWindowId) { IPortletUrlBuilder portletUrlBuilder; synchronized (this.portletUrlBuilders) { portletUrlBuilder = this.portletUrlBuilders.get(portletWindowId); if (portletUrlBuilder == null) { portletUrlBuilder = new FailSafePortletUrlBuilder(portletWindowId, this); this.portletUrlBuilders.put(portletWindowId, portletUrlBuilder); } } return portletUrlBuilder; } }
public class class_name { @Override public IPortletUrlBuilder getPortletUrlBuilder(IPortletWindowId portletWindowId) { IPortletUrlBuilder portletUrlBuilder; synchronized (this.portletUrlBuilders) { portletUrlBuilder = this.portletUrlBuilders.get(portletWindowId); if (portletUrlBuilder == null) { portletUrlBuilder = new FailSafePortletUrlBuilder(portletWindowId, this); // depends on control dependency: [if], data = [none] this.portletUrlBuilders.put(portletWindowId, portletUrlBuilder); // depends on control dependency: [if], data = [none] } } return portletUrlBuilder; } }
public class class_name { public static <K, V> void initOrAddList(Map<K, List<V>> orginMap, K key, V needAdd) { List<V> listeners = orginMap.get(key); if (listeners == null) { listeners = new CopyOnWriteArrayList<V>(); listeners.add(needAdd); orginMap.put(key, listeners); } else { listeners.add(needAdd); } } }
public class class_name { public static <K, V> void initOrAddList(Map<K, List<V>> orginMap, K key, V needAdd) { List<V> listeners = orginMap.get(key); if (listeners == null) { listeners = new CopyOnWriteArrayList<V>(); // depends on control dependency: [if], data = [none] listeners.add(needAdd); // depends on control dependency: [if], data = [none] orginMap.put(key, listeners); // depends on control dependency: [if], data = [none] } else { listeners.add(needAdd); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void createRoleSummary(final VerticalLayout roleSummaryLayoutTabsheet, final List<AssignmentData> assignmentList, final ViewRiksdagenPolitician viewRiksdagenPolitician) { final VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.addComponent(new Label(TOTAL_ASSIGNMENTS + assignmentList.size())); if (viewRiksdagenPolitician != null) { layout.addComponent(new Label(GOVERNMENT_EXPERIENCE + convertToYearsString(viewRiksdagenPolitician.getTotalDaysServedGovernment()))); layout.addComponent(new Label( SPEAKER_EXPERIENCE + convertToYearsString(viewRiksdagenPolitician.getTotalDaysServedSpeaker()))); layout.addComponent(new Label(COMMITTEE_EXPERIENCE + convertToYearsString(viewRiksdagenPolitician.getTotalDaysServedCommittee()))); layout.addComponent( new Label(EU_EXPERIENCE + convertToYearsString(viewRiksdagenPolitician.getTotalDaysServedEu()))); layout.addComponent(new Label(PARLIAMENT_EXPERIENCE + convertToYearsString(viewRiksdagenPolitician.getTotalDaysServedParliament()))); layout.addComponent(new Label( PARTY_EXPERIENCE + convertToYearsString(viewRiksdagenPolitician.getTotalDaysServedParty()))); } roleSummaryLayoutTabsheet.addComponent(layout); roleSummaryLayoutTabsheet.setExpandRatio(layout, ContentRatio.GRID); } }
public class class_name { private void createRoleSummary(final VerticalLayout roleSummaryLayoutTabsheet, final List<AssignmentData> assignmentList, final ViewRiksdagenPolitician viewRiksdagenPolitician) { final VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.addComponent(new Label(TOTAL_ASSIGNMENTS + assignmentList.size())); if (viewRiksdagenPolitician != null) { layout.addComponent(new Label(GOVERNMENT_EXPERIENCE + convertToYearsString(viewRiksdagenPolitician.getTotalDaysServedGovernment()))); // depends on control dependency: [if], data = [none] layout.addComponent(new Label( SPEAKER_EXPERIENCE + convertToYearsString(viewRiksdagenPolitician.getTotalDaysServedSpeaker()))); // depends on control dependency: [if], data = [none] layout.addComponent(new Label(COMMITTEE_EXPERIENCE + convertToYearsString(viewRiksdagenPolitician.getTotalDaysServedCommittee()))); // depends on control dependency: [if], data = [none] layout.addComponent( new Label(EU_EXPERIENCE + convertToYearsString(viewRiksdagenPolitician.getTotalDaysServedEu()))); // depends on control dependency: [if], data = [none] layout.addComponent(new Label(PARLIAMENT_EXPERIENCE + convertToYearsString(viewRiksdagenPolitician.getTotalDaysServedParliament()))); // depends on control dependency: [if], data = [none] layout.addComponent(new Label( PARTY_EXPERIENCE + convertToYearsString(viewRiksdagenPolitician.getTotalDaysServedParty()))); // depends on control dependency: [if], data = [none] } roleSummaryLayoutTabsheet.addComponent(layout); roleSummaryLayoutTabsheet.setExpandRatio(layout, ContentRatio.GRID); } }
public class class_name { protected Map<String, String> getElementAttributes() { // Preserve order of attributes Map<String, String> attrs = new HashMap<>(); if (this.getTo() != null) { attrs.put("to", this.getTo()); } if (this.getFrom() != null) { attrs.put("from", this.getFrom()); } if (this.getAction() != null) { attrs.put("action", this.getAction().toString()); } if (this.getMethod() != null) { attrs.put("method", this.getMethod().toString()); } if (this.getStatusCallback() != null) { attrs.put("statusCallback", this.getStatusCallback().toString()); } return attrs; } }
public class class_name { protected Map<String, String> getElementAttributes() { // Preserve order of attributes Map<String, String> attrs = new HashMap<>(); if (this.getTo() != null) { attrs.put("to", this.getTo()); // depends on control dependency: [if], data = [none] } if (this.getFrom() != null) { attrs.put("from", this.getFrom()); // depends on control dependency: [if], data = [none] } if (this.getAction() != null) { attrs.put("action", this.getAction().toString()); // depends on control dependency: [if], data = [none] } if (this.getMethod() != null) { attrs.put("method", this.getMethod().toString()); // depends on control dependency: [if], data = [none] } if (this.getStatusCallback() != null) { attrs.put("statusCallback", this.getStatusCallback().toString()); // depends on control dependency: [if], data = [none] } return attrs; } }
public class class_name { public java.util.List<BulkEmailDestinationStatus> getStatus() { if (status == null) { status = new com.amazonaws.internal.SdkInternalList<BulkEmailDestinationStatus>(); } return status; } }
public class class_name { public java.util.List<BulkEmailDestinationStatus> getStatus() { if (status == null) { status = new com.amazonaws.internal.SdkInternalList<BulkEmailDestinationStatus>(); // depends on control dependency: [if], data = [none] } return status; } }
public class class_name { @Override public CPInstance remove(Serializable primaryKey) throws NoSuchCPInstanceException { Session session = null; try { session = openSession(); CPInstance cpInstance = (CPInstance)session.get(CPInstanceImpl.class, primaryKey); if (cpInstance == null) { if (_log.isDebugEnabled()) { _log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } throw new NoSuchCPInstanceException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } return remove(cpInstance); } catch (NoSuchCPInstanceException nsee) { throw nsee; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } }
public class class_name { @Override public CPInstance remove(Serializable primaryKey) throws NoSuchCPInstanceException { Session session = null; try { session = openSession(); CPInstance cpInstance = (CPInstance)session.get(CPInstanceImpl.class, primaryKey); if (cpInstance == null) { if (_log.isDebugEnabled()) { _log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); // depends on control dependency: [if], data = [none] } throw new NoSuchCPInstanceException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } return remove(cpInstance); } catch (NoSuchCPInstanceException nsee) { throw nsee; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } }
public class class_name { public static Object invokeMethod(final Object obj, final String methodName, final Object[] params, final Class[] paramTypes) { Object res = null; try { Class cls = obj.getClass(); Method method = cls.getMethod(methodName, paramTypes); res = method.invoke(obj, params); } catch (SecurityException e) { throw new SystemException(e); } catch (NoSuchMethodException e) { throw new SystemException(e); } catch (IllegalAccessException e) { throw new SystemException(e); } catch (InvocationTargetException e) { throw new SystemException(e); } return res; } }
public class class_name { public static Object invokeMethod(final Object obj, final String methodName, final Object[] params, final Class[] paramTypes) { Object res = null; try { Class cls = obj.getClass(); Method method = cls.getMethod(methodName, paramTypes); res = method.invoke(obj, params); } catch (SecurityException e) { throw new SystemException(e); } catch (NoSuchMethodException e) { // depends on control dependency: [catch], data = [none] throw new SystemException(e); } catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none] throw new SystemException(e); } catch (InvocationTargetException e) { // depends on control dependency: [catch], data = [none] throw new SystemException(e); } // depends on control dependency: [catch], data = [none] return res; } }
public class class_name { public ProgressStyle setMax(int value){ if(mProgressStyle == HORIZONTAL) { if (mProgress.isIndeterminate()) mProgress.setIndeterminate(false); mProgress.setMax(value); if (!mIsPercentageMode) mProgressMax.setText(String.format("%d %s", value, mSuffix)); } return this; } }
public class class_name { public ProgressStyle setMax(int value){ if(mProgressStyle == HORIZONTAL) { if (mProgress.isIndeterminate()) mProgress.setIndeterminate(false); mProgress.setMax(value); // depends on control dependency: [if], data = [none] if (!mIsPercentageMode) mProgressMax.setText(String.format("%d %s", value, mSuffix)); } return this; } }
public class class_name { private void runJob(Job jobToRun) { long startExecutionTime = timeProvider.currentTime(); long timeBeforeNextExecution = jobToRun.nextExecutionTimeInMillis() - startExecutionTime; if(timeBeforeNextExecution < 0) { logger.debug("Job '{}' execution is {}ms late", jobToRun.name(), -timeBeforeNextExecution); } jobToRun.status(JobStatus.RUNNING); jobToRun.lastExecutionStartedTimeInMillis(startExecutionTime); jobToRun.threadRunningJob(Thread.currentThread()); try { jobToRun.runnable().run(); } catch(Throwable t) { logger.error("Error during job '{}' execution", jobToRun.name(), t); } jobToRun.executionsCount(jobToRun.executionsCount() + 1); jobToRun.lastExecutionEndedTimeInMillis(timeProvider.currentTime()); jobToRun.threadRunningJob(null); if(logger.isDebugEnabled()) { logger.debug( "Job '{}' executed in {}ms", jobToRun.name(), timeProvider.currentTime() - startExecutionTime ); } if(shuttingDown) { return; } synchronized (this) { scheduleNextExecution(jobToRun); } } }
public class class_name { private void runJob(Job jobToRun) { long startExecutionTime = timeProvider.currentTime(); long timeBeforeNextExecution = jobToRun.nextExecutionTimeInMillis() - startExecutionTime; if(timeBeforeNextExecution < 0) { logger.debug("Job '{}' execution is {}ms late", jobToRun.name(), -timeBeforeNextExecution); // depends on control dependency: [if], data = [none] } jobToRun.status(JobStatus.RUNNING); jobToRun.lastExecutionStartedTimeInMillis(startExecutionTime); jobToRun.threadRunningJob(Thread.currentThread()); try { jobToRun.runnable().run(); // depends on control dependency: [try], data = [none] } catch(Throwable t) { logger.error("Error during job '{}' execution", jobToRun.name(), t); } // depends on control dependency: [catch], data = [none] jobToRun.executionsCount(jobToRun.executionsCount() + 1); jobToRun.lastExecutionEndedTimeInMillis(timeProvider.currentTime()); jobToRun.threadRunningJob(null); if(logger.isDebugEnabled()) { logger.debug( "Job '{}' executed in {}ms", jobToRun.name(), timeProvider.currentTime() - startExecutionTime ); // depends on control dependency: [if], data = [none] } if(shuttingDown) { return; // depends on control dependency: [if], data = [none] } synchronized (this) { scheduleNextExecution(jobToRun); } } }
public class class_name { @Override public EClass getRevision() { if (revisionEClass == null) { revisionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(5); } return revisionEClass; } }
public class class_name { @Override public EClass getRevision() { if (revisionEClass == null) { revisionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(5); // depends on control dependency: [if], data = [none] } return revisionEClass; } }
public class class_name { protected SecurityToken getSecurityTokenFromRequest(final HttpServletRequest request) { val cookieValue = wsFederationRequestConfigurationContext.getTicketGrantingTicketCookieGenerator().retrieveCookieValue(request); if (StringUtils.isNotBlank(cookieValue)) { val tgt = wsFederationRequestConfigurationContext.getTicketRegistry().getTicket(cookieValue, TicketGrantingTicket.class); if (tgt != null) { val sts = tgt.getDescendantTickets().stream() .filter(t -> t.startsWith(SecurityTokenTicket.PREFIX)) .findFirst() .orElse(null); if (StringUtils.isNotBlank(sts)) { val stt = wsFederationRequestConfigurationContext.getTicketRegistry().getTicket(sts, SecurityTokenTicket.class); if (stt == null || stt.isExpired()) { LOGGER.warn("Security token ticket [{}] is not found or has expired", sts); return null; } if (stt.getSecurityToken().isExpired()) { LOGGER.warn("Security token linked to ticket [{}] has expired", sts); return null; } return stt.getSecurityToken(); } } } return null; } }
public class class_name { protected SecurityToken getSecurityTokenFromRequest(final HttpServletRequest request) { val cookieValue = wsFederationRequestConfigurationContext.getTicketGrantingTicketCookieGenerator().retrieveCookieValue(request); if (StringUtils.isNotBlank(cookieValue)) { val tgt = wsFederationRequestConfigurationContext.getTicketRegistry().getTicket(cookieValue, TicketGrantingTicket.class); if (tgt != null) { val sts = tgt.getDescendantTickets().stream() .filter(t -> t.startsWith(SecurityTokenTicket.PREFIX)) .findFirst() .orElse(null); if (StringUtils.isNotBlank(sts)) { val stt = wsFederationRequestConfigurationContext.getTicketRegistry().getTicket(sts, SecurityTokenTicket.class); if (stt == null || stt.isExpired()) { LOGGER.warn("Security token ticket [{}] is not found or has expired", sts); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } if (stt.getSecurityToken().isExpired()) { LOGGER.warn("Security token linked to ticket [{}] has expired", sts); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } return stt.getSecurityToken(); // depends on control dependency: [if], data = [none] } } } return null; } }
public class class_name { public static Analyzer getAnalyzer() throws EFapsException { IAnalyzerProvider provider = null; if (EFapsSystemConfiguration.get().containsAttributeValue(KernelSettings.INDEXANALYZERPROVCLASS)) { final String clazzname = EFapsSystemConfiguration.get().getAttributeValue( KernelSettings.INDEXANALYZERPROVCLASS); try { final Class<?> clazz = Class.forName(clazzname, false, EFapsClassLoader.getInstance()); provider = (IAnalyzerProvider) clazz.newInstance(); } catch (final ClassNotFoundException | InstantiationException | IllegalAccessException e) { throw new EFapsException(Index.class, "Could not instanciate IAnalyzerProvider", e); } } else { provider = new IAnalyzerProvider() { @Override public Analyzer getAnalyzer() { return new StandardAnalyzer(SpanishAnalyzer.getDefaultStopSet()); } }; } return provider.getAnalyzer(); } }
public class class_name { public static Analyzer getAnalyzer() throws EFapsException { IAnalyzerProvider provider = null; if (EFapsSystemConfiguration.get().containsAttributeValue(KernelSettings.INDEXANALYZERPROVCLASS)) { final String clazzname = EFapsSystemConfiguration.get().getAttributeValue( KernelSettings.INDEXANALYZERPROVCLASS); try { final Class<?> clazz = Class.forName(clazzname, false, EFapsClassLoader.getInstance()); provider = (IAnalyzerProvider) clazz.newInstance(); } catch (final ClassNotFoundException | InstantiationException | IllegalAccessException e) { throw new EFapsException(Index.class, "Could not instanciate IAnalyzerProvider", e); } // depends on control dependency: [catch], data = [none] } else { provider = new IAnalyzerProvider() { @Override public Analyzer getAnalyzer() { return new StandardAnalyzer(SpanishAnalyzer.getDefaultStopSet()); } }; } return provider.getAnalyzer(); } }
public class class_name { private int getLayoutId(final IPerson person, final IUserProfile profile) { final Hashtable<Integer, UserProfile> profiles = getUserProfileList(person); int layoutId = profile.getLayoutId(); Set<Integer> layoutIds = getAllNonZeroLayoutIdsFromProfiles(profiles.values()); if (!layoutIds.isEmpty()) { layoutId = layoutIds.iterator().next(); } if (layoutIds.size() > 1) { // log that only one non-zero layout id assumption has been broken logger.error(UNSUPPORTED_MULTIPLE_LAYOUTS_FOUND, person.getID()); } return layoutId; } }
public class class_name { private int getLayoutId(final IPerson person, final IUserProfile profile) { final Hashtable<Integer, UserProfile> profiles = getUserProfileList(person); int layoutId = profile.getLayoutId(); Set<Integer> layoutIds = getAllNonZeroLayoutIdsFromProfiles(profiles.values()); if (!layoutIds.isEmpty()) { layoutId = layoutIds.iterator().next(); // depends on control dependency: [if], data = [none] } if (layoutIds.size() > 1) { // log that only one non-zero layout id assumption has been broken logger.error(UNSUPPORTED_MULTIPLE_LAYOUTS_FOUND, person.getID()); // depends on control dependency: [if], data = [none] } return layoutId; } }
public class class_name { public final Collection<State> acceptStates() { if(acceptStates == null) { final Collection<State> states = this.states(); acceptStates = DSUtil.filterColl(_acceptStates(), new Predicate<State>() { public boolean check(State state) { return states.contains(state); } }, new LinkedHashSet<State>()); } return acceptStates; } }
public class class_name { public final Collection<State> acceptStates() { if(acceptStates == null) { final Collection<State> states = this.states(); acceptStates = DSUtil.filterColl(_acceptStates(), new Predicate<State>() { public boolean check(State state) { return states.contains(state); } }, new LinkedHashSet<State>()); // depends on control dependency: [if], data = [none] } return acceptStates; } }
public class class_name { private void updateHighlighting(boolean initial) { Map<I_CmsDropContainer, CmsPositionBean> containers = new HashMap<I_CmsDropContainer, CmsPositionBean>(); for (I_CmsDropTarget target : m_dragInfos.keySet()) { if ((target instanceof I_CmsDropContainer) && !Display.NONE.getCssName().equalsIgnoreCase( CmsDomUtil.getCurrentStyle(target.getElement(), CmsDomUtil.Style.display))) { if (initial && (target != m_initialDropTarget)) { ((I_CmsDropContainer)target).highlightContainer(); } else { ((I_CmsDropContainer)target).updatePositionInfo(); } containers.put((I_CmsDropContainer)target, ((I_CmsDropContainer)target).getPositionInfo()); } } List<I_CmsDropContainer> containersToMatch = new ArrayList<I_CmsDropContainer>(containers.keySet()); for (I_CmsDropContainer contA : containers.keySet()) { containersToMatch.remove(contA); for (I_CmsDropContainer contB : containersToMatch) { CmsPositionBean posA = containers.get(contA); CmsPositionBean posB = containers.get(contB); if (CmsPositionBean.checkCollision(posA, posB, HIGHLIGHTING_OFFSET * 3)) { if (contA.hasDnDChildren() && contA.getDnDChildren().contains(contB)) { if (!posA.isInside(posB, HIGHLIGHTING_OFFSET)) { // the nested container is not completely inside the other // increase the size of the outer container posA.ensureSurrounds(posB, HIGHLIGHTING_OFFSET); } } else if (contB.hasDnDChildren() && contB.getDnDChildren().contains(contA)) { if (!posB.isInside(posA, HIGHLIGHTING_OFFSET)) { // the nested container is not completely inside the other // increase the size of the outer container posB.ensureSurrounds(posA, HIGHLIGHTING_OFFSET); } } else { CmsPositionBean.avoidCollision(posA, posB, HIGHLIGHTING_OFFSET * 3); } } } } for (Entry<I_CmsDropContainer, CmsPositionBean> containerEntry : containers.entrySet()) { containerEntry.getKey().refreshHighlighting(containerEntry.getValue()); } } }
public class class_name { private void updateHighlighting(boolean initial) { Map<I_CmsDropContainer, CmsPositionBean> containers = new HashMap<I_CmsDropContainer, CmsPositionBean>(); for (I_CmsDropTarget target : m_dragInfos.keySet()) { if ((target instanceof I_CmsDropContainer) && !Display.NONE.getCssName().equalsIgnoreCase( CmsDomUtil.getCurrentStyle(target.getElement(), CmsDomUtil.Style.display))) { if (initial && (target != m_initialDropTarget)) { ((I_CmsDropContainer)target).highlightContainer(); // depends on control dependency: [if], data = [none] } else { ((I_CmsDropContainer)target).updatePositionInfo(); // depends on control dependency: [if], data = [none] } containers.put((I_CmsDropContainer)target, ((I_CmsDropContainer)target).getPositionInfo()); // depends on control dependency: [if], data = [none] } } List<I_CmsDropContainer> containersToMatch = new ArrayList<I_CmsDropContainer>(containers.keySet()); for (I_CmsDropContainer contA : containers.keySet()) { containersToMatch.remove(contA); // depends on control dependency: [for], data = [contA] for (I_CmsDropContainer contB : containersToMatch) { CmsPositionBean posA = containers.get(contA); CmsPositionBean posB = containers.get(contB); if (CmsPositionBean.checkCollision(posA, posB, HIGHLIGHTING_OFFSET * 3)) { if (contA.hasDnDChildren() && contA.getDnDChildren().contains(contB)) { if (!posA.isInside(posB, HIGHLIGHTING_OFFSET)) { // the nested container is not completely inside the other // increase the size of the outer container posA.ensureSurrounds(posB, HIGHLIGHTING_OFFSET); // depends on control dependency: [if], data = [none] } } else if (contB.hasDnDChildren() && contB.getDnDChildren().contains(contA)) { if (!posB.isInside(posA, HIGHLIGHTING_OFFSET)) { // the nested container is not completely inside the other // increase the size of the outer container posB.ensureSurrounds(posA, HIGHLIGHTING_OFFSET); // depends on control dependency: [if], data = [none] } } else { CmsPositionBean.avoidCollision(posA, posB, HIGHLIGHTING_OFFSET * 3); // depends on control dependency: [if], data = [none] } } } } for (Entry<I_CmsDropContainer, CmsPositionBean> containerEntry : containers.entrySet()) { containerEntry.getKey().refreshHighlighting(containerEntry.getValue()); // depends on control dependency: [for], data = [containerEntry] } } }
public class class_name { protected static void addClass2Component(UIComponent c, String aclass) { Map<String, Object> a = c.getAttributes(); if (a.containsKey("styleClass")) { a.put("styleClass", a.get("styleClass") + " " + aclass); } else { a.put("styleClass", aclass); } } }
public class class_name { protected static void addClass2Component(UIComponent c, String aclass) { Map<String, Object> a = c.getAttributes(); if (a.containsKey("styleClass")) { a.put("styleClass", a.get("styleClass") + " " + aclass); // depends on control dependency: [if], data = [none] } else { a.put("styleClass", aclass); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setVal(int offset, Constant val, long txNum, LogSeqNum lsn) { internalLock.writeLock().lock(); try { modifiedBy.add(txNum); if (lsn != null && lsn.compareTo(lastLsn) > 0) lastLsn = lsn; // Put the last LSN in front of the data lastLsn.writeToPage(contents, LAST_LSN_OFFSET); contents.setVal(DATA_START_OFFSET + offset, val); } finally { internalLock.writeLock().unlock(); } } }
public class class_name { public void setVal(int offset, Constant val, long txNum, LogSeqNum lsn) { internalLock.writeLock().lock(); try { modifiedBy.add(txNum); // depends on control dependency: [try], data = [none] if (lsn != null && lsn.compareTo(lastLsn) > 0) lastLsn = lsn; // Put the last LSN in front of the data lastLsn.writeToPage(contents, LAST_LSN_OFFSET); // depends on control dependency: [try], data = [none] contents.setVal(DATA_START_OFFSET + offset, val); // depends on control dependency: [try], data = [none] } finally { internalLock.writeLock().unlock(); } } }
public class class_name { public boolean addChild(final Tag child, final Integer position) { if (getChildren() == null) { this.childTagPositions = ListFactory.newArrayList(); } final ChildTagPosition childTagPosition = ChildTagPosition.builder().child(child) .position(position).build(); return getChildren().add(childTagPosition); } }
public class class_name { public boolean addChild(final Tag child, final Integer position) { if (getChildren() == null) { this.childTagPositions = ListFactory.newArrayList(); // depends on control dependency: [if], data = [none] } final ChildTagPosition childTagPosition = ChildTagPosition.builder().child(child) .position(position).build(); return getChildren().add(childTagPosition); } }
public class class_name { public synchronized void recordBreadcrumb(Breadcrumb breadcrumb) { if (breadcrumbs == null) { breadcrumbs = new CircularFifoQueue<>(breadcrumbLimit); } breadcrumbs.add(breadcrumb); } }
public class class_name { public synchronized void recordBreadcrumb(Breadcrumb breadcrumb) { if (breadcrumbs == null) { breadcrumbs = new CircularFifoQueue<>(breadcrumbLimit); // depends on control dependency: [if], data = [none] } breadcrumbs.add(breadcrumb); } }
public class class_name { @SuppressWarnings({"ChainOfInstanceofChecks", "MagicNumber"}) @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) private void fixAllCellInfo(List<CellInfo> cellInfo) { if (cellInfo == null) return; String networkOperator = telephonyManager.getNetworkOperator(); if (networkOperator.length() != 5) return; int realMnc = Integer.parseInt(networkOperator.substring(3)); boolean theBug = false; for (CellInfo info : cellInfo) { if (info instanceof CellInfoCdma) return; if (info.isRegistered()) { Cell cell = parseCellInfo(info); if (cell == null) continue; int infoMnc = cell.getMnc(); if (infoMnc == (realMnc * 10 + 15)) { theBug = true; } } } if (theBug) { for (CellInfo info : cellInfo) { Object identity = null; if (info instanceof CellInfoGsm) identity = ((CellInfoGsm) info).getCellIdentity(); else if (info instanceof CellInfoLte) identity = ((CellInfoLte) info).getCellIdentity(); else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && info instanceof CellInfoWcdma) identity = ((CellInfoWcdma) info).getCellIdentity(); if (identity == null) continue; try { Field mncField = identity.getClass().getDeclaredField("mMnc"); mncField.setAccessible(true); int mnc = (Integer) mncField.get(identity); if (mnc >= 25 && mnc <= 1005) { mnc = (mnc - 15) / 10; mncField.setInt(identity, mnc); } } catch (Exception ignored) { } } } } }
public class class_name { @SuppressWarnings({"ChainOfInstanceofChecks", "MagicNumber"}) @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) private void fixAllCellInfo(List<CellInfo> cellInfo) { if (cellInfo == null) return; String networkOperator = telephonyManager.getNetworkOperator(); if (networkOperator.length() != 5) return; int realMnc = Integer.parseInt(networkOperator.substring(3)); boolean theBug = false; for (CellInfo info : cellInfo) { if (info instanceof CellInfoCdma) return; if (info.isRegistered()) { Cell cell = parseCellInfo(info); if (cell == null) continue; int infoMnc = cell.getMnc(); if (infoMnc == (realMnc * 10 + 15)) { theBug = true; // depends on control dependency: [if], data = [none] } } } if (theBug) { for (CellInfo info : cellInfo) { Object identity = null; if (info instanceof CellInfoGsm) identity = ((CellInfoGsm) info).getCellIdentity(); else if (info instanceof CellInfoLte) identity = ((CellInfoLte) info).getCellIdentity(); else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && info instanceof CellInfoWcdma) identity = ((CellInfoWcdma) info).getCellIdentity(); if (identity == null) continue; try { Field mncField = identity.getClass().getDeclaredField("mMnc"); mncField.setAccessible(true); // depends on control dependency: [try], data = [none] int mnc = (Integer) mncField.get(identity); if (mnc >= 25 && mnc <= 1005) { mnc = (mnc - 15) / 10; // depends on control dependency: [if], data = [(mnc] mncField.setInt(identity, mnc); // depends on control dependency: [if], data = [none] } } catch (Exception ignored) { } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { @Override protected void doHandle(CommandContext ctx) throws CommandLineException { final BatchManager batchManager = ctx.getBatchManager(); final boolean list = l.isPresent(ctx.getParsedCommandLine()); final String path = file.getValue(ctx.getParsedCommandLine()); final String name = this.name.getValue(ctx.getParsedCommandLine()); if(list) { if(path != null || name != null) { throw new CommandFormatException("-l is exclusive, neither --file nor name can appear with -l."); } final Set<String> heldbackNames = batchManager.getHeldbackNames(); if(!heldbackNames.isEmpty()) { List<String> names = new ArrayList<String>(heldbackNames.size()); for (String heldbackName : heldbackNames) { names.add(heldbackName == null ? "<unnamed>" : heldbackName); } Collections.sort(names); for (String heldbackName : names) { ctx.printLine(heldbackName); } } return; } if(batchManager.isBatchActive()) { throw new CommandLineException("Can't start a new batch while in batch mode."); } if(path != null) { if(name != null) { throw new CommandFormatException("Either --file or name argument can be specified at a time."); } final File f = new File(path); if(!f.exists()) { throw new CommandLineException("File " + f.getAbsolutePath() + " does not exist."); } final File currentDir = ctx.getCurrentDir(); final File baseDir = f.getParentFile(); if(baseDir != null) { ctx.setCurrentDir(baseDir); } try (BufferedReader reader = new BufferedReader(new FileReader(f))) { String line = reader.readLine(); batchManager.activateNewBatch(); final Batch batch = batchManager.getActiveBatch(); while (line != null) { line = line.trim(); if (!line.isEmpty() && line.charAt(0) != '#') { batch.add(ctx.toBatchedCommand(line)); } line = reader.readLine(); } } catch(IOException e) { batchManager.discardActiveBatch(); throw new CommandLineException("Failed to read file " + f.getAbsolutePath(), e); } catch(CommandFormatException e) { batchManager.discardActiveBatch(); throw new CommandLineException("Failed to create batch from " + f.getAbsolutePath(), e); } finally { if (baseDir != null) { ctx.setCurrentDir(currentDir); } } return; } boolean activated; if(batchManager.isHeldback(name)) { activated = batchManager.activateHeldbackBatch(name); if (activated) { final String msg = name == null ? "Re-activated batch" : "Re-activated batch '" + name + "'"; ctx.printLine(msg); List<BatchedCommand> batch = batchManager.getActiveBatch().getCommands(); if (!batch.isEmpty()) { for (int i = 0; i < batch.size(); ++i) { BatchedCommand cmd = batch.get(i); ctx.printLine("#" + (i + 1) + ' ' + cmd.getCommand()); } } } } else if(name != null) { throw new CommandLineException("'" + name + "' not found among the held back batches."); } else { activated = batchManager.activateNewBatch(); } if(!activated) { // that's more like illegal state throw new CommandLineException("Failed to activate batch."); } } }
public class class_name { @Override protected void doHandle(CommandContext ctx) throws CommandLineException { final BatchManager batchManager = ctx.getBatchManager(); final boolean list = l.isPresent(ctx.getParsedCommandLine()); final String path = file.getValue(ctx.getParsedCommandLine()); final String name = this.name.getValue(ctx.getParsedCommandLine()); if(list) { if(path != null || name != null) { throw new CommandFormatException("-l is exclusive, neither --file nor name can appear with -l."); } final Set<String> heldbackNames = batchManager.getHeldbackNames(); if(!heldbackNames.isEmpty()) { List<String> names = new ArrayList<String>(heldbackNames.size()); for (String heldbackName : heldbackNames) { names.add(heldbackName == null ? "<unnamed>" : heldbackName); // depends on control dependency: [for], data = [heldbackName] } Collections.sort(names); // depends on control dependency: [if], data = [none] for (String heldbackName : names) { ctx.printLine(heldbackName); // depends on control dependency: [for], data = [heldbackName] } } return; } if(batchManager.isBatchActive()) { throw new CommandLineException("Can't start a new batch while in batch mode."); } if(path != null) { if(name != null) { throw new CommandFormatException("Either --file or name argument can be specified at a time."); } final File f = new File(path); if(!f.exists()) { throw new CommandLineException("File " + f.getAbsolutePath() + " does not exist."); } final File currentDir = ctx.getCurrentDir(); final File baseDir = f.getParentFile(); if(baseDir != null) { ctx.setCurrentDir(baseDir); // depends on control dependency: [if], data = [(baseDir] } try (BufferedReader reader = new BufferedReader(new FileReader(f))) { String line = reader.readLine(); batchManager.activateNewBatch(); final Batch batch = batchManager.getActiveBatch(); while (line != null) { line = line.trim(); // depends on control dependency: [while], data = [none] if (!line.isEmpty() && line.charAt(0) != '#') { batch.add(ctx.toBatchedCommand(line)); // depends on control dependency: [if], data = [none] } line = reader.readLine(); // depends on control dependency: [while], data = [none] } } catch(IOException e) { batchManager.discardActiveBatch(); throw new CommandLineException("Failed to read file " + f.getAbsolutePath(), e); } catch(CommandFormatException e) { batchManager.discardActiveBatch(); throw new CommandLineException("Failed to create batch from " + f.getAbsolutePath(), e); } finally { if (baseDir != null) { ctx.setCurrentDir(currentDir); // depends on control dependency: [if], data = [none] } } return; } boolean activated; if(batchManager.isHeldback(name)) { activated = batchManager.activateHeldbackBatch(name); if (activated) { final String msg = name == null ? "Re-activated batch" : "Re-activated batch '" + name + "'"; ctx.printLine(msg); List<BatchedCommand> batch = batchManager.getActiveBatch().getCommands(); if (!batch.isEmpty()) { for (int i = 0; i < batch.size(); ++i) { BatchedCommand cmd = batch.get(i); ctx.printLine("#" + (i + 1) + ' ' + cmd.getCommand()); } } } } else if(name != null) { throw new CommandLineException("'" + name + "' not found among the held back batches."); } else { activated = batchManager.activateNewBatch(); } if(!activated) { // that's more like illegal state throw new CommandLineException("Failed to activate batch."); } } }
public class class_name { public Iterator<Map.Entry<String, JrsValue>> fields() { if (_values.isEmpty()) { return _values.entrySet().iterator(); } return _values.entrySet().iterator(); } }
public class class_name { public Iterator<Map.Entry<String, JrsValue>> fields() { if (_values.isEmpty()) { return _values.entrySet().iterator(); // depends on control dependency: [if], data = [none] } return _values.entrySet().iterator(); } }
public class class_name { public void setFunction(String prefix, String localName, Method method) { if (functions == null) { functions = new Functions(); } functions.setFunction(prefix, localName, method); } }
public class class_name { public void setFunction(String prefix, String localName, Method method) { if (functions == null) { functions = new Functions(); // depends on control dependency: [if], data = [none] } functions.setFunction(prefix, localName, method); } }
public class class_name { public void setForegroundBaseColor(final Color COLOR) { if (null == titleColor) { _titleColor = COLOR; } else { titleColor.set(COLOR); } if (null == descriptionColor) { _descriptionColor = COLOR; } else { descriptionColor.set(COLOR); } if (null == unitColor) { _unitColor = COLOR; } else { unitColor.set(COLOR); } if (null == valueColor) { _valueColor = COLOR; } else { valueColor.set(COLOR); } if (null == textColor) { _textColor = COLOR; } else { textColor.set(COLOR); } if (null == foregroundColor) { _foregroundColor = COLOR; } else { foregroundColor.set(COLOR); } fireTileEvent(REDRAW_EVENT); } }
public class class_name { public void setForegroundBaseColor(final Color COLOR) { if (null == titleColor) { _titleColor = COLOR; } else { titleColor.set(COLOR); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] if (null == descriptionColor) { _descriptionColor = COLOR; } else { descriptionColor.set(COLOR); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] if (null == unitColor) { _unitColor = COLOR; } else { unitColor.set(COLOR); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] if (null == valueColor) { _valueColor = COLOR; } else { valueColor.set(COLOR); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] if (null == textColor) { _textColor = COLOR; } else { textColor.set(COLOR); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] if (null == foregroundColor) { _foregroundColor = COLOR; } else { foregroundColor.set(COLOR); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] fireTileEvent(REDRAW_EVENT); } }