code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
private Token simpleTokenLexer(Token tkn, int c) throws IOException {
for (;;) {
if (isEndOfLine(c)) {
// end of record
tkn.type = TT_EORECORD;
tkn.isReady = true;
break;
} else if (isEndOfFile(c)) {
// end of file
tkn.type = TT_EOF;
tkn.isReady = true;
break;
} else if (c == strategy.getDelimiter()) {
// end of token
tkn.type = TT_TOKEN;
tkn.isReady = true;
break;
} else if (c == '\\' && strategy.getUnicodeEscapeInterpretation() && in.lookAhead() == 'u') {
// interpret unicode escaped chars (like \u0070 -> p)
tkn.content.append((char) unicodeEscapeLexer(c));
} else if (c == strategy.getEscape()) {
tkn.content.append((char) readEscape(c));
} else {
tkn.content.append((char) c);
}
c = in.read();
}
if (strategy.getIgnoreTrailingWhitespaces()) {
tkn.content.trimTrailingWhitespace();
}
return tkn;
} } | public class class_name {
private Token simpleTokenLexer(Token tkn, int c) throws IOException {
for (;;) {
if (isEndOfLine(c)) {
// end of record
tkn.type = TT_EORECORD; // depends on control dependency: [if], data = [none]
tkn.isReady = true; // depends on control dependency: [if], data = [none]
break;
} else if (isEndOfFile(c)) {
// end of file
tkn.type = TT_EOF; // depends on control dependency: [if], data = [none]
tkn.isReady = true; // depends on control dependency: [if], data = [none]
break;
} else if (c == strategy.getDelimiter()) {
// end of token
tkn.type = TT_TOKEN; // depends on control dependency: [if], data = [none]
tkn.isReady = true; // depends on control dependency: [if], data = [none]
break;
} else if (c == '\\' && strategy.getUnicodeEscapeInterpretation() && in.lookAhead() == 'u') {
// interpret unicode escaped chars (like \u0070 -> p)
tkn.content.append((char) unicodeEscapeLexer(c)); // depends on control dependency: [if], data = [(c]
} else if (c == strategy.getEscape()) {
tkn.content.append((char) readEscape(c)); // depends on control dependency: [if], data = [(c]
} else {
tkn.content.append((char) c); // depends on control dependency: [if], data = [(c]
}
c = in.read();
}
if (strategy.getIgnoreTrailingWhitespaces()) {
tkn.content.trimTrailingWhitespace();
}
return tkn;
} } |
public class class_name {
private void writeWorkWeeks(Project.Calendars.Calendar xmlCalendar, ProjectCalendar mpxjCalendar)
{
List<ProjectCalendarWeek> weeks = mpxjCalendar.getWorkWeeks();
if (!weeks.isEmpty())
{
WorkWeeks xmlWorkWeeks = m_factory.createProjectCalendarsCalendarWorkWeeks();
xmlCalendar.setWorkWeeks(xmlWorkWeeks);
List<WorkWeek> xmlWorkWeekList = xmlWorkWeeks.getWorkWeek();
for (ProjectCalendarWeek week : weeks)
{
WorkWeek xmlWeek = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeek();
xmlWorkWeekList.add(xmlWeek);
xmlWeek.setName(week.getName());
TimePeriod xmlTimePeriod = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekTimePeriod();
xmlWeek.setTimePeriod(xmlTimePeriod);
xmlTimePeriod.setFromDate(week.getDateRange().getStart());
xmlTimePeriod.setToDate(week.getDateRange().getEnd());
WeekDays xmlWeekDays = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekWeekDays();
xmlWeek.setWeekDays(xmlWeekDays);
List<Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay> dayList = xmlWeekDays.getWeekDay();
for (int loop = 1; loop < 8; loop++)
{
DayType workingFlag = week.getWorkingDay(Day.getInstance(loop));
if (workingFlag != DayType.DEFAULT)
{
Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay day = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekWeekDaysWeekDay();
dayList.add(day);
day.setDayType(BigInteger.valueOf(loop));
day.setDayWorking(Boolean.valueOf(workingFlag == DayType.WORKING));
if (workingFlag == DayType.WORKING)
{
Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes times = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekWeekDaysWeekDayWorkingTimes();
day.setWorkingTimes(times);
List<Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes.WorkingTime> timesList = times.getWorkingTime();
ProjectCalendarHours bch = week.getCalendarHours(Day.getInstance(loop));
if (bch != null)
{
for (DateRange range : bch)
{
if (range != null)
{
Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes.WorkingTime time = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekWeekDaysWeekDayWorkingTimesWorkingTime();
timesList.add(time);
time.setFromTime(range.getStart());
time.setToTime(range.getEnd());
}
}
}
}
}
}
}
}
} } | public class class_name {
private void writeWorkWeeks(Project.Calendars.Calendar xmlCalendar, ProjectCalendar mpxjCalendar)
{
List<ProjectCalendarWeek> weeks = mpxjCalendar.getWorkWeeks();
if (!weeks.isEmpty())
{
WorkWeeks xmlWorkWeeks = m_factory.createProjectCalendarsCalendarWorkWeeks();
xmlCalendar.setWorkWeeks(xmlWorkWeeks); // depends on control dependency: [if], data = [none]
List<WorkWeek> xmlWorkWeekList = xmlWorkWeeks.getWorkWeek();
for (ProjectCalendarWeek week : weeks)
{
WorkWeek xmlWeek = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeek();
xmlWorkWeekList.add(xmlWeek); // depends on control dependency: [for], data = [none]
xmlWeek.setName(week.getName()); // depends on control dependency: [for], data = [week]
TimePeriod xmlTimePeriod = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekTimePeriod();
xmlWeek.setTimePeriod(xmlTimePeriod); // depends on control dependency: [for], data = [none]
xmlTimePeriod.setFromDate(week.getDateRange().getStart()); // depends on control dependency: [for], data = [week]
xmlTimePeriod.setToDate(week.getDateRange().getEnd()); // depends on control dependency: [for], data = [week]
WeekDays xmlWeekDays = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekWeekDays();
xmlWeek.setWeekDays(xmlWeekDays); // depends on control dependency: [for], data = [none]
List<Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay> dayList = xmlWeekDays.getWeekDay();
for (int loop = 1; loop < 8; loop++)
{
DayType workingFlag = week.getWorkingDay(Day.getInstance(loop));
if (workingFlag != DayType.DEFAULT)
{
Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay day = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekWeekDaysWeekDay();
dayList.add(day); // depends on control dependency: [if], data = [none]
day.setDayType(BigInteger.valueOf(loop)); // depends on control dependency: [if], data = [none]
day.setDayWorking(Boolean.valueOf(workingFlag == DayType.WORKING)); // depends on control dependency: [if], data = [(workingFlag]
if (workingFlag == DayType.WORKING)
{
Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes times = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekWeekDaysWeekDayWorkingTimes();
day.setWorkingTimes(times); // depends on control dependency: [if], data = [none]
List<Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes.WorkingTime> timesList = times.getWorkingTime();
ProjectCalendarHours bch = week.getCalendarHours(Day.getInstance(loop));
if (bch != null)
{
for (DateRange range : bch)
{
if (range != null)
{
Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes.WorkingTime time = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekWeekDaysWeekDayWorkingTimesWorkingTime();
timesList.add(time); // depends on control dependency: [if], data = [none]
time.setFromTime(range.getStart()); // depends on control dependency: [if], data = [(range]
time.setToTime(range.getEnd()); // depends on control dependency: [if], data = [(range]
}
}
}
}
}
}
}
}
} } |
public class class_name {
private static @Nullable Dimension getDimensionFromImageBinary(@NotNull Rendition rendition,
boolean suppressLogWarningNoRenditionsMetadata) {
try (InputStream is = rendition.getStream()) {
if (is != null) {
if (!suppressLogWarningNoRenditionsMetadata) {
log.warn("Unable to detect rendition metadata for {}, "
+ "fallback to inefficient detection by loading image into in memory. "
+ "Please check if the service user for the bundle 'io.wcm.handler.media' is configured properly.",
rendition.getPath());
}
Layer layer = new Layer(is);
long width = layer.getWidth();
long height = layer.getHeight();
return toDimension(width, height);
}
else {
log.warn("Unable to get binary stream for rendition {}", rendition.getPath());
}
}
catch (IOException ex) {
log.warn("Unable to read binary stream to layer for rendition {}", rendition.getPath(), ex);
}
return null;
} } | public class class_name {
private static @Nullable Dimension getDimensionFromImageBinary(@NotNull Rendition rendition,
boolean suppressLogWarningNoRenditionsMetadata) {
try (InputStream is = rendition.getStream()) {
if (is != null) {
if (!suppressLogWarningNoRenditionsMetadata) {
log.warn("Unable to detect rendition metadata for {}, "
+ "fallback to inefficient detection by loading image into in memory. "
+ "Please check if the service user for the bundle 'io.wcm.handler.media' is configured properly.",
rendition.getPath()); // depends on control dependency: [if], data = [none]
}
Layer layer = new Layer(is);
long width = layer.getWidth();
long height = layer.getHeight();
return toDimension(width, height); // depends on control dependency: [if], data = [none]
}
else {
log.warn("Unable to get binary stream for rendition {}", rendition.getPath()); // depends on control dependency: [if], data = [none]
}
}
catch (IOException ex) {
log.warn("Unable to read binary stream to layer for rendition {}", rendition.getPath(), ex);
}
return null;
} } |
public class class_name {
@Override
public float getProgress() {
try {
return Math.max(Math.min(1, progressProvider.get().getProgress()), 0);
} catch (final Exception e) {
// An Exception must be caught and logged here because YARN swallows the Exception and fails the job.
LOG.log(Level.WARNING, "Cannot get the application progress. Will return 0.", e);
return 0;
}
} } | public class class_name {
@Override
public float getProgress() {
try {
return Math.max(Math.min(1, progressProvider.get().getProgress()), 0); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
// An Exception must be caught and logged here because YARN swallows the Exception and fails the job.
LOG.log(Level.WARNING, "Cannot get the application progress. Will return 0.", e);
return 0;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void actionPerformed(ActionEvent e) {
int pos = viewToModel(new Point(popup.x, popup.y));
popup.setVisible(false);
String cmd = e.getActionCommand();
int line = -1;
try {
line = getLineOfOffset(pos);
} catch (Exception exc) {
}
if (cmd.equals("Set Breakpoint")) {
w.setBreakPoint(line + 1);
} else if (cmd.equals("Clear Breakpoint")) {
w.clearBreakPoint(line + 1);
} else if (cmd.equals("Run")) {
w.load();
}
} } | public class class_name {
@Override
public void actionPerformed(ActionEvent e) {
int pos = viewToModel(new Point(popup.x, popup.y));
popup.setVisible(false);
String cmd = e.getActionCommand();
int line = -1;
try {
line = getLineOfOffset(pos); // depends on control dependency: [try], data = [none]
} catch (Exception exc) {
} // depends on control dependency: [catch], data = [none]
if (cmd.equals("Set Breakpoint")) {
w.setBreakPoint(line + 1); // depends on control dependency: [if], data = [none]
} else if (cmd.equals("Clear Breakpoint")) {
w.clearBreakPoint(line + 1); // depends on control dependency: [if], data = [none]
} else if (cmd.equals("Run")) {
w.load(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(CreateEndpointRequest createEndpointRequest, ProtocolMarshaller protocolMarshaller) {
if (createEndpointRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createEndpointRequest.getEndpointIdentifier(), ENDPOINTIDENTIFIER_BINDING);
protocolMarshaller.marshall(createEndpointRequest.getEndpointType(), ENDPOINTTYPE_BINDING);
protocolMarshaller.marshall(createEndpointRequest.getEngineName(), ENGINENAME_BINDING);
protocolMarshaller.marshall(createEndpointRequest.getUsername(), USERNAME_BINDING);
protocolMarshaller.marshall(createEndpointRequest.getPassword(), PASSWORD_BINDING);
protocolMarshaller.marshall(createEndpointRequest.getServerName(), SERVERNAME_BINDING);
protocolMarshaller.marshall(createEndpointRequest.getPort(), PORT_BINDING);
protocolMarshaller.marshall(createEndpointRequest.getDatabaseName(), DATABASENAME_BINDING);
protocolMarshaller.marshall(createEndpointRequest.getExtraConnectionAttributes(), EXTRACONNECTIONATTRIBUTES_BINDING);
protocolMarshaller.marshall(createEndpointRequest.getKmsKeyId(), KMSKEYID_BINDING);
protocolMarshaller.marshall(createEndpointRequest.getTags(), TAGS_BINDING);
protocolMarshaller.marshall(createEndpointRequest.getCertificateArn(), CERTIFICATEARN_BINDING);
protocolMarshaller.marshall(createEndpointRequest.getSslMode(), SSLMODE_BINDING);
protocolMarshaller.marshall(createEndpointRequest.getServiceAccessRoleArn(), SERVICEACCESSROLEARN_BINDING);
protocolMarshaller.marshall(createEndpointRequest.getExternalTableDefinition(), EXTERNALTABLEDEFINITION_BINDING);
protocolMarshaller.marshall(createEndpointRequest.getDynamoDbSettings(), DYNAMODBSETTINGS_BINDING);
protocolMarshaller.marshall(createEndpointRequest.getS3Settings(), S3SETTINGS_BINDING);
protocolMarshaller.marshall(createEndpointRequest.getDmsTransferSettings(), DMSTRANSFERSETTINGS_BINDING);
protocolMarshaller.marshall(createEndpointRequest.getMongoDbSettings(), MONGODBSETTINGS_BINDING);
protocolMarshaller.marshall(createEndpointRequest.getKinesisSettings(), KINESISSETTINGS_BINDING);
protocolMarshaller.marshall(createEndpointRequest.getElasticsearchSettings(), ELASTICSEARCHSETTINGS_BINDING);
protocolMarshaller.marshall(createEndpointRequest.getRedshiftSettings(), REDSHIFTSETTINGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateEndpointRequest createEndpointRequest, ProtocolMarshaller protocolMarshaller) {
if (createEndpointRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createEndpointRequest.getEndpointIdentifier(), ENDPOINTIDENTIFIER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEndpointRequest.getEndpointType(), ENDPOINTTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEndpointRequest.getEngineName(), ENGINENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEndpointRequest.getUsername(), USERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEndpointRequest.getPassword(), PASSWORD_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEndpointRequest.getServerName(), SERVERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEndpointRequest.getPort(), PORT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEndpointRequest.getDatabaseName(), DATABASENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEndpointRequest.getExtraConnectionAttributes(), EXTRACONNECTIONATTRIBUTES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEndpointRequest.getKmsKeyId(), KMSKEYID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEndpointRequest.getTags(), TAGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEndpointRequest.getCertificateArn(), CERTIFICATEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEndpointRequest.getSslMode(), SSLMODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEndpointRequest.getServiceAccessRoleArn(), SERVICEACCESSROLEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEndpointRequest.getExternalTableDefinition(), EXTERNALTABLEDEFINITION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEndpointRequest.getDynamoDbSettings(), DYNAMODBSETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEndpointRequest.getS3Settings(), S3SETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEndpointRequest.getDmsTransferSettings(), DMSTRANSFERSETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEndpointRequest.getMongoDbSettings(), MONGODBSETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEndpointRequest.getKinesisSettings(), KINESISSETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEndpointRequest.getElasticsearchSettings(), ELASTICSEARCHSETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createEndpointRequest.getRedshiftSettings(), REDSHIFTSETTINGS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void init(ServletConfig config) throws ServletException {
m_cache = new HashMap<String, Templates>();
m_creds = new HashMap<String, UsernamePasswordCredentials>();
m_cManager = new PoolingClientConnectionManager();
m_cManager.getSchemeRegistry().register(
new Scheme("https", 443, SSLSocketFactory.getSocketFactory()));
m_cManager.getSchemeRegistry().register(
new Scheme("https-tomcat", 8443, SSLSocketFactory.getSocketFactory()));
m_cManager.getSchemeRegistry().register(
new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
m_cManager.getSchemeRegistry().register(
new Scheme("http-tomcat", 8080, PlainSocketFactory.getSocketFactory()));
Enumeration<?> enm = config.getInitParameterNames();
while (enm.hasMoreElements()) {
String name = (String) enm.nextElement();
if (name.startsWith(CRED_PARAM_START)) {
String value = config.getInitParameter(name);
if (value.indexOf(":") == -1) {
throw new ServletException("Malformed credentials for "
+ name + " -- expected ':' user/pass delimiter");
}
String[] parts = value.split(":");
String user = parts[0];
StringBuffer pass = new StringBuffer();
for (int i = 1; i < parts.length; i++) {
if (i > 1) {
pass.append(':');
}
pass.append(parts[i]);
}
m_creds.put(name.substring(CRED_PARAM_START.length()),
new UsernamePasswordCredentials(user, pass
.toString()));
}
}
} } | public class class_name {
@Override
public void init(ServletConfig config) throws ServletException {
m_cache = new HashMap<String, Templates>();
m_creds = new HashMap<String, UsernamePasswordCredentials>();
m_cManager = new PoolingClientConnectionManager();
m_cManager.getSchemeRegistry().register(
new Scheme("https", 443, SSLSocketFactory.getSocketFactory()));
m_cManager.getSchemeRegistry().register(
new Scheme("https-tomcat", 8443, SSLSocketFactory.getSocketFactory()));
m_cManager.getSchemeRegistry().register(
new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
m_cManager.getSchemeRegistry().register(
new Scheme("http-tomcat", 8080, PlainSocketFactory.getSocketFactory()));
Enumeration<?> enm = config.getInitParameterNames();
while (enm.hasMoreElements()) {
String name = (String) enm.nextElement();
if (name.startsWith(CRED_PARAM_START)) {
String value = config.getInitParameter(name);
if (value.indexOf(":") == -1) {
throw new ServletException("Malformed credentials for "
+ name + " -- expected ':' user/pass delimiter");
}
String[] parts = value.split(":");
String user = parts[0];
StringBuffer pass = new StringBuffer();
for (int i = 1; i < parts.length; i++) {
if (i > 1) {
pass.append(':'); // depends on control dependency: [if], data = [none]
}
pass.append(parts[i]); // depends on control dependency: [for], data = [i]
}
m_creds.put(name.substring(CRED_PARAM_START.length()),
new UsernamePasswordCredentials(user, pass
.toString()));
}
}
} } |
public class class_name {
public CompletableFuture<RaftSessionState> openSession(
String serviceName,
PrimitiveType primitiveType,
ServiceConfig config,
ReadConsistency readConsistency,
CommunicationStrategy communicationStrategy,
Duration minTimeout,
Duration maxTimeout) {
checkNotNull(serviceName, "serviceName cannot be null");
checkNotNull(primitiveType, "serviceType cannot be null");
checkNotNull(communicationStrategy, "communicationStrategy cannot be null");
checkNotNull(maxTimeout, "timeout cannot be null");
log.debug("Opening session; name: {}, type: {}", serviceName, primitiveType);
OpenSessionRequest request = OpenSessionRequest.builder()
.withMemberId(memberId)
.withServiceName(serviceName)
.withServiceType(primitiveType)
.withServiceConfig(Serializer.using(primitiveType.namespace()).encode(config))
.withReadConsistency(readConsistency)
.withMinTimeout(minTimeout.toMillis())
.withMaxTimeout(maxTimeout.toMillis())
.build();
CompletableFuture<RaftSessionState> future = new CompletableFuture<>();
ThreadContext proxyContext = threadContextFactory.createContext();
connection.openSession(request).whenCompleteAsync((response, error) -> {
if (error == null) {
if (response.status() == RaftResponse.Status.OK) {
// Create and store the proxy state.
RaftSessionState state = new RaftSessionState(
clientId,
SessionId.from(response.session()),
serviceName,
primitiveType,
response.timeout());
sessions.put(state.getSessionId().id(), state);
state.addStateChangeListener(s -> {
if (s == PrimitiveState.EXPIRED || s == PrimitiveState.CLOSED) {
sessions.remove(state.getSessionId().id());
}
});
// Ensure the proxy session info is reset and the session is kept alive.
keepAliveSessions(System.currentTimeMillis(), state.getSessionTimeout());
future.complete(state);
} else {
future.completeExceptionally(new RaftException.Unavailable(response.error().message()));
}
} else {
future.completeExceptionally(new RaftException.Unavailable(error.getMessage()));
}
}, proxyContext);
return future;
} } | public class class_name {
public CompletableFuture<RaftSessionState> openSession(
String serviceName,
PrimitiveType primitiveType,
ServiceConfig config,
ReadConsistency readConsistency,
CommunicationStrategy communicationStrategy,
Duration minTimeout,
Duration maxTimeout) {
checkNotNull(serviceName, "serviceName cannot be null");
checkNotNull(primitiveType, "serviceType cannot be null");
checkNotNull(communicationStrategy, "communicationStrategy cannot be null");
checkNotNull(maxTimeout, "timeout cannot be null");
log.debug("Opening session; name: {}, type: {}", serviceName, primitiveType);
OpenSessionRequest request = OpenSessionRequest.builder()
.withMemberId(memberId)
.withServiceName(serviceName)
.withServiceType(primitiveType)
.withServiceConfig(Serializer.using(primitiveType.namespace()).encode(config))
.withReadConsistency(readConsistency)
.withMinTimeout(minTimeout.toMillis())
.withMaxTimeout(maxTimeout.toMillis())
.build();
CompletableFuture<RaftSessionState> future = new CompletableFuture<>();
ThreadContext proxyContext = threadContextFactory.createContext();
connection.openSession(request).whenCompleteAsync((response, error) -> {
if (error == null) {
if (response.status() == RaftResponse.Status.OK) {
// Create and store the proxy state.
RaftSessionState state = new RaftSessionState(
clientId,
SessionId.from(response.session()),
serviceName,
primitiveType,
response.timeout());
sessions.put(state.getSessionId().id(), state); // depends on control dependency: [if], data = [none]
state.addStateChangeListener(s -> {
if (s == PrimitiveState.EXPIRED || s == PrimitiveState.CLOSED) {
sessions.remove(state.getSessionId().id()); // depends on control dependency: [if], data = [none]
}
});
// Ensure the proxy session info is reset and the session is kept alive.
keepAliveSessions(System.currentTimeMillis(), state.getSessionTimeout());
future.complete(state);
} else {
future.completeExceptionally(new RaftException.Unavailable(response.error().message()));
}
} else {
future.completeExceptionally(new RaftException.Unavailable(error.getMessage()));
}
}, proxyContext);
return future;
} } |
public class class_name {
private String getSchemaProperty(String persistenceUnit, Map<String, Object> externalProperties)
{
PersistenceUnitMetadata persistenceUnitMetadata = kunderaMetadata.getApplicationMetadata()
.getPersistenceUnitMetadata(persistenceUnit);
String autoDdlOption = externalProperties != null
? (String) externalProperties.get(PersistenceProperties.KUNDERA_DDL_AUTO_PREPARE) : null;
if (autoDdlOption == null)
{
autoDdlOption = persistenceUnitMetadata != null
? persistenceUnitMetadata.getProperty(PersistenceProperties.KUNDERA_DDL_AUTO_PREPARE) : null;
}
return autoDdlOption;
} } | public class class_name {
private String getSchemaProperty(String persistenceUnit, Map<String, Object> externalProperties)
{
PersistenceUnitMetadata persistenceUnitMetadata = kunderaMetadata.getApplicationMetadata()
.getPersistenceUnitMetadata(persistenceUnit);
String autoDdlOption = externalProperties != null
? (String) externalProperties.get(PersistenceProperties.KUNDERA_DDL_AUTO_PREPARE) : null;
if (autoDdlOption == null)
{
autoDdlOption = persistenceUnitMetadata != null
? persistenceUnitMetadata.getProperty(PersistenceProperties.KUNDERA_DDL_AUTO_PREPARE) : null; // depends on control dependency: [if], data = [none]
}
return autoDdlOption;
} } |
public class class_name {
public void marshall(UpdateImagePermissionsRequest updateImagePermissionsRequest, ProtocolMarshaller protocolMarshaller) {
if (updateImagePermissionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateImagePermissionsRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(updateImagePermissionsRequest.getSharedAccountId(), SHAREDACCOUNTID_BINDING);
protocolMarshaller.marshall(updateImagePermissionsRequest.getImagePermissions(), IMAGEPERMISSIONS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateImagePermissionsRequest updateImagePermissionsRequest, ProtocolMarshaller protocolMarshaller) {
if (updateImagePermissionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateImagePermissionsRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateImagePermissionsRequest.getSharedAccountId(), SHAREDACCOUNTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateImagePermissionsRequest.getImagePermissions(), IMAGEPERMISSIONS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean validLogin(String identifier, String password, String hash) {
Objects.requireNonNull(identifier, Required.USERNAME.toString());
Objects.requireNonNull(password, Required.PASSWORD.toString());
Objects.requireNonNull(hash, Required.HASH.toString());
Cache cache = Application.getInstance(CacheProvider.class).getCache(CacheName.AUTH);
boolean authenticated = false;
if (!userHasLock(identifier) && CodecUtils.checkJBCrypt(password, hash)) {
authenticated = true;
} else {
cache.increment(identifier);
}
return authenticated;
} } | public class class_name {
public boolean validLogin(String identifier, String password, String hash) {
Objects.requireNonNull(identifier, Required.USERNAME.toString());
Objects.requireNonNull(password, Required.PASSWORD.toString());
Objects.requireNonNull(hash, Required.HASH.toString());
Cache cache = Application.getInstance(CacheProvider.class).getCache(CacheName.AUTH);
boolean authenticated = false;
if (!userHasLock(identifier) && CodecUtils.checkJBCrypt(password, hash)) {
authenticated = true; // depends on control dependency: [if], data = [none]
} else {
cache.increment(identifier); // depends on control dependency: [if], data = [none]
}
return authenticated;
} } |
public class class_name {
public final EObject entryRuleGroup() throws RecognitionException {
EObject current = null;
EObject iv_ruleGroup = null;
try {
// InternalSimpleAntlr.g:567:2: (iv_ruleGroup= ruleGroup EOF )
// InternalSimpleAntlr.g:568:2: iv_ruleGroup= ruleGroup EOF
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getGroupRule());
}
pushFollow(FOLLOW_1);
iv_ruleGroup=ruleGroup();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current =iv_ruleGroup;
}
match(input,EOF,FOLLOW_2); if (state.failed) return current;
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final EObject entryRuleGroup() throws RecognitionException {
EObject current = null;
EObject iv_ruleGroup = null;
try {
// InternalSimpleAntlr.g:567:2: (iv_ruleGroup= ruleGroup EOF )
// InternalSimpleAntlr.g:568:2: iv_ruleGroup= ruleGroup EOF
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getGroupRule()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_1);
iv_ruleGroup=ruleGroup();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current =iv_ruleGroup; // depends on control dependency: [if], data = [none]
}
match(input,EOF,FOLLOW_2); if (state.failed) return current;
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } |
public class class_name {
private void processModifyResponses(String errorMessage, List<TablePopulationRequirements> responseList) {
assert(errorMessage != null);
// if no requirements, then it's just not possible
if (responseList == null) {
m_supported = false;
m_errors.append(errorMessage + "\n");
return;
}
// otherwise, it's possible if a specific table is empty
// collect the error message(s) and decide if it can be done inside @UAC
for (TablePopulationRequirements response : responseList) {
String objectName = response.getObjectName();
String nonEmptyErrorMessage = response.getErrorMessage();
assert (nonEmptyErrorMessage != null);
TablePopulationRequirements popreq = m_tablesThatMustBeEmpty.get(objectName);
if (popreq == null) {
popreq = response;
m_tablesThatMustBeEmpty.put(objectName, popreq);
} else {
String newErrorMessage = popreq.getErrorMessage() + "\n " + response.getErrorMessage();
popreq.setErrorMessage(newErrorMessage);
}
}
} } | public class class_name {
private void processModifyResponses(String errorMessage, List<TablePopulationRequirements> responseList) {
assert(errorMessage != null);
// if no requirements, then it's just not possible
if (responseList == null) {
m_supported = false; // depends on control dependency: [if], data = [none]
m_errors.append(errorMessage + "\n"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// otherwise, it's possible if a specific table is empty
// collect the error message(s) and decide if it can be done inside @UAC
for (TablePopulationRequirements response : responseList) {
String objectName = response.getObjectName();
String nonEmptyErrorMessage = response.getErrorMessage();
assert (nonEmptyErrorMessage != null); // depends on control dependency: [for], data = [none]
TablePopulationRequirements popreq = m_tablesThatMustBeEmpty.get(objectName);
if (popreq == null) {
popreq = response; // depends on control dependency: [if], data = [none]
m_tablesThatMustBeEmpty.put(objectName, popreq); // depends on control dependency: [if], data = [none]
} else {
String newErrorMessage = popreq.getErrorMessage() + "\n " + response.getErrorMessage();
popreq.setErrorMessage(newErrorMessage); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public Deferred<Boolean> processTSMetaThroughTrees(final TSMeta meta) {
if (config.enable_tree_processing()) {
return TreeBuilder.processAllTrees(this, meta);
}
return Deferred.fromResult(false);
} } | public class class_name {
public Deferred<Boolean> processTSMetaThroughTrees(final TSMeta meta) {
if (config.enable_tree_processing()) {
return TreeBuilder.processAllTrees(this, meta); // depends on control dependency: [if], data = [none]
}
return Deferred.fromResult(false);
} } |
public class class_name {
public static JsonObject toJson( IGeneratorSet generatorSet)
{
JsonObjectBuilder builder = Json.createObjectBuilder();
for( String function : generatorSet.getGeneratorFunctions())
{
builder.add( function, toJson( generatorSet.getGenerator( function)));
}
return builder.build();
} } | public class class_name {
public static JsonObject toJson( IGeneratorSet generatorSet)
{
JsonObjectBuilder builder = Json.createObjectBuilder();
for( String function : generatorSet.getGeneratorFunctions())
{
builder.add( function, toJson( generatorSet.getGenerator( function))); // depends on control dependency: [for], data = [function]
}
return builder.build();
} } |
public class class_name {
public static void stop() {
synchronized (lock) {
if (singleton == null) return;
LeaderSelector leaderSelector = singleton.leaderSelector;
if (leaderSelector == null) {
return;
}
LOG.info("节点退出zk选举");
leaderSelector.close();
singleton = null;
LOG.info("退出选举 完毕");
}
} } | public class class_name {
public static void stop() {
synchronized (lock) {
if (singleton == null) return;
LeaderSelector leaderSelector = singleton.leaderSelector;
if (leaderSelector == null) {
return; // depends on control dependency: [if], data = [none]
}
LOG.info("节点退出zk选举");
leaderSelector.close();
singleton = null;
LOG.info("退出选举 完毕");
}
} } |
public class class_name {
public void setCaseSensitiveMatch(final Boolean caseInsensitive) {
FilterableBeanBoundDataModel model = getFilterableTableModel();
if (model != null) {
model.setCaseSensitiveMatch(caseInsensitive);
}
} } | public class class_name {
public void setCaseSensitiveMatch(final Boolean caseInsensitive) {
FilterableBeanBoundDataModel model = getFilterableTableModel();
if (model != null) {
model.setCaseSensitiveMatch(caseInsensitive); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
static <T extends Annotation> T findAnnotation(Method method, Class<T> clazz) {
T annotation = AnnotationUtils.findAnnotation(method, clazz);
if (annotation == null) {
try {
annotation = AnnotationUtils.findAnnotation(method.getDeclaringClass()
.getMethod(method.getName(), method.getParameterTypes()), clazz);
}
catch (NoSuchMethodException | SecurityException ex) {
if (log.isDebugEnabled()) {
log.debug("Exception occurred while tyring to find the annotation",
ex);
}
}
}
return annotation;
} } | public class class_name {
static <T extends Annotation> T findAnnotation(Method method, Class<T> clazz) {
T annotation = AnnotationUtils.findAnnotation(method, clazz);
if (annotation == null) {
try {
annotation = AnnotationUtils.findAnnotation(method.getDeclaringClass()
.getMethod(method.getName(), method.getParameterTypes()), clazz); // depends on control dependency: [try], data = [none]
}
catch (NoSuchMethodException | SecurityException ex) {
if (log.isDebugEnabled()) {
log.debug("Exception occurred while tyring to find the annotation",
ex); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
return annotation;
} } |
public class class_name {
private static Set<StatusCode.Code> buildRetryCodes(RetryOptions retryOptions) {
ImmutableSet.Builder<StatusCode.Code> statusCodeBuilder = ImmutableSet.builder();
for (Status.Code retryCode : retryOptions.getRetryableStatusCodes()) {
statusCodeBuilder.add(GrpcStatusCode.of(retryCode).getCode());
}
return statusCodeBuilder.build();
} } | public class class_name {
private static Set<StatusCode.Code> buildRetryCodes(RetryOptions retryOptions) {
ImmutableSet.Builder<StatusCode.Code> statusCodeBuilder = ImmutableSet.builder();
for (Status.Code retryCode : retryOptions.getRetryableStatusCodes()) {
statusCodeBuilder.add(GrpcStatusCode.of(retryCode).getCode()); // depends on control dependency: [for], data = [retryCode]
}
return statusCodeBuilder.build();
} } |
public class class_name {
@RequestMapping(value="/{providerId}", method=RequestMethod.POST)
public RedirectView signIn(@PathVariable String providerId, NativeWebRequest request) {
try {
ConnectionFactory<?> connectionFactory = connectionFactoryLocator.getConnectionFactory(providerId);
MultiValueMap<String, String> parameters = new LinkedMultiValueMap<String, String>();
preSignIn(connectionFactory, parameters, request);
return new RedirectView(connectSupport.buildOAuthUrl(connectionFactory, request, parameters));
} catch (Exception e) {
logger.error("Exception while building authorization URL: ", e);
return redirect(URIBuilder.fromUri(signInUrl).queryParam("error", "provider").build().toString());
}
} } | public class class_name {
@RequestMapping(value="/{providerId}", method=RequestMethod.POST)
public RedirectView signIn(@PathVariable String providerId, NativeWebRequest request) {
try {
ConnectionFactory<?> connectionFactory = connectionFactoryLocator.getConnectionFactory(providerId);
MultiValueMap<String, String> parameters = new LinkedMultiValueMap<String, String>();
preSignIn(connectionFactory, parameters, request); // depends on control dependency: [try], data = [none]
return new RedirectView(connectSupport.buildOAuthUrl(connectionFactory, request, parameters)); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.error("Exception while building authorization URL: ", e);
return redirect(URIBuilder.fromUri(signInUrl).queryParam("error", "provider").build().toString());
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void hook(HttpServletRequest request, HttpServletResponse response, FilterHookChain chain) throws IOException, ServletException {
final Map<String, String> originallyMap = prepareOriginallyMap();
if (originallyMap != null) {
mdcMap.forEach((key, value) -> {
final String originallyValue = MDC.get(key);
if (originallyValue != null) {
originallyMap.put(key, originallyValue);
}
});
}
final boolean topLevel = inTopLevelScope();
if (topLevel) {
begunLocal.set(new Object());
}
try {
if (!mdcMap.isEmpty()) {
final MDCSetupResource resouce = createSetupResource();
mdcMap.forEach((key, value) -> MDC.put(key, value.apply(resouce)));
}
chain.doNext(request, response);
} finally {
if (originallyMap != null) {
originallyMap.forEach((key, value) -> MDC.remove(key));
}
if (topLevel) {
final Map<String, Object> registeredMap = registeredMapLocal.get();
if (registeredMap != null) {
registeredMap.forEach((key, value) -> MDC.remove(key));
registeredMapLocal.set(null);
}
begunLocal.set(null);
}
}
} } | public class class_name {
@Override
public void hook(HttpServletRequest request, HttpServletResponse response, FilterHookChain chain) throws IOException, ServletException {
final Map<String, String> originallyMap = prepareOriginallyMap();
if (originallyMap != null) {
mdcMap.forEach((key, value) -> {
final String originallyValue = MDC.get(key);
if (originallyValue != null) {
originallyMap.put(key, originallyValue);
}
});
}
final boolean topLevel = inTopLevelScope();
if (topLevel) {
begunLocal.set(new Object());
}
try {
if (!mdcMap.isEmpty()) {
final MDCSetupResource resouce = createSetupResource();
mdcMap.forEach((key, value) -> MDC.put(key, value.apply(resouce))); // depends on control dependency: [if], data = [none]
}
chain.doNext(request, response);
} finally {
if (originallyMap != null) {
originallyMap.forEach((key, value) -> MDC.remove(key)); // depends on control dependency: [if], data = [none]
}
if (topLevel) {
final Map<String, Object> registeredMap = registeredMapLocal.get();
if (registeredMap != null) {
registeredMap.forEach((key, value) -> MDC.remove(key)); // depends on control dependency: [if], data = [none]
registeredMapLocal.set(null); // depends on control dependency: [if], data = [null)]
}
begunLocal.set(null); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private static String processEntry(Column column, Object entry, Locale locale,
Map<Integer, Format> columnFormatters) throws IOException {
if (!String.valueOf(entry).contains(DOUBLE_INFINITY_STRING)) {
String valueToPrint;
if (entry.getClass() == Date.class) {
valueToPrint = convertDateElementToString((Date) entry,
(SimpleDateFormat) columnFormatters.computeIfAbsent(column.getId(),
e -> getDateFormatProcessor(column.getFormat(), locale)));
} else {
if (TIME_FORMAT_STRINGS.contains(column.getFormat().getName())) {
valueToPrint = convertTimeElementToString((Long) entry);
} else if (PERCENT_FORMAT.equals(column.getFormat().getName())) {
valueToPrint = convertPercentElementToString(entry,
(DecimalFormat) columnFormatters.computeIfAbsent(column.getId(),
e -> getPercentFormatProcessor(column.getFormat(), locale)));
} else {
valueToPrint = String.valueOf(entry);
if (entry.getClass() == Double.class) {
valueToPrint = convertDoubleElementToString((Double) entry);
}
}
}
return valueToPrint;
}
return "";
} } | public class class_name {
private static String processEntry(Column column, Object entry, Locale locale,
Map<Integer, Format> columnFormatters) throws IOException {
if (!String.valueOf(entry).contains(DOUBLE_INFINITY_STRING)) {
String valueToPrint;
if (entry.getClass() == Date.class) {
valueToPrint = convertDateElementToString((Date) entry,
(SimpleDateFormat) columnFormatters.computeIfAbsent(column.getId(),
e -> getDateFormatProcessor(column.getFormat(), locale))); // depends on control dependency: [if], data = [none]
} else {
if (TIME_FORMAT_STRINGS.contains(column.getFormat().getName())) {
valueToPrint = convertTimeElementToString((Long) entry); // depends on control dependency: [if], data = [none]
} else if (PERCENT_FORMAT.equals(column.getFormat().getName())) {
valueToPrint = convertPercentElementToString(entry,
(DecimalFormat) columnFormatters.computeIfAbsent(column.getId(),
e -> getPercentFormatProcessor(column.getFormat(), locale))); // depends on control dependency: [if], data = [none]
} else {
valueToPrint = String.valueOf(entry); // depends on control dependency: [if], data = [none]
if (entry.getClass() == Double.class) {
valueToPrint = convertDoubleElementToString((Double) entry); // depends on control dependency: [if], data = [none]
}
}
}
return valueToPrint;
}
return "";
} } |
public class class_name {
public DescribeRouteTablesResult withRouteTables(RouteTable... routeTables) {
if (this.routeTables == null) {
setRouteTables(new com.amazonaws.internal.SdkInternalList<RouteTable>(routeTables.length));
}
for (RouteTable ele : routeTables) {
this.routeTables.add(ele);
}
return this;
} } | public class class_name {
public DescribeRouteTablesResult withRouteTables(RouteTable... routeTables) {
if (this.routeTables == null) {
setRouteTables(new com.amazonaws.internal.SdkInternalList<RouteTable>(routeTables.length)); // depends on control dependency: [if], data = [none]
}
for (RouteTable ele : routeTables) {
this.routeTables.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
protected void responseBodyConsumed() {
// make sure this is the initial invocation of the notification,
// ignore subsequent ones.
responseStream = null;
if (responseConnection != null) {
responseConnection.setLastResponseInputStream(null);
// At this point, no response data should be available.
// If there is data available, regard the connection as being
// unreliable and close it.
if (shouldCloseConnection(responseConnection)) {
responseConnection.close();
} else {
try {
if(responseConnection.isResponseAvailable()) {
boolean logExtraInput =
getParams().isParameterTrue(HttpMethodParams.WARN_EXTRA_INPUT);
if(logExtraInput) {
LOG.warn("Extra response data detected - closing connection");
}
responseConnection.close();
}
}
catch (IOException e) {
LOG.warn(e.getMessage());
responseConnection.close();
}
}
}
this.connectionCloseForced = false;
ensureConnectionRelease();
} } | public class class_name {
protected void responseBodyConsumed() {
// make sure this is the initial invocation of the notification,
// ignore subsequent ones.
responseStream = null;
if (responseConnection != null) {
responseConnection.setLastResponseInputStream(null); // depends on control dependency: [if], data = [null)]
// At this point, no response data should be available.
// If there is data available, regard the connection as being
// unreliable and close it.
if (shouldCloseConnection(responseConnection)) {
responseConnection.close(); // depends on control dependency: [if], data = [none]
} else {
try {
if(responseConnection.isResponseAvailable()) {
boolean logExtraInput =
getParams().isParameterTrue(HttpMethodParams.WARN_EXTRA_INPUT);
if(logExtraInput) {
LOG.warn("Extra response data detected - closing connection"); // depends on control dependency: [if], data = [none]
}
responseConnection.close(); // depends on control dependency: [if], data = [none]
}
}
catch (IOException e) {
LOG.warn(e.getMessage());
responseConnection.close();
} // depends on control dependency: [catch], data = [none]
}
}
this.connectionCloseForced = false;
ensureConnectionRelease();
} } |
public class class_name {
@Override
public boolean check(Arg pArg) {
if (pArg.isTypeAllowed()) {
// Its allowed in general, so we only need to check
// the denied section, whether its forbidded
return deny == null || !matches(deny, pArg);
} else {
// Its forbidden by default, so we need to check the
// allowed section
return allow != null && matches(allow, pArg);
}
} } | public class class_name {
@Override
public boolean check(Arg pArg) {
if (pArg.isTypeAllowed()) {
// Its allowed in general, so we only need to check
// the denied section, whether its forbidded
return deny == null || !matches(deny, pArg); // depends on control dependency: [if], data = [none]
} else {
// Its forbidden by default, so we need to check the
// allowed section
return allow != null && matches(allow, pArg); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static boolean isBiggerOrEqual(final BigInteger big1,
final BigInteger big2)
{
final int compared = big1.compareTo(big2);
if (compared >= 0)
{
return true;
}
return false;
} } | public class class_name {
public static boolean isBiggerOrEqual(final BigInteger big1,
final BigInteger big2)
{
final int compared = big1.compareTo(big2);
if (compared >= 0)
{
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
protected String getReadElfTag(String tag) {
String tagValue = null;
try {
String result[] = ExecUtil.execute("/usr/bin/readelf -A /proc/self/exe");
if(result != null){
for(String line : result) {
line = line.trim();
if (line.startsWith(tag) && line.contains(":")) {
String lineParts[] = line.split(":", 2);
if(lineParts.length > 1)
tagValue = lineParts[1].trim();
break;
}
}
}
}
catch (IOException|InterruptedException ioe) { ioe.printStackTrace(); }
return tagValue;
} } | public class class_name {
protected String getReadElfTag(String tag) {
String tagValue = null;
try {
String result[] = ExecUtil.execute("/usr/bin/readelf -A /proc/self/exe");
if(result != null){
for(String line : result) {
line = line.trim(); // depends on control dependency: [for], data = [line]
if (line.startsWith(tag) && line.contains(":")) {
String lineParts[] = line.split(":", 2);
if(lineParts.length > 1)
tagValue = lineParts[1].trim();
break;
}
}
}
}
catch (IOException|InterruptedException ioe) { ioe.printStackTrace(); } // depends on control dependency: [catch], data = [none]
return tagValue;
} } |
public class class_name {
public void setEnvironment(java.util.Collection<KeyValuePair> environment) {
if (environment == null) {
this.environment = null;
return;
}
this.environment = new java.util.ArrayList<KeyValuePair>(environment);
} } | public class class_name {
public void setEnvironment(java.util.Collection<KeyValuePair> environment) {
if (environment == null) {
this.environment = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.environment = new java.util.ArrayList<KeyValuePair>(environment);
} } |
public class class_name {
public static boolean isInterElementWhitespace(String text) {
int n = text.length();
for (int i = 0; i < n; ++i) {
if (!Strings.isHtmlSpace(text.charAt(i))) {
return false;
}
}
return true;
} } | public class class_name {
public static boolean isInterElementWhitespace(String text) {
int n = text.length();
for (int i = 0; i < n; ++i) {
if (!Strings.isHtmlSpace(text.charAt(i))) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public static AttributeScorer getScorer(TrainingCorpus corpus, Lexicon lexicon){
int numAttributes = lexicon.getAttributesNum();
AttributeScorer scorer = new AttributeScorer();
// build the matrix: attributes x labels
double[][] matrix = new double[numAttributes][lexicon.getLabelNum()];
double [] totalAttributes = new double[numAttributes];
double [] totalClasses = new double[lexicon.getLabelNum()];
double total = 0d;
int[] attributeIDToRank = new int[lexicon.maxAttributeID()+1];
java.util.Arrays.fill(attributeIDToRank, -1);
int[] attributeRankToID = new int[numAttributes];
java.util.Arrays.fill(attributeRankToID, -1);
int latestRank = 0;
// fill the matrix
Iterator<Document> docIter = corpus.iterator();
while(docIter.hasNext()){
Document d = docIter.next();
Vector vector = d.getFeatureVector(lexicon);
// get a vector based on the number of occurrences i.e on the raw document
// Vector vector = d.getFeatureVector(lexicon,Parameters.WeightingMethod.OCCURRENCES);
int[] indices = vector.getIndices();
double[] values = vector.getValues();
int classNum = d.getLabel();
for (int i=0;i<indices.length;i++){
int index = indices[i];
double value = values[i];
if (value==0) continue;
// problem here : the index is not the same as the rank
// find the rank of this attribute
int rank = attributeIDToRank[index];
if (rank==-1){
// not seen this one yet
rank = latestRank;
attributeIDToRank[index]= rank;
attributeRankToID[rank]=index;
latestRank++;
}
matrix[rank][classNum]+= value;
totalAttributes[rank]+= value;
totalClasses[classNum]+= value;
total+=value;
}
}
Map invertedAttributeIndex = lexicon.getInvertedIndex();
// attribute by attribute
for (int m=0;m<totalAttributes.length;m++){
double score4attribute = 0;
// (total for this attribute * total for label value) / bigTotal
StringBuffer buffer = new StringBuffer();
StringBuffer buffer2 = new StringBuffer();
int idAttr = attributeRankToID[m];
buffer.append(invertedAttributeIndex.get(idAttr));
buffer.append( "[").append(idAttr).append("]");
for (int l=0;l<totalClasses.length;l++){
double observed = matrix[m][l];
if (observed==0){
buffer2.append("\t").append(observed);
continue;
}
double expected = (totalAttributes[m]*totalClasses[l])/total;
double scoreClasse = observed*Math.log(observed/expected);
buffer2.append("\t").append(scoreClasse);
score4attribute += scoreClasse;
}
score4attribute = 2*score4attribute;
scorer.setScore(idAttr, score4attribute);
buffer.append("\t").append(score4attribute);
buffer.append(buffer2);
System.out.println(buffer.toString());
}
return scorer;
} } | public class class_name {
public static AttributeScorer getScorer(TrainingCorpus corpus, Lexicon lexicon){
int numAttributes = lexicon.getAttributesNum();
AttributeScorer scorer = new AttributeScorer();
// build the matrix: attributes x labels
double[][] matrix = new double[numAttributes][lexicon.getLabelNum()];
double [] totalAttributes = new double[numAttributes];
double [] totalClasses = new double[lexicon.getLabelNum()];
double total = 0d;
int[] attributeIDToRank = new int[lexicon.maxAttributeID()+1];
java.util.Arrays.fill(attributeIDToRank, -1);
int[] attributeRankToID = new int[numAttributes];
java.util.Arrays.fill(attributeRankToID, -1);
int latestRank = 0;
// fill the matrix
Iterator<Document> docIter = corpus.iterator();
while(docIter.hasNext()){
Document d = docIter.next();
Vector vector = d.getFeatureVector(lexicon);
// get a vector based on the number of occurrences i.e on the raw document
// Vector vector = d.getFeatureVector(lexicon,Parameters.WeightingMethod.OCCURRENCES);
int[] indices = vector.getIndices();
double[] values = vector.getValues();
int classNum = d.getLabel();
for (int i=0;i<indices.length;i++){
int index = indices[i];
double value = values[i];
if (value==0) continue;
// problem here : the index is not the same as the rank
// find the rank of this attribute
int rank = attributeIDToRank[index];
if (rank==-1){
// not seen this one yet
rank = latestRank;
// depends on control dependency: [if], data = [none]
attributeIDToRank[index]= rank;
// depends on control dependency: [if], data = [none]
attributeRankToID[rank]=index;
// depends on control dependency: [if], data = [none]
latestRank++;
// depends on control dependency: [if], data = [none]
}
matrix[rank][classNum]+= value;
// depends on control dependency: [for], data = [none]
totalAttributes[rank]+= value;
// depends on control dependency: [for], data = [none]
totalClasses[classNum]+= value;
// depends on control dependency: [for], data = [none]
total+=value;
// depends on control dependency: [for], data = [none]
}
}
Map invertedAttributeIndex = lexicon.getInvertedIndex();
// attribute by attribute
for (int m=0;m<totalAttributes.length;m++){
double score4attribute = 0;
// (total for this attribute * total for label value) / bigTotal
StringBuffer buffer = new StringBuffer();
StringBuffer buffer2 = new StringBuffer();
int idAttr = attributeRankToID[m];
buffer.append(invertedAttributeIndex.get(idAttr));
// depends on control dependency: [for], data = [none]
buffer.append( "[").append(idAttr).append("]");
// depends on control dependency: [for], data = [none]
for (int l=0;l<totalClasses.length;l++){
double observed = matrix[m][l];
if (observed==0){
buffer2.append("\t").append(observed);
// depends on control dependency: [if], data = [(observed]
continue;
}
double expected = (totalAttributes[m]*totalClasses[l])/total;
double scoreClasse = observed*Math.log(observed/expected);
buffer2.append("\t").append(scoreClasse);
// depends on control dependency: [for], data = [none]
score4attribute += scoreClasse;
// depends on control dependency: [for], data = [none]
}
score4attribute = 2*score4attribute;
// depends on control dependency: [for], data = [none]
scorer.setScore(idAttr, score4attribute);
// depends on control dependency: [for], data = [none]
buffer.append("\t").append(score4attribute);
// depends on control dependency: [for], data = [none]
buffer.append(buffer2);
// depends on control dependency: [for], data = [none]
System.out.println(buffer.toString());
// depends on control dependency: [for], data = [none]
}
return scorer;
} } |
public class class_name {
public Class define() {
process();
if ((!proxetta.isForced()) && (!isProxyApplied())) {
if (log.isDebugEnabled()) {
log.debug("Proxy not applied: " + StringUtil.toSafeString(targetClassName));
}
if (targetClass != null) {
return targetClass;
}
if (targetClassName != null) {
try {
return ClassLoaderUtil.loadClass(targetClassName);
} catch (ClassNotFoundException cnfex) {
throw new ProxettaException(cnfex);
}
}
}
if (log.isDebugEnabled()) {
log.debug("Proxy created: " + StringUtil.toSafeString(targetClassName));
}
try {
ClassLoader classLoader = proxetta.getClassLoader();
if (classLoader == null) {
classLoader = ClassLoaderUtil.getDefaultClassLoader();
if ((classLoader == null) && (targetClass != null)) {
classLoader = targetClass.getClassLoader();
}
}
final byte[] bytes = toByteArray();
dumpClassInDebugFolder(bytes);
return DefineClass.of(getProxyClassName(), bytes, classLoader);
} catch (Exception ex) {
throw new ProxettaException("Class definition failed", ex);
}
} } | public class class_name {
public Class define() {
process();
if ((!proxetta.isForced()) && (!isProxyApplied())) {
if (log.isDebugEnabled()) {
log.debug("Proxy not applied: " + StringUtil.toSafeString(targetClassName)); // depends on control dependency: [if], data = [none]
}
if (targetClass != null) {
return targetClass; // depends on control dependency: [if], data = [none]
}
if (targetClassName != null) {
try {
return ClassLoaderUtil.loadClass(targetClassName); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException cnfex) {
throw new ProxettaException(cnfex);
} // depends on control dependency: [catch], data = [none]
}
}
if (log.isDebugEnabled()) {
log.debug("Proxy created: " + StringUtil.toSafeString(targetClassName));
}
try {
ClassLoader classLoader = proxetta.getClassLoader();
if (classLoader == null) {
classLoader = ClassLoaderUtil.getDefaultClassLoader(); // depends on control dependency: [if], data = [none]
if ((classLoader == null) && (targetClass != null)) {
classLoader = targetClass.getClassLoader(); // depends on control dependency: [if], data = [none]
}
}
final byte[] bytes = toByteArray();
dumpClassInDebugFolder(bytes);
return DefineClass.of(getProxyClassName(), bytes, classLoader);
} catch (Exception ex) {
throw new ProxettaException("Class definition failed", ex);
}
} } |
public class class_name {
public synchronized XAttribute get(Object key) {
if(backingStore != null) {
return backingStore.get(key);
} else {
return null;
}
} } | public class class_name {
public synchronized XAttribute get(Object key) {
if(backingStore != null) {
return backingStore.get(key); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(UpdateJobExecutionRequest updateJobExecutionRequest, ProtocolMarshaller protocolMarshaller) {
if (updateJobExecutionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateJobExecutionRequest.getJobId(), JOBID_BINDING);
protocolMarshaller.marshall(updateJobExecutionRequest.getThingName(), THINGNAME_BINDING);
protocolMarshaller.marshall(updateJobExecutionRequest.getStatus(), STATUS_BINDING);
protocolMarshaller.marshall(updateJobExecutionRequest.getStatusDetails(), STATUSDETAILS_BINDING);
protocolMarshaller.marshall(updateJobExecutionRequest.getStepTimeoutInMinutes(), STEPTIMEOUTINMINUTES_BINDING);
protocolMarshaller.marshall(updateJobExecutionRequest.getExpectedVersion(), EXPECTEDVERSION_BINDING);
protocolMarshaller.marshall(updateJobExecutionRequest.getIncludeJobExecutionState(), INCLUDEJOBEXECUTIONSTATE_BINDING);
protocolMarshaller.marshall(updateJobExecutionRequest.getIncludeJobDocument(), INCLUDEJOBDOCUMENT_BINDING);
protocolMarshaller.marshall(updateJobExecutionRequest.getExecutionNumber(), EXECUTIONNUMBER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateJobExecutionRequest updateJobExecutionRequest, ProtocolMarshaller protocolMarshaller) {
if (updateJobExecutionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateJobExecutionRequest.getJobId(), JOBID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateJobExecutionRequest.getThingName(), THINGNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateJobExecutionRequest.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateJobExecutionRequest.getStatusDetails(), STATUSDETAILS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateJobExecutionRequest.getStepTimeoutInMinutes(), STEPTIMEOUTINMINUTES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateJobExecutionRequest.getExpectedVersion(), EXPECTEDVERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateJobExecutionRequest.getIncludeJobExecutionState(), INCLUDEJOBEXECUTIONSTATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateJobExecutionRequest.getIncludeJobDocument(), INCLUDEJOBDOCUMENT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateJobExecutionRequest.getExecutionNumber(), EXECUTIONNUMBER_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String getCharset(HttpURLConnection conn) {
if (conn == null) {
return null;
}
return ReUtil.get(CHARSET_PATTERN, conn.getContentType(), 1);
} } | public class class_name {
public static String getCharset(HttpURLConnection conn) {
if (conn == null) {
return null;
// depends on control dependency: [if], data = [none]
}
return ReUtil.get(CHARSET_PATTERN, conn.getContentType(), 1);
} } |
public class class_name {
public void addNextString(String string)
{
try {
m_daOut.writeUTF(string);
} catch (IOException ex) {
ex.printStackTrace();
}
} } | public class class_name {
public void addNextString(String string)
{
try {
m_daOut.writeUTF(string); // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public double getValue(final U u) {
if (metricPerUser.containsKey(u)) {
return metricPerUser.get(u);
}
return Double.NaN;
} } | public class class_name {
@Override
public double getValue(final U u) {
if (metricPerUser.containsKey(u)) {
return metricPerUser.get(u); // depends on control dependency: [if], data = [none]
}
return Double.NaN;
} } |
public class class_name {
public static float[] floatArrayCopyOf(CollectionNumber coll) {
float[] data = new float[coll.size()];
IteratorNumber iter = coll.iterator();
int index = 0;
while (iter.hasNext()) {
data[index] = iter.nextFloat();
index++;
}
return data;
} } | public class class_name {
public static float[] floatArrayCopyOf(CollectionNumber coll) {
float[] data = new float[coll.size()];
IteratorNumber iter = coll.iterator();
int index = 0;
while (iter.hasNext()) {
data[index] = iter.nextFloat();
// depends on control dependency: [while], data = [none]
index++;
// depends on control dependency: [while], data = [none]
}
return data;
} } |
public class class_name {
private void concatSingleDate2TimeInterval(String dtfmt,
String datePattern,
int field,
Map<String, PatternInfo> intervalPatterns)
{
PatternInfo timeItvPtnInfo =
intervalPatterns.get(DateIntervalInfo.CALENDAR_FIELD_TO_PATTERN_LETTER[field]);
if ( timeItvPtnInfo != null ) {
String timeIntervalPattern = timeItvPtnInfo.getFirstPart() +
timeItvPtnInfo.getSecondPart();
String pattern = SimpleFormatterImpl.formatRawPattern(
dtfmt, 2, 2, timeIntervalPattern, datePattern);
timeItvPtnInfo = DateIntervalInfo.genPatternInfo(pattern,
timeItvPtnInfo.firstDateInPtnIsLaterDate());
intervalPatterns.put(
DateIntervalInfo.CALENDAR_FIELD_TO_PATTERN_LETTER[field], timeItvPtnInfo);
}
// else: fall back
// it should not happen if the interval format defined is valid
} } | public class class_name {
private void concatSingleDate2TimeInterval(String dtfmt,
String datePattern,
int field,
Map<String, PatternInfo> intervalPatterns)
{
PatternInfo timeItvPtnInfo =
intervalPatterns.get(DateIntervalInfo.CALENDAR_FIELD_TO_PATTERN_LETTER[field]);
if ( timeItvPtnInfo != null ) {
String timeIntervalPattern = timeItvPtnInfo.getFirstPart() +
timeItvPtnInfo.getSecondPart();
String pattern = SimpleFormatterImpl.formatRawPattern(
dtfmt, 2, 2, timeIntervalPattern, datePattern);
timeItvPtnInfo = DateIntervalInfo.genPatternInfo(pattern,
timeItvPtnInfo.firstDateInPtnIsLaterDate()); // depends on control dependency: [if], data = [none]
intervalPatterns.put(
DateIntervalInfo.CALENDAR_FIELD_TO_PATTERN_LETTER[field], timeItvPtnInfo); // depends on control dependency: [if], data = [none]
}
// else: fall back
// it should not happen if the interval format defined is valid
} } |
public class class_name {
public static URIContext getInstance()
{
URIContext uriContext = MutableURI.getDefaultContext();
UrlConfig urlConfig = ConfigUtil.getConfig().getUrlConfig();
if ( urlConfig != null)
{
uriContext.setUseAmpEntity( urlConfig.isHtmlAmpEntity() );
}
return uriContext;
} } | public class class_name {
public static URIContext getInstance()
{
URIContext uriContext = MutableURI.getDefaultContext();
UrlConfig urlConfig = ConfigUtil.getConfig().getUrlConfig();
if ( urlConfig != null)
{
uriContext.setUseAmpEntity( urlConfig.isHtmlAmpEntity() ); // depends on control dependency: [if], data = [( urlConfig]
}
return uriContext;
} } |
public class class_name {
@SuppressWarnings({ "rawtypes", "unchecked" })
public Map getMap(NodeConfig nodeConfig) {
Map map = new HashMap();
List<AttributeConfig> attributes = nodeConfig.getAttribute();
map.putAll(getAttribute(attributes));
List<NodeConfig> childrenNodes = nodeConfig.getChildrenNodes();
if (childrenNodes != null && childrenNodes.size() > 0) {
for (NodeConfig childNode : childrenNodes) {
String name = childNode.getName();
Object value = childNode.getValue();
if (childNode.hasChildren()) {
Map childNodeMap = getMap(childNode);
map.put(name, addToList(map.get(name), childNodeMap));
} else {
if (childNode.hasAttributes()) {
Map attributeMap = new HashMap();
attributeMap = getAttribute(childNode.getAttribute());
if (attributeMap.size() > 0) {
if (value != null && value instanceof String) {
attributeMap.put("nodeValue", value);
}
value = attributeMap;
}
}
}
if (value != null) {
map.put(name, addToList(map.get(name), value));
}
}
}
if (nodeConfig.getName() != null && nodeConfig.getValue() != null) {
map.put(nodeConfig.getName(), nodeConfig.getValue());
}
return map;
} } | public class class_name {
@SuppressWarnings({ "rawtypes", "unchecked" })
public Map getMap(NodeConfig nodeConfig) {
Map map = new HashMap();
List<AttributeConfig> attributes = nodeConfig.getAttribute();
map.putAll(getAttribute(attributes));
List<NodeConfig> childrenNodes = nodeConfig.getChildrenNodes();
if (childrenNodes != null && childrenNodes.size() > 0) {
for (NodeConfig childNode : childrenNodes) {
String name = childNode.getName();
Object value = childNode.getValue();
if (childNode.hasChildren()) {
Map childNodeMap = getMap(childNode);
map.put(name, addToList(map.get(name), childNodeMap)); // depends on control dependency: [if], data = [none]
} else {
if (childNode.hasAttributes()) {
Map attributeMap = new HashMap();
attributeMap = getAttribute(childNode.getAttribute()); // depends on control dependency: [if], data = [none]
if (attributeMap.size() > 0) {
if (value != null && value instanceof String) {
attributeMap.put("nodeValue", value); // depends on control dependency: [if], data = [none]
}
value = attributeMap; // depends on control dependency: [if], data = [none]
}
}
}
if (value != null) {
map.put(name, addToList(map.get(name), value)); // depends on control dependency: [if], data = [none]
}
}
}
if (nodeConfig.getName() != null && nodeConfig.getValue() != null) {
map.put(nodeConfig.getName(), nodeConfig.getValue()); // depends on control dependency: [if], data = [(nodeConfig.getName()]
}
return map;
} } |
public class class_name {
public SipServletRequest createRequest(SipApplicationSession sipAppSession,
String method, URI from, URI to, String handler) {
if (logger.isDebugEnabled()) {
logger
.debug("Creating new SipServletRequest for SipApplicationSession["
+ sipAppSession
+ "] METHOD["
+ method
+ "] FROM_URI[" + from + "] TO_URI[" + to + "]");
}
validateCreation(method, sipAppSession);
//javadoc specifies that a copy of the uri should be done hence the clone
Address toA = this.createAddress(to.clone());
Address fromA = this.createAddress(from.clone());
try {
return createSipServletRequest(sipAppSession, method, fromA, toA, handler, null, null);
} catch (ServletParseException e) {
logger.error("Error creating sipServletRequest", e);
return null;
}
} } | public class class_name {
public SipServletRequest createRequest(SipApplicationSession sipAppSession,
String method, URI from, URI to, String handler) {
if (logger.isDebugEnabled()) {
logger
.debug("Creating new SipServletRequest for SipApplicationSession["
+ sipAppSession
+ "] METHOD["
+ method
+ "] FROM_URI[" + from + "] TO_URI[" + to + "]"); // depends on control dependency: [if], data = [none]
}
validateCreation(method, sipAppSession);
//javadoc specifies that a copy of the uri should be done hence the clone
Address toA = this.createAddress(to.clone());
Address fromA = this.createAddress(from.clone());
try {
return createSipServletRequest(sipAppSession, method, fromA, toA, handler, null, null); // depends on control dependency: [try], data = [none]
} catch (ServletParseException e) {
logger.error("Error creating sipServletRequest", e);
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public final EObject ruleXBlockExpression() throws RecognitionException {
EObject current = null;
Token otherlv_1=null;
Token otherlv_3=null;
Token otherlv_4=null;
EObject lv_expressions_2_0 = null;
enterRule();
try {
// InternalXbaseWithAnnotations.g:4239:2: ( ( () otherlv_1= '{' ( ( (lv_expressions_2_0= ruleXExpressionOrVarDeclaration ) ) (otherlv_3= ';' )? )* otherlv_4= '}' ) )
// InternalXbaseWithAnnotations.g:4240:2: ( () otherlv_1= '{' ( ( (lv_expressions_2_0= ruleXExpressionOrVarDeclaration ) ) (otherlv_3= ';' )? )* otherlv_4= '}' )
{
// InternalXbaseWithAnnotations.g:4240:2: ( () otherlv_1= '{' ( ( (lv_expressions_2_0= ruleXExpressionOrVarDeclaration ) ) (otherlv_3= ';' )? )* otherlv_4= '}' )
// InternalXbaseWithAnnotations.g:4241:3: () otherlv_1= '{' ( ( (lv_expressions_2_0= ruleXExpressionOrVarDeclaration ) ) (otherlv_3= ';' )? )* otherlv_4= '}'
{
// InternalXbaseWithAnnotations.g:4241:3: ()
// InternalXbaseWithAnnotations.g:4242:4:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElement(
grammarAccess.getXBlockExpressionAccess().getXBlockExpressionAction_0(),
current);
}
}
otherlv_1=(Token)match(input,55,FOLLOW_62); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_1, grammarAccess.getXBlockExpressionAccess().getLeftCurlyBracketKeyword_1());
}
// InternalXbaseWithAnnotations.g:4252:3: ( ( (lv_expressions_2_0= ruleXExpressionOrVarDeclaration ) ) (otherlv_3= ';' )? )*
loop73:
do {
int alt73=2;
int LA73_0 = input.LA(1);
if ( ((LA73_0>=RULE_STRING && LA73_0<=RULE_ID)||LA73_0==14||(LA73_0>=18 && LA73_0<=19)||LA73_0==26||(LA73_0>=42 && LA73_0<=43)||LA73_0==48||LA73_0==55||LA73_0==59||LA73_0==61||(LA73_0>=65 && LA73_0<=82)||LA73_0==84) ) {
alt73=1;
}
switch (alt73) {
case 1 :
// InternalXbaseWithAnnotations.g:4253:4: ( (lv_expressions_2_0= ruleXExpressionOrVarDeclaration ) ) (otherlv_3= ';' )?
{
// InternalXbaseWithAnnotations.g:4253:4: ( (lv_expressions_2_0= ruleXExpressionOrVarDeclaration ) )
// InternalXbaseWithAnnotations.g:4254:5: (lv_expressions_2_0= ruleXExpressionOrVarDeclaration )
{
// InternalXbaseWithAnnotations.g:4254:5: (lv_expressions_2_0= ruleXExpressionOrVarDeclaration )
// InternalXbaseWithAnnotations.g:4255:6: lv_expressions_2_0= ruleXExpressionOrVarDeclaration
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXBlockExpressionAccess().getExpressionsXExpressionOrVarDeclarationParserRuleCall_2_0_0());
}
pushFollow(FOLLOW_63);
lv_expressions_2_0=ruleXExpressionOrVarDeclaration();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXBlockExpressionRule());
}
add(
current,
"expressions",
lv_expressions_2_0,
"org.eclipse.xtext.xbase.Xbase.XExpressionOrVarDeclaration");
afterParserOrEnumRuleCall();
}
}
}
// InternalXbaseWithAnnotations.g:4272:4: (otherlv_3= ';' )?
int alt72=2;
int LA72_0 = input.LA(1);
if ( (LA72_0==58) ) {
alt72=1;
}
switch (alt72) {
case 1 :
// InternalXbaseWithAnnotations.g:4273:5: otherlv_3= ';'
{
otherlv_3=(Token)match(input,58,FOLLOW_62); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_3, grammarAccess.getXBlockExpressionAccess().getSemicolonKeyword_2_1());
}
}
break;
}
}
break;
default :
break loop73;
}
} while (true);
otherlv_4=(Token)match(input,56,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_4, grammarAccess.getXBlockExpressionAccess().getRightCurlyBracketKeyword_3());
}
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final EObject ruleXBlockExpression() throws RecognitionException {
EObject current = null;
Token otherlv_1=null;
Token otherlv_3=null;
Token otherlv_4=null;
EObject lv_expressions_2_0 = null;
enterRule();
try {
// InternalXbaseWithAnnotations.g:4239:2: ( ( () otherlv_1= '{' ( ( (lv_expressions_2_0= ruleXExpressionOrVarDeclaration ) ) (otherlv_3= ';' )? )* otherlv_4= '}' ) )
// InternalXbaseWithAnnotations.g:4240:2: ( () otherlv_1= '{' ( ( (lv_expressions_2_0= ruleXExpressionOrVarDeclaration ) ) (otherlv_3= ';' )? )* otherlv_4= '}' )
{
// InternalXbaseWithAnnotations.g:4240:2: ( () otherlv_1= '{' ( ( (lv_expressions_2_0= ruleXExpressionOrVarDeclaration ) ) (otherlv_3= ';' )? )* otherlv_4= '}' )
// InternalXbaseWithAnnotations.g:4241:3: () otherlv_1= '{' ( ( (lv_expressions_2_0= ruleXExpressionOrVarDeclaration ) ) (otherlv_3= ';' )? )* otherlv_4= '}'
{
// InternalXbaseWithAnnotations.g:4241:3: ()
// InternalXbaseWithAnnotations.g:4242:4:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElement(
grammarAccess.getXBlockExpressionAccess().getXBlockExpressionAction_0(),
current); // depends on control dependency: [if], data = [none]
}
}
otherlv_1=(Token)match(input,55,FOLLOW_62); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_1, grammarAccess.getXBlockExpressionAccess().getLeftCurlyBracketKeyword_1()); // depends on control dependency: [if], data = [none]
}
// InternalXbaseWithAnnotations.g:4252:3: ( ( (lv_expressions_2_0= ruleXExpressionOrVarDeclaration ) ) (otherlv_3= ';' )? )*
loop73:
do {
int alt73=2;
int LA73_0 = input.LA(1);
if ( ((LA73_0>=RULE_STRING && LA73_0<=RULE_ID)||LA73_0==14||(LA73_0>=18 && LA73_0<=19)||LA73_0==26||(LA73_0>=42 && LA73_0<=43)||LA73_0==48||LA73_0==55||LA73_0==59||LA73_0==61||(LA73_0>=65 && LA73_0<=82)||LA73_0==84) ) {
alt73=1; // depends on control dependency: [if], data = [none]
}
switch (alt73) {
case 1 :
// InternalXbaseWithAnnotations.g:4253:4: ( (lv_expressions_2_0= ruleXExpressionOrVarDeclaration ) ) (otherlv_3= ';' )?
{
// InternalXbaseWithAnnotations.g:4253:4: ( (lv_expressions_2_0= ruleXExpressionOrVarDeclaration ) )
// InternalXbaseWithAnnotations.g:4254:5: (lv_expressions_2_0= ruleXExpressionOrVarDeclaration )
{
// InternalXbaseWithAnnotations.g:4254:5: (lv_expressions_2_0= ruleXExpressionOrVarDeclaration )
// InternalXbaseWithAnnotations.g:4255:6: lv_expressions_2_0= ruleXExpressionOrVarDeclaration
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXBlockExpressionAccess().getExpressionsXExpressionOrVarDeclarationParserRuleCall_2_0_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_63);
lv_expressions_2_0=ruleXExpressionOrVarDeclaration();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXBlockExpressionRule()); // depends on control dependency: [if], data = [none]
}
add(
current,
"expressions",
lv_expressions_2_0,
"org.eclipse.xtext.xbase.Xbase.XExpressionOrVarDeclaration"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
// InternalXbaseWithAnnotations.g:4272:4: (otherlv_3= ';' )?
int alt72=2;
int LA72_0 = input.LA(1);
if ( (LA72_0==58) ) {
alt72=1; // depends on control dependency: [if], data = [none]
}
switch (alt72) {
case 1 :
// InternalXbaseWithAnnotations.g:4273:5: otherlv_3= ';'
{
otherlv_3=(Token)match(input,58,FOLLOW_62); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_3, grammarAccess.getXBlockExpressionAccess().getSemicolonKeyword_2_1()); // depends on control dependency: [if], data = [none]
}
}
break;
}
}
break;
default :
break loop73;
}
} while (true);
otherlv_4=(Token)match(input,56,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_4, grammarAccess.getXBlockExpressionAccess().getRightCurlyBracketKeyword_3()); // depends on control dependency: [if], data = [none]
}
}
}
if ( state.backtracking==0 ) {
leaveRule(); // depends on control dependency: [if], data = [none]
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } |
public class class_name {
public static String getHelpText(IBotCommand...botCommands) {
StringBuilder reply = new StringBuilder();
for (IBotCommand com : botCommands) {
reply.append(com.toString()).append(System.lineSeparator()).append(System.lineSeparator());
}
return reply.toString();
} } | public class class_name {
public static String getHelpText(IBotCommand...botCommands) {
StringBuilder reply = new StringBuilder();
for (IBotCommand com : botCommands) {
reply.append(com.toString()).append(System.lineSeparator()).append(System.lineSeparator()); // depends on control dependency: [for], data = [com]
}
return reply.toString();
} } |
public class class_name {
public EList<GCFLTRG> getRg() {
if (rg == null) {
rg = new EObjectContainmentEList.Resolving<GCFLTRG>(GCFLTRG.class, this, AfplibPackage.GCFLT__RG);
}
return rg;
} } | public class class_name {
public EList<GCFLTRG> getRg() {
if (rg == null) {
rg = new EObjectContainmentEList.Resolving<GCFLTRG>(GCFLTRG.class, this, AfplibPackage.GCFLT__RG); // depends on control dependency: [if], data = [none]
}
return rg;
} } |
public class class_name {
public void marshall(DeleteIdentityPoolRequest deleteIdentityPoolRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteIdentityPoolRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteIdentityPoolRequest.getIdentityPoolId(), IDENTITYPOOLID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteIdentityPoolRequest deleteIdentityPoolRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteIdentityPoolRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteIdentityPoolRequest.getIdentityPoolId(), IDENTITYPOOLID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void updateInvocationStats(List<InvocationStat> snapshots) {
for (InvocationStat snapshot : snapshots) {
getInvocationStat(snapshot.getDimension()).update(snapshot);
}
} } | public class class_name {
public static void updateInvocationStats(List<InvocationStat> snapshots) {
for (InvocationStat snapshot : snapshots) {
getInvocationStat(snapshot.getDimension()).update(snapshot); // depends on control dependency: [for], data = [snapshot]
}
} } |
public class class_name {
public static void loadFirstAvailable(ClassLoader loader, String... names) {
List<Throwable> suppressed = new ArrayList<Throwable>();
for (String name : names) {
try {
load(name, loader);
return;
} catch (Throwable t) {
suppressed.add(t);
logger.debug("Unable to load the library '{}', trying next name...", name, t);
}
}
IllegalArgumentException iae =
new IllegalArgumentException("Failed to load any of the given libraries: " + Arrays.toString(names));
ThrowableUtil.addSuppressedAndClear(iae, suppressed);
throw iae;
} } | public class class_name {
public static void loadFirstAvailable(ClassLoader loader, String... names) {
List<Throwable> suppressed = new ArrayList<Throwable>();
for (String name : names) {
try {
load(name, loader); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
suppressed.add(t);
logger.debug("Unable to load the library '{}', trying next name...", name, t);
} // depends on control dependency: [catch], data = [none]
}
IllegalArgumentException iae =
new IllegalArgumentException("Failed to load any of the given libraries: " + Arrays.toString(names));
ThrowableUtil.addSuppressedAndClear(iae, suppressed);
throw iae;
} } |
public class class_name {
public FieldList setHandle(Object bookmark, int iHandleType) throws DBException
{
Record recMain = this.getRecord();
this.setCurrentTable(this.getNextTable());
FieldList record = super.setHandle(bookmark, iHandleType);
if (record == null)
{ // Not found in the main table, try the other tables
Iterator<BaseTable> iterator = this.getTables();
while (iterator.hasNext())
{
BaseTable table = iterator.next();
if ((table != null) && (table != this.getNextTable()))
{
Record recAlt = table.getRecord();
record = recAlt.setHandle(bookmark, iHandleType);
if (record != null)
{
this.syncRecordToBase(recMain, recAlt, false);
this.setCurrentTable(table);
break;
}
}
}
}
return record;
} } | public class class_name {
public FieldList setHandle(Object bookmark, int iHandleType) throws DBException
{
Record recMain = this.getRecord();
this.setCurrentTable(this.getNextTable());
FieldList record = super.setHandle(bookmark, iHandleType);
if (record == null)
{ // Not found in the main table, try the other tables
Iterator<BaseTable> iterator = this.getTables();
while (iterator.hasNext())
{
BaseTable table = iterator.next();
if ((table != null) && (table != this.getNextTable()))
{
Record recAlt = table.getRecord();
record = recAlt.setHandle(bookmark, iHandleType);
if (record != null)
{
this.syncRecordToBase(recMain, recAlt, false); // depends on control dependency: [if], data = [none]
this.setCurrentTable(table); // depends on control dependency: [if], data = [none]
break;
}
}
}
}
return record;
} } |
public class class_name {
private boolean tryElim(final int cand) {
assert var(cand).free();
final CLOccs p = occs(cand);
final CLOccs n = occs(-cand);
long limit = (long) p.count() + n.count();
for (int i = 0; limit >= 0 && i < p.clauses().size(); i++) {
final CLClause c = p.clauses().get(i);
assert !c.redundant();
this.stats.steps++;
if (c.dumped() || satisfied(c)) { continue; }
for (int j = 0; limit >= 0 && j < n.clauses().size(); j++) {
final CLClause d = n.clauses().get(j);
assert !d.redundant();
this.stats.steps++;
if (d.dumped() || satisfied(d)) { continue; }
if (tryResolve(c, cand, d)) { limit--; }
}
}
return limit >= 0;
} } | public class class_name {
private boolean tryElim(final int cand) {
assert var(cand).free();
final CLOccs p = occs(cand);
final CLOccs n = occs(-cand);
long limit = (long) p.count() + n.count();
for (int i = 0; limit >= 0 && i < p.clauses().size(); i++) {
final CLClause c = p.clauses().get(i);
assert !c.redundant(); // depends on control dependency: [for], data = [none] // depends on control dependency: [for], data = [none]
this.stats.steps++; // depends on control dependency: [for], data = [none]
if (c.dumped() || satisfied(c)) { continue; }
for (int j = 0; limit >= 0 && j < n.clauses().size(); j++) {
final CLClause d = n.clauses().get(j);
assert !d.redundant(); // depends on control dependency: [for], data = [none] // depends on control dependency: [for], data = [none]
this.stats.steps++; // depends on control dependency: [for], data = [none]
if (d.dumped() || satisfied(d)) { continue; }
if (tryResolve(c, cand, d)) { limit--; } // depends on control dependency: [if], data = [none]
}
}
return limit >= 0;
} } |
public class class_name {
static
public String trim(String string){
int length = string.length();
int trimmedLength = length;
while(trimmedLength > 0){
char c = string.charAt(trimmedLength - 1);
if(!Character.isWhitespace(c)){
break;
}
trimmedLength--;
}
if(trimmedLength < length){
string = string.substring(0, trimmedLength);
}
return string;
} } | public class class_name {
static
public String trim(String string){
int length = string.length();
int trimmedLength = length;
while(trimmedLength > 0){
char c = string.charAt(trimmedLength - 1);
if(!Character.isWhitespace(c)){
break;
}
trimmedLength--; // depends on control dependency: [while], data = [none]
}
if(trimmedLength < length){
string = string.substring(0, trimmedLength); // depends on control dependency: [if], data = [none]
}
return string;
} } |
public class class_name {
@Override
public void visit(final int version, final int access, final String name,
final String signature, final String superName,
final String[] interfaces) {
this.version = version;
this.access = access;
this.name = name;
this.signature = signature;
this.superName = superName;
if (interfaces != null) {
this.interfaces.addAll(Arrays.asList(interfaces));
}
} } | public class class_name {
@Override
public void visit(final int version, final int access, final String name,
final String signature, final String superName,
final String[] interfaces) {
this.version = version;
this.access = access;
this.name = name;
this.signature = signature;
this.superName = superName;
if (interfaces != null) {
this.interfaces.addAll(Arrays.asList(interfaces)); // depends on control dependency: [if], data = [(interfaces]
}
} } |
public class class_name {
static <E> List<E> toEntities(Class<E> entityClass, Entity[] nativeEntities) {
if (nativeEntities == null || nativeEntities.length == 0) {
return new ArrayList<>();
}
return toEntities(entityClass, Arrays.asList(nativeEntities));
} } | public class class_name {
static <E> List<E> toEntities(Class<E> entityClass, Entity[] nativeEntities) {
if (nativeEntities == null || nativeEntities.length == 0) {
return new ArrayList<>(); // depends on control dependency: [if], data = [none]
}
return toEntities(entityClass, Arrays.asList(nativeEntities));
} } |
public class class_name {
public void marshall(ListWebhooksRequest listWebhooksRequest, ProtocolMarshaller protocolMarshaller) {
if (listWebhooksRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listWebhooksRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listWebhooksRequest.getMaxResults(), MAXRESULTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListWebhooksRequest listWebhooksRequest, ProtocolMarshaller protocolMarshaller) {
if (listWebhooksRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listWebhooksRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listWebhooksRequest.getMaxResults(), MAXRESULTS_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 static Path normalizePath(Path path) {
URI uri = path.toUri();
if (uri.getScheme() == null) {
try {
uri = new URI("file", uri.getHost(), uri.getPath(), uri.getFragment());
path = new Path(uri.toString());
} catch (URISyntaxException e) {
throw new IllegalArgumentException("path is invalid", e);
}
}
return path;
} } | public class class_name {
private static Path normalizePath(Path path) {
URI uri = path.toUri();
if (uri.getScheme() == null) {
try {
uri = new URI("file", uri.getHost(), uri.getPath(), uri.getFragment()); // depends on control dependency: [try], data = [none]
path = new Path(uri.toString()); // depends on control dependency: [try], data = [none]
} catch (URISyntaxException e) {
throw new IllegalArgumentException("path is invalid", e);
} // depends on control dependency: [catch], data = [none]
}
return path;
} } |
public class class_name {
public Map<K, V> getMap() {
if (mode == StorageMode.LIST) {
synchronized (this) {
if (mode == StorageMode.LIST) {
mapData = convertListToMap(listData);
mode = StorageMode.BOTH;
}
}
}
return Collections.unmodifiableMap(mapData);
} } | public class class_name {
public Map<K, V> getMap() {
if (mode == StorageMode.LIST) {
synchronized (this) { // depends on control dependency: [if], data = [none]
if (mode == StorageMode.LIST) {
mapData = convertListToMap(listData); // depends on control dependency: [if], data = [none]
mode = StorageMode.BOTH; // depends on control dependency: [if], data = [none]
}
}
}
return Collections.unmodifiableMap(mapData);
} } |
public class class_name {
int handleNumbers(String line, BitSet numberBitSet, int startingPoint) {
int end = startingPoint + 1;
while (end < line.length() && Character.isDigit(line.charAt(end))) {
end++;
}
if (end == line.length()) {
if (Character.isDigit(line.charAt(line.length() - 1))) {
numberBitSet.set(startingPoint, end);
}
} else if (Character.isWhitespace(line.charAt(end))
|| line.charAt(end) == ';'
|| line.charAt(end) == ','
|| line.charAt(end) == '='
|| line.charAt(end) == '<'
|| line.charAt(end) == '>'
|| line.charAt(end) == '-'
|| line.charAt(end) == '+'
|| line.charAt(end) == '/'
|| line.charAt(end) == ')'
|| line.charAt(end) == '%'
|| line.charAt(end) == '*'
|| line.charAt(end) == '!'
|| line.charAt(end) == '^'
|| line.charAt(end) == '|'
|| line.charAt(end) == '&'
|| line.charAt(end) == ']') {
numberBitSet.set(startingPoint, end);
}
startingPoint = end - 1;
return startingPoint;
} } | public class class_name {
int handleNumbers(String line, BitSet numberBitSet, int startingPoint) {
int end = startingPoint + 1;
while (end < line.length() && Character.isDigit(line.charAt(end))) {
end++; // depends on control dependency: [while], data = [none]
}
if (end == line.length()) {
if (Character.isDigit(line.charAt(line.length() - 1))) {
numberBitSet.set(startingPoint, end); // depends on control dependency: [if], data = [none]
}
} else if (Character.isWhitespace(line.charAt(end))
|| line.charAt(end) == ';'
|| line.charAt(end) == ','
|| line.charAt(end) == '='
|| line.charAt(end) == '<'
|| line.charAt(end) == '>'
|| line.charAt(end) == '-'
|| line.charAt(end) == '+'
|| line.charAt(end) == '/'
|| line.charAt(end) == ')'
|| line.charAt(end) == '%'
|| line.charAt(end) == '*'
|| line.charAt(end) == '!'
|| line.charAt(end) == '^'
|| line.charAt(end) == '|'
|| line.charAt(end) == '&'
|| line.charAt(end) == ']') {
numberBitSet.set(startingPoint, end); // depends on control dependency: [if], data = [none]
}
startingPoint = end - 1;
return startingPoint;
} } |
public class class_name {
public boolean isSecureLink(CmsObject cms, String vfsName, boolean fromSecure) {
if (!cms.getRequestContext().getCurrentProject().isOnlineProject()) {
return false;
}
String cacheKey = OpenCms.getStaticExportManager().getCacheKey(cms.getRequestContext().getSiteRoot(), vfsName);
String secureResource = OpenCms.getStaticExportManager().getCacheSecureLinks().get(cacheKey);
if (secureResource == null) {
CmsObject cmsForReadingProperties = cms;
try {
// the link target resource may not be readable by the current user, so we use a CmsObject with admin permissions
// to read the "secure" property
CmsObject adminCms = OpenCms.initCmsObject(m_adminCms);
adminCms.getRequestContext().setSiteRoot(cms.getRequestContext().getSiteRoot());
adminCms.getRequestContext().setCurrentProject(cms.getRequestContext().getCurrentProject());
adminCms.getRequestContext().setRequestTime(cms.getRequestContext().getRequestTime());
cmsForReadingProperties = adminCms;
} catch (Exception e) {
LOG.error("Could not initialize CmsObject in isSecureLink:" + e.getLocalizedMessage(), e);
}
try {
secureResource = cmsForReadingProperties.readPropertyObject(
vfsName,
CmsPropertyDefinition.PROPERTY_SECURE,
true).getValue();
if (CmsStringUtil.isEmptyOrWhitespaceOnly(secureResource)) {
secureResource = "false";
}
// only cache result if read was successfull
OpenCms.getStaticExportManager().getCacheSecureLinks().put(cacheKey, secureResource);
} catch (CmsVfsResourceNotFoundException e) {
secureResource = SECURE_PROPERTY_VALUE_BOTH;
OpenCms.getStaticExportManager().getCacheSecureLinks().put(cacheKey, secureResource);
} catch (Exception e) {
// no secure link required (probably security issues, e.g. no access for current user)
// however other users may be allowed to read the resource, so the result can't be cached
return false;
}
}
return Boolean.parseBoolean(secureResource)
|| (fromSecure && SECURE_PROPERTY_VALUE_BOTH.equals(secureResource));
} } | public class class_name {
public boolean isSecureLink(CmsObject cms, String vfsName, boolean fromSecure) {
if (!cms.getRequestContext().getCurrentProject().isOnlineProject()) {
return false; // depends on control dependency: [if], data = [none]
}
String cacheKey = OpenCms.getStaticExportManager().getCacheKey(cms.getRequestContext().getSiteRoot(), vfsName);
String secureResource = OpenCms.getStaticExportManager().getCacheSecureLinks().get(cacheKey);
if (secureResource == null) {
CmsObject cmsForReadingProperties = cms;
try {
// the link target resource may not be readable by the current user, so we use a CmsObject with admin permissions
// to read the "secure" property
CmsObject adminCms = OpenCms.initCmsObject(m_adminCms);
adminCms.getRequestContext().setSiteRoot(cms.getRequestContext().getSiteRoot()); // depends on control dependency: [try], data = [none]
adminCms.getRequestContext().setCurrentProject(cms.getRequestContext().getCurrentProject()); // depends on control dependency: [try], data = [none]
adminCms.getRequestContext().setRequestTime(cms.getRequestContext().getRequestTime()); // depends on control dependency: [try], data = [none]
cmsForReadingProperties = adminCms; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.error("Could not initialize CmsObject in isSecureLink:" + e.getLocalizedMessage(), e);
} // depends on control dependency: [catch], data = [none]
try {
secureResource = cmsForReadingProperties.readPropertyObject(
vfsName,
CmsPropertyDefinition.PROPERTY_SECURE,
true).getValue(); // depends on control dependency: [try], data = [none]
if (CmsStringUtil.isEmptyOrWhitespaceOnly(secureResource)) {
secureResource = "false"; // depends on control dependency: [if], data = [none]
}
// only cache result if read was successfull
OpenCms.getStaticExportManager().getCacheSecureLinks().put(cacheKey, secureResource); // depends on control dependency: [try], data = [none]
} catch (CmsVfsResourceNotFoundException e) {
secureResource = SECURE_PROPERTY_VALUE_BOTH;
OpenCms.getStaticExportManager().getCacheSecureLinks().put(cacheKey, secureResource);
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
// no secure link required (probably security issues, e.g. no access for current user)
// however other users may be allowed to read the resource, so the result can't be cached
return false;
} // depends on control dependency: [catch], data = [none]
}
return Boolean.parseBoolean(secureResource)
|| (fromSecure && SECURE_PROPERTY_VALUE_BOTH.equals(secureResource));
} } |
public class class_name {
protected void handleNotSignedIn(final Activity context, SocialNetworkPostListener listener) {
String msg = "Not signed into Facebook";
if(listener != null) {
listener.onNetworkError(context, SocialNetwork.FACEBOOK, new SocializeException(msg));
}
else {
handleNonListenerError(msg, new SocializeException(msg));
}
} } | public class class_name {
protected void handleNotSignedIn(final Activity context, SocialNetworkPostListener listener) {
String msg = "Not signed into Facebook";
if(listener != null) {
listener.onNetworkError(context, SocialNetwork.FACEBOOK, new SocializeException(msg)); // depends on control dependency: [if], data = [none]
}
else {
handleNonListenerError(msg, new SocializeException(msg)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("PMD.LawOfDemeter")
public byte[] decrypt(final byte[] cipherText, final IvParameterSpec initializationVector) {
try {
final Cipher cipher = Cipher.getInstance(getCipherTransformation());
cipher.init(DECRYPT_MODE, getEncryptionKeySpec(), initializationVector);
return cipher.doFinal(cipherText);
} catch (final NoSuchAlgorithmException | NoSuchPaddingException
| InvalidKeyException | InvalidAlgorithmParameterException | IllegalBlockSizeException e) {
// this should not happen as we use an algorithm (AES) and padding
// (PKCS5) that are guaranteed to exist.
// in addition, we validate the encryption key and initialization vector up front
throw new IllegalStateException(e.getMessage(), e);
} catch (final BadPaddingException bpe) {
throw new TokenValidationException("Invalid padding in token: " + bpe.getMessage(), bpe);
}
} } | public class class_name {
@SuppressWarnings("PMD.LawOfDemeter")
public byte[] decrypt(final byte[] cipherText, final IvParameterSpec initializationVector) {
try {
final Cipher cipher = Cipher.getInstance(getCipherTransformation());
cipher.init(DECRYPT_MODE, getEncryptionKeySpec(), initializationVector); // depends on control dependency: [try], data = [none]
return cipher.doFinal(cipherText); // depends on control dependency: [try], data = [none]
} catch (final NoSuchAlgorithmException | NoSuchPaddingException
| InvalidKeyException | InvalidAlgorithmParameterException | IllegalBlockSizeException e) {
// this should not happen as we use an algorithm (AES) and padding
// (PKCS5) that are guaranteed to exist.
// in addition, we validate the encryption key and initialization vector up front
throw new IllegalStateException(e.getMessage(), e);
} catch (final BadPaddingException bpe) { // depends on control dependency: [catch], data = [none]
throw new TokenValidationException("Invalid padding in token: " + bpe.getMessage(), bpe);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected void init() {
for (int i = 0; i < config.getFilter().getInclusions().size(); i++) {
inclusions.add(Pattern.compile(config.getFilter().getInclusions().get(i)).asPredicate());
}
for (int i = 0; i < config.getFilter().getExclusions().size(); i++) {
exclusions.add(Pattern.compile(config.getFilter().getExclusions().get(i)).asPredicate());
}
} } | public class class_name {
protected void init() {
for (int i = 0; i < config.getFilter().getInclusions().size(); i++) {
inclusions.add(Pattern.compile(config.getFilter().getInclusions().get(i)).asPredicate()); // depends on control dependency: [for], data = [i]
}
for (int i = 0; i < config.getFilter().getExclusions().size(); i++) {
exclusions.add(Pattern.compile(config.getFilter().getExclusions().get(i)).asPredicate()); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
static void insertEmptyFlag(final WritableMemory wmem, final boolean empty) {
int flags = wmem.getByte(FLAGS_BYTE);
if (empty) { flags |= EMPTY_FLAG_MASK; }
else { flags &= ~EMPTY_FLAG_MASK; }
wmem.putByte(FLAGS_BYTE, (byte) flags);
} } | public class class_name {
static void insertEmptyFlag(final WritableMemory wmem, final boolean empty) {
int flags = wmem.getByte(FLAGS_BYTE);
if (empty) { flags |= EMPTY_FLAG_MASK; } // depends on control dependency: [if], data = [none]
else { flags &= ~EMPTY_FLAG_MASK; } // depends on control dependency: [if], data = [none]
wmem.putByte(FLAGS_BYTE, (byte) flags);
} } |
public class class_name {
public static CompoundSecMech getMatchingSecurityMech(ClientRequestInfo ri, Codec codec, short clientSupports,
short clientRequires) {
CompoundSecMechList csmList;
try {
TaggedComponent tc = ri.get_effective_component(org.omg.IOP.TAG_CSI_SEC_MECH_LIST.value);
Any any = codec.decode_value(tc.component_data, CompoundSecMechListHelper.type());
csmList = CompoundSecMechListHelper.extract(any);
// look for the first matching security mech.
for (int i = 0; i < csmList.mechanism_list.length; i++) {
CompoundSecMech securityMech = csmList.mechanism_list[i];
AS_ContextSec authConfig = securityMech.as_context_mech;
if ((EstablishTrustInTarget.value & (clientRequires ^ authConfig.target_supports)
& ~authConfig.target_supports) != 0) {
// client requires EstablishTrustInTarget, but target does not support it: skip this securityMech.
continue;
}
if ((EstablishTrustInClient.value & (authConfig.target_requires ^ clientSupports)
& ~clientSupports) != 0) {
// target requires EstablishTrustInClient, but client does not support it: skip this securityMech.
continue;
}
SAS_ContextSec identityConfig = securityMech.sas_context_mech;
if ((IdentityAssertion.value & (identityConfig.target_requires ^ clientSupports)
& ~clientSupports) != 0) {
// target requires IdentityAssertion, but client does not support it: skip this securityMech
continue;
}
// found matching securityMech.
return securityMech;
}
// no matching securityMech was found.
return null;
} catch (BAD_PARAM e) {
// no component with TAG_CSI_SEC_MECH_LIST was found.
return null;
} catch (org.omg.IOP.CodecPackage.TypeMismatch e) {
// unexpected exception in codec
throw IIOPLogger.ROOT_LOGGER.unexpectedException(e);
} catch (org.omg.IOP.CodecPackage.FormatMismatch e) {
// unexpected exception in codec
throw IIOPLogger.ROOT_LOGGER.unexpectedException(e);
}
} } | public class class_name {
public static CompoundSecMech getMatchingSecurityMech(ClientRequestInfo ri, Codec codec, short clientSupports,
short clientRequires) {
CompoundSecMechList csmList;
try {
TaggedComponent tc = ri.get_effective_component(org.omg.IOP.TAG_CSI_SEC_MECH_LIST.value);
Any any = codec.decode_value(tc.component_data, CompoundSecMechListHelper.type());
csmList = CompoundSecMechListHelper.extract(any); // depends on control dependency: [try], data = [none]
// look for the first matching security mech.
for (int i = 0; i < csmList.mechanism_list.length; i++) {
CompoundSecMech securityMech = csmList.mechanism_list[i];
AS_ContextSec authConfig = securityMech.as_context_mech;
if ((EstablishTrustInTarget.value & (clientRequires ^ authConfig.target_supports)
& ~authConfig.target_supports) != 0) {
// client requires EstablishTrustInTarget, but target does not support it: skip this securityMech.
continue;
}
if ((EstablishTrustInClient.value & (authConfig.target_requires ^ clientSupports)
& ~clientSupports) != 0) {
// target requires EstablishTrustInClient, but client does not support it: skip this securityMech.
continue;
}
SAS_ContextSec identityConfig = securityMech.sas_context_mech;
if ((IdentityAssertion.value & (identityConfig.target_requires ^ clientSupports)
& ~clientSupports) != 0) {
// target requires IdentityAssertion, but client does not support it: skip this securityMech
continue;
}
// found matching securityMech.
return securityMech; // depends on control dependency: [for], data = [none]
}
// no matching securityMech was found.
return null; // depends on control dependency: [try], data = [none]
} catch (BAD_PARAM e) {
// no component with TAG_CSI_SEC_MECH_LIST was found.
return null;
} catch (org.omg.IOP.CodecPackage.TypeMismatch e) { // depends on control dependency: [catch], data = [none]
// unexpected exception in codec
throw IIOPLogger.ROOT_LOGGER.unexpectedException(e);
} catch (org.omg.IOP.CodecPackage.FormatMismatch e) { // depends on control dependency: [catch], data = [none]
// unexpected exception in codec
throw IIOPLogger.ROOT_LOGGER.unexpectedException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void recognition(List<Vertex> segResult, WordNet wordNetOptimum, WordNet wordNetAll)
{
StringBuilder sbName = new StringBuilder();
int appendTimes = 0;
ListIterator<Vertex> listIterator = segResult.listIterator();
listIterator.next();
int line = 1;
int activeLine = 1;
while (listIterator.hasNext())
{
Vertex vertex = listIterator.next();
if (appendTimes > 0)
{
if (vertex.guessNature() == Nature.nrf || TranslatedPersonDictionary.containsKey(vertex.realWord))
{
sbName.append(vertex.realWord);
++appendTimes;
}
else
{
// 识别结束
if (appendTimes > 1)
{
if (HanLP.Config.DEBUG)
{
System.out.println("音译人名识别出:" + sbName.toString());
}
wordNetOptimum.insert(activeLine, new Vertex(Predefine.TAG_PEOPLE, sbName.toString(), new CoreDictionary.Attribute(Nature.nrf), WORD_ID), wordNetAll);
}
sbName.setLength(0);
appendTimes = 0;
}
}
else
{
// nrf触发识别
if (vertex.guessNature() == Nature.nrf
// || TranslatedPersonDictionary.containsKey(vertex.realWord)
)
{
sbName.append(vertex.realWord);
++appendTimes;
activeLine = line;
}
}
line += vertex.realWord.length();
}
} } | public class class_name {
public static void recognition(List<Vertex> segResult, WordNet wordNetOptimum, WordNet wordNetAll)
{
StringBuilder sbName = new StringBuilder();
int appendTimes = 0;
ListIterator<Vertex> listIterator = segResult.listIterator();
listIterator.next();
int line = 1;
int activeLine = 1;
while (listIterator.hasNext())
{
Vertex vertex = listIterator.next();
if (appendTimes > 0)
{
if (vertex.guessNature() == Nature.nrf || TranslatedPersonDictionary.containsKey(vertex.realWord))
{
sbName.append(vertex.realWord); // depends on control dependency: [if], data = [none]
++appendTimes; // depends on control dependency: [if], data = [none]
}
else
{
// 识别结束
if (appendTimes > 1)
{
if (HanLP.Config.DEBUG)
{
System.out.println("音译人名识别出:" + sbName.toString()); // depends on control dependency: [if], data = [none]
}
wordNetOptimum.insert(activeLine, new Vertex(Predefine.TAG_PEOPLE, sbName.toString(), new CoreDictionary.Attribute(Nature.nrf), WORD_ID), wordNetAll); // depends on control dependency: [if], data = [none]
}
sbName.setLength(0); // depends on control dependency: [if], data = [none]
appendTimes = 0; // depends on control dependency: [if], data = [none]
}
}
else
{
// nrf触发识别
if (vertex.guessNature() == Nature.nrf
// || TranslatedPersonDictionary.containsKey(vertex.realWord)
)
{
sbName.append(vertex.realWord); // depends on control dependency: [if], data = [(verte]
++appendTimes; // depends on control dependency: [if], data = [none]
activeLine = line; // depends on control dependency: [if], data = [none]
}
}
line += vertex.realWord.length(); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
public static List<Relation<?>> getRelations(Result r) {
if(r instanceof Relation<?>) {
List<Relation<?>> anns = new ArrayList<>(1);
anns.add((Relation<?>) r);
return anns;
}
if(r instanceof HierarchicalResult) {
return filterResults(((HierarchicalResult) r).getHierarchy(), r, Relation.class);
}
return Collections.emptyList();
} } | public class class_name {
public static List<Relation<?>> getRelations(Result r) {
if(r instanceof Relation<?>) {
List<Relation<?>> anns = new ArrayList<>(1); // depends on control dependency: [if], data = [)]
anns.add((Relation<?>) r); // depends on control dependency: [if], data = [)]
return anns; // depends on control dependency: [if], data = [none]
}
if(r instanceof HierarchicalResult) {
return filterResults(((HierarchicalResult) r).getHierarchy(), r, Relation.class); // depends on control dependency: [if], data = [none]
}
return Collections.emptyList();
} } |
public class class_name {
public List<JavaResource> getProjectClasses(Project project)
{
final List<JavaResource> classes = new ArrayList<>();
if (project != null)
{
project.getFacet(JavaSourceFacet.class).visitJavaSources(new JavaClassSourceVisitor(classes));
}
return classes;
} } | public class class_name {
public List<JavaResource> getProjectClasses(Project project)
{
final List<JavaResource> classes = new ArrayList<>();
if (project != null)
{
project.getFacet(JavaSourceFacet.class).visitJavaSources(new JavaClassSourceVisitor(classes)); // depends on control dependency: [if], data = [none]
}
return classes;
} } |
public class class_name {
@Override
public void visit(NodeVisitor v) {
if (v.visit(this)) {
target.visit(v);
element.visit(v);
}
} } | public class class_name {
@Override
public void visit(NodeVisitor v) {
if (v.visit(this)) {
target.visit(v); // depends on control dependency: [if], data = [none]
element.visit(v); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
LedgerMetadata getLedger(long ledgerId) {
int index = getLedgerMetadataIndex(ledgerId);
if (index >= 0) {
return this.ledgers.get(index);
}
return null;
} } | public class class_name {
LedgerMetadata getLedger(long ledgerId) {
int index = getLedgerMetadataIndex(ledgerId);
if (index >= 0) {
return this.ledgers.get(index); // depends on control dependency: [if], data = [(index]
}
return null;
} } |
public class class_name {
JPAEMPool getEntityManagerPool(J2EEName j2eeName,
String refName,
Map<?, ?> properties) {
JPAEMPool emPool = null;
String poolKey = j2eeName.toString() + "#" + refName;
synchronized (ivEMPoolMap) {
emPool = ivEMPoolMap.get(poolKey);
if (emPool == null) {
EntityManagerFactory emf = getEntityManagerFactory(j2eeName);
emPool = new JPAEMPool(emf, properties, ivEMPoolCapacity, this, getJPAComponent()); //d638095.1, d743325
ivEMPoolMap.put(poolKey, emPool);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getEntityManagerPool : " + poolKey + " : " + emPool);
return emPool;
} } | public class class_name {
JPAEMPool getEntityManagerPool(J2EEName j2eeName,
String refName,
Map<?, ?> properties) {
JPAEMPool emPool = null;
String poolKey = j2eeName.toString() + "#" + refName;
synchronized (ivEMPoolMap) {
emPool = ivEMPoolMap.get(poolKey);
if (emPool == null) {
EntityManagerFactory emf = getEntityManagerFactory(j2eeName);
emPool = new JPAEMPool(emf, properties, ivEMPoolCapacity, this, getJPAComponent()); //d638095.1, d743325 // depends on control dependency: [if], data = [none]
ivEMPoolMap.put(poolKey, emPool); // depends on control dependency: [if], data = [none]
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getEntityManagerPool : " + poolKey + " : " + emPool);
return emPool;
} } |
public class class_name {
protected static String getWatermarkFromPreviousWorkUnits(SourceState state, String watermark) {
if (state.getPreviousWorkUnitStates().isEmpty()) {
return ComplianceConfigurationKeys.NO_PREVIOUS_WATERMARK;
}
return state.getPreviousWorkUnitStates().get(0)
.getProp(watermark, ComplianceConfigurationKeys.NO_PREVIOUS_WATERMARK);
} } | public class class_name {
protected static String getWatermarkFromPreviousWorkUnits(SourceState state, String watermark) {
if (state.getPreviousWorkUnitStates().isEmpty()) {
return ComplianceConfigurationKeys.NO_PREVIOUS_WATERMARK; // depends on control dependency: [if], data = [none]
}
return state.getPreviousWorkUnitStates().get(0)
.getProp(watermark, ComplianceConfigurationKeys.NO_PREVIOUS_WATERMARK);
} } |
public class class_name {
public void setMessageControlClassification(String value) {
if (value != null) {
getHdr2().setField(JsHdr2Access.MESSAGECONTROLCLASSIFICATION_DATA, value);
}
else {
getHdr2().setChoiceField(JsHdr2Access.MESSAGECONTROLCLASSIFICATION, JsHdr2Access.IS_MESSAGECONTROLCLASSIFICATION_EMPTY);
}
} } | public class class_name {
public void setMessageControlClassification(String value) {
if (value != null) {
getHdr2().setField(JsHdr2Access.MESSAGECONTROLCLASSIFICATION_DATA, value); // depends on control dependency: [if], data = [none]
}
else {
getHdr2().setChoiceField(JsHdr2Access.MESSAGECONTROLCLASSIFICATION, JsHdr2Access.IS_MESSAGECONTROLCLASSIFICATION_EMPTY); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Locale getLocaleFromPath(String sitePath) {
Locale result = null;
if (sitePath.indexOf("/") == 0) {
sitePath = sitePath.substring(1);
}
if (sitePath.length() > 1) {
String localePrefix;
if (!sitePath.contains("/")) {
// this may be the case for paths pointing to the root folder of a site
// check for parameters
int separator = -1;
int param = sitePath.indexOf("?");
int hash = sitePath.indexOf("#");
if (param >= 0) {
if (hash != 0) {
separator = param < hash ? param : hash;
} else {
separator = param;
}
} else {
separator = hash;
}
if (separator >= 0) {
localePrefix = sitePath.substring(0, separator);
} else {
localePrefix = sitePath;
}
} else {
localePrefix = sitePath.substring(0, sitePath.indexOf("/"));
}
Locale locale = CmsLocaleManager.getLocale(localePrefix);
if (localePrefix.equals(locale.toString())
&& OpenCms.getLocaleManager().getAvailableLocales().contains(locale)) {
result = locale;
}
}
return result;
} } | public class class_name {
public static Locale getLocaleFromPath(String sitePath) {
Locale result = null;
if (sitePath.indexOf("/") == 0) {
sitePath = sitePath.substring(1); // depends on control dependency: [if], data = [none]
}
if (sitePath.length() > 1) {
String localePrefix;
if (!sitePath.contains("/")) {
// this may be the case for paths pointing to the root folder of a site
// check for parameters
int separator = -1;
int param = sitePath.indexOf("?");
int hash = sitePath.indexOf("#");
if (param >= 0) {
if (hash != 0) {
separator = param < hash ? param : hash; // depends on control dependency: [if], data = [none]
} else {
separator = param; // depends on control dependency: [if], data = [none]
}
} else {
separator = hash; // depends on control dependency: [if], data = [none]
}
if (separator >= 0) {
localePrefix = sitePath.substring(0, separator); // depends on control dependency: [if], data = [none]
} else {
localePrefix = sitePath; // depends on control dependency: [if], data = [none]
}
} else {
localePrefix = sitePath.substring(0, sitePath.indexOf("/")); // depends on control dependency: [if], data = [none]
}
Locale locale = CmsLocaleManager.getLocale(localePrefix);
if (localePrefix.equals(locale.toString())
&& OpenCms.getLocaleManager().getAvailableLocales().contains(locale)) {
result = locale; // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
@Override
public boolean start()
{
if (! _lifecycle.toStarting()) {
return false;
}
log.isLoggable(Level.FINER);
String name = "resin-nio-select-manager-" + _gId++;
_thread = new Thread(this, name);
_thread.setDaemon(true);
_thread.start();
_lifecycle.waitForActive(2000);
if (log.isLoggable(Level.FINER))
log.finer(this + " active");
log.fine("Non-blocking keepalive enabled with max sockets = "
+ _selectMax);
return true;
} } | public class class_name {
@Override
public boolean start()
{
if (! _lifecycle.toStarting()) {
return false; // depends on control dependency: [if], data = [none]
}
log.isLoggable(Level.FINER);
String name = "resin-nio-select-manager-" + _gId++;
_thread = new Thread(this, name);
_thread.setDaemon(true);
_thread.start();
_lifecycle.waitForActive(2000);
if (log.isLoggable(Level.FINER))
log.finer(this + " active");
log.fine("Non-blocking keepalive enabled with max sockets = "
+ _selectMax);
return true;
} } |
public class class_name {
public CreateDBClusterEndpointRequest withStaticMembers(String... staticMembers) {
if (this.staticMembers == null) {
setStaticMembers(new com.amazonaws.internal.SdkInternalList<String>(staticMembers.length));
}
for (String ele : staticMembers) {
this.staticMembers.add(ele);
}
return this;
} } | public class class_name {
public CreateDBClusterEndpointRequest withStaticMembers(String... staticMembers) {
if (this.staticMembers == null) {
setStaticMembers(new com.amazonaws.internal.SdkInternalList<String>(staticMembers.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : staticMembers) {
this.staticMembers.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static PeriodType standard() {
PeriodType type = cStandard;
if (type == null) {
type = new PeriodType(
"Standard",
new DurationFieldType[] {
DurationFieldType.years(), DurationFieldType.months(),
DurationFieldType.weeks(), DurationFieldType.days(),
DurationFieldType.hours(), DurationFieldType.minutes(),
DurationFieldType.seconds(), DurationFieldType.millis(),
},
new int[] { 0, 1, 2, 3, 4, 5, 6, 7, }
);
cStandard = type;
}
return type;
} } | public class class_name {
public static PeriodType standard() {
PeriodType type = cStandard;
if (type == null) {
type = new PeriodType(
"Standard",
new DurationFieldType[] {
DurationFieldType.years(), DurationFieldType.months(),
DurationFieldType.weeks(), DurationFieldType.days(),
DurationFieldType.hours(), DurationFieldType.minutes(),
DurationFieldType.seconds(), DurationFieldType.millis(),
},
new int[] { 0, 1, 2, 3, 4, 5, 6, 7, }
); // depends on control dependency: [if], data = [none]
cStandard = type; // depends on control dependency: [if], data = [none]
}
return type;
} } |
public class class_name {
@Override
public void complete(com.ibm.wsspi.channelfw.VirtualConnection vc, com.ibm.wsspi.tcpchannel.TCPWriteRequestContext wsc) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "complete called : " + vc + "WriteListener enabled: " + this._wl);
synchronized(_upgradeOut) {
if (null == vc) {
return;
}
if (_upgradeOut.getBufferHelper().isOutputStream_closed()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "complete , outputStream closed ignoring complete : " + vc);
return;
}
// clean up any request state we had on this thread.
WebContainerRequestState reqState = WebContainerRequestState.getInstance(true);
reqState.init();
try{
_upgradeOut.getBufferHelper().writeRemainingToBuffers();
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
Tr.debug(tc, "exception during writeBuffers" + e.toString());
}
this.error(vc, e);
return;
}
// rest must be written now ,
// this case will only be true if write which went aysnc was
// from println, now we have to write crlf
if ( _upgradeOut.getBufferHelper().isInternalReady() && _upgradeOut.getBufferHelper().write_crlf_pending) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "write CRLF bytes , WriteListener enabled: " + this._wl);
try {
reqState.setAttribute("com.ibm.ws.webcontainer.upgrade.WriteAllowedonThisThread", true);
reqState.setAttribute("com.ibm.ws.webcontainer.upgrade.CRLFWriteinPorgress", true);
_upgradeOut.getBufferHelper().writeCRLFIfNeeded();
} catch (IOException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, " Exception during write CRLF bytes: " + e);
_upgradeOut.getBufferHelper().write_crlf_pending = false;
this.error(vc, e);
return;
}
}
if( _upgradeOut.getBufferHelper().isInternalReady()){
WebContainerRequestState.getInstance(true).setAttribute("com.ibm.ws.webcontainer.upgrade.WriteAllowedonThisThread", true);
_upgradeOut.getBufferHelper().setReadyForApp(true);
// if close was in progress
if(_upgradeOut.getBufferHelper().isOutputStream_close_initiated_but_not_Flush_ready()){
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
Tr.debug(tc, "complete , In process of closing outputStream, no more data is left to write, call close");
}
try {
if(_upCon.isOutputStream_CloseStartedFromWC()){
//at this point inputstream and handler are already closed
_upCon.closeOutputandConnection();
}
else{
_upgradeOut.close();
}
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "complete , stack exception" + e.toString());
this.error(vc, e);
}
}// no close in progress now check if onWP needs to be called.
else{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
Tr.debug(tc, "WriteListener enabled: " + this._wl + " ,status_not_ready_checked -->" + _upgradeOut.getBufferHelper().status_not_ready_checked);
}
if (_upgradeOut.getBufferHelper().status_not_ready_checked) {
try{
_upgradeOut.getBufferHelper().status_not_ready_checked = false;
// Push the original thread's context onto the current thread,
// also save off the current thread's context
_contextManager.pushContextData();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
Tr.debug(tc, "Calling user's WriteListener onWritePossible");
}
// Call into the user's WriteListener to indicate more data cane
// be written
_wl.onWritePossible();
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
Tr.debug(tc, "stack exception" + e.toString());
}
this.error(vc, e);
} finally {
// Revert back to the thread's current context
_contextManager.popContextData();
}
}
else{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
Tr.debug(tc, "WriteListener enabled: "
+ this._wl + " .onWritePossible will be skipped as isReady has not been checked since write went async.");
}
}
}
}
}
} } | public class class_name {
@Override
public void complete(com.ibm.wsspi.channelfw.VirtualConnection vc, com.ibm.wsspi.tcpchannel.TCPWriteRequestContext wsc) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "complete called : " + vc + "WriteListener enabled: " + this._wl);
synchronized(_upgradeOut) {
if (null == vc) {
return; // depends on control dependency: [if], data = [none]
}
if (_upgradeOut.getBufferHelper().isOutputStream_closed()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "complete , outputStream closed ignoring complete : " + vc);
return; // depends on control dependency: [if], data = [none]
}
// clean up any request state we had on this thread.
WebContainerRequestState reqState = WebContainerRequestState.getInstance(true);
reqState.init();
try{
_upgradeOut.getBufferHelper().writeRemainingToBuffers(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
Tr.debug(tc, "exception during writeBuffers" + e.toString()); // depends on control dependency: [if], data = [none]
}
this.error(vc, e);
return;
} // depends on control dependency: [catch], data = [none]
// rest must be written now ,
// this case will only be true if write which went aysnc was
// from println, now we have to write crlf
if ( _upgradeOut.getBufferHelper().isInternalReady() && _upgradeOut.getBufferHelper().write_crlf_pending) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "write CRLF bytes , WriteListener enabled: " + this._wl);
try {
reqState.setAttribute("com.ibm.ws.webcontainer.upgrade.WriteAllowedonThisThread", true); // depends on control dependency: [try], data = [none]
reqState.setAttribute("com.ibm.ws.webcontainer.upgrade.CRLFWriteinPorgress", true); // depends on control dependency: [try], data = [none]
_upgradeOut.getBufferHelper().writeCRLFIfNeeded(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, " Exception during write CRLF bytes: " + e);
_upgradeOut.getBufferHelper().write_crlf_pending = false;
this.error(vc, e);
return;
} // depends on control dependency: [catch], data = [none]
}
if( _upgradeOut.getBufferHelper().isInternalReady()){
WebContainerRequestState.getInstance(true).setAttribute("com.ibm.ws.webcontainer.upgrade.WriteAllowedonThisThread", true); // depends on control dependency: [if], data = [none]
_upgradeOut.getBufferHelper().setReadyForApp(true); // depends on control dependency: [if], data = [none]
// if close was in progress
if(_upgradeOut.getBufferHelper().isOutputStream_close_initiated_but_not_Flush_ready()){
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
Tr.debug(tc, "complete , In process of closing outputStream, no more data is left to write, call close"); // depends on control dependency: [if], data = [none]
}
try {
if(_upCon.isOutputStream_CloseStartedFromWC()){
//at this point inputstream and handler are already closed
_upCon.closeOutputandConnection(); // depends on control dependency: [if], data = [none]
}
else{
_upgradeOut.close(); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "complete , stack exception" + e.toString());
this.error(vc, e);
} // depends on control dependency: [catch], data = [none]
}// no close in progress now check if onWP needs to be called.
else{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
Tr.debug(tc, "WriteListener enabled: " + this._wl + " ,status_not_ready_checked -->" + _upgradeOut.getBufferHelper().status_not_ready_checked); // depends on control dependency: [if], data = [none]
}
if (_upgradeOut.getBufferHelper().status_not_ready_checked) {
try{
_upgradeOut.getBufferHelper().status_not_ready_checked = false; // depends on control dependency: [try], data = [none]
// Push the original thread's context onto the current thread,
// also save off the current thread's context
_contextManager.pushContextData(); // depends on control dependency: [try], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
Tr.debug(tc, "Calling user's WriteListener onWritePossible"); // depends on control dependency: [if], data = [none]
}
// Call into the user's WriteListener to indicate more data cane
// be written
_wl.onWritePossible(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
Tr.debug(tc, "stack exception" + e.toString()); // depends on control dependency: [if], data = [none]
}
this.error(vc, e);
} finally { // depends on control dependency: [catch], data = [none]
// Revert back to the thread's current context
_contextManager.popContextData();
}
}
else{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
Tr.debug(tc, "WriteListener enabled: "
+ this._wl + " .onWritePossible will be skipped as isReady has not been checked since write went async."); // depends on control dependency: [if], data = [none]
}
}
}
}
}
} } |
public class class_name {
public static ModelControllerClient createReceiving(final Channel channel, final ExecutorService executorService) {
final ManagementClientChannelStrategy strategy = ManagementClientChannelStrategy.create(channel);
final ManagementChannelHandler handler = new ManagementChannelHandler(strategy, executorService);
final ExistingChannelModelControllerClient client = new ExistingChannelModelControllerClient(handler);
handler.addHandlerFactory(client);
channel.addCloseHandler(new CloseHandler<Channel>() {
@Override
public void handleClose(Channel closed, IOException exception) {
handler.shutdown();
try {
handler.awaitCompletion(1, TimeUnit.SECONDS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} finally {
handler.shutdownNow();
}
}
});
channel.receiveMessage(handler.getReceiver());
return client;
} } | public class class_name {
public static ModelControllerClient createReceiving(final Channel channel, final ExecutorService executorService) {
final ManagementClientChannelStrategy strategy = ManagementClientChannelStrategy.create(channel);
final ManagementChannelHandler handler = new ManagementChannelHandler(strategy, executorService);
final ExistingChannelModelControllerClient client = new ExistingChannelModelControllerClient(handler);
handler.addHandlerFactory(client);
channel.addCloseHandler(new CloseHandler<Channel>() {
@Override
public void handleClose(Channel closed, IOException exception) {
handler.shutdown();
try {
handler.awaitCompletion(1, TimeUnit.SECONDS); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} finally { // depends on control dependency: [catch], data = [none]
handler.shutdownNow();
}
}
});
channel.receiveMessage(handler.getReceiver());
return client;
} } |
public class class_name {
public void shutdown() {
// shutdown each single thread executor in the managed collection
for (ExecutorService singleThreadExecutorService : singleThreadExecutorServices) {
shutdownExecutor(singleThreadExecutorService);
}
// shutdown scheduled executor instance
shutdownExecutor(getInternalScheduledExecutorService());
shutdownExecutor(getInternalGpioExecutorService());
} } | public class class_name {
public void shutdown() {
// shutdown each single thread executor in the managed collection
for (ExecutorService singleThreadExecutorService : singleThreadExecutorServices) {
shutdownExecutor(singleThreadExecutorService); // depends on control dependency: [for], data = [singleThreadExecutorService]
}
// shutdown scheduled executor instance
shutdownExecutor(getInternalScheduledExecutorService());
shutdownExecutor(getInternalGpioExecutorService());
} } |
public class class_name {
@Beta
public static <E> Multiset<E> filter(Multiset<E> unfiltered, Predicate<? super E> predicate) {
if (unfiltered instanceof FilteredMultiset) {
// Support clear(), removeAll(), and retainAll() when filtering a filtered
// collection.
FilteredMultiset<E> filtered = (FilteredMultiset<E>) unfiltered;
Predicate<E> combinedPredicate = Predicates.<E>and(filtered.predicate, predicate);
return new FilteredMultiset<E>(filtered.unfiltered, combinedPredicate);
}
return new FilteredMultiset<E>(unfiltered, predicate);
} } | public class class_name {
@Beta
public static <E> Multiset<E> filter(Multiset<E> unfiltered, Predicate<? super E> predicate) {
if (unfiltered instanceof FilteredMultiset) {
// Support clear(), removeAll(), and retainAll() when filtering a filtered
// collection.
FilteredMultiset<E> filtered = (FilteredMultiset<E>) unfiltered;
Predicate<E> combinedPredicate = Predicates.<E>and(filtered.predicate, predicate);
return new FilteredMultiset<E>(filtered.unfiltered, combinedPredicate); // depends on control dependency: [if], data = [none]
}
return new FilteredMultiset<E>(unfiltered, predicate);
} } |
public class class_name {
@Override
public EClass getIfcMaterialLayerSet() {
if (ifcMaterialLayerSetEClass == null) {
ifcMaterialLayerSetEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(363);
}
return ifcMaterialLayerSetEClass;
} } | public class class_name {
@Override
public EClass getIfcMaterialLayerSet() {
if (ifcMaterialLayerSetEClass == null) {
ifcMaterialLayerSetEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(363);
// depends on control dependency: [if], data = [none]
}
return ifcMaterialLayerSetEClass;
} } |
public class class_name {
public static int copy( File sourceFileOrDirectory,
File destinationFileOrDirectory,
FilenameFilter exclusionFilter ) throws IOException {
if (exclusionFilter == null) exclusionFilter = ACCEPT_ALL;
int numberOfFilesCopied = 0;
if (sourceFileOrDirectory.isDirectory()) {
destinationFileOrDirectory.mkdirs();
String list[] = sourceFileOrDirectory.list(exclusionFilter);
for (int i = 0; i < list.length; i++) {
String dest1 = destinationFileOrDirectory.getPath() + File.separator + list[i];
String src1 = sourceFileOrDirectory.getPath() + File.separator + list[i];
numberOfFilesCopied += copy(new File(src1), new File(dest1), exclusionFilter);
}
} else {
try (FileInputStream fis = new FileInputStream(sourceFileOrDirectory);
BufferedInputStream bis = new BufferedInputStream(fis);
FileOutputStream fos = new FileOutputStream(destinationFileOrDirectory);
BufferedOutputStream bos = new BufferedOutputStream(fos)) {
int c;
while ((c = bis.read()) >= 0) {
bos.write(c);
}
}
numberOfFilesCopied++;
}
return numberOfFilesCopied;
} } | public class class_name {
public static int copy( File sourceFileOrDirectory,
File destinationFileOrDirectory,
FilenameFilter exclusionFilter ) throws IOException {
if (exclusionFilter == null) exclusionFilter = ACCEPT_ALL;
int numberOfFilesCopied = 0;
if (sourceFileOrDirectory.isDirectory()) {
destinationFileOrDirectory.mkdirs();
String list[] = sourceFileOrDirectory.list(exclusionFilter);
for (int i = 0; i < list.length; i++) {
String dest1 = destinationFileOrDirectory.getPath() + File.separator + list[i];
String src1 = sourceFileOrDirectory.getPath() + File.separator + list[i];
numberOfFilesCopied += copy(new File(src1), new File(dest1), exclusionFilter);
}
} else {
try (FileInputStream fis = new FileInputStream(sourceFileOrDirectory);
BufferedInputStream bis = new BufferedInputStream(fis);
FileOutputStream fos = new FileOutputStream(destinationFileOrDirectory);
BufferedOutputStream bos = new BufferedOutputStream(fos)) {
int c;
while ((c = bis.read()) >= 0) {
bos.write(c); // depends on control dependency: [while], data = [none]
}
}
numberOfFilesCopied++;
}
return numberOfFilesCopied;
} } |
public class class_name {
public ManagedReference getReference() {
try {
return view.createInstance();
} catch (Exception e) {
throw EeLogger.ROOT_LOGGER.componentViewConstructionFailure(e);
}
} } | public class class_name {
public ManagedReference getReference() {
try {
return view.createInstance(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw EeLogger.ROOT_LOGGER.componentViewConstructionFailure(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
static private StringBuilder replace(StringBuilder input, java.util.regex.Pattern pattern, String replacement) {
java.util.regex.Matcher m = pattern.matcher(input);
while (m.find()) {
if (isEscapedChar(input.toString(), m.start())) {
continue;
}
// since we're replacing the original string being matched,
// we have to reset the matcher so that it searches the new
// string
input.replace(m.start(), m.end(), replacement);
m.reset(input);
}
return input;
} } | public class class_name {
static private StringBuilder replace(StringBuilder input, java.util.regex.Pattern pattern, String replacement) {
java.util.regex.Matcher m = pattern.matcher(input);
while (m.find()) {
if (isEscapedChar(input.toString(), m.start())) {
continue;
}
// since we're replacing the original string being matched,
// we have to reset the matcher so that it searches the new
// string
input.replace(m.start(), m.end(), replacement); // depends on control dependency: [while], data = [none]
m.reset(input); // depends on control dependency: [while], data = [none]
}
return input;
} } |
public class class_name {
private DictSegment[] getChildrenArray() {
if (this.childrenArray == null) {
synchronized (this) {
if (this.childrenArray == null) {
this.childrenArray = new DictSegment[ARRAY_LENGTH_LIMIT];
}
}
}
return this.childrenArray;
} } | public class class_name {
private DictSegment[] getChildrenArray() {
if (this.childrenArray == null) {
synchronized (this) { // depends on control dependency: [if], data = [none]
if (this.childrenArray == null) {
this.childrenArray = new DictSegment[ARRAY_LENGTH_LIMIT]; // depends on control dependency: [if], data = [none]
}
}
}
return this.childrenArray;
} } |
public class class_name {
public EEnum getIfcReinforcingBarRoleEnum() {
if (ifcReinforcingBarRoleEnumEEnum == null) {
ifcReinforcingBarRoleEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(884);
}
return ifcReinforcingBarRoleEnumEEnum;
} } | public class class_name {
public EEnum getIfcReinforcingBarRoleEnum() {
if (ifcReinforcingBarRoleEnumEEnum == null) {
ifcReinforcingBarRoleEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(884);
// depends on control dependency: [if], data = [none]
}
return ifcReinforcingBarRoleEnumEEnum;
} } |
public class class_name {
int getPort() {
LOGGER.entering();
int val = -1;
InstanceType type = getType();
if (commands.contains(PORT_ARG)) {
val = Integer.parseInt(commands.get(commands.indexOf(PORT_ARG) + 1));
LOGGER.exiting(val);
return val;
}
try {
if (type.equals(InstanceType.SELENIUM_NODE) || type.equals(InstanceType.SELENIUM_HUB)) {
val = getSeleniumConfigAsJsonObject().get("port").getAsInt();
}
} catch (JsonParseException | NullPointerException e) {
// ignore
}
// last ditch effort
val = (val != -1) ? val : 4444;
LOGGER.exiting(val);
return val;
} } | public class class_name {
int getPort() {
LOGGER.entering();
int val = -1;
InstanceType type = getType();
if (commands.contains(PORT_ARG)) {
val = Integer.parseInt(commands.get(commands.indexOf(PORT_ARG) + 1)); // depends on control dependency: [if], data = [none]
LOGGER.exiting(val); // depends on control dependency: [if], data = [none]
return val; // depends on control dependency: [if], data = [none]
}
try {
if (type.equals(InstanceType.SELENIUM_NODE) || type.equals(InstanceType.SELENIUM_HUB)) {
val = getSeleniumConfigAsJsonObject().get("port").getAsInt(); // depends on control dependency: [if], data = [none]
}
} catch (JsonParseException | NullPointerException e) {
// ignore
} // depends on control dependency: [catch], data = [none]
// last ditch effort
val = (val != -1) ? val : 4444;
LOGGER.exiting(val);
return val;
} } |
public class class_name {
@Override
public double[] toArray() {
double[] data = new double[dimensionality];
for(int i = BitsUtil.nextSetBit(bits, 0); i >= 0; i = BitsUtil.nextSetBit(bits, i + 1)) {
data[i] = 1;
}
return data;
} } | public class class_name {
@Override
public double[] toArray() {
double[] data = new double[dimensionality];
for(int i = BitsUtil.nextSetBit(bits, 0); i >= 0; i = BitsUtil.nextSetBit(bits, i + 1)) {
data[i] = 1; // depends on control dependency: [for], data = [i]
}
return data;
} } |
public class class_name {
private String extractDeclarations(Match match) {
final StringBuilder result = new StringBuilder();
List<String> declarations = match.getDeclarationIds();
Map<String, Declaration> declsMap = ( (AgendaItem) match ).getTerminalNode().getSubRule().getOuterDeclarations();
for ( int i = 0; i < declarations.size(); i++ ) {
String declaration = declarations.get(i);
Declaration decl = declsMap.get(declaration);
InternalFactHandle handle = ( (Tuple) match ).get( decl );
if (!handle.isValid()) {
continue;
}
Object value = decl.getValue(null, handle.getObject());
result.append( declaration );
result.append( "=" );
if ( value == null ) {
// this should never occur
result.append( "null" );
} else {
result.append( value );
}
if ( i < declarations.size() - 1 ) {
result.append( "; " );
}
}
return result.toString();
} } | public class class_name {
private String extractDeclarations(Match match) {
final StringBuilder result = new StringBuilder();
List<String> declarations = match.getDeclarationIds();
Map<String, Declaration> declsMap = ( (AgendaItem) match ).getTerminalNode().getSubRule().getOuterDeclarations();
for ( int i = 0; i < declarations.size(); i++ ) {
String declaration = declarations.get(i);
Declaration decl = declsMap.get(declaration);
InternalFactHandle handle = ( (Tuple) match ).get( decl );
if (!handle.isValid()) {
continue;
}
Object value = decl.getValue(null, handle.getObject());
result.append( declaration ); // depends on control dependency: [for], data = [none]
result.append( "=" ); // depends on control dependency: [for], data = [none]
if ( value == null ) {
// this should never occur
result.append( "null" ); // depends on control dependency: [if], data = [none]
} else {
result.append( value ); // depends on control dependency: [if], data = [( value]
}
if ( i < declarations.size() - 1 ) {
result.append( "; " ); // depends on control dependency: [if], data = [none]
}
}
return result.toString();
} } |
public class class_name {
public static int getRequiredSize(ByteBuffer source) {
ByteBuffer input = source.duplicate();
// Do we have a complete header?
if (input.remaining() < RECORD_HEADER_SIZE) {
throw new BufferUnderflowException();
}
// Is it a handshake message?
byte firstByte = input.get();
input.get();
byte thirdByte = input.get();
if ((firstByte & 0x80) != 0 && thirdByte == 0x01) {
// looks like a V2ClientHello
// return (((firstByte & 0x7F) << 8) | (secondByte & 0xFF)) + 2;
return RECORD_HEADER_SIZE; // Only need the header fields
} else {
return ((input.get() & 0xFF) << 8 | input.get() & 0xFF) + 5;
}
} } | public class class_name {
public static int getRequiredSize(ByteBuffer source) {
ByteBuffer input = source.duplicate();
// Do we have a complete header?
if (input.remaining() < RECORD_HEADER_SIZE) {
throw new BufferUnderflowException();
}
// Is it a handshake message?
byte firstByte = input.get();
input.get();
byte thirdByte = input.get();
if ((firstByte & 0x80) != 0 && thirdByte == 0x01) {
// looks like a V2ClientHello
// return (((firstByte & 0x7F) << 8) | (secondByte & 0xFF)) + 2;
return RECORD_HEADER_SIZE; // Only need the header fields // depends on control dependency: [if], data = [none]
} else {
return ((input.get() & 0xFF) << 8 | input.get() & 0xFF) + 5; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private synchronized Object progressiveListeners() {
Object listeners = this.listeners;
if (listeners == null) {
// No listeners added
return null;
}
if (listeners instanceof DefaultFutureListeners) {
// Copy DefaultFutureListeners into an array of listeners.
DefaultFutureListeners dfl = (DefaultFutureListeners) listeners;
int progressiveSize = dfl.progressiveSize();
switch (progressiveSize) {
case 0:
return null;
case 1:
for (GenericFutureListener<?> l: dfl.listeners()) {
if (l instanceof GenericProgressiveFutureListener) {
return l;
}
}
return null;
}
GenericFutureListener<?>[] array = dfl.listeners();
GenericProgressiveFutureListener<?>[] copy = new GenericProgressiveFutureListener[progressiveSize];
for (int i = 0, j = 0; j < progressiveSize; i ++) {
GenericFutureListener<?> l = array[i];
if (l instanceof GenericProgressiveFutureListener) {
copy[j ++] = (GenericProgressiveFutureListener<?>) l;
}
}
return copy;
} else if (listeners instanceof GenericProgressiveFutureListener) {
return listeners;
} else {
// Only one listener was added and it's not a progressive listener.
return null;
}
} } | public class class_name {
private synchronized Object progressiveListeners() {
Object listeners = this.listeners;
if (listeners == null) {
// No listeners added
return null; // depends on control dependency: [if], data = [none]
}
if (listeners instanceof DefaultFutureListeners) {
// Copy DefaultFutureListeners into an array of listeners.
DefaultFutureListeners dfl = (DefaultFutureListeners) listeners;
int progressiveSize = dfl.progressiveSize();
switch (progressiveSize) {
case 0:
return null;
case 1:
for (GenericFutureListener<?> l: dfl.listeners()) {
if (l instanceof GenericProgressiveFutureListener) {
return l; // depends on control dependency: [if], data = [none]
}
}
return null;
}
GenericFutureListener<?>[] array = dfl.listeners();
GenericProgressiveFutureListener<?>[] copy = new GenericProgressiveFutureListener[progressiveSize];
for (int i = 0, j = 0; j < progressiveSize; i ++) {
GenericFutureListener<?> l = array[i];
if (l instanceof GenericProgressiveFutureListener) {
copy[j ++] = (GenericProgressiveFutureListener<?>) l; // depends on control dependency: [if], data = [none]
}
}
return copy; // depends on control dependency: [if], data = [none]
} else if (listeners instanceof GenericProgressiveFutureListener) {
return listeners; // depends on control dependency: [if], data = [none]
} else {
// Only one listener was added and it's not a progressive listener.
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public T getService(ServiceReference<T> serviceReference) {
if (serviceReference != null) {
ComponentContext ctx = contextRef.get();
if (ctx != null) {
ConcurrentServiceReferenceElement<T> element;
synchronized (elementMap) {
element = elementMap.get(serviceReference);
}
if (element != null) {
return element.getService(ctx);
}
}
}
return null;
} } | public class class_name {
public T getService(ServiceReference<T> serviceReference) {
if (serviceReference != null) {
ComponentContext ctx = contextRef.get();
if (ctx != null) {
ConcurrentServiceReferenceElement<T> element;
synchronized (elementMap) { // depends on control dependency: [if], data = [none]
element = elementMap.get(serviceReference);
}
if (element != null) {
return element.getService(ctx); // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
public void setTemplate( String template )
{
if ( template == null || template.length() == 0 )
{
throw new IllegalStateException( "Template cannot be null or empty." );
}
if ( template.equals( _template ) )
{
return;
}
_template = template;
_isParsed = false;
_parsedTemplate = null;
} } | public class class_name {
public void setTemplate( String template )
{
if ( template == null || template.length() == 0 )
{
throw new IllegalStateException( "Template cannot be null or empty." );
}
if ( template.equals( _template ) )
{
return; // depends on control dependency: [if], data = [none]
}
_template = template;
_isParsed = false;
_parsedTemplate = null;
} } |
public class class_name {
@SuppressWarnings("unchecked")
protected <T extends BaseTopicWrapper<T>> List<T> getUniqueTopicsFromSpecTopics(final List<ITopicNode> topics) {
// Find all the unique topics first
final Map<Integer, T> revisionToTopic = new HashMap<Integer, T>();
for (final ITopicNode specTopic : topics) {
final T topic = (T) specTopic.getTopic();
// Find the Topic Revision
final Integer topicRevision = topic.getTopicRevision();
if (!revisionToTopic.containsKey(topicRevision)) {
revisionToTopic.put(topicRevision, topic);
}
}
// Convert the revision to topic mapping to just a list of topics
final List<T> retValue = new ArrayList<T>();
for (final Entry<Integer, T> entry : revisionToTopic.entrySet()) {
retValue.add(entry.getValue());
}
return retValue;
} } | public class class_name {
@SuppressWarnings("unchecked")
protected <T extends BaseTopicWrapper<T>> List<T> getUniqueTopicsFromSpecTopics(final List<ITopicNode> topics) {
// Find all the unique topics first
final Map<Integer, T> revisionToTopic = new HashMap<Integer, T>();
for (final ITopicNode specTopic : topics) {
final T topic = (T) specTopic.getTopic();
// Find the Topic Revision
final Integer topicRevision = topic.getTopicRevision();
if (!revisionToTopic.containsKey(topicRevision)) {
revisionToTopic.put(topicRevision, topic); // depends on control dependency: [if], data = [none]
}
}
// Convert the revision to topic mapping to just a list of topics
final List<T> retValue = new ArrayList<T>();
for (final Entry<Integer, T> entry : revisionToTopic.entrySet()) {
retValue.add(entry.getValue()); // depends on control dependency: [for], data = [entry]
}
return retValue;
} } |
public class class_name {
public void addSingleEntity(String keyName) {
// [START addSingleEntity]
Key key = datastore.newKeyFactory().setKind("MyKind").newKey(keyName);
Entity.Builder entityBuilder = Entity.newBuilder(key);
entityBuilder.set("propertyName", "value");
Entity entity = entityBuilder.build();
try {
datastore.add(entity);
} catch (DatastoreException ex) {
if ("ALREADY_EXISTS".equals(ex.getReason())) {
// entity.getKey() already exists
}
}
// [END addSingleEntity]
} } | public class class_name {
public void addSingleEntity(String keyName) {
// [START addSingleEntity]
Key key = datastore.newKeyFactory().setKind("MyKind").newKey(keyName);
Entity.Builder entityBuilder = Entity.newBuilder(key);
entityBuilder.set("propertyName", "value");
Entity entity = entityBuilder.build();
try {
datastore.add(entity); // depends on control dependency: [try], data = [none]
} catch (DatastoreException ex) {
if ("ALREADY_EXISTS".equals(ex.getReason())) {
// entity.getKey() already exists
}
} // depends on control dependency: [catch], data = [none]
// [END addSingleEntity]
} } |
public class class_name {
public void marshall(Database database, ProtocolMarshaller protocolMarshaller) {
if (database == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(database.getName(), NAME_BINDING);
protocolMarshaller.marshall(database.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(database.getLocationUri(), LOCATIONURI_BINDING);
protocolMarshaller.marshall(database.getParameters(), PARAMETERS_BINDING);
protocolMarshaller.marshall(database.getCreateTime(), CREATETIME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Database database, ProtocolMarshaller protocolMarshaller) {
if (database == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(database.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(database.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(database.getLocationUri(), LOCATIONURI_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(database.getParameters(), PARAMETERS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(database.getCreateTime(), CREATETIME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setDelimiter(byte[] delim, boolean resetMatchCount) {
if (delim == null) {
throw new NullPointerException("Null delimiter not allowed");
}
// Convert delimiter to IoBuffer.
IoBuffer delimiter = IoBuffer.allocate(delim.length);
delimiter.put(delim);
delimiter.flip();
ctx.setDelimiter(delimiter);
ctx.setContentLength(-1);
if (resetMatchCount) {
ctx.setMatchCount(0);
}
} } | public class class_name {
public void setDelimiter(byte[] delim, boolean resetMatchCount) {
if (delim == null) {
throw new NullPointerException("Null delimiter not allowed");
}
// Convert delimiter to IoBuffer.
IoBuffer delimiter = IoBuffer.allocate(delim.length);
delimiter.put(delim);
delimiter.flip();
ctx.setDelimiter(delimiter);
ctx.setContentLength(-1);
if (resetMatchCount) {
ctx.setMatchCount(0); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setAllowBrokenRelations(String allowBrokenRelations) {
m_allowBrokenRelations = Boolean.valueOf(allowBrokenRelations).booleanValue();
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
m_allowBrokenRelations
? Messages.INIT_RELATION_DELETION_ENABLED_0
: Messages.INIT_RELATION_DELETION_DISABLED_0));
}
} } | public class class_name {
public void setAllowBrokenRelations(String allowBrokenRelations) {
m_allowBrokenRelations = Boolean.valueOf(allowBrokenRelations).booleanValue();
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
m_allowBrokenRelations
? Messages.INIT_RELATION_DELETION_ENABLED_0
: Messages.INIT_RELATION_DELETION_DISABLED_0)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static double elementMax( DMatrixD1 a ) {
final int size = a.getNumElements();
double max = a.get(0);
for( int i = 1; i < size; i++ ) {
double val = a.get(i);
if( val >= max ) {
max = val;
}
}
return max;
} } | public class class_name {
public static double elementMax( DMatrixD1 a ) {
final int size = a.getNumElements();
double max = a.get(0);
for( int i = 1; i < size; i++ ) {
double val = a.get(i);
if( val >= max ) {
max = val; // depends on control dependency: [if], data = [none]
}
}
return max;
} } |
public class class_name {
public boolean eq(Matrix B) {
Matrix A = this;
if (B.M != A.M || B.N != A.N) {
throw new RuntimeException("Illegal matrix dimensions.");
}
for (int i = 0; i < M; i++) {
for (int j = 0; j < N; j++) {
if (A.data[i][j] != B.data[i][j]) {
return false;
}
}
}
return true;
} } | public class class_name {
public boolean eq(Matrix B) {
Matrix A = this;
if (B.M != A.M || B.N != A.N) {
throw new RuntimeException("Illegal matrix dimensions.");
}
for (int i = 0; i < M; i++) {
for (int j = 0; j < N; j++) {
if (A.data[i][j] != B.data[i][j]) {
return false; // depends on control dependency: [if], data = [none]
}
}
}
return true;
} } |
public class class_name {
public final BELScriptWalker.unset_return unset() throws RecognitionException {
BELScriptWalker.unset_return retval = new BELScriptWalker.unset_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
CommonTree _first_0 = null;
CommonTree _last = null;
CommonTree an=null;
CommonTree list=null;
CommonTree string_literal22=null;
CommonTree an_tree=null;
CommonTree list_tree=null;
CommonTree string_literal22_tree=null;
try {
// BELScriptWalker.g:285:6: ( 'UNSET' (an= OBJECT_IDENT | list= IDENT_LIST ) )
// BELScriptWalker.g:286:5: 'UNSET' (an= OBJECT_IDENT | list= IDENT_LIST )
{
root_0 = (CommonTree)adaptor.nil();
_last = (CommonTree)input.LT(1);
string_literal22=(CommonTree)match(input,26,FOLLOW_26_in_unset281);
string_literal22_tree = (CommonTree)adaptor.dupNode(string_literal22);
adaptor.addChild(root_0, string_literal22_tree);
// BELScriptWalker.g:286:13: (an= OBJECT_IDENT | list= IDENT_LIST )
int alt6=2;
int LA6_0 = input.LA(1);
if ( (LA6_0==OBJECT_IDENT) ) {
alt6=1;
}
else if ( (LA6_0==IDENT_LIST) ) {
alt6=2;
}
else {
NoViableAltException nvae =
new NoViableAltException("", 6, 0, input);
throw nvae;
}
switch (alt6) {
case 1 :
// BELScriptWalker.g:286:14: an= OBJECT_IDENT
{
_last = (CommonTree)input.LT(1);
an=(CommonTree)match(input,OBJECT_IDENT,FOLLOW_OBJECT_IDENT_in_unset286);
an_tree = (CommonTree)adaptor.dupNode(an);
adaptor.addChild(root_0, an_tree);
}
break;
case 2 :
// BELScriptWalker.g:286:32: list= IDENT_LIST
{
_last = (CommonTree)input.LT(1);
list=(CommonTree)match(input,IDENT_LIST,FOLLOW_IDENT_LIST_in_unset292);
list_tree = (CommonTree)adaptor.dupNode(list);
adaptor.addChild(root_0, list_tree);
}
break;
}
if (an != null) {
String annotationName = an.getText();
if ("ALL".equals(annotationName)) {
if (activeStatementGroup == null)
annotationContext.clear();
else
sgAnnotationContext.clear();
} else if (definedAnnotations.containsKey(annotationName)) {
if (activeStatementGroup == null)
annotationContext.remove(annotationName);
else
sgAnnotationContext.remove(annotationName);
} else if (docprop.containsKey(BELDocumentProperty.getDocumentProperty(annotationName))) {
addError(new UnsetDocumentPropertiesException(an.getLine(), an.getCharPositionInLine()));
} else {
addWarning(new UnsetUndefinedAnnotationException(an.getLine(), an.getCharPositionInLine()));
}
}
}
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return retval;
} } | public class class_name {
public final BELScriptWalker.unset_return unset() throws RecognitionException {
BELScriptWalker.unset_return retval = new BELScriptWalker.unset_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
CommonTree _first_0 = null;
CommonTree _last = null;
CommonTree an=null;
CommonTree list=null;
CommonTree string_literal22=null;
CommonTree an_tree=null;
CommonTree list_tree=null;
CommonTree string_literal22_tree=null;
try {
// BELScriptWalker.g:285:6: ( 'UNSET' (an= OBJECT_IDENT | list= IDENT_LIST ) )
// BELScriptWalker.g:286:5: 'UNSET' (an= OBJECT_IDENT | list= IDENT_LIST )
{
root_0 = (CommonTree)adaptor.nil();
_last = (CommonTree)input.LT(1);
string_literal22=(CommonTree)match(input,26,FOLLOW_26_in_unset281);
string_literal22_tree = (CommonTree)adaptor.dupNode(string_literal22);
adaptor.addChild(root_0, string_literal22_tree);
// BELScriptWalker.g:286:13: (an= OBJECT_IDENT | list= IDENT_LIST )
int alt6=2;
int LA6_0 = input.LA(1);
if ( (LA6_0==OBJECT_IDENT) ) {
alt6=1; // depends on control dependency: [if], data = [none]
}
else if ( (LA6_0==IDENT_LIST) ) {
alt6=2; // depends on control dependency: [if], data = [none]
}
else {
NoViableAltException nvae =
new NoViableAltException("", 6, 0, input);
throw nvae;
}
switch (alt6) {
case 1 :
// BELScriptWalker.g:286:14: an= OBJECT_IDENT
{
_last = (CommonTree)input.LT(1);
an=(CommonTree)match(input,OBJECT_IDENT,FOLLOW_OBJECT_IDENT_in_unset286);
an_tree = (CommonTree)adaptor.dupNode(an);
adaptor.addChild(root_0, an_tree);
}
break;
case 2 :
// BELScriptWalker.g:286:32: list= IDENT_LIST
{
_last = (CommonTree)input.LT(1);
list=(CommonTree)match(input,IDENT_LIST,FOLLOW_IDENT_LIST_in_unset292);
list_tree = (CommonTree)adaptor.dupNode(list);
adaptor.addChild(root_0, list_tree);
}
break;
}
if (an != null) {
String annotationName = an.getText();
if ("ALL".equals(annotationName)) {
if (activeStatementGroup == null)
annotationContext.clear();
else
sgAnnotationContext.clear();
} else if (definedAnnotations.containsKey(annotationName)) {
if (activeStatementGroup == null)
annotationContext.remove(annotationName);
else
sgAnnotationContext.remove(annotationName);
} else if (docprop.containsKey(BELDocumentProperty.getDocumentProperty(annotationName))) {
addError(new UnsetDocumentPropertiesException(an.getLine(), an.getCharPositionInLine())); // depends on control dependency: [if], data = [none]
} else {
addWarning(new UnsetUndefinedAnnotationException(an.getLine(), an.getCharPositionInLine())); // depends on control dependency: [if], data = [none]
}
}
}
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return retval;
} } |
public class class_name {
public Wife addWifeToFamily(final Family family, final Person person) {
if (family == null || person == null) {
return new Wife();
}
final FamS famS = new FamS(person, "FAMS",
new ObjectId(family.getString()));
final Wife wife = new Wife(family, "Wife",
new ObjectId(person.getString()));
family.insert(wife);
person.insert(famS);
return wife;
} } | public class class_name {
public Wife addWifeToFamily(final Family family, final Person person) {
if (family == null || person == null) {
return new Wife(); // depends on control dependency: [if], data = [none]
}
final FamS famS = new FamS(person, "FAMS",
new ObjectId(family.getString()));
final Wife wife = new Wife(family, "Wife",
new ObjectId(person.getString()));
family.insert(wife);
person.insert(famS);
return wife;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.