repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
networknt/light-rest-4j | openapi-validator/src/main/java/com/networknt/openapi/ResponseValidator.java | ResponseValidator.convertStrToObjTree | private Object convertStrToObjTree(String s) {
Object contentObj = null;
if (s != null) {
s = s.trim();
try {
if (s.startsWith("{")) {
contentObj = Config.getInstance().getMapper().readValue(s, new TypeReference<HashMap<String, Object>>() {
});
} else if (s.startsWith("[")) {
contentObj = Config.getInstance().getMapper().readValue(s, new TypeReference<List<Object>>() {
});
} else {
logger.error("cannot deserialize json str: {}", s);
return null;
}
} catch (IOException e) {
logger.error(e.getMessage());
}
}
return contentObj;
} | java | private Object convertStrToObjTree(String s) {
Object contentObj = null;
if (s != null) {
s = s.trim();
try {
if (s.startsWith("{")) {
contentObj = Config.getInstance().getMapper().readValue(s, new TypeReference<HashMap<String, Object>>() {
});
} else if (s.startsWith("[")) {
contentObj = Config.getInstance().getMapper().readValue(s, new TypeReference<List<Object>>() {
});
} else {
logger.error("cannot deserialize json str: {}", s);
return null;
}
} catch (IOException e) {
logger.error(e.getMessage());
}
}
return contentObj;
} | [
"private",
"Object",
"convertStrToObjTree",
"(",
"String",
"s",
")",
"{",
"Object",
"contentObj",
"=",
"null",
";",
"if",
"(",
"s",
"!=",
"null",
")",
"{",
"s",
"=",
"s",
".",
"trim",
"(",
")",
";",
"try",
"{",
"if",
"(",
"s",
".",
"startsWith",
... | try to convert a string with json style to a structured object.
@param s
@return Object | [
"try",
"to",
"convert",
"a",
"string",
"with",
"json",
"style",
"to",
"a",
"structured",
"object",
"."
] | 06b15128e6101351e617284a636ef5d632e6b1fe | https://github.com/networknt/light-rest-4j/blob/06b15128e6101351e617284a636ef5d632e6b1fe/openapi-validator/src/main/java/com/networknt/openapi/ResponseValidator.java#L145-L165 | train |
networknt/light-rest-4j | openapi-validator/src/main/java/com/networknt/openapi/ResponseValidator.java | ResponseValidator.getOpenApiOperation | private OpenApiOperation getOpenApiOperation(String uri, String httpMethod) throws URISyntaxException {
String uriWithoutQuery = new URI(uri).getPath();
NormalisedPath requestPath = new ApiNormalisedPath(uriWithoutQuery);
Optional<NormalisedPath> maybeApiPath = OpenApiHelper.findMatchingApiPath(requestPath);
if (!maybeApiPath.isPresent()) {
return null;
}
final NormalisedPath openApiPathString = maybeApiPath.get();
final Path path = OpenApiHelper.openApi3.getPath(openApiPathString.original());
final Operation operation = path.getOperation(httpMethod);
return new OpenApiOperation(openApiPathString, path, httpMethod, operation);
} | java | private OpenApiOperation getOpenApiOperation(String uri, String httpMethod) throws URISyntaxException {
String uriWithoutQuery = new URI(uri).getPath();
NormalisedPath requestPath = new ApiNormalisedPath(uriWithoutQuery);
Optional<NormalisedPath> maybeApiPath = OpenApiHelper.findMatchingApiPath(requestPath);
if (!maybeApiPath.isPresent()) {
return null;
}
final NormalisedPath openApiPathString = maybeApiPath.get();
final Path path = OpenApiHelper.openApi3.getPath(openApiPathString.original());
final Operation operation = path.getOperation(httpMethod);
return new OpenApiOperation(openApiPathString, path, httpMethod, operation);
} | [
"private",
"OpenApiOperation",
"getOpenApiOperation",
"(",
"String",
"uri",
",",
"String",
"httpMethod",
")",
"throws",
"URISyntaxException",
"{",
"String",
"uriWithoutQuery",
"=",
"new",
"URI",
"(",
"uri",
")",
".",
"getPath",
"(",
")",
";",
"NormalisedPath",
"... | locate operation based on uri and httpMethod
@param uri original uri of the request
@param httpMethod http method of the request
@return OpenApiOperation the wrapper of an api operation | [
"locate",
"operation",
"based",
"on",
"uri",
"and",
"httpMethod"
] | 06b15128e6101351e617284a636ef5d632e6b1fe | https://github.com/networknt/light-rest-4j/blob/06b15128e6101351e617284a636ef5d632e6b1fe/openapi-validator/src/main/java/com/networknt/openapi/ResponseValidator.java#L173-L186 | train |
spring-projects/spring-social-twitter | spring-social-twitter/src/main/java/org/springframework/social/twitter/api/FilterStreamParameters.java | FilterStreamParameters.follow | public FilterStreamParameters follow(long follow) {
if (this.follow.length() > 0) {
this.follow.append(',');
}
this.follow.append(follow);
return this;
} | java | public FilterStreamParameters follow(long follow) {
if (this.follow.length() > 0) {
this.follow.append(',');
}
this.follow.append(follow);
return this;
} | [
"public",
"FilterStreamParameters",
"follow",
"(",
"long",
"follow",
")",
"{",
"if",
"(",
"this",
".",
"follow",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"this",
".",
"follow",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"this",
".",
"follow",... | Add a user to follow in the stream.
Does not replace any existing follows in the filter.
@param follow the Twitter user ID of a user to follow in the stream.
@return this FilterStreamParameters for building up filter parameters. | [
"Add",
"a",
"user",
"to",
"follow",
"in",
"the",
"stream",
".",
"Does",
"not",
"replace",
"any",
"existing",
"follows",
"in",
"the",
"filter",
"."
] | 5df7b3556d7bdbe7db8d833f30141336b5552178 | https://github.com/spring-projects/spring-social-twitter/blob/5df7b3556d7bdbe7db8d833f30141336b5552178/spring-social-twitter/src/main/java/org/springframework/social/twitter/api/FilterStreamParameters.java#L35-L41 | train |
spring-projects/spring-social-twitter | spring-social-twitter/src/main/java/org/springframework/social/twitter/api/AbstractStreamParameters.java | AbstractStreamParameters.track | public AbstractStreamParameters track(String track) {
if (this.track.length() > 0) {
this.track.append(',');
}
this.track.append(track);
return this;
} | java | public AbstractStreamParameters track(String track) {
if (this.track.length() > 0) {
this.track.append(',');
}
this.track.append(track);
return this;
} | [
"public",
"AbstractStreamParameters",
"track",
"(",
"String",
"track",
")",
"{",
"if",
"(",
"this",
".",
"track",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"this",
".",
"track",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"this",
".",
"track",
... | Add tracking keywords to the filter.
Does not replace any existing tracking keywords in the filter.
@param track the keywords to track.
@return this StreamFilter for building up filter parameters. | [
"Add",
"tracking",
"keywords",
"to",
"the",
"filter",
".",
"Does",
"not",
"replace",
"any",
"existing",
"tracking",
"keywords",
"in",
"the",
"filter",
"."
] | 5df7b3556d7bdbe7db8d833f30141336b5552178 | https://github.com/spring-projects/spring-social-twitter/blob/5df7b3556d7bdbe7db8d833f30141336b5552178/spring-social-twitter/src/main/java/org/springframework/social/twitter/api/AbstractStreamParameters.java#L44-L50 | train |
spring-projects/spring-social-twitter | spring-social-twitter/src/main/java/org/springframework/social/twitter/api/AbstractStreamParameters.java | AbstractStreamParameters.addLocation | public AbstractStreamParameters addLocation(float west, float south, float east, float north) {
if (locations.length() > 0) {
locations.append(',');
}
locations.append(west).append(',').append(south).append(',');
locations.append(east).append(',').append(north).append(',');
return this;
} | java | public AbstractStreamParameters addLocation(float west, float south, float east, float north) {
if (locations.length() > 0) {
locations.append(',');
}
locations.append(west).append(',').append(south).append(',');
locations.append(east).append(',').append(north).append(',');
return this;
} | [
"public",
"AbstractStreamParameters",
"addLocation",
"(",
"float",
"west",
",",
"float",
"south",
",",
"float",
"east",
",",
"float",
"north",
")",
"{",
"if",
"(",
"locations",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"locations",
".",
"append",
"(",... | Add a location to the filter
Does not replace any existing locations in the filter.
@param west the longitude of the western side of the location's bounding box.
@param south the latitude of the southern side of the location's bounding box.
@param east the longitude of the eastern side of the location's bounding box.
@param north the latitude of the northern side of the location's bounding box.
@return this StreamFilter for building up filter parameters. | [
"Add",
"a",
"location",
"to",
"the",
"filter",
"Does",
"not",
"replace",
"any",
"existing",
"locations",
"in",
"the",
"filter",
"."
] | 5df7b3556d7bdbe7db8d833f30141336b5552178 | https://github.com/spring-projects/spring-social-twitter/blob/5df7b3556d7bdbe7db8d833f30141336b5552178/spring-social-twitter/src/main/java/org/springframework/social/twitter/api/AbstractStreamParameters.java#L61-L68 | train |
spring-projects/spring-social-twitter | spring-social-twitter/src/main/java/org/springframework/social/twitter/api/impl/TweetDeserializer.java | TweetDeserializer.toEntities | private Entities toEntities(final JsonNode node, String text) throws IOException {
if (null == node || node.isNull() || node.isMissingNode()) {
return null;
}
final ObjectMapper mapper = this.createMapper();
Entities entities = mapper.readerFor(Entities.class).readValue(node);
extractTickerSymbolEntitiesFromText(text, entities);
return entities;
} | java | private Entities toEntities(final JsonNode node, String text) throws IOException {
if (null == node || node.isNull() || node.isMissingNode()) {
return null;
}
final ObjectMapper mapper = this.createMapper();
Entities entities = mapper.readerFor(Entities.class).readValue(node);
extractTickerSymbolEntitiesFromText(text, entities);
return entities;
} | [
"private",
"Entities",
"toEntities",
"(",
"final",
"JsonNode",
"node",
",",
"String",
"text",
")",
"throws",
"IOException",
"{",
"if",
"(",
"null",
"==",
"node",
"||",
"node",
".",
"isNull",
"(",
")",
"||",
"node",
".",
"isMissingNode",
"(",
")",
")",
... | passing in text to fetch ticker symbol pseudo-entities | [
"passing",
"in",
"text",
"to",
"fetch",
"ticker",
"symbol",
"pseudo",
"-",
"entities"
] | 5df7b3556d7bdbe7db8d833f30141336b5552178 | https://github.com/spring-projects/spring-social-twitter/blob/5df7b3556d7bdbe7db8d833f30141336b5552178/spring-social-twitter/src/main/java/org/springframework/social/twitter/api/impl/TweetDeserializer.java#L125-L133 | train |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/user/UserClient.java | UserClient.getUserState | public UserStateResult getUserState(String username)
throws APIConnectionException, APIRequestException {
StringUtils.checkUsername(username);
ResponseWrapper response = _httpClient.sendGet(_baseUrl + userPath + "/" + username + "/userstat");
return UserStateResult.fromResponse(response, UserStateResult.class);
} | java | public UserStateResult getUserState(String username)
throws APIConnectionException, APIRequestException {
StringUtils.checkUsername(username);
ResponseWrapper response = _httpClient.sendGet(_baseUrl + userPath + "/" + username + "/userstat");
return UserStateResult.fromResponse(response, UserStateResult.class);
} | [
"public",
"UserStateResult",
"getUserState",
"(",
"String",
"username",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"StringUtils",
".",
"checkUsername",
"(",
"username",
")",
";",
"ResponseWrapper",
"response",
"=",
"_httpClient",
".",
"s... | Get user state
@param username Necessary
@return user state info, include login and online message.
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Get",
"user",
"state"
] | 767f5fb15e9fe5a546c00f6e68b64f6dd53c617c | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/user/UserClient.java#L108-L113 | train |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/user/UserClient.java | UserClient.getUsersState | public UserStateListResult[] getUsersState(String... users) throws APIConnectionException, APIRequestException {
JsonArray jsonArray = new JsonArray();
for (String username : users) {
StringUtils.checkUsername(username);
jsonArray.add(new JsonPrimitive(username));
}
ResponseWrapper response = _httpClient.sendPost(_baseUrl + userPath + "/userstat", jsonArray.toString());
return _gson.fromJson(response.responseContent, UserStateListResult[].class);
} | java | public UserStateListResult[] getUsersState(String... users) throws APIConnectionException, APIRequestException {
JsonArray jsonArray = new JsonArray();
for (String username : users) {
StringUtils.checkUsername(username);
jsonArray.add(new JsonPrimitive(username));
}
ResponseWrapper response = _httpClient.sendPost(_baseUrl + userPath + "/userstat", jsonArray.toString());
return _gson.fromJson(response.responseContent, UserStateListResult[].class);
} | [
"public",
"UserStateListResult",
"[",
"]",
"getUsersState",
"(",
"String",
"...",
"users",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"JsonArray",
"jsonArray",
"=",
"new",
"JsonArray",
"(",
")",
";",
"for",
"(",
"String",
"username",... | Get users' state
@param users username of users
@return {@link UserStateListResult}
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Get",
"users",
"state"
] | 767f5fb15e9fe5a546c00f6e68b64f6dd53c617c | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/user/UserClient.java#L123-L131 | train |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/user/UserClient.java | UserClient.getBlackList | public UserInfoResult[] getBlackList(String username)
throws APIConnectionException, APIRequestException {
StringUtils.checkUsername(username);
ResponseWrapper response = _httpClient.sendGet(_baseUrl + userPath + "/" + username + "/blacklist");
return _gson.fromJson(response.responseContent, UserInfoResult[].class);
} | java | public UserInfoResult[] getBlackList(String username)
throws APIConnectionException, APIRequestException {
StringUtils.checkUsername(username);
ResponseWrapper response = _httpClient.sendGet(_baseUrl + userPath + "/" + username + "/blacklist");
return _gson.fromJson(response.responseContent, UserInfoResult[].class);
} | [
"public",
"UserInfoResult",
"[",
"]",
"getBlackList",
"(",
"String",
"username",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"StringUtils",
".",
"checkUsername",
"(",
"username",
")",
";",
"ResponseWrapper",
"response",
"=",
"_httpClient"... | Get a user's all black list
@param username The owner of the black list
@return UserList
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Get",
"a",
"user",
"s",
"all",
"black",
"list"
] | 767f5fb15e9fe5a546c00f6e68b64f6dd53c617c | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/user/UserClient.java#L161-L166 | train |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/user/UserClient.java | UserClient.getGroupList | public UserGroupsResult getGroupList(String username)
throws APIConnectionException, APIRequestException {
StringUtils.checkUsername(username);
ResponseWrapper response = _httpClient.sendGet(_baseUrl + userPath + "/" + username + "/groups");
return UserGroupsResult.fromResponse(response);
} | java | public UserGroupsResult getGroupList(String username)
throws APIConnectionException, APIRequestException {
StringUtils.checkUsername(username);
ResponseWrapper response = _httpClient.sendGet(_baseUrl + userPath + "/" + username + "/groups");
return UserGroupsResult.fromResponse(response);
} | [
"public",
"UserGroupsResult",
"getGroupList",
"(",
"String",
"username",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"StringUtils",
".",
"checkUsername",
"(",
"username",
")",
";",
"ResponseWrapper",
"response",
"=",
"_httpClient",
".",
"... | Get all groups of a user
@param username Necessary
@return Group info list
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Get",
"all",
"groups",
"of",
"a",
"user"
] | 767f5fb15e9fe5a546c00f6e68b64f6dd53c617c | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/user/UserClient.java#L266-L272 | train |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/JMessageClient.java | JMessageClient.addBlackList | public ResponseWrapper addBlackList(String username, String...users)
throws APIConnectionException, APIRequestException {
return _userClient.addBlackList(username, users);
} | java | public ResponseWrapper addBlackList(String username, String...users)
throws APIConnectionException, APIRequestException {
return _userClient.addBlackList(username, users);
} | [
"public",
"ResponseWrapper",
"addBlackList",
"(",
"String",
"username",
",",
"String",
"...",
"users",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"return",
"_userClient",
".",
"addBlackList",
"(",
"username",
",",
"users",
")",
";",
... | Add Users to black list
@param username The owner of the black list
@param users The users that will add to black list
@return add users to black list
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Add",
"Users",
"to",
"black",
"list"
] | 767f5fb15e9fe5a546c00f6e68b64f6dd53c617c | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L241-L244 | train |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/JMessageClient.java | JMessageClient.setNoDisturb | public ResponseWrapper setNoDisturb(String username, NoDisturbPayload payload)
throws APIConnectionException, APIRequestException {
return _userClient.setNoDisturb(username, payload);
} | java | public ResponseWrapper setNoDisturb(String username, NoDisturbPayload payload)
throws APIConnectionException, APIRequestException {
return _userClient.setNoDisturb(username, payload);
} | [
"public",
"ResponseWrapper",
"setNoDisturb",
"(",
"String",
"username",
",",
"NoDisturbPayload",
"payload",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"return",
"_userClient",
".",
"setNoDisturb",
"(",
"username",
",",
"payload",
")",
";... | Set don't disturb service while receiving messages.
You can Add or remove single conversation or group conversation
@param username Necessary
@param payload NoDisturbPayload
@return No content
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Set",
"don",
"t",
"disturb",
"service",
"while",
"receiving",
"messages",
".",
"You",
"can",
"Add",
"or",
"remove",
"single",
"conversation",
"or",
"group",
"conversation"
] | 767f5fb15e9fe5a546c00f6e68b64f6dd53c617c | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L277-L280 | train |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/JMessageClient.java | JMessageClient.addOrRemoveMembers | public void addOrRemoveMembers(long gid, String[] addList, String[] removeList)
throws APIConnectionException, APIRequestException {
Members add = Members.newBuilder()
.addMember(addList)
.build();
Members remove = Members.newBuilder()
.addMember(removeList)
.build();
_groupClient.addOrRemoveMembers(gid, add, remove);
} | java | public void addOrRemoveMembers(long gid, String[] addList, String[] removeList)
throws APIConnectionException, APIRequestException {
Members add = Members.newBuilder()
.addMember(addList)
.build();
Members remove = Members.newBuilder()
.addMember(removeList)
.build();
_groupClient.addOrRemoveMembers(gid, add, remove);
} | [
"public",
"void",
"addOrRemoveMembers",
"(",
"long",
"gid",
",",
"String",
"[",
"]",
"addList",
",",
"String",
"[",
"]",
"removeList",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"Members",
"add",
"=",
"Members",
".",
"newBuilder",
... | Add or remove members from a group
@param gid The group id
@param addList If this parameter is null then send remove request
@param removeList If this parameter is null then send add request
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Add",
"or",
"remove",
"members",
"from",
"a",
"group"
] | 767f5fb15e9fe5a546c00f6e68b64f6dd53c617c | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L400-L411 | train |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/JMessageClient.java | JMessageClient.sendSingleTextByAdmin | public SendMessageResult sendSingleTextByAdmin(String targetId, String fromId, MessageBody body)
throws APIConnectionException, APIRequestException {
return sendMessage(_sendVersion, "single", targetId, "admin",fromId, MessageType.TEXT, body);
} | java | public SendMessageResult sendSingleTextByAdmin(String targetId, String fromId, MessageBody body)
throws APIConnectionException, APIRequestException {
return sendMessage(_sendVersion, "single", targetId, "admin",fromId, MessageType.TEXT, body);
} | [
"public",
"SendMessageResult",
"sendSingleTextByAdmin",
"(",
"String",
"targetId",
",",
"String",
"fromId",
",",
"MessageBody",
"body",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"return",
"sendMessage",
"(",
"_sendVersion",
",",
"\"single... | Send single text message by admin
@param targetId target user's id
@param fromId sender's id
@param body message body, include text and extra(if needed).
@return return msg_id
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Send",
"single",
"text",
"message",
"by",
"admin"
] | 767f5fb15e9fe5a546c00f6e68b64f6dd53c617c | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L472-L475 | train |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/JMessageClient.java | JMessageClient.addCrossBlacklist | public ResponseWrapper addCrossBlacklist(String username, CrossBlacklist[] blacklists)
throws APIConnectionException, APIRequestException {
return _crossAppClient.addCrossBlacklist(username, blacklists);
} | java | public ResponseWrapper addCrossBlacklist(String username, CrossBlacklist[] blacklists)
throws APIConnectionException, APIRequestException {
return _crossAppClient.addCrossBlacklist(username, blacklists);
} | [
"public",
"ResponseWrapper",
"addCrossBlacklist",
"(",
"String",
"username",
",",
"CrossBlacklist",
"[",
"]",
"blacklists",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"return",
"_crossAppClient",
".",
"addCrossBlacklist",
"(",
"username",
... | Add blacklist whose users belong to another app to a given user.
@param username The owner of the blacklist
@param blacklists CrossBlacklist array
@return No Content
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Add",
"blacklist",
"whose",
"users",
"belong",
"to",
"another",
"app",
"to",
"a",
"given",
"user",
"."
] | 767f5fb15e9fe5a546c00f6e68b64f6dd53c617c | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L619-L622 | train |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/chatroom/ChatRoomClient.java | ChatRoomClient.createChatRoom | public CreateChatRoomResult createChatRoom(ChatRoomPayload payload) throws APIConnectionException, APIRequestException {
Preconditions.checkArgument(null != payload, "ChatRoomPayload should not be null");
ResponseWrapper responseWrapper = _httpClient.sendPost(_baseUrl + mChatRoomPath, payload.toString());
return CreateChatRoomResult.fromResponse(responseWrapper, CreateChatRoomResult.class);
} | java | public CreateChatRoomResult createChatRoom(ChatRoomPayload payload) throws APIConnectionException, APIRequestException {
Preconditions.checkArgument(null != payload, "ChatRoomPayload should not be null");
ResponseWrapper responseWrapper = _httpClient.sendPost(_baseUrl + mChatRoomPath, payload.toString());
return CreateChatRoomResult.fromResponse(responseWrapper, CreateChatRoomResult.class);
} | [
"public",
"CreateChatRoomResult",
"createChatRoom",
"(",
"ChatRoomPayload",
"payload",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"null",
"!=",
"payload",
",",
"\"ChatRoomPayload should not be null\"",... | Create chat room
@param payload {@link ChatRoomPayload}
@return result contains room id
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Create",
"chat",
"room"
] | 767f5fb15e9fe5a546c00f6e68b64f6dd53c617c | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/chatroom/ChatRoomClient.java#L53-L57 | train |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/chatroom/ChatRoomClient.java | ChatRoomClient.getBatchChatRoomInfo | public ChatRoomListResult getBatchChatRoomInfo(long... roomIds) throws APIConnectionException, APIRequestException {
Preconditions.checkArgument(roomIds != null && roomIds.length > 0, "Room ids should not be null");
JsonArray array = new JsonArray();
for (long id : roomIds) {
array.add(new JsonPrimitive(id));
}
ResponseWrapper responseWrapper = _httpClient.sendPost(_baseUrl + mChatRoomPath + "/batch", array.toString());
return ChatRoomListResult.fromResponse(responseWrapper);
} | java | public ChatRoomListResult getBatchChatRoomInfo(long... roomIds) throws APIConnectionException, APIRequestException {
Preconditions.checkArgument(roomIds != null && roomIds.length > 0, "Room ids should not be null");
JsonArray array = new JsonArray();
for (long id : roomIds) {
array.add(new JsonPrimitive(id));
}
ResponseWrapper responseWrapper = _httpClient.sendPost(_baseUrl + mChatRoomPath + "/batch", array.toString());
return ChatRoomListResult.fromResponse(responseWrapper);
} | [
"public",
"ChatRoomListResult",
"getBatchChatRoomInfo",
"(",
"long",
"...",
"roomIds",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"roomIds",
"!=",
"null",
"&&",
"roomIds",
".",
"length",
">",
... | Get chat room information by room ids
@param roomIds Array of room id
@return {@link ChatRoomListResult}
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Get",
"chat",
"room",
"information",
"by",
"room",
"ids"
] | 767f5fb15e9fe5a546c00f6e68b64f6dd53c617c | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/chatroom/ChatRoomClient.java#L67-L75 | train |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/chatroom/ChatRoomClient.java | ChatRoomClient.getUserChatRoomInfo | public ChatRoomListResult getUserChatRoomInfo(String username) throws APIConnectionException, APIRequestException {
StringUtils.checkUsername(username);
ResponseWrapper responseWrapper = _httpClient.sendGet(_baseUrl + mUserPath + "/" + username + "/chatroom");
return ChatRoomListResult.fromResponse(responseWrapper);
} | java | public ChatRoomListResult getUserChatRoomInfo(String username) throws APIConnectionException, APIRequestException {
StringUtils.checkUsername(username);
ResponseWrapper responseWrapper = _httpClient.sendGet(_baseUrl + mUserPath + "/" + username + "/chatroom");
return ChatRoomListResult.fromResponse(responseWrapper);
} | [
"public",
"ChatRoomListResult",
"getUserChatRoomInfo",
"(",
"String",
"username",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"StringUtils",
".",
"checkUsername",
"(",
"username",
")",
";",
"ResponseWrapper",
"responseWrapper",
"=",
"_httpCli... | Get user's whole chat room information
@param username required
@return {@link ChatRoomListResult}
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Get",
"user",
"s",
"whole",
"chat",
"room",
"information"
] | 767f5fb15e9fe5a546c00f6e68b64f6dd53c617c | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/chatroom/ChatRoomClient.java#L85-L89 | train |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/chatroom/ChatRoomClient.java | ChatRoomClient.deleteChatRoom | public ResponseWrapper deleteChatRoom(long roomId) throws APIConnectionException, APIRequestException {
Preconditions.checkArgument(roomId > 0, "room id is invalid");
return _httpClient.sendDelete(_baseUrl + mChatRoomPath + "/" + roomId);
} | java | public ResponseWrapper deleteChatRoom(long roomId) throws APIConnectionException, APIRequestException {
Preconditions.checkArgument(roomId > 0, "room id is invalid");
return _httpClient.sendDelete(_baseUrl + mChatRoomPath + "/" + roomId);
} | [
"public",
"ResponseWrapper",
"deleteChatRoom",
"(",
"long",
"roomId",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"roomId",
">",
"0",
",",
"\"room id is invalid\"",
")",
";",
"return",
"_httpCli... | Delete chat room by id
@param roomId room id
@return No content
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Delete",
"chat",
"room",
"by",
"id"
] | 767f5fb15e9fe5a546c00f6e68b64f6dd53c617c | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/chatroom/ChatRoomClient.java#L139-L142 | train |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/resource/ResourceClient.java | ResourceClient.downloadFile | public DownloadResult downloadFile(String mediaId)
throws APIConnectionException, APIRequestException {
Preconditions.checkArgument(null != mediaId, "mediaId is necessary");
ResponseWrapper response = _httpClient.sendGet(_baseUrl + resourcePath + "?mediaId=" + mediaId);
return DownloadResult.fromResponse(response, DownloadResult.class);
} | java | public DownloadResult downloadFile(String mediaId)
throws APIConnectionException, APIRequestException {
Preconditions.checkArgument(null != mediaId, "mediaId is necessary");
ResponseWrapper response = _httpClient.sendGet(_baseUrl + resourcePath + "?mediaId=" + mediaId);
return DownloadResult.fromResponse(response, DownloadResult.class);
} | [
"public",
"DownloadResult",
"downloadFile",
"(",
"String",
"mediaId",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"null",
"!=",
"mediaId",
",",
"\"mediaId is necessary\"",
")",
";",
"ResponseWrapp... | Download file with mediaId, will return DownloadResult which include url.
@param mediaId Necessary
@return DownloadResult
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Download",
"file",
"with",
"mediaId",
"will",
"return",
"DownloadResult",
"which",
"include",
"url",
"."
] | 767f5fb15e9fe5a546c00f6e68b64f6dd53c617c | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/resource/ResourceClient.java#L55-L61 | train |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/reportv2/ReportClient.java | ReportClient.v2GetMessageListByCursor | public MessageListResult v2GetMessageListByCursor(String cursor)
throws APIConnectionException, APIRequestException {
if (null != cursor) {
String requestUrl = mBaseReportPath + mV2MessagePath + "?cursor=" + cursor;
ResponseWrapper response = _httpClient.sendGet(requestUrl);
return MessageListResult.fromResponse(response, MessageListResult.class);
} else {
throw new IllegalArgumentException("the cursor parameter should not be null");
}
} | java | public MessageListResult v2GetMessageListByCursor(String cursor)
throws APIConnectionException, APIRequestException {
if (null != cursor) {
String requestUrl = mBaseReportPath + mV2MessagePath + "?cursor=" + cursor;
ResponseWrapper response = _httpClient.sendGet(requestUrl);
return MessageListResult.fromResponse(response, MessageListResult.class);
} else {
throw new IllegalArgumentException("the cursor parameter should not be null");
}
} | [
"public",
"MessageListResult",
"v2GetMessageListByCursor",
"(",
"String",
"cursor",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"if",
"(",
"null",
"!=",
"cursor",
")",
"{",
"String",
"requestUrl",
"=",
"mBaseReportPath",
"+",
"mV2MessageP... | Get message list with cursor, the cursor will effective in 120 seconds. And will
return same count of messages as first request.
@param cursor First request will return cursor
@return MessageListResult
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Get",
"message",
"list",
"with",
"cursor",
"the",
"cursor",
"will",
"effective",
"in",
"120",
"seconds",
".",
"And",
"will",
"return",
"same",
"count",
"of",
"messages",
"as",
"first",
"request",
"."
] | 767f5fb15e9fe5a546c00f6e68b64f6dd53c617c | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/reportv2/ReportClient.java#L115-L124 | train |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/crossapp/CrossAppClient.java | CrossAppClient.getCrossGroupMembers | public MemberListResult getCrossGroupMembers(long gid)
throws APIConnectionException, APIRequestException {
Preconditions.checkArgument(0 != gid, "gid must not be empty");
ResponseWrapper response = _httpClient.sendGet(_baseUrl + crossGroupPath + "/" + gid + "/members/");
return MemberListResult.fromResponse(response);
} | java | public MemberListResult getCrossGroupMembers(long gid)
throws APIConnectionException, APIRequestException {
Preconditions.checkArgument(0 != gid, "gid must not be empty");
ResponseWrapper response = _httpClient.sendGet(_baseUrl + crossGroupPath + "/" + gid + "/members/");
return MemberListResult.fromResponse(response);
} | [
"public",
"MemberListResult",
"getCrossGroupMembers",
"(",
"long",
"gid",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"0",
"!=",
"gid",
",",
"\"gid must not be empty\"",
")",
";",
"ResponseWrapper... | Get members' info from cross group
@param gid Necessary, target group id
@return Member info array
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Get",
"members",
"info",
"from",
"cross",
"group"
] | 767f5fb15e9fe5a546c00f6e68b64f6dd53c617c | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/crossapp/CrossAppClient.java#L68-L73 | train |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/crossapp/CrossAppClient.java | CrossAppClient.deleteCrossBlacklist | public ResponseWrapper deleteCrossBlacklist(String username, CrossBlacklist[] blacklists)
throws APIConnectionException, APIRequestException {
StringUtils.checkUsername(username);
CrossBlacklistPayload payload = new CrossBlacklistPayload.Builder()
.setCrossBlacklists(blacklists)
.build();
return _httpClient.sendDelete(_baseUrl + crossUserPath + "/" + username + "/blacklist", payload.toString());
} | java | public ResponseWrapper deleteCrossBlacklist(String username, CrossBlacklist[] blacklists)
throws APIConnectionException, APIRequestException {
StringUtils.checkUsername(username);
CrossBlacklistPayload payload = new CrossBlacklistPayload.Builder()
.setCrossBlacklists(blacklists)
.build();
return _httpClient.sendDelete(_baseUrl + crossUserPath + "/" + username + "/blacklist", payload.toString());
} | [
"public",
"ResponseWrapper",
"deleteCrossBlacklist",
"(",
"String",
"username",
",",
"CrossBlacklist",
"[",
"]",
"blacklists",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"StringUtils",
".",
"checkUsername",
"(",
"username",
")",
";",
"Cr... | Delete blacklist whose users belong to another app from a given user.
@param username The owner of the blacklist
@param blacklists CrossBlacklist array
@return No content
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Delete",
"blacklist",
"whose",
"users",
"belong",
"to",
"another",
"app",
"from",
"a",
"given",
"user",
"."
] | 767f5fb15e9fe5a546c00f6e68b64f6dd53c617c | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/crossapp/CrossAppClient.java#L100-L107 | train |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/sensitiveword/SensitiveWordClient.java | SensitiveWordClient.deleteSensitiveWord | public ResponseWrapper deleteSensitiveWord(String word) throws APIConnectionException, APIRequestException {
Preconditions.checkArgument(word.length() <= 10, "one word's max length is 10");
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("word", word);
return _httpClient.sendDelete(_baseUrl + sensitiveWordPath, jsonObject.toString());
} | java | public ResponseWrapper deleteSensitiveWord(String word) throws APIConnectionException, APIRequestException {
Preconditions.checkArgument(word.length() <= 10, "one word's max length is 10");
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("word", word);
return _httpClient.sendDelete(_baseUrl + sensitiveWordPath, jsonObject.toString());
} | [
"public",
"ResponseWrapper",
"deleteSensitiveWord",
"(",
"String",
"word",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"word",
".",
"length",
"(",
")",
"<=",
"10",
",",
"\"one word's max length ... | Delete sensitive word
@param word word to be deleted
@return No content
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Delete",
"sensitive",
"word"
] | 767f5fb15e9fe5a546c00f6e68b64f6dd53c617c | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/sensitiveword/SensitiveWordClient.java#L94-L99 | train |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/sensitiveword/SensitiveWordClient.java | SensitiveWordClient.updateSensitiveWordStatus | public ResponseWrapper updateSensitiveWordStatus(int status) throws APIConnectionException, APIRequestException {
Preconditions.checkArgument(status == 0 || status == 1, "status should be 0 or 1");
return _httpClient.sendPut(_baseUrl + sensitiveWordPath + "/status?status=" + status, null);
} | java | public ResponseWrapper updateSensitiveWordStatus(int status) throws APIConnectionException, APIRequestException {
Preconditions.checkArgument(status == 0 || status == 1, "status should be 0 or 1");
return _httpClient.sendPut(_baseUrl + sensitiveWordPath + "/status?status=" + status, null);
} | [
"public",
"ResponseWrapper",
"updateSensitiveWordStatus",
"(",
"int",
"status",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"status",
"==",
"0",
"||",
"status",
"==",
"1",
",",
"\"status should ... | Update sensitive word status
@param status 1 represent turn on filtering, 0 represent turn off.
@return No content
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Update",
"sensitive",
"word",
"status"
] | 767f5fb15e9fe5a546c00f6e68b64f6dd53c617c | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/sensitiveword/SensitiveWordClient.java#L124-L127 | train |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/sensitiveword/SensitiveWordClient.java | SensitiveWordClient.getSensitiveWordStatus | public SensitiveWordStatusResult getSensitiveWordStatus() throws APIConnectionException, APIRequestException {
ResponseWrapper responseWrapper = _httpClient.sendGet(_baseUrl + sensitiveWordPath + "/status");
return _gson.fromJson(responseWrapper.responseContent, SensitiveWordStatusResult.class);
} | java | public SensitiveWordStatusResult getSensitiveWordStatus() throws APIConnectionException, APIRequestException {
ResponseWrapper responseWrapper = _httpClient.sendGet(_baseUrl + sensitiveWordPath + "/status");
return _gson.fromJson(responseWrapper.responseContent, SensitiveWordStatusResult.class);
} | [
"public",
"SensitiveWordStatusResult",
"getSensitiveWordStatus",
"(",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"ResponseWrapper",
"responseWrapper",
"=",
"_httpClient",
".",
"sendGet",
"(",
"_baseUrl",
"+",
"sensitiveWordPath",
"+",
"\"/stat... | Get sensitive word status
@return status of sensitive word
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Get",
"sensitive",
"word",
"status"
] | 767f5fb15e9fe5a546c00f6e68b64f6dd53c617c | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/sensitiveword/SensitiveWordClient.java#L135-L138 | train |
markushi/android-ui | src/main/java/at/markushi/ui/ActionView.java | ActionView.setAction | public void setAction(final Action fromAction, final Action toAction, final int rotation, long delay) {
setAction(fromAction, false, ROTATE_CLOCKWISE);
postDelayed(new Runnable() {
@Override
public void run() {
if (!isAttachedToWindow()) {
return;
}
setAction(toAction, true, rotation);
}
}, delay);
} | java | public void setAction(final Action fromAction, final Action toAction, final int rotation, long delay) {
setAction(fromAction, false, ROTATE_CLOCKWISE);
postDelayed(new Runnable() {
@Override
public void run() {
if (!isAttachedToWindow()) {
return;
}
setAction(toAction, true, rotation);
}
}, delay);
} | [
"public",
"void",
"setAction",
"(",
"final",
"Action",
"fromAction",
",",
"final",
"Action",
"toAction",
",",
"final",
"int",
"rotation",
",",
"long",
"delay",
")",
"{",
"setAction",
"(",
"fromAction",
",",
"false",
",",
"ROTATE_CLOCKWISE",
")",
";",
"postDe... | Sets a new action transition.
@param fromAction The initial action.
@param toAction The target action.
@param rotation The rotation direction used for the transition {@link #ROTATE_CLOCKWISE} or {@link #ROTATE_COUNTER_CLOCKWISE}.
@param delay The delay in ms before the transition is started. | [
"Sets",
"a",
"new",
"action",
"transition",
"."
] | a589fad7b74ace063c2b0e90741d43225b200a18 | https://github.com/markushi/android-ui/blob/a589fad7b74ace063c2b0e90741d43225b200a18/src/main/java/at/markushi/ui/ActionView.java#L215-L226 | train |
markushi/android-ui | src/main/java/at/markushi/ui/RevealColorView.java | RevealColorView.calculateScale | private float calculateScale(int x, int y) {
final float centerX = getWidth() / 2f;
final float centerY = getHeight() / 2f;
final float maxDistance = (float) Math.sqrt(centerX * centerX + centerY * centerY);
final float deltaX = centerX - x;
final float deltaY = centerY - y;
final float distance = (float) Math.sqrt(deltaX * deltaX + deltaY * deltaY);
final float scale = 0.5f + (distance / maxDistance) * 0.5f;
return scale;
} | java | private float calculateScale(int x, int y) {
final float centerX = getWidth() / 2f;
final float centerY = getHeight() / 2f;
final float maxDistance = (float) Math.sqrt(centerX * centerX + centerY * centerY);
final float deltaX = centerX - x;
final float deltaY = centerY - y;
final float distance = (float) Math.sqrt(deltaX * deltaX + deltaY * deltaY);
final float scale = 0.5f + (distance / maxDistance) * 0.5f;
return scale;
} | [
"private",
"float",
"calculateScale",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"final",
"float",
"centerX",
"=",
"getWidth",
"(",
")",
"/",
"2f",
";",
"final",
"float",
"centerY",
"=",
"getHeight",
"(",
")",
"/",
"2f",
";",
"final",
"float",
"maxD... | calculates the required scale of the ink-view to fill the whole view
@param x circle center x
@param y circle center y
@return | [
"calculates",
"the",
"required",
"scale",
"of",
"the",
"ink",
"-",
"view",
"to",
"fill",
"the",
"whole",
"view"
] | a589fad7b74ace063c2b0e90741d43225b200a18 | https://github.com/markushi/android-ui/blob/a589fad7b74ace063c2b0e90741d43225b200a18/src/main/java/at/markushi/ui/RevealColorView.java#L207-L217 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/SarlDoclet.java | SarlDoclet.validOptions | public static boolean validOptions(String[][] options, DocErrorReporter reporter) {
return SARL_DOCLET.configuration.validOptions(options, reporter);
} | java | public static boolean validOptions(String[][] options, DocErrorReporter reporter) {
return SARL_DOCLET.configuration.validOptions(options, reporter);
} | [
"public",
"static",
"boolean",
"validOptions",
"(",
"String",
"[",
"]",
"[",
"]",
"options",
",",
"DocErrorReporter",
"reporter",
")",
"{",
"return",
"SARL_DOCLET",
".",
"configuration",
".",
"validOptions",
"(",
"options",
",",
"reporter",
")",
";",
"}"
] | Validate the given options.
@param options the options to validate, which their parameters.
@param reporter the receiver of errors.
@return the validation status. | [
"Validate",
"the",
"given",
"options",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/SarlDoclet.java#L104-L106 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/Kernel.java | Kernel.spawn | public List<UUID> spawn(int nbAgents, Class<? extends Agent> agent, Object... params) {
return this.spawnService.spawn(nbAgents, null, this.janusContext, null, agent, params);
} | java | public List<UUID> spawn(int nbAgents, Class<? extends Agent> agent, Object... params) {
return this.spawnService.spawn(nbAgents, null, this.janusContext, null, agent, params);
} | [
"public",
"List",
"<",
"UUID",
">",
"spawn",
"(",
"int",
"nbAgents",
",",
"Class",
"<",
"?",
"extends",
"Agent",
">",
"agent",
",",
"Object",
"...",
"params",
")",
"{",
"return",
"this",
".",
"spawnService",
".",
"spawn",
"(",
"nbAgents",
",",
"null",
... | Spawn agents of the given type, and pass the parameters to its initialization function.
@param nbAgents the number of agents to spawn.
@param agent the type of the agents to spawn.
@param params the list of the parameters to pass to the agent initialization function.
@return the identifiers of the agents, never <code>null</code>. | [
"Spawn",
"agents",
"of",
"the",
"given",
"type",
"and",
"pass",
"the",
"parameters",
"to",
"its",
"initialization",
"function",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/Kernel.java#L154-L156 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/Kernel.java | Kernel.spawn | public UUID spawn(UUID agentID, Class<? extends Agent> agent, Object... params) {
final List<UUID> ids = this.spawnService.spawn(1, null, this.janusContext, agentID, agent, params);
if (ids.isEmpty()) {
return null;
}
return ids.get(0);
} | java | public UUID spawn(UUID agentID, Class<? extends Agent> agent, Object... params) {
final List<UUID> ids = this.spawnService.spawn(1, null, this.janusContext, agentID, agent, params);
if (ids.isEmpty()) {
return null;
}
return ids.get(0);
} | [
"public",
"UUID",
"spawn",
"(",
"UUID",
"agentID",
",",
"Class",
"<",
"?",
"extends",
"Agent",
">",
"agent",
",",
"Object",
"...",
"params",
")",
"{",
"final",
"List",
"<",
"UUID",
">",
"ids",
"=",
"this",
".",
"spawnService",
".",
"spawn",
"(",
"1",... | Spawn an agent of the given type, and pass the parameters to its initialization function.
@param agentID the identifier of the agent to spawn. If <code>null</code> the identifier is randomly selected.
@param agent the type of the agent to spawn.
@param params the list of the parameters to pass to the agent initialization function.
@return the identifier of the agent, never <code>null</code>. | [
"Spawn",
"an",
"agent",
"of",
"the",
"given",
"type",
"and",
"pass",
"the",
"parameters",
"to",
"its",
"initialization",
"function",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/Kernel.java#L166-L172 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/Kernel.java | Kernel.getService | public <S extends Service> S getService(Class<S> type) {
for (final Service serv : this.serviceManager.servicesByState().values()) {
if (serv.isRunning() && type.isInstance(serv)) {
return type.cast(serv);
}
}
return null;
} | java | public <S extends Service> S getService(Class<S> type) {
for (final Service serv : this.serviceManager.servicesByState().values()) {
if (serv.isRunning() && type.isInstance(serv)) {
return type.cast(serv);
}
}
return null;
} | [
"public",
"<",
"S",
"extends",
"Service",
">",
"S",
"getService",
"(",
"Class",
"<",
"S",
">",
"type",
")",
"{",
"for",
"(",
"final",
"Service",
"serv",
":",
"this",
".",
"serviceManager",
".",
"servicesByState",
"(",
")",
".",
"values",
"(",
")",
")... | Replies a kernel service that is alive.
@param <S> - type of the type to reply.
@param type type of the type to reply.
@return the service, or <code>null</code>. | [
"Replies",
"a",
"kernel",
"service",
"that",
"is",
"alive",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/Kernel.java#L181-L188 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/codemining/SARLCodeminingPreferenceAccess.java | SARLCodeminingPreferenceAccess.setCodeminingEnabled | public void setCodeminingEnabled(Boolean enable) {
final IPreferenceStore store = getWritablePreferenceStore(null);
if (enable == null) {
store.setToDefault(CODEMINING_PROPERTY);
} else {
store.setValue(CODEMINING_PROPERTY, enable.booleanValue());
}
} | java | public void setCodeminingEnabled(Boolean enable) {
final IPreferenceStore store = getWritablePreferenceStore(null);
if (enable == null) {
store.setToDefault(CODEMINING_PROPERTY);
} else {
store.setValue(CODEMINING_PROPERTY, enable.booleanValue());
}
} | [
"public",
"void",
"setCodeminingEnabled",
"(",
"Boolean",
"enable",
")",
"{",
"final",
"IPreferenceStore",
"store",
"=",
"getWritablePreferenceStore",
"(",
"null",
")",
";",
"if",
"(",
"enable",
"==",
"null",
")",
"{",
"store",
".",
"setToDefault",
"(",
"CODEM... | Enable or disable the codemining feature into the SARL editor.
@param enable is {@code true} if it is enabled; {@code false} if it is disable; {@code null}
to restore the default value.
@since 0.8
@see #getWritablePreferenceStore(Object) | [
"Enable",
"or",
"disable",
"the",
"codemining",
"feature",
"into",
"the",
"SARL",
"editor",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/codemining/SARLCodeminingPreferenceAccess.java#L69-L76 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/writers/WriterUtils.java | WriterUtils.addFormalParameter | public static void addFormalParameter(ExecutableMemberDoc member, Parameter param, boolean isVarArg, Content htmlTree,
SarlConfiguration configuration, SubWriterHolderWriter writer) {
final ProxyInstaller proxyInstaller = configuration.getProxyInstaller();
final ExecutableMemberDoc omember = proxyInstaller.unwrap(member);
final Parameter oparam = proxyInstaller.unwrap(param);
final String defaultValue = Utils.getParameterDefaultValue(omember, oparam, configuration);
final boolean addDefaultValueBrackets = Utils.isNullOrEmpty(defaultValue)
&& Utils.isDefaultValuedParameter(oparam, configuration);
if (addDefaultValueBrackets) {
htmlTree.addContent("["); //$NON-NLS-1$
}
if (oparam.name().length() > 0) {
htmlTree.addContent(oparam.name());
}
htmlTree.addContent(writer.getSpace());
htmlTree.addContent(Utils.getKeywords().getColonKeyword());
htmlTree.addContent(" "); //$NON-NLS-1$
if (oparam.type() != null) {
final Content link = writer.getLink(new LinkInfoImpl(
configuration, LinkInfoImpl.Kind.EXECUTABLE_MEMBER_PARAM,
oparam.type()).varargs(isVarArg));
htmlTree.addContent(link);
}
if (addDefaultValueBrackets) {
htmlTree.addContent("]"); //$NON-NLS-1$
} else if (!Utils.isNullOrEmpty(defaultValue)) {
htmlTree.addContent(" "); //$NON-NLS-1$
htmlTree.addContent(Utils.getKeywords().getEqualsSignKeyword());
htmlTree.addContent(writer.getSpace());
htmlTree.addContent(defaultValue);
}
} | java | public static void addFormalParameter(ExecutableMemberDoc member, Parameter param, boolean isVarArg, Content htmlTree,
SarlConfiguration configuration, SubWriterHolderWriter writer) {
final ProxyInstaller proxyInstaller = configuration.getProxyInstaller();
final ExecutableMemberDoc omember = proxyInstaller.unwrap(member);
final Parameter oparam = proxyInstaller.unwrap(param);
final String defaultValue = Utils.getParameterDefaultValue(omember, oparam, configuration);
final boolean addDefaultValueBrackets = Utils.isNullOrEmpty(defaultValue)
&& Utils.isDefaultValuedParameter(oparam, configuration);
if (addDefaultValueBrackets) {
htmlTree.addContent("["); //$NON-NLS-1$
}
if (oparam.name().length() > 0) {
htmlTree.addContent(oparam.name());
}
htmlTree.addContent(writer.getSpace());
htmlTree.addContent(Utils.getKeywords().getColonKeyword());
htmlTree.addContent(" "); //$NON-NLS-1$
if (oparam.type() != null) {
final Content link = writer.getLink(new LinkInfoImpl(
configuration, LinkInfoImpl.Kind.EXECUTABLE_MEMBER_PARAM,
oparam.type()).varargs(isVarArg));
htmlTree.addContent(link);
}
if (addDefaultValueBrackets) {
htmlTree.addContent("]"); //$NON-NLS-1$
} else if (!Utils.isNullOrEmpty(defaultValue)) {
htmlTree.addContent(" "); //$NON-NLS-1$
htmlTree.addContent(Utils.getKeywords().getEqualsSignKeyword());
htmlTree.addContent(writer.getSpace());
htmlTree.addContent(defaultValue);
}
} | [
"public",
"static",
"void",
"addFormalParameter",
"(",
"ExecutableMemberDoc",
"member",
",",
"Parameter",
"param",
",",
"boolean",
"isVarArg",
",",
"Content",
"htmlTree",
",",
"SarlConfiguration",
"configuration",
",",
"SubWriterHolderWriter",
"writer",
")",
"{",
"fin... | Add a parameter to the given executable member.
@param member the executable member.
@param param the parameter.
@param isVarArg indicates if the parameter is variadic.
@param htmlTree the output.
@param configuration the configuration.
@param writer the background writer. | [
"Add",
"a",
"parameter",
"to",
"the",
"given",
"executable",
"member",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/writers/WriterUtils.java#L58-L89 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/binding/BindingElement.java | BindingElement.getKeyString | public String getKeyString() {
if (!Strings.isEmpty(getAnnotatedWith())) {
return MessageFormat.format("@{1} {0}", getBind(), getAnnotatedWith()); //$NON-NLS-1$
}
if (!Strings.isEmpty(getAnnotatedWithName())) {
return MessageFormat.format("@Named({1}) {0}", getBind(), getAnnotatedWithName()); //$NON-NLS-1$
}
return MessageFormat.format("{0}", getBind()); //$NON-NLS-1$
} | java | public String getKeyString() {
if (!Strings.isEmpty(getAnnotatedWith())) {
return MessageFormat.format("@{1} {0}", getBind(), getAnnotatedWith()); //$NON-NLS-1$
}
if (!Strings.isEmpty(getAnnotatedWithName())) {
return MessageFormat.format("@Named({1}) {0}", getBind(), getAnnotatedWithName()); //$NON-NLS-1$
}
return MessageFormat.format("{0}", getBind()); //$NON-NLS-1$
} | [
"public",
"String",
"getKeyString",
"(",
")",
"{",
"if",
"(",
"!",
"Strings",
".",
"isEmpty",
"(",
"getAnnotatedWith",
"(",
")",
")",
")",
"{",
"return",
"MessageFormat",
".",
"format",
"(",
"\"@{1} {0}\"",
",",
"getBind",
"(",
")",
",",
"getAnnotatedWith"... | Replies the string representation of the binding key.
@return the string representation of the binding key.
@since 0.8 | [
"Replies",
"the",
"string",
"representation",
"of",
"the",
"binding",
"key",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/binding/BindingElement.java#L97-L105 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java | SREsPreferencePage.refreshSREListUI | protected void refreshSREListUI() {
// Refreshes the SRE listing after a SRE install notification, might not
// happen on the UI thread.
final Display display = Display.getDefault();
if (display.getThread().equals(Thread.currentThread())) {
if (!this.sresList.isBusy()) {
this.sresList.refresh();
}
} else {
display.syncExec(new Runnable() {
@SuppressWarnings("synthetic-access")
@Override
public void run() {
if (!SREsPreferencePage.this.sresList.isBusy()) {
SREsPreferencePage.this.sresList.refresh();
}
}
});
}
} | java | protected void refreshSREListUI() {
// Refreshes the SRE listing after a SRE install notification, might not
// happen on the UI thread.
final Display display = Display.getDefault();
if (display.getThread().equals(Thread.currentThread())) {
if (!this.sresList.isBusy()) {
this.sresList.refresh();
}
} else {
display.syncExec(new Runnable() {
@SuppressWarnings("synthetic-access")
@Override
public void run() {
if (!SREsPreferencePage.this.sresList.isBusy()) {
SREsPreferencePage.this.sresList.refresh();
}
}
});
}
} | [
"protected",
"void",
"refreshSREListUI",
"(",
")",
"{",
"// Refreshes the SRE listing after a SRE install notification, might not",
"// happen on the UI thread.",
"final",
"Display",
"display",
"=",
"Display",
".",
"getDefault",
"(",
")",
";",
"if",
"(",
"display",
".",
"... | Refresh the UI list of SRE. | [
"Refresh",
"the",
"UI",
"list",
"of",
"SRE",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java#L161-L180 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java | SREsPreferencePage.setErrorMessage | public void setErrorMessage(Throwable exception) {
if (exception != null) {
String message = exception.getLocalizedMessage();
if (Strings.isNullOrEmpty(message)) {
message = exception.getMessage();
}
if (Strings.isNullOrEmpty(message)) {
message = MessageFormat.format(Messages.SREsPreferencePage_9, exception.getClass().getName());
}
setErrorMessage(message);
}
} | java | public void setErrorMessage(Throwable exception) {
if (exception != null) {
String message = exception.getLocalizedMessage();
if (Strings.isNullOrEmpty(message)) {
message = exception.getMessage();
}
if (Strings.isNullOrEmpty(message)) {
message = MessageFormat.format(Messages.SREsPreferencePage_9, exception.getClass().getName());
}
setErrorMessage(message);
}
} | [
"public",
"void",
"setErrorMessage",
"(",
"Throwable",
"exception",
")",
"{",
"if",
"(",
"exception",
"!=",
"null",
")",
"{",
"String",
"message",
"=",
"exception",
".",
"getLocalizedMessage",
"(",
")",
";",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
... | Set the error message from the given exception.
@param exception the exception to log. | [
"Set",
"the",
"error",
"message",
"from",
"the",
"given",
"exception",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java#L186-L197 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java | SREsPreferencePage.setSREs | protected void setSREs(ISREInstall[] sres) {
this.sreArray.clear();
for (final ISREInstall sre : sres) {
this.sreArray.add(sre);
}
this.sresList.setInput(this.sreArray);
refreshSREListUI();
updateUI();
} | java | protected void setSREs(ISREInstall[] sres) {
this.sreArray.clear();
for (final ISREInstall sre : sres) {
this.sreArray.add(sre);
}
this.sresList.setInput(this.sreArray);
refreshSREListUI();
updateUI();
} | [
"protected",
"void",
"setSREs",
"(",
"ISREInstall",
"[",
"]",
"sres",
")",
"{",
"this",
".",
"sreArray",
".",
"clear",
"(",
")",
";",
"for",
"(",
"final",
"ISREInstall",
"sre",
":",
"sres",
")",
"{",
"this",
".",
"sreArray",
".",
"add",
"(",
"sre",
... | Sets the SREs to be displayed in this block.
@param sres SREs to be displayed | [
"Sets",
"the",
"SREs",
"to",
"be",
"displayed",
"in",
"this",
"block",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java#L375-L383 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java | SREsPreferencePage.createUniqueName | public String createUniqueName(String name) {
if (!isDuplicateName(name)) {
return name;
}
if (name.matches(".*\\(\\d*\\)")) { //$NON-NLS-1$
final int start = name.lastIndexOf('(');
final int end = name.lastIndexOf(')');
final String stringInt = name.substring(start + 1, end);
final int numericValue = Integer.parseInt(stringInt);
final String newName = name.substring(0, start + 1) + (numericValue + 1) + ")"; //$NON-NLS-1$
return createUniqueName(newName);
}
return createUniqueName(name + " (1)"); //$NON-NLS-1$
} | java | public String createUniqueName(String name) {
if (!isDuplicateName(name)) {
return name;
}
if (name.matches(".*\\(\\d*\\)")) { //$NON-NLS-1$
final int start = name.lastIndexOf('(');
final int end = name.lastIndexOf(')');
final String stringInt = name.substring(start + 1, end);
final int numericValue = Integer.parseInt(stringInt);
final String newName = name.substring(0, start + 1) + (numericValue + 1) + ")"; //$NON-NLS-1$
return createUniqueName(newName);
}
return createUniqueName(name + " (1)"); //$NON-NLS-1$
} | [
"public",
"String",
"createUniqueName",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"!",
"isDuplicateName",
"(",
"name",
")",
")",
"{",
"return",
"name",
";",
"}",
"if",
"(",
"name",
".",
"matches",
"(",
"\".*\\\\(\\\\d*\\\\)\"",
")",
")",
"{",
"//$NON-N... | Compares the given name against current names and adds the appropriate numerical
suffix to ensure that it is unique.
@param name the name with which to ensure uniqueness.
@return the unique version of the given name. | [
"Compares",
"the",
"given",
"name",
"against",
"current",
"names",
"and",
"adds",
"the",
"appropriate",
"numerical",
"suffix",
"to",
"ensure",
"that",
"it",
"is",
"unique",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java#L429-L442 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java | SREsPreferencePage.addSRE | protected void addSRE() {
final AddSREInstallWizard wizard = new AddSREInstallWizard(
createUniqueIdentifier(),
this.sreArray.toArray(new ISREInstall[this.sreArray.size()]));
final WizardDialog dialog = new WizardDialog(getShell(), wizard);
if (dialog.open() == Window.OK) {
final ISREInstall result = wizard.getCreatedSRE();
if (result != null) {
this.sreArray.add(result);
//refresh from model
refreshSREListUI();
this.sresList.setSelection(new StructuredSelection(result));
//ensure labels are updated
if (!this.sresList.isBusy()) {
this.sresList.refresh(true);
}
updateUI();
// Autoselect the default SRE
if (getDefaultSRE() == null) {
setDefaultSRE(result);
}
}
}
} | java | protected void addSRE() {
final AddSREInstallWizard wizard = new AddSREInstallWizard(
createUniqueIdentifier(),
this.sreArray.toArray(new ISREInstall[this.sreArray.size()]));
final WizardDialog dialog = new WizardDialog(getShell(), wizard);
if (dialog.open() == Window.OK) {
final ISREInstall result = wizard.getCreatedSRE();
if (result != null) {
this.sreArray.add(result);
//refresh from model
refreshSREListUI();
this.sresList.setSelection(new StructuredSelection(result));
//ensure labels are updated
if (!this.sresList.isBusy()) {
this.sresList.refresh(true);
}
updateUI();
// Autoselect the default SRE
if (getDefaultSRE() == null) {
setDefaultSRE(result);
}
}
}
} | [
"protected",
"void",
"addSRE",
"(",
")",
"{",
"final",
"AddSREInstallWizard",
"wizard",
"=",
"new",
"AddSREInstallWizard",
"(",
"createUniqueIdentifier",
"(",
")",
",",
"this",
".",
"sreArray",
".",
"toArray",
"(",
"new",
"ISREInstall",
"[",
"this",
".",
"sreA... | Add a SRE. | [
"Add",
"a",
"SRE",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java#L446-L469 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java | SREsPreferencePage.editSRE | protected void editSRE() {
final IStructuredSelection selection = (IStructuredSelection) this.sresList.getSelection();
final ISREInstall sre = (ISREInstall) selection.getFirstElement();
if (sre == null) {
return;
}
final EditSREInstallWizard wizard = new EditSREInstallWizard(
sre, this.sreArray.toArray(new ISREInstall[this.sreArray.size()]));
final WizardDialog dialog = new WizardDialog(getShell(), wizard);
if (dialog.open() == Window.OK) {
this.sresList.setSelection(new StructuredSelection(sre));
this.sresList.refresh(true);
updateUI();
}
} | java | protected void editSRE() {
final IStructuredSelection selection = (IStructuredSelection) this.sresList.getSelection();
final ISREInstall sre = (ISREInstall) selection.getFirstElement();
if (sre == null) {
return;
}
final EditSREInstallWizard wizard = new EditSREInstallWizard(
sre, this.sreArray.toArray(new ISREInstall[this.sreArray.size()]));
final WizardDialog dialog = new WizardDialog(getShell(), wizard);
if (dialog.open() == Window.OK) {
this.sresList.setSelection(new StructuredSelection(sre));
this.sresList.refresh(true);
updateUI();
}
} | [
"protected",
"void",
"editSRE",
"(",
")",
"{",
"final",
"IStructuredSelection",
"selection",
"=",
"(",
"IStructuredSelection",
")",
"this",
".",
"sresList",
".",
"getSelection",
"(",
")",
";",
"final",
"ISREInstall",
"sre",
"=",
"(",
"ISREInstall",
")",
"selec... | Edit the selected SRE. | [
"Edit",
"the",
"selected",
"SRE",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java#L473-L487 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java | SREsPreferencePage.copySRE | @SuppressWarnings("unchecked")
protected void copySRE() {
final IStructuredSelection selection = (IStructuredSelection) this.sresList.getSelection();
final Iterator<ISREInstall> it = selection.iterator();
final List<ISREInstall> newEntries = new ArrayList<>();
while (it.hasNext()) {
final ISREInstall selectedSRE = it.next();
final ISREInstall copy = selectedSRE.copy(createUniqueIdentifier());
copy.setName(createUniqueName(selectedSRE.getName()));
final EditSREInstallWizard wizard = new EditSREInstallWizard(
copy, this.sreArray.toArray(new ISREInstall[this.sreArray.size()]));
final WizardDialog dialog = new WizardDialog(getShell(), wizard);
final int dlgResult = dialog.open();
if (dlgResult == Window.OK) {
newEntries.add(copy);
} else {
assert dlgResult == Window.CANCEL;
// Canceling one wizard should cancel all subsequent wizards
break;
}
}
if (!newEntries.isEmpty()) {
this.sreArray.addAll(newEntries);
refreshSREListUI();
this.sresList.setSelection(new StructuredSelection(newEntries.toArray()));
} else {
this.sresList.setSelection(selection);
}
this.sresList.refresh(true);
updateUI();
} | java | @SuppressWarnings("unchecked")
protected void copySRE() {
final IStructuredSelection selection = (IStructuredSelection) this.sresList.getSelection();
final Iterator<ISREInstall> it = selection.iterator();
final List<ISREInstall> newEntries = new ArrayList<>();
while (it.hasNext()) {
final ISREInstall selectedSRE = it.next();
final ISREInstall copy = selectedSRE.copy(createUniqueIdentifier());
copy.setName(createUniqueName(selectedSRE.getName()));
final EditSREInstallWizard wizard = new EditSREInstallWizard(
copy, this.sreArray.toArray(new ISREInstall[this.sreArray.size()]));
final WizardDialog dialog = new WizardDialog(getShell(), wizard);
final int dlgResult = dialog.open();
if (dlgResult == Window.OK) {
newEntries.add(copy);
} else {
assert dlgResult == Window.CANCEL;
// Canceling one wizard should cancel all subsequent wizards
break;
}
}
if (!newEntries.isEmpty()) {
this.sreArray.addAll(newEntries);
refreshSREListUI();
this.sresList.setSelection(new StructuredSelection(newEntries.toArray()));
} else {
this.sresList.setSelection(selection);
}
this.sresList.refresh(true);
updateUI();
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"void",
"copySRE",
"(",
")",
"{",
"final",
"IStructuredSelection",
"selection",
"=",
"(",
"IStructuredSelection",
")",
"this",
".",
"sresList",
".",
"getSelection",
"(",
")",
";",
"final",
"Iterato... | Copy the selected SRE. | [
"Copy",
"the",
"selected",
"SRE",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java#L491-L524 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java | SREsPreferencePage.removeSREs | @SuppressWarnings("unchecked")
protected void removeSREs() {
final IStructuredSelection selection = (IStructuredSelection) this.sresList.getSelection();
final ISREInstall[] vms = new ISREInstall[selection.size()];
final Iterator<ISREInstall> iter = selection.iterator();
int i = 0;
while (iter.hasNext()) {
vms[i] = iter.next();
i++;
}
removeSREs(vms);
} | java | @SuppressWarnings("unchecked")
protected void removeSREs() {
final IStructuredSelection selection = (IStructuredSelection) this.sresList.getSelection();
final ISREInstall[] vms = new ISREInstall[selection.size()];
final Iterator<ISREInstall> iter = selection.iterator();
int i = 0;
while (iter.hasNext()) {
vms[i] = iter.next();
i++;
}
removeSREs(vms);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"void",
"removeSREs",
"(",
")",
"{",
"final",
"IStructuredSelection",
"selection",
"=",
"(",
"IStructuredSelection",
")",
"this",
".",
"sresList",
".",
"getSelection",
"(",
")",
";",
"final",
"ISRE... | Remove the selected SREs. | [
"Remove",
"the",
"selected",
"SREs",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java#L528-L539 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java | SREsPreferencePage.removeSREs | @SuppressWarnings("checkstyle:npathcomplexity")
public void removeSREs(ISREInstall... sres) {
final ISREInstall defaultSRE = getDefaultSRE();
final String defaultId = defaultSRE == null ? null : defaultSRE.getId();
int defaultIndex = -1;
if (defaultId != null) {
for (int i = 0; defaultIndex == -1 && i < this.sreTable.getItemCount(); ++i) {
if (defaultId.equals(
((ISREInstall) this.sreTable.getItem(i).getData()).getId())) {
defaultIndex = i;
}
}
}
final String normedDefaultId = Strings.nullToEmpty(defaultId);
boolean defaultIsRemoved = false;
for (final ISREInstall sre : sres) {
if (this.sreArray.remove(sre) && sre.getId().equals(normedDefaultId)) {
defaultIsRemoved = true;
}
}
refreshSREListUI();
// Update the default SRE
if (defaultIsRemoved) {
if (this.sreTable.getItemCount() == 0) {
setSelection(null);
} else {
if (defaultIndex < 0) {
defaultIndex = 0;
} else if (defaultIndex >= this.sreTable.getItemCount()) {
defaultIndex = this.sreTable.getItemCount() - 1;
}
setSelection(new StructuredSelection(
this.sreTable.getItem(defaultIndex).getData()));
}
}
this.sresList.refresh(true);
if (defaultIsRemoved) {
fireDefaultSREChanged();
}
updateUI();
} | java | @SuppressWarnings("checkstyle:npathcomplexity")
public void removeSREs(ISREInstall... sres) {
final ISREInstall defaultSRE = getDefaultSRE();
final String defaultId = defaultSRE == null ? null : defaultSRE.getId();
int defaultIndex = -1;
if (defaultId != null) {
for (int i = 0; defaultIndex == -1 && i < this.sreTable.getItemCount(); ++i) {
if (defaultId.equals(
((ISREInstall) this.sreTable.getItem(i).getData()).getId())) {
defaultIndex = i;
}
}
}
final String normedDefaultId = Strings.nullToEmpty(defaultId);
boolean defaultIsRemoved = false;
for (final ISREInstall sre : sres) {
if (this.sreArray.remove(sre) && sre.getId().equals(normedDefaultId)) {
defaultIsRemoved = true;
}
}
refreshSREListUI();
// Update the default SRE
if (defaultIsRemoved) {
if (this.sreTable.getItemCount() == 0) {
setSelection(null);
} else {
if (defaultIndex < 0) {
defaultIndex = 0;
} else if (defaultIndex >= this.sreTable.getItemCount()) {
defaultIndex = this.sreTable.getItemCount() - 1;
}
setSelection(new StructuredSelection(
this.sreTable.getItem(defaultIndex).getData()));
}
}
this.sresList.refresh(true);
if (defaultIsRemoved) {
fireDefaultSREChanged();
}
updateUI();
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:npathcomplexity\"",
")",
"public",
"void",
"removeSREs",
"(",
"ISREInstall",
"...",
"sres",
")",
"{",
"final",
"ISREInstall",
"defaultSRE",
"=",
"getDefaultSRE",
"(",
")",
";",
"final",
"String",
"defaultId",
"=",
"defau... | Removes the given SREs from the table.
@param sres the SREs to remove. | [
"Removes",
"the",
"given",
"SREs",
"from",
"the",
"table",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java#L546-L586 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java | SREsPreferencePage.enableButtons | @SuppressWarnings("unchecked")
private void enableButtons() {
final IStructuredSelection selection = (IStructuredSelection) this.sresList.getSelection();
final int selectionCount = selection.size();
this.editButton.setEnabled(selectionCount == 1);
this.copyButton.setEnabled(selectionCount > 0);
if (selectionCount > 0 && selectionCount <= this.sresList.getTable().getItemCount()) {
final Iterator<ISREInstall> iterator = selection.iterator();
while (iterator.hasNext()) {
final ISREInstall install = iterator.next();
if (SARLRuntime.isPlatformSRE(install)) {
this.removeButton.setEnabled(false);
return;
}
}
this.removeButton.setEnabled(true);
} else {
this.removeButton.setEnabled(false);
}
} | java | @SuppressWarnings("unchecked")
private void enableButtons() {
final IStructuredSelection selection = (IStructuredSelection) this.sresList.getSelection();
final int selectionCount = selection.size();
this.editButton.setEnabled(selectionCount == 1);
this.copyButton.setEnabled(selectionCount > 0);
if (selectionCount > 0 && selectionCount <= this.sresList.getTable().getItemCount()) {
final Iterator<ISREInstall> iterator = selection.iterator();
while (iterator.hasNext()) {
final ISREInstall install = iterator.next();
if (SARLRuntime.isPlatformSRE(install)) {
this.removeButton.setEnabled(false);
return;
}
}
this.removeButton.setEnabled(true);
} else {
this.removeButton.setEnabled(false);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"enableButtons",
"(",
")",
"{",
"final",
"IStructuredSelection",
"selection",
"=",
"(",
"IStructuredSelection",
")",
"this",
".",
"sresList",
".",
"getSelection",
"(",
")",
";",
"final",
"int... | Enables the buttons based on selected items counts in the viewer. | [
"Enables",
"the",
"buttons",
"based",
"on",
"selected",
"items",
"counts",
"in",
"the",
"viewer",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java#L837-L856 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java | SREsPreferencePage.sortByName | private void sortByName() {
this.sresList.setComparator(new ViewerComparator() {
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
if ((e1 instanceof ISREInstall) && (e2 instanceof ISREInstall)) {
final ISREInstall left = (ISREInstall) e1;
final ISREInstall right = (ISREInstall) e2;
return left.getName().compareToIgnoreCase(right.getName());
}
return super.compare(viewer, e1, e2);
}
@Override
public boolean isSorterProperty(Object element, String property) {
return true;
}
});
this.sortColumn = Column.NAME;
} | java | private void sortByName() {
this.sresList.setComparator(new ViewerComparator() {
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
if ((e1 instanceof ISREInstall) && (e2 instanceof ISREInstall)) {
final ISREInstall left = (ISREInstall) e1;
final ISREInstall right = (ISREInstall) e2;
return left.getName().compareToIgnoreCase(right.getName());
}
return super.compare(viewer, e1, e2);
}
@Override
public boolean isSorterProperty(Object element, String property) {
return true;
}
});
this.sortColumn = Column.NAME;
} | [
"private",
"void",
"sortByName",
"(",
")",
"{",
"this",
".",
"sresList",
".",
"setComparator",
"(",
"new",
"ViewerComparator",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"compare",
"(",
"Viewer",
"viewer",
",",
"Object",
"e1",
",",
"Object",
"e2",
... | Sorts by SRE name. | [
"Sorts",
"by",
"SRE",
"name",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java#L861-L879 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java | SREsPreferencePage.sortByLocation | private void sortByLocation() {
this.sresList.setComparator(new ViewerComparator() {
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
if ((e1 instanceof ISREInstall) && (e2 instanceof ISREInstall)) {
final ISREInstall left = (ISREInstall) e1;
final ISREInstall right = (ISREInstall) e2;
return left.getLocation().compareToIgnoreCase(right.getLocation());
}
return super.compare(viewer, e1, e2);
}
@Override
public boolean isSorterProperty(Object element, String property) {
return true;
}
});
this.sortColumn = Column.LOCATION;
} | java | private void sortByLocation() {
this.sresList.setComparator(new ViewerComparator() {
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
if ((e1 instanceof ISREInstall) && (e2 instanceof ISREInstall)) {
final ISREInstall left = (ISREInstall) e1;
final ISREInstall right = (ISREInstall) e2;
return left.getLocation().compareToIgnoreCase(right.getLocation());
}
return super.compare(viewer, e1, e2);
}
@Override
public boolean isSorterProperty(Object element, String property) {
return true;
}
});
this.sortColumn = Column.LOCATION;
} | [
"private",
"void",
"sortByLocation",
"(",
")",
"{",
"this",
".",
"sresList",
".",
"setComparator",
"(",
"new",
"ViewerComparator",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"compare",
"(",
"Viewer",
"viewer",
",",
"Object",
"e1",
",",
"Object",
"e2"... | Sorts by VM location. | [
"Sorts",
"by",
"VM",
"location",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/preferences/SREsPreferencePage.java#L884-L902 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/CodeBuilderFragment2.java | CodeBuilderFragment2.initializeSubGenerators | @SuppressWarnings("static-method")
protected Collection<AbstractSubCodeBuilderFragment> initializeSubGenerators(Injector injector) {
final Collection<AbstractSubCodeBuilderFragment> fragments = new ArrayList<>();
fragments.add(injector.getInstance(BuilderFactoryFragment.class));
fragments.add(injector.getInstance(DocumentationBuilderFragment.class));
fragments.add(injector.getInstance(AbstractBuilderBuilderFragment.class));
fragments.add(injector.getInstance(AbstractAppenderBuilderFragment.class));
fragments.add(injector.getInstance(ScriptBuilderFragment.class));
return fragments;
} | java | @SuppressWarnings("static-method")
protected Collection<AbstractSubCodeBuilderFragment> initializeSubGenerators(Injector injector) {
final Collection<AbstractSubCodeBuilderFragment> fragments = new ArrayList<>();
fragments.add(injector.getInstance(BuilderFactoryFragment.class));
fragments.add(injector.getInstance(DocumentationBuilderFragment.class));
fragments.add(injector.getInstance(AbstractBuilderBuilderFragment.class));
fragments.add(injector.getInstance(AbstractAppenderBuilderFragment.class));
fragments.add(injector.getInstance(ScriptBuilderFragment.class));
return fragments;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"Collection",
"<",
"AbstractSubCodeBuilderFragment",
">",
"initializeSubGenerators",
"(",
"Injector",
"injector",
")",
"{",
"final",
"Collection",
"<",
"AbstractSubCodeBuilderFragment",
">",
"fragments",
... | Initialize the sub generators.
@param injector the injector.
@return the list of the generators. | [
"Initialize",
"the",
"sub",
"generators",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/CodeBuilderFragment2.java#L94-L103 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/CodeBuilderFragment2.java | CodeBuilderFragment2.createRuntimeBindings | protected BindingFactory createRuntimeBindings() {
final BindingFactory factory = new BindingFactory(getClass().getName());
for (final AbstractSubCodeBuilderFragment subFragment : this.subFragments) {
subFragment.generateRuntimeBindings(factory);
}
return factory;
} | java | protected BindingFactory createRuntimeBindings() {
final BindingFactory factory = new BindingFactory(getClass().getName());
for (final AbstractSubCodeBuilderFragment subFragment : this.subFragments) {
subFragment.generateRuntimeBindings(factory);
}
return factory;
} | [
"protected",
"BindingFactory",
"createRuntimeBindings",
"(",
")",
"{",
"final",
"BindingFactory",
"factory",
"=",
"new",
"BindingFactory",
"(",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"for",
"(",
"final",
"AbstractSubCodeBuilderFragment",
"subFra... | Create the runtime bindings for the builders.
@return the bindings. | [
"Create",
"the",
"runtime",
"bindings",
"for",
"the",
"builders",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/CodeBuilderFragment2.java#L166-L172 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/CodeBuilderFragment2.java | CodeBuilderFragment2.createEclipseBindings | protected BindingFactory createEclipseBindings() {
final BindingFactory factory = new BindingFactory(getClass().getName());
for (final AbstractSubCodeBuilderFragment subFragment : this.subFragments) {
subFragment.generateEclipseBindings(factory);
}
return factory;
} | java | protected BindingFactory createEclipseBindings() {
final BindingFactory factory = new BindingFactory(getClass().getName());
for (final AbstractSubCodeBuilderFragment subFragment : this.subFragments) {
subFragment.generateEclipseBindings(factory);
}
return factory;
} | [
"protected",
"BindingFactory",
"createEclipseBindings",
"(",
")",
"{",
"final",
"BindingFactory",
"factory",
"=",
"new",
"BindingFactory",
"(",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"for",
"(",
"final",
"AbstractSubCodeBuilderFragment",
"subFra... | Create the Eclipse bindings for the builders.
@return the bindings. | [
"Create",
"the",
"Eclipse",
"bindings",
"for",
"the",
"builders",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/CodeBuilderFragment2.java#L178-L184 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/CodeBuilderFragment2.java | CodeBuilderFragment2.createIdeaBindings | protected BindingFactory createIdeaBindings() {
final BindingFactory factory = new BindingFactory(getClass().getName());
for (final AbstractSubCodeBuilderFragment subFragment : this.subFragments) {
subFragment.generateIdeaBindings(factory);
}
return factory;
} | java | protected BindingFactory createIdeaBindings() {
final BindingFactory factory = new BindingFactory(getClass().getName());
for (final AbstractSubCodeBuilderFragment subFragment : this.subFragments) {
subFragment.generateIdeaBindings(factory);
}
return factory;
} | [
"protected",
"BindingFactory",
"createIdeaBindings",
"(",
")",
"{",
"final",
"BindingFactory",
"factory",
"=",
"new",
"BindingFactory",
"(",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"for",
"(",
"final",
"AbstractSubCodeBuilderFragment",
"subFragme... | Create the IDEA bindings for the builders.
@return the bindings. | [
"Create",
"the",
"IDEA",
"bindings",
"for",
"the",
"builders",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/CodeBuilderFragment2.java#L190-L196 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/CodeBuilderFragment2.java | CodeBuilderFragment2.createWebBindings | protected BindingFactory createWebBindings() {
final BindingFactory factory = new BindingFactory(getClass().getName());
for (final AbstractSubCodeBuilderFragment subFragment : this.subFragments) {
subFragment.generateWebBindings(factory);
}
return factory;
} | java | protected BindingFactory createWebBindings() {
final BindingFactory factory = new BindingFactory(getClass().getName());
for (final AbstractSubCodeBuilderFragment subFragment : this.subFragments) {
subFragment.generateWebBindings(factory);
}
return factory;
} | [
"protected",
"BindingFactory",
"createWebBindings",
"(",
")",
"{",
"final",
"BindingFactory",
"factory",
"=",
"new",
"BindingFactory",
"(",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"for",
"(",
"final",
"AbstractSubCodeBuilderFragment",
"subFragmen... | Create the Web-interface bindings for the builders.
@return the bindings. | [
"Create",
"the",
"Web",
"-",
"interface",
"bindings",
"for",
"the",
"builders",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/CodeBuilderFragment2.java#L202-L208 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/core/Address.java | Address.compareTo | @Override
@Pure
public int compareTo(Address address) {
if (address == null) {
return 1;
}
return this.agentId.compareTo(address.getUUID());
} | java | @Override
@Pure
public int compareTo(Address address) {
if (address == null) {
return 1;
}
return this.agentId.compareTo(address.getUUID());
} | [
"@",
"Override",
"@",
"Pure",
"public",
"int",
"compareTo",
"(",
"Address",
"address",
")",
"{",
"if",
"(",
"address",
"==",
"null",
")",
"{",
"return",
"1",
";",
"}",
"return",
"this",
".",
"agentId",
".",
"compareTo",
"(",
"address",
".",
"getUUID",
... | Compares this object with the specified object for order. Returns a
negative integer, zero, or a positive integer as this object is less
than, equal to, or greater than the specified object.
<p>The implementor must ensure <code>sgn(x.compareTo(y)) ==
-sgn(y.compareTo(x))</code> for all <code>x</code> and <code>y</code>. (This
implies that <code>x.compareTo(y)</code> must throw an exception iff
<code>y.compareTo(x)</code> throws an exception.)
<p>The implementor must also ensure that the relation is transitive:
<code>(x.compareTo(y)>0 && y.compareTo(z)>0)</code> implies
<code>x.compareTo(z)>0</code>.
<p>Finally, the implementor must ensure that <code>x.compareTo(y)==0</code>
implies that <code>sgn(x.compareTo(z)) == sgn(y.compareTo(z))</code>, for all
<code>z</code>.
<p>It is strongly recommended, but <i>not</i> strictly required that
<code>(x.compareTo(y)==0) == (x.equals(y))</code>. Generally speaking, any
class that implements the <code>Comparable</code> interface and violates this
condition should clearly indicate this fact. The recommended language is
"Note: this class has a natural ordering that is inconsistent with
equals."
<p>In the foregoing description, the notation <code>sgn(</code><i>expression</i>
<code>)</code> designates the mathematical <i>signum</i> function, which is
defined to return one of <code>-1</code>, <code>0</code>, or <code>1</code> according
to whether the value of <i>expression</i> is negative, zero or positive.
@param address is the address to be compared.
@return a negative integer, zero, or a positive integer as this object is
less than, equal to, or greater than the specified object. | [
"Compares",
"this",
"object",
"with",
"the",
"specified",
"object",
"for",
"order",
".",
"Returns",
"a",
"negative",
"integer",
"zero",
"or",
"a",
"positive",
"integer",
"as",
"this",
"object",
"is",
"less",
"than",
"equal",
"to",
"or",
"greater",
"than",
... | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/core/Address.java#L156-L163 | train |
sarl/sarl | products/sarlc/src/main/java/io/sarl/lang/sarlc/Main.java | Main.main | public static void main(String[] args) {
final int retCode = createMainObject().runCompiler(args);
System.exit(retCode);
} | java | public static void main(String[] args) {
final int retCode = createMainObject().runCompiler(args);
System.exit(retCode);
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"final",
"int",
"retCode",
"=",
"createMainObject",
"(",
")",
".",
"runCompiler",
"(",
"args",
")",
";",
"System",
".",
"exit",
"(",
"retCode",
")",
";",
"}"
] | Main program of the batch compiler.
@param args the command line arguments. | [
"Main",
"program",
"of",
"the",
"batch",
"compiler",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/products/sarlc/src/main/java/io/sarl/lang/sarlc/Main.java#L46-L49 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SectionNumber.java | SectionNumber.setFromString | public void setFromString(String sectionNumber, int level) {
assert level >= 1;
final String[] numbers = sectionNumber.split("[^0-9]+"); //$NON-NLS-1$
final int len = Math.max(0, this.numbers.size() - numbers.length);
for (int i = 0; i < len; ++i) {
this.numbers.removeLast();
}
for (int i = 0; i < numbers.length && i < level; ++i) {
this.numbers.addLast(Integer.valueOf(numbers[i]));
}
} | java | public void setFromString(String sectionNumber, int level) {
assert level >= 1;
final String[] numbers = sectionNumber.split("[^0-9]+"); //$NON-NLS-1$
final int len = Math.max(0, this.numbers.size() - numbers.length);
for (int i = 0; i < len; ++i) {
this.numbers.removeLast();
}
for (int i = 0; i < numbers.length && i < level; ++i) {
this.numbers.addLast(Integer.valueOf(numbers[i]));
}
} | [
"public",
"void",
"setFromString",
"(",
"String",
"sectionNumber",
",",
"int",
"level",
")",
"{",
"assert",
"level",
">=",
"1",
";",
"final",
"String",
"[",
"]",
"numbers",
"=",
"sectionNumber",
".",
"split",
"(",
"\"[^0-9]+\"",
")",
";",
"//$NON-NLS-1$",
... | Change this version number from the given string representation.
<p>The string representation should be integer numbers, separated by dot characters.
@param sectionNumber the string representation of the version number.
@param level is the level at which the section number is visible (1 for the top level, 2 for subsections...) | [
"Change",
"this",
"version",
"number",
"from",
"the",
"given",
"string",
"representation",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SectionNumber.java#L56-L66 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SectionNumber.java | SectionNumber.increment | public void increment(int level) {
assert level >= 1;
if (this.numbers.size() < level) {
do {
this.numbers.addLast(0);
} while (this.numbers.size() < level);
} else if (this.numbers.size() > level) {
do {
this.numbers.removeLast();
} while (this.numbers.size() > level);
}
assert this.numbers.size() == level;
final int previousSection = this.numbers.removeLast();
this.numbers.addLast(previousSection + 1);
} | java | public void increment(int level) {
assert level >= 1;
if (this.numbers.size() < level) {
do {
this.numbers.addLast(0);
} while (this.numbers.size() < level);
} else if (this.numbers.size() > level) {
do {
this.numbers.removeLast();
} while (this.numbers.size() > level);
}
assert this.numbers.size() == level;
final int previousSection = this.numbers.removeLast();
this.numbers.addLast(previousSection + 1);
} | [
"public",
"void",
"increment",
"(",
"int",
"level",
")",
"{",
"assert",
"level",
">=",
"1",
";",
"if",
"(",
"this",
".",
"numbers",
".",
"size",
"(",
")",
"<",
"level",
")",
"{",
"do",
"{",
"this",
".",
"numbers",
".",
"addLast",
"(",
"0",
")",
... | Change this version number by incrementing the number for the given level.
@param level is the level at which the section number is visible (1 for the top level, 2 for subsections...) | [
"Change",
"this",
"version",
"number",
"by",
"incrementing",
"the",
"number",
"for",
"the",
"given",
"level",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SectionNumber.java#L72-L86 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixSuppressWarnings | @Fix("*")
public void fixSuppressWarnings(Issue issue, IssueResolutionAcceptor acceptor) {
if (isIgnorable(issue.getCode())) {
SuppressWarningsAddModification.accept(this, issue, acceptor);
}
} | java | @Fix("*")
public void fixSuppressWarnings(Issue issue, IssueResolutionAcceptor acceptor) {
if (isIgnorable(issue.getCode())) {
SuppressWarningsAddModification.accept(this, issue, acceptor);
}
} | [
"@",
"Fix",
"(",
"\"*\"",
")",
"public",
"void",
"fixSuppressWarnings",
"(",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
"if",
"(",
"isIgnorable",
"(",
"issue",
".",
"getCode",
"(",
")",
")",
")",
"{",
"SuppressWarningsAddModificati... | Add the fixes with suppress-warning annotations.
@param issue the issue.
@param acceptor the resolution acceptor. | [
"Add",
"the",
"fixes",
"with",
"suppress",
"-",
"warning",
"annotations",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L181-L186 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.getJvmOperationsFromURIs | public List<JvmOperation> getJvmOperationsFromURIs(XtendTypeDeclaration container, String... operationUris) {
// Collect the JvmOperation prior to any modification for ensuring that
// URI are pointing the JvmOperations.
final List<JvmOperation> operations = new ArrayList<>();
final ResourceSet resourceSet = container.eResource().getResourceSet();
for (final String operationUriAsString : operationUris) {
final URI operationURI = URI.createURI(operationUriAsString);
final EObject overridden = resourceSet.getEObject(operationURI, true);
if (overridden instanceof JvmOperation) {
final JvmOperation operation = (JvmOperation) overridden;
if (this.annotationFinder.findAnnotation(operation, DefaultValueUse.class) == null) {
operations.add(operation);
}
}
}
return operations;
} | java | public List<JvmOperation> getJvmOperationsFromURIs(XtendTypeDeclaration container, String... operationUris) {
// Collect the JvmOperation prior to any modification for ensuring that
// URI are pointing the JvmOperations.
final List<JvmOperation> operations = new ArrayList<>();
final ResourceSet resourceSet = container.eResource().getResourceSet();
for (final String operationUriAsString : operationUris) {
final URI operationURI = URI.createURI(operationUriAsString);
final EObject overridden = resourceSet.getEObject(operationURI, true);
if (overridden instanceof JvmOperation) {
final JvmOperation operation = (JvmOperation) overridden;
if (this.annotationFinder.findAnnotation(operation, DefaultValueUse.class) == null) {
operations.add(operation);
}
}
}
return operations;
} | [
"public",
"List",
"<",
"JvmOperation",
">",
"getJvmOperationsFromURIs",
"(",
"XtendTypeDeclaration",
"container",
",",
"String",
"...",
"operationUris",
")",
"{",
"// Collect the JvmOperation prior to any modification for ensuring that",
"// URI are pointing the JvmOperations.",
"f... | Replies the JVM operations that correspond to the given URIs.
@param container the container of the operations.
@param operationUris the URIs.
@return the JVM operations. | [
"Replies",
"the",
"JVM",
"operations",
"that",
"correspond",
"to",
"the",
"given",
"URIs",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L194-L210 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.removeToPreviousSeparator | public boolean removeToPreviousSeparator(Issue issue, IXtextDocument document, String separator)
throws BadLocationException {
return removeToPreviousSeparator(issue.getOffset(), issue.getLength(), document, separator);
} | java | public boolean removeToPreviousSeparator(Issue issue, IXtextDocument document, String separator)
throws BadLocationException {
return removeToPreviousSeparator(issue.getOffset(), issue.getLength(), document, separator);
} | [
"public",
"boolean",
"removeToPreviousSeparator",
"(",
"Issue",
"issue",
",",
"IXtextDocument",
"document",
",",
"String",
"separator",
")",
"throws",
"BadLocationException",
"{",
"return",
"removeToPreviousSeparator",
"(",
"issue",
".",
"getOffset",
"(",
")",
",",
... | Remove the element related to the issue, and the whitespaces before the element until the given separator.
@param issue the issue.
@param document the document.
@param separator the separator to consider.
@return <code>true</code> if the separator was found, <code>false</code> if not.
@throws BadLocationException if there is a problem with the location of the element. | [
"Remove",
"the",
"element",
"related",
"to",
"the",
"issue",
"and",
"the",
"whitespaces",
"before",
"the",
"element",
"until",
"the",
"given",
"separator",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L315-L318 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.removeToPreviousSeparator | public boolean removeToPreviousSeparator(int offset, int length, IXtextDocument document, String separator)
throws BadLocationException {
// Skip spaces before the identifier until the separator
int index = offset - 1;
char c = document.getChar(index);
while (Character.isWhitespace(c)) {
index--;
c = document.getChar(index);
}
// Test if it previous non-space character is the separator
final boolean foundSeparator = document.getChar(index) == separator.charAt(0);
if (foundSeparator) {
index--;
c = document.getChar(index);
// Skip the previous spaces
while (Character.isWhitespace(c)) {
index--;
c = document.getChar(index);
}
final int delta = offset - index - 1;
document.replace(index + 1, length + delta, ""); //$NON-NLS-1$
}
return foundSeparator;
} | java | public boolean removeToPreviousSeparator(int offset, int length, IXtextDocument document, String separator)
throws BadLocationException {
// Skip spaces before the identifier until the separator
int index = offset - 1;
char c = document.getChar(index);
while (Character.isWhitespace(c)) {
index--;
c = document.getChar(index);
}
// Test if it previous non-space character is the separator
final boolean foundSeparator = document.getChar(index) == separator.charAt(0);
if (foundSeparator) {
index--;
c = document.getChar(index);
// Skip the previous spaces
while (Character.isWhitespace(c)) {
index--;
c = document.getChar(index);
}
final int delta = offset - index - 1;
document.replace(index + 1, length + delta, ""); //$NON-NLS-1$
}
return foundSeparator;
} | [
"public",
"boolean",
"removeToPreviousSeparator",
"(",
"int",
"offset",
",",
"int",
"length",
",",
"IXtextDocument",
"document",
",",
"String",
"separator",
")",
"throws",
"BadLocationException",
"{",
"// Skip spaces before the identifier until the separator",
"int",
"index... | Remove the portion of text, and the whitespaces before the text until the given separator.
@param offset the offset where to start to remove.
@param length the length of the text to remove.
@param document the document.
@param separator the separator to consider.
@return <code>true</code> if the separator was found, <code>false</code> if not.
@throws BadLocationException if there is a problem with the location of the element. | [
"Remove",
"the",
"portion",
"of",
"text",
"and",
"the",
"whitespaces",
"before",
"the",
"text",
"until",
"the",
"given",
"separator",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L329-L355 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.getImportInsertOffset | public int getImportInsertOffset(SarlScript script) {
final ICompositeNode node = NodeModelUtils.findActualNodeFor(script.getImportSection());
if (node == null) {
final List<INode> children = NodeModelUtils.findNodesForFeature(script,
XtendPackage.eINSTANCE.getXtendFile_Package());
if (children.isEmpty()) {
return 0;
}
return children.get(0).getEndOffset();
}
return node.getEndOffset();
} | java | public int getImportInsertOffset(SarlScript script) {
final ICompositeNode node = NodeModelUtils.findActualNodeFor(script.getImportSection());
if (node == null) {
final List<INode> children = NodeModelUtils.findNodesForFeature(script,
XtendPackage.eINSTANCE.getXtendFile_Package());
if (children.isEmpty()) {
return 0;
}
return children.get(0).getEndOffset();
}
return node.getEndOffset();
} | [
"public",
"int",
"getImportInsertOffset",
"(",
"SarlScript",
"script",
")",
"{",
"final",
"ICompositeNode",
"node",
"=",
"NodeModelUtils",
".",
"findActualNodeFor",
"(",
"script",
".",
"getImportSection",
"(",
")",
")",
";",
"if",
"(",
"node",
"==",
"null",
")... | Replies the index where import declaration could be inserted into the given container.
@param script the script to consider for the insertion
@return the insertion index. | [
"Replies",
"the",
"index",
"where",
"import",
"declaration",
"could",
"be",
"inserted",
"into",
"the",
"given",
"container",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L362-L373 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.removeToNextSeparator | public boolean removeToNextSeparator(Issue issue, IXtextDocument document, String separator)
throws BadLocationException {
// Skip spaces after the identifier until the separator
int index = issue.getOffset() + issue.getLength();
char c = document.getChar(index);
while (Character.isWhitespace(c)) {
index++;
c = document.getChar(index);
}
// Test if it next non-space character is the separator
final boolean foundSeparator = document.getChar(index) == separator.charAt(0);
if (foundSeparator) {
index++;
c = document.getChar(index);
// Skip the previous spaces
while (Character.isWhitespace(c)) {
index++;
c = document.getChar(index);
}
final int newLength = index - issue.getOffset();
document.replace(issue.getOffset(), newLength, ""); //$NON-NLS-1$
}
return foundSeparator;
} | java | public boolean removeToNextSeparator(Issue issue, IXtextDocument document, String separator)
throws BadLocationException {
// Skip spaces after the identifier until the separator
int index = issue.getOffset() + issue.getLength();
char c = document.getChar(index);
while (Character.isWhitespace(c)) {
index++;
c = document.getChar(index);
}
// Test if it next non-space character is the separator
final boolean foundSeparator = document.getChar(index) == separator.charAt(0);
if (foundSeparator) {
index++;
c = document.getChar(index);
// Skip the previous spaces
while (Character.isWhitespace(c)) {
index++;
c = document.getChar(index);
}
final int newLength = index - issue.getOffset();
document.replace(issue.getOffset(), newLength, ""); //$NON-NLS-1$
}
return foundSeparator;
} | [
"public",
"boolean",
"removeToNextSeparator",
"(",
"Issue",
"issue",
",",
"IXtextDocument",
"document",
",",
"String",
"separator",
")",
"throws",
"BadLocationException",
"{",
"// Skip spaces after the identifier until the separator",
"int",
"index",
"=",
"issue",
".",
"g... | Remove the element related to the issue, and the whitespaces after the element until the given separator.
@param issue the issue.
@param document the document.
@param separator the separator to consider.
@return <code>true</code> if the separator was found, <code>false</code> if not.
@throws BadLocationException if there is a problem with the location of the element. | [
"Remove",
"the",
"element",
"related",
"to",
"the",
"issue",
"and",
"the",
"whitespaces",
"after",
"the",
"element",
"until",
"the",
"given",
"separator",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L383-L409 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.removeToPreviousKeyword | public boolean removeToPreviousKeyword(Issue issue, IXtextDocument document,
String keyword1, String... otherKeywords) throws BadLocationException {
// Skip spaces before the element
int index = issue.getOffset() - 1;
char c = document.getChar(index);
while (Character.isWhitespace(c)) {
index--;
c = document.getChar(index);
}
// Skip non-spaces before the identifier
final StringBuffer kw = new StringBuffer();
while (!Character.isWhitespace(c)) {
kw.insert(0, c);
index--;
c = document.getChar(index);
}
if (kw.toString().equals(keyword1) || Arrays.contains(otherKeywords, kw.toString())) {
// Skip spaces before the previous keyword
while (Character.isWhitespace(c)) {
index--;
c = document.getChar(index);
}
final int delta = issue.getOffset() - index - 1;
document.replace(index + 1, issue.getLength() + delta, ""); //$NON-NLS-1$
return true;
}
return false;
} | java | public boolean removeToPreviousKeyword(Issue issue, IXtextDocument document,
String keyword1, String... otherKeywords) throws BadLocationException {
// Skip spaces before the element
int index = issue.getOffset() - 1;
char c = document.getChar(index);
while (Character.isWhitespace(c)) {
index--;
c = document.getChar(index);
}
// Skip non-spaces before the identifier
final StringBuffer kw = new StringBuffer();
while (!Character.isWhitespace(c)) {
kw.insert(0, c);
index--;
c = document.getChar(index);
}
if (kw.toString().equals(keyword1) || Arrays.contains(otherKeywords, kw.toString())) {
// Skip spaces before the previous keyword
while (Character.isWhitespace(c)) {
index--;
c = document.getChar(index);
}
final int delta = issue.getOffset() - index - 1;
document.replace(index + 1, issue.getLength() + delta, ""); //$NON-NLS-1$
return true;
}
return false;
} | [
"public",
"boolean",
"removeToPreviousKeyword",
"(",
"Issue",
"issue",
",",
"IXtextDocument",
"document",
",",
"String",
"keyword1",
",",
"String",
"...",
"otherKeywords",
")",
"throws",
"BadLocationException",
"{",
"// Skip spaces before the element",
"int",
"index",
"... | Remove the element related to the issue, and the whitespaces before the element until one of the given
keywords is encountered.
@param issue the issue.
@param document the document.
@param keyword1 the first keyword to consider.
@param otherKeywords other keywords.
@return <code>true</code> if one keyword was found, <code>false</code> if not.
@throws BadLocationException if there is a problem with the location of the element. | [
"Remove",
"the",
"element",
"related",
"to",
"the",
"issue",
"and",
"the",
"whitespaces",
"before",
"the",
"element",
"until",
"one",
"of",
"the",
"given",
"keywords",
"is",
"encountered",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L421-L453 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.removeBetweenSeparators | public boolean removeBetweenSeparators(Issue issue, IXtextDocument document,
String beginSeparator, String endSeparator) throws BadLocationException {
int offset = issue.getOffset();
int length = issue.getLength();
// Skip spaces before the identifier until the separator
int index = offset - 1;
char c = document.getChar(index);
while (Character.isWhitespace(c)) {
index--;
c = document.getChar(index);
}
// Test if it previous non-space character is the separator
boolean foundSeparator = document.getChar(index) == beginSeparator.charAt(0);
if (foundSeparator) {
index--;
c = document.getChar(index);
// Skip the previous spaces
while (Character.isWhitespace(c)) {
index--;
c = document.getChar(index);
}
length = length + (offset - index - 1);
offset = index + 1;
// Skip spaces after the identifier until the separator
index = offset + length;
c = document.getChar(index);
while (Character.isWhitespace(c)) {
index++;
c = document.getChar(index);
}
// Test if it next non-space character is the separator
foundSeparator = document.getChar(index) == endSeparator.charAt(0);
if (foundSeparator) {
index++;
length = index - offset;
document.replace(offset, length, ""); //$NON-NLS-1$
}
}
return foundSeparator;
} | java | public boolean removeBetweenSeparators(Issue issue, IXtextDocument document,
String beginSeparator, String endSeparator) throws BadLocationException {
int offset = issue.getOffset();
int length = issue.getLength();
// Skip spaces before the identifier until the separator
int index = offset - 1;
char c = document.getChar(index);
while (Character.isWhitespace(c)) {
index--;
c = document.getChar(index);
}
// Test if it previous non-space character is the separator
boolean foundSeparator = document.getChar(index) == beginSeparator.charAt(0);
if (foundSeparator) {
index--;
c = document.getChar(index);
// Skip the previous spaces
while (Character.isWhitespace(c)) {
index--;
c = document.getChar(index);
}
length = length + (offset - index - 1);
offset = index + 1;
// Skip spaces after the identifier until the separator
index = offset + length;
c = document.getChar(index);
while (Character.isWhitespace(c)) {
index++;
c = document.getChar(index);
}
// Test if it next non-space character is the separator
foundSeparator = document.getChar(index) == endSeparator.charAt(0);
if (foundSeparator) {
index++;
length = index - offset;
document.replace(offset, length, ""); //$NON-NLS-1$
}
}
return foundSeparator;
} | [
"public",
"boolean",
"removeBetweenSeparators",
"(",
"Issue",
"issue",
",",
"IXtextDocument",
"document",
",",
"String",
"beginSeparator",
",",
"String",
"endSeparator",
")",
"throws",
"BadLocationException",
"{",
"int",
"offset",
"=",
"issue",
".",
"getOffset",
"("... | Remove the element related to the issue, and the whitespaces before the element until the begin separator,
and the whitespaces after the element until the end separator.
@param issue the issue.
@param document the document.
@param beginSeparator the separator before the element.
@param endSeparator the separator after the element.
@return <code>true</code> if the separator was found, <code>false</code> if not.
@throws BadLocationException if there is a problem with the location of the element. | [
"Remove",
"the",
"element",
"related",
"to",
"the",
"issue",
"and",
"the",
"whitespaces",
"before",
"the",
"element",
"until",
"the",
"begin",
"separator",
"and",
"the",
"whitespaces",
"after",
"the",
"element",
"until",
"the",
"end",
"separator",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L465-L511 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.getInsertOffset | public int getInsertOffset(XtendTypeDeclaration container) {
if (container.getMembers().isEmpty()) {
final ICompositeNode node = NodeModelUtils.findActualNodeFor(container);
final ILeafNode openingBraceNode = IterableExtensions.findFirst(node.getLeafNodes(),
lnode -> "{".equals(lnode.getText())); //$NON-NLS-1$
if (openingBraceNode != null) {
return openingBraceNode.getOffset() + 1;
}
return node.getEndOffset();
}
final EObject lastFeature = IterableExtensions.last(container.getMembers());
final ICompositeNode node = NodeModelUtils.findActualNodeFor(lastFeature);
return node.getEndOffset();
} | java | public int getInsertOffset(XtendTypeDeclaration container) {
if (container.getMembers().isEmpty()) {
final ICompositeNode node = NodeModelUtils.findActualNodeFor(container);
final ILeafNode openingBraceNode = IterableExtensions.findFirst(node.getLeafNodes(),
lnode -> "{".equals(lnode.getText())); //$NON-NLS-1$
if (openingBraceNode != null) {
return openingBraceNode.getOffset() + 1;
}
return node.getEndOffset();
}
final EObject lastFeature = IterableExtensions.last(container.getMembers());
final ICompositeNode node = NodeModelUtils.findActualNodeFor(lastFeature);
return node.getEndOffset();
} | [
"public",
"int",
"getInsertOffset",
"(",
"XtendTypeDeclaration",
"container",
")",
"{",
"if",
"(",
"container",
".",
"getMembers",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"final",
"ICompositeNode",
"node",
"=",
"NodeModelUtils",
".",
"findActualNodeFor",
... | Replies the index where elements could be inserted into the given container.
@param container the container to consider for the insertion
@return the insertion index. | [
"Replies",
"the",
"index",
"where",
"elements",
"could",
"be",
"inserted",
"into",
"the",
"given",
"container",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L518-L531 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.getSpaceSize | public int getSpaceSize(IXtextDocument document, int offset) throws BadLocationException {
int size = 0;
char c = document.getChar(offset + size);
while (Character.isWhitespace(c)) {
size++;
c = document.getChar(offset + size);
}
return size;
} | java | public int getSpaceSize(IXtextDocument document, int offset) throws BadLocationException {
int size = 0;
char c = document.getChar(offset + size);
while (Character.isWhitespace(c)) {
size++;
c = document.getChar(offset + size);
}
return size;
} | [
"public",
"int",
"getSpaceSize",
"(",
"IXtextDocument",
"document",
",",
"int",
"offset",
")",
"throws",
"BadLocationException",
"{",
"int",
"size",
"=",
"0",
";",
"char",
"c",
"=",
"document",
".",
"getChar",
"(",
"offset",
"+",
"size",
")",
";",
"while",... | Replies the size of a sequence of whitespaces.
@param document the document.
@param offset the offset of the first character of the sequence.
@return the number of whitespaces at the given offset.
@throws BadLocationException if there is a problem with the location of the element. | [
"Replies",
"the",
"size",
"of",
"a",
"sequence",
"of",
"whitespaces",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L540-L548 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.getOffsetForPattern | public int getOffsetForPattern(IXtextDocument document, int startOffset, String pattern) {
final Pattern compiledPattern = Pattern.compile(pattern);
final Matcher matcher = compiledPattern.matcher(document.get());
if (matcher.find(startOffset)) {
final int end = matcher.end();
return end;
}
return -1;
} | java | public int getOffsetForPattern(IXtextDocument document, int startOffset, String pattern) {
final Pattern compiledPattern = Pattern.compile(pattern);
final Matcher matcher = compiledPattern.matcher(document.get());
if (matcher.find(startOffset)) {
final int end = matcher.end();
return end;
}
return -1;
} | [
"public",
"int",
"getOffsetForPattern",
"(",
"IXtextDocument",
"document",
",",
"int",
"startOffset",
",",
"String",
"pattern",
")",
"{",
"final",
"Pattern",
"compiledPattern",
"=",
"Pattern",
".",
"compile",
"(",
"pattern",
")",
";",
"final",
"Matcher",
"matche... | Replies the offset that corresponds to the given regular expression pattern.
@param document the document to parse.
@param startOffset the offset in the text at which the pattern must be recognized.
@param pattern the regular expression pattern.
@return the offset (greater or equal to the startOffset), or <code>-1</code> if the pattern
cannot be recognized. | [
"Replies",
"the",
"offset",
"that",
"corresponds",
"to",
"the",
"given",
"regular",
"expression",
"pattern",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L558-L566 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.qualifiedName | public QualifiedName qualifiedName(String name) {
if (!com.google.common.base.Strings.isNullOrEmpty(name)) {
final List<String> segments = Strings.split(name, "."); //$NON-NLS-1$
return QualifiedName.create(segments);
}
return QualifiedName.create();
} | java | public QualifiedName qualifiedName(String name) {
if (!com.google.common.base.Strings.isNullOrEmpty(name)) {
final List<String> segments = Strings.split(name, "."); //$NON-NLS-1$
return QualifiedName.create(segments);
}
return QualifiedName.create();
} | [
"public",
"QualifiedName",
"qualifiedName",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"!",
"com",
".",
"google",
".",
"common",
".",
"base",
".",
"Strings",
".",
"isNullOrEmpty",
"(",
"name",
")",
")",
"{",
"final",
"List",
"<",
"String",
">",
"segme... | Replies the qualified name for the given name.
@param name the name.
@return the qualified name. | [
"Replies",
"the",
"qualified",
"name",
"for",
"the",
"given",
"name",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L573-L579 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.removeExecutableFeature | public void removeExecutableFeature(EObject element, IModificationContext context) throws BadLocationException {
final ICompositeNode node;
final SarlAction action = EcoreUtil2.getContainerOfType(element, SarlAction.class);
if (action == null) {
final XtendMember feature = EcoreUtil2.getContainerOfType(element, XtendMember.class);
node = NodeModelUtils.findActualNodeFor(feature);
} else {
node = NodeModelUtils.findActualNodeFor(action);
}
if (node != null) {
remove(context.getXtextDocument(), node);
}
} | java | public void removeExecutableFeature(EObject element, IModificationContext context) throws BadLocationException {
final ICompositeNode node;
final SarlAction action = EcoreUtil2.getContainerOfType(element, SarlAction.class);
if (action == null) {
final XtendMember feature = EcoreUtil2.getContainerOfType(element, XtendMember.class);
node = NodeModelUtils.findActualNodeFor(feature);
} else {
node = NodeModelUtils.findActualNodeFor(action);
}
if (node != null) {
remove(context.getXtextDocument(), node);
}
} | [
"public",
"void",
"removeExecutableFeature",
"(",
"EObject",
"element",
",",
"IModificationContext",
"context",
")",
"throws",
"BadLocationException",
"{",
"final",
"ICompositeNode",
"node",
";",
"final",
"SarlAction",
"action",
"=",
"EcoreUtil2",
".",
"getContainerOfTy... | Remove the exectuable feature.
@param element the executable feature to remove.
@param context the context of the change.
@throws BadLocationException if there is a problem with the location of the element. | [
"Remove",
"the",
"exectuable",
"feature",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L587-L599 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixDuplicateTopElements | @Fix(IssueCodes.DUPLICATE_TYPE_NAME)
public void fixDuplicateTopElements(Issue issue, IssueResolutionAcceptor acceptor) {
MemberRemoveModification.accept(this, issue, acceptor);
} | java | @Fix(IssueCodes.DUPLICATE_TYPE_NAME)
public void fixDuplicateTopElements(Issue issue, IssueResolutionAcceptor acceptor) {
MemberRemoveModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"IssueCodes",
".",
"DUPLICATE_TYPE_NAME",
")",
"public",
"void",
"fixDuplicateTopElements",
"(",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
"MemberRemoveModification",
".",
"accept",
"(",
"this",
",",
"issue",
",",
"ac... | Quick fix for "Duplicate type".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Duplicate",
"type",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L667-L670 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixDuplicateAttribute | @Fix(IssueCodes.DUPLICATE_FIELD)
public void fixDuplicateAttribute(Issue issue, IssueResolutionAcceptor acceptor) {
MemberRemoveModification.accept(this, issue, acceptor);
} | java | @Fix(IssueCodes.DUPLICATE_FIELD)
public void fixDuplicateAttribute(Issue issue, IssueResolutionAcceptor acceptor) {
MemberRemoveModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"IssueCodes",
".",
"DUPLICATE_FIELD",
")",
"public",
"void",
"fixDuplicateAttribute",
"(",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
"MemberRemoveModification",
".",
"accept",
"(",
"this",
",",
"issue",
",",
"acceptor... | Quick fix for "Duplicate field".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Duplicate",
"field",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L677-L680 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixDuplicateMethod | @Fix(IssueCodes.DUPLICATE_METHOD)
public void fixDuplicateMethod(Issue issue, IssueResolutionAcceptor acceptor) {
MemberRemoveModification.accept(this, issue, acceptor);
} | java | @Fix(IssueCodes.DUPLICATE_METHOD)
public void fixDuplicateMethod(Issue issue, IssueResolutionAcceptor acceptor) {
MemberRemoveModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"IssueCodes",
".",
"DUPLICATE_METHOD",
")",
"public",
"void",
"fixDuplicateMethod",
"(",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
"MemberRemoveModification",
".",
"accept",
"(",
"this",
",",
"issue",
",",
"acceptor",... | Quick fix for "Duplicate method".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Duplicate",
"method",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L687-L690 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixMemberName | @Fix(IssueCodes.INVALID_MEMBER_NAME)
public void fixMemberName(final Issue issue, IssueResolutionAcceptor acceptor) {
MemberRenameModification.accept(this, issue, acceptor);
MemberRemoveModification.accept(this, issue, acceptor);
} | java | @Fix(IssueCodes.INVALID_MEMBER_NAME)
public void fixMemberName(final Issue issue, IssueResolutionAcceptor acceptor) {
MemberRenameModification.accept(this, issue, acceptor);
MemberRemoveModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"IssueCodes",
".",
"INVALID_MEMBER_NAME",
")",
"public",
"void",
"fixMemberName",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
"MemberRenameModification",
".",
"accept",
"(",
"this",
",",
"issue",
",",
"a... | Quick fix for "Invalid member name".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Invalid",
"member",
"name",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L718-L722 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixRedundantInterface | @Fix(io.sarl.lang.validation.IssueCodes.REDUNDANT_INTERFACE_IMPLEMENTATION)
public void fixRedundantInterface(final Issue issue, IssueResolutionAcceptor acceptor) {
ImplementedTypeRemoveModification.accept(this, issue, acceptor);
} | java | @Fix(io.sarl.lang.validation.IssueCodes.REDUNDANT_INTERFACE_IMPLEMENTATION)
public void fixRedundantInterface(final Issue issue, IssueResolutionAcceptor acceptor) {
ImplementedTypeRemoveModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"io",
".",
"sarl",
".",
"lang",
".",
"validation",
".",
"IssueCodes",
".",
"REDUNDANT_INTERFACE_IMPLEMENTATION",
")",
"public",
"void",
"fixRedundantInterface",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
... | Quick fix for "Redundant interface implementation".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Redundant",
"interface",
"implementation",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L729-L732 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixVariableNameShadowing | @Fix(org.eclipse.xtext.xbase.validation.IssueCodes.VARIABLE_NAME_SHADOWING)
public void fixVariableNameShadowing(final Issue issue, IssueResolutionAcceptor acceptor) {
MemberRemoveModification.accept(this, issue, acceptor);
MemberRenameModification.accept(this, issue, acceptor);
} | java | @Fix(org.eclipse.xtext.xbase.validation.IssueCodes.VARIABLE_NAME_SHADOWING)
public void fixVariableNameShadowing(final Issue issue, IssueResolutionAcceptor acceptor) {
MemberRemoveModification.accept(this, issue, acceptor);
MemberRenameModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"org",
".",
"eclipse",
".",
"xtext",
".",
"xbase",
".",
"validation",
".",
"IssueCodes",
".",
"VARIABLE_NAME_SHADOWING",
")",
"public",
"void",
"fixVariableNameShadowing",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",... | Quick fix for "Variable name shadowing".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Variable",
"name",
"shadowing",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L739-L743 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixOverriddenFinal | @Fix(IssueCodes.OVERRIDDEN_FINAL)
public void fixOverriddenFinal(Issue issue, IssueResolutionAcceptor acceptor) {
final MultiModification modifications = new MultiModification(
this, issue, acceptor,
Messages.SARLQuickfixProvider_0,
Messages.SARLQuickfixProvider_1);
modifications.bind(XtendTypeDeclaration.class, SuperTypeRemoveModification.class);
modifications.bind(XtendMember.class, MemberRemoveModification.class);
} | java | @Fix(IssueCodes.OVERRIDDEN_FINAL)
public void fixOverriddenFinal(Issue issue, IssueResolutionAcceptor acceptor) {
final MultiModification modifications = new MultiModification(
this, issue, acceptor,
Messages.SARLQuickfixProvider_0,
Messages.SARLQuickfixProvider_1);
modifications.bind(XtendTypeDeclaration.class, SuperTypeRemoveModification.class);
modifications.bind(XtendMember.class, MemberRemoveModification.class);
} | [
"@",
"Fix",
"(",
"IssueCodes",
".",
"OVERRIDDEN_FINAL",
")",
"public",
"void",
"fixOverriddenFinal",
"(",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
"final",
"MultiModification",
"modifications",
"=",
"new",
"MultiModification",
"(",
"th... | Quick fix for "Override final operation".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Override",
"final",
"operation",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L750-L758 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixDiscouragedBooleanExpression | @Fix(io.sarl.lang.validation.IssueCodes.DISCOURAGED_BOOLEAN_EXPRESSION)
public void fixDiscouragedBooleanExpression(final Issue issue, IssueResolutionAcceptor acceptor) {
BehaviorUnitGuardRemoveModification.accept(this, issue, acceptor);
} | java | @Fix(io.sarl.lang.validation.IssueCodes.DISCOURAGED_BOOLEAN_EXPRESSION)
public void fixDiscouragedBooleanExpression(final Issue issue, IssueResolutionAcceptor acceptor) {
BehaviorUnitGuardRemoveModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"io",
".",
"sarl",
".",
"lang",
".",
"validation",
".",
"IssueCodes",
".",
"DISCOURAGED_BOOLEAN_EXPRESSION",
")",
"public",
"void",
"fixDiscouragedBooleanExpression",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
... | Quick fix for "Discouraged boolean expression".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Discouraged",
"boolean",
"expression",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L765-L768 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixUnreachableBehaviorUnit | @Fix(io.sarl.lang.validation.IssueCodes.UNREACHABLE_BEHAVIOR_UNIT)
public void fixUnreachableBehaviorUnit(Issue issue, IssueResolutionAcceptor acceptor) {
MemberRemoveModification.accept(this, issue, acceptor);
} | java | @Fix(io.sarl.lang.validation.IssueCodes.UNREACHABLE_BEHAVIOR_UNIT)
public void fixUnreachableBehaviorUnit(Issue issue, IssueResolutionAcceptor acceptor) {
MemberRemoveModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"io",
".",
"sarl",
".",
"lang",
".",
"validation",
".",
"IssueCodes",
".",
"UNREACHABLE_BEHAVIOR_UNIT",
")",
"public",
"void",
"fixUnreachableBehaviorUnit",
"(",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
"MemberRemove... | Quick fix for "Unreachable behavior unit".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Unreachable",
"behavior",
"unit",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L775-L778 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixInvalidCapacityType | @Fix(io.sarl.lang.validation.IssueCodes.INVALID_CAPACITY_TYPE)
public void fixInvalidCapacityType(final Issue issue, IssueResolutionAcceptor acceptor) {
CapacityReferenceRemoveModification.accept(this, issue, acceptor);
} | java | @Fix(io.sarl.lang.validation.IssueCodes.INVALID_CAPACITY_TYPE)
public void fixInvalidCapacityType(final Issue issue, IssueResolutionAcceptor acceptor) {
CapacityReferenceRemoveModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"io",
".",
"sarl",
".",
"lang",
".",
"validation",
".",
"IssueCodes",
".",
"INVALID_CAPACITY_TYPE",
")",
"public",
"void",
"fixInvalidCapacityType",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
"CapacityR... | Quick fix for "Invalid capacity type".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Invalid",
"capacity",
"type",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L785-L788 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixInvalidFiringEventType | @Fix(io.sarl.lang.validation.IssueCodes.INVALID_FIRING_EVENT_TYPE)
public void fixInvalidFiringEventType(final Issue issue, IssueResolutionAcceptor acceptor) {
FiredEventRemoveModification.accept(this, issue, acceptor);
} | java | @Fix(io.sarl.lang.validation.IssueCodes.INVALID_FIRING_EVENT_TYPE)
public void fixInvalidFiringEventType(final Issue issue, IssueResolutionAcceptor acceptor) {
FiredEventRemoveModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"io",
".",
"sarl",
".",
"lang",
".",
"validation",
".",
"IssueCodes",
".",
"INVALID_FIRING_EVENT_TYPE",
")",
"public",
"void",
"fixInvalidFiringEventType",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
"Fi... | Quick fix for "Invalid firing event type".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Invalid",
"firing",
"event",
"type",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L795-L798 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixInvalidImplementedType | @Fix(io.sarl.lang.validation.IssueCodes.INVALID_IMPLEMENTED_TYPE)
public void fixInvalidImplementedType(final Issue issue, IssueResolutionAcceptor acceptor) {
ImplementedTypeRemoveModification.accept(this, issue, acceptor, RemovalType.OTHER);
} | java | @Fix(io.sarl.lang.validation.IssueCodes.INVALID_IMPLEMENTED_TYPE)
public void fixInvalidImplementedType(final Issue issue, IssueResolutionAcceptor acceptor) {
ImplementedTypeRemoveModification.accept(this, issue, acceptor, RemovalType.OTHER);
} | [
"@",
"Fix",
"(",
"io",
".",
"sarl",
".",
"lang",
".",
"validation",
".",
"IssueCodes",
".",
"INVALID_IMPLEMENTED_TYPE",
")",
"public",
"void",
"fixInvalidImplementedType",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
"Imp... | Quick fix for "Invalid implemented type".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Invalid",
"implemented",
"type",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L805-L808 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixInvalidExtendedType | @Fix(io.sarl.lang.validation.IssueCodes.INVALID_EXTENDED_TYPE)
public void fixInvalidExtendedType(final Issue issue, IssueResolutionAcceptor acceptor) {
ExtendedTypeRemoveModification.accept(this, issue, acceptor);
} | java | @Fix(io.sarl.lang.validation.IssueCodes.INVALID_EXTENDED_TYPE)
public void fixInvalidExtendedType(final Issue issue, IssueResolutionAcceptor acceptor) {
ExtendedTypeRemoveModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"io",
".",
"sarl",
".",
"lang",
".",
"validation",
".",
"IssueCodes",
".",
"INVALID_EXTENDED_TYPE",
")",
"public",
"void",
"fixInvalidExtendedType",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
"ExtendedT... | Quick fix for "Invalid extended type".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Invalid",
"extended",
"type",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L815-L818 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixCyclicInheritance | @Fix(IssueCodes.CYCLIC_INHERITANCE)
public void fixCyclicInheritance(final Issue issue, IssueResolutionAcceptor acceptor) {
ExtendedTypeRemoveModification.accept(this, issue, acceptor);
} | java | @Fix(IssueCodes.CYCLIC_INHERITANCE)
public void fixCyclicInheritance(final Issue issue, IssueResolutionAcceptor acceptor) {
ExtendedTypeRemoveModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"IssueCodes",
".",
"CYCLIC_INHERITANCE",
")",
"public",
"void",
"fixCyclicInheritance",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
"ExtendedTypeRemoveModification",
".",
"accept",
"(",
"this",
",",
"issue",... | Quick fix for "Cyclic hierarchy".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Cyclic",
"hierarchy",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L825-L828 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixInteraceExpected | @Fix(IssueCodes.INTERFACE_EXPECTED)
public void fixInteraceExpected(final Issue issue, IssueResolutionAcceptor acceptor) {
ExtendedTypeRemoveModification.accept(this, issue, acceptor);
} | java | @Fix(IssueCodes.INTERFACE_EXPECTED)
public void fixInteraceExpected(final Issue issue, IssueResolutionAcceptor acceptor) {
ExtendedTypeRemoveModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"IssueCodes",
".",
"INTERFACE_EXPECTED",
")",
"public",
"void",
"fixInteraceExpected",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
"ExtendedTypeRemoveModification",
".",
"accept",
"(",
"this",
",",
"issue",
... | Quick fix for "Interface expected".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Interface",
"expected",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L835-L838 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixClassExpected | @Fix(IssueCodes.CLASS_EXPECTED)
public void fixClassExpected(final Issue issue, IssueResolutionAcceptor acceptor) {
ExtendedTypeRemoveModification.accept(this, issue, acceptor);
} | java | @Fix(IssueCodes.CLASS_EXPECTED)
public void fixClassExpected(final Issue issue, IssueResolutionAcceptor acceptor) {
ExtendedTypeRemoveModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"IssueCodes",
".",
"CLASS_EXPECTED",
")",
"public",
"void",
"fixClassExpected",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
"ExtendedTypeRemoveModification",
".",
"accept",
"(",
"this",
",",
"issue",
",",
... | Quick fix for "Class expected".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Class",
"expected",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L845-L848 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixDiscouragedCapacityDefinition | @Fix(io.sarl.lang.validation.IssueCodes.DISCOURAGED_CAPACITY_DEFINITION)
public void fixDiscouragedCapacityDefinition(Issue issue, IssueResolutionAcceptor acceptor) {
MemberRemoveModification.accept(this, issue, acceptor, SarlCapacity.class);
ActionAddModification.accept(this, issue, acceptor);
} | java | @Fix(io.sarl.lang.validation.IssueCodes.DISCOURAGED_CAPACITY_DEFINITION)
public void fixDiscouragedCapacityDefinition(Issue issue, IssueResolutionAcceptor acceptor) {
MemberRemoveModification.accept(this, issue, acceptor, SarlCapacity.class);
ActionAddModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"io",
".",
"sarl",
".",
"lang",
".",
"validation",
".",
"IssueCodes",
".",
"DISCOURAGED_CAPACITY_DEFINITION",
")",
"public",
"void",
"fixDiscouragedCapacityDefinition",
"(",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
"... | Quick fix for "Discouraged capacity definition".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Discouraged",
"capacity",
"definition",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L855-L859 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixIncompatibleReturnType | @Fix(org.eclipse.xtext.xbase.validation.IssueCodes.INCOMPATIBLE_RETURN_TYPE)
public void fixIncompatibleReturnType(final Issue issue, IssueResolutionAcceptor acceptor) {
ReturnTypeReplaceModification.accept(this, issue, acceptor);
} | java | @Fix(org.eclipse.xtext.xbase.validation.IssueCodes.INCOMPATIBLE_RETURN_TYPE)
public void fixIncompatibleReturnType(final Issue issue, IssueResolutionAcceptor acceptor) {
ReturnTypeReplaceModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"org",
".",
"eclipse",
".",
"xtext",
".",
"xbase",
".",
"validation",
".",
"IssueCodes",
".",
"INCOMPATIBLE_RETURN_TYPE",
")",
"public",
"void",
"fixIncompatibleReturnType",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor... | Quick fix for "Incompatible return type".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Incompatible",
"return",
"type",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L866-L869 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixReturnTypeRecommended | @Fix(io.sarl.lang.validation.IssueCodes.RETURN_TYPE_SPECIFICATION_IS_RECOMMENDED)
public void fixReturnTypeRecommended(final Issue issue, IssueResolutionAcceptor acceptor) {
ReturnTypeAddModification.accept(this, issue, acceptor);
} | java | @Fix(io.sarl.lang.validation.IssueCodes.RETURN_TYPE_SPECIFICATION_IS_RECOMMENDED)
public void fixReturnTypeRecommended(final Issue issue, IssueResolutionAcceptor acceptor) {
ReturnTypeAddModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"io",
".",
"sarl",
".",
"lang",
".",
"validation",
".",
"IssueCodes",
".",
"RETURN_TYPE_SPECIFICATION_IS_RECOMMENDED",
")",
"public",
"void",
"fixReturnTypeRecommended",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")"... | Quick fix for "Return type is recommended".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Return",
"type",
"is",
"recommended",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L876-L879 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixUnusedAgentCapacity | @Fix(io.sarl.lang.validation.IssueCodes.UNUSED_AGENT_CAPACITY)
public void fixUnusedAgentCapacity(final Issue issue, IssueResolutionAcceptor acceptor) {
CapacityReferenceRemoveModification.accept(this, issue, acceptor);
} | java | @Fix(io.sarl.lang.validation.IssueCodes.UNUSED_AGENT_CAPACITY)
public void fixUnusedAgentCapacity(final Issue issue, IssueResolutionAcceptor acceptor) {
CapacityReferenceRemoveModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"io",
".",
"sarl",
".",
"lang",
".",
"validation",
".",
"IssueCodes",
".",
"UNUSED_AGENT_CAPACITY",
")",
"public",
"void",
"fixUnusedAgentCapacity",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
"CapacityR... | Quick fix for "Unused agent capacity".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Unused",
"agent",
"capacity",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L886-L889 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixRedundantAgentCapacityUse | @Fix(io.sarl.lang.validation.IssueCodes.REDUNDANT_CAPACITY_USE)
public void fixRedundantAgentCapacityUse(final Issue issue, IssueResolutionAcceptor acceptor) {
CapacityReferenceRemoveModification.accept(this, issue, acceptor);
} | java | @Fix(io.sarl.lang.validation.IssueCodes.REDUNDANT_CAPACITY_USE)
public void fixRedundantAgentCapacityUse(final Issue issue, IssueResolutionAcceptor acceptor) {
CapacityReferenceRemoveModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"io",
".",
"sarl",
".",
"lang",
".",
"validation",
".",
"IssueCodes",
".",
"REDUNDANT_CAPACITY_USE",
")",
"public",
"void",
"fixRedundantAgentCapacityUse",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
"Ca... | Quick fix for "Redundant capacity use".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Redundant",
"capacity",
"use",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L896-L899 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixNoViableAlternativeAtKeyword | @Fix(SyntaxIssueCodes.USED_RESERVED_KEYWORD)
public void fixNoViableAlternativeAtKeyword(final Issue issue, IssueResolutionAcceptor acceptor) {
ProtectKeywordModification.accept(this, issue, acceptor);
} | java | @Fix(SyntaxIssueCodes.USED_RESERVED_KEYWORD)
public void fixNoViableAlternativeAtKeyword(final Issue issue, IssueResolutionAcceptor acceptor) {
ProtectKeywordModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"SyntaxIssueCodes",
".",
"USED_RESERVED_KEYWORD",
")",
"public",
"void",
"fixNoViableAlternativeAtKeyword",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
"ProtectKeywordModification",
".",
"accept",
"(",
"this",
... | Quick fix for the no viable alternative at an input that is a SARL keyword.
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"the",
"no",
"viable",
"alternative",
"at",
"an",
"input",
"that",
"is",
"a",
"SARL",
"keyword",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L964-L967 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixDiscouragedAnnotationUse | @Fix(io.sarl.lang.validation.IssueCodes.USED_RESERVED_SARL_ANNOTATION)
public void fixDiscouragedAnnotationUse(final Issue issue, IssueResolutionAcceptor acceptor) {
AnnotationRemoveModification.accept(this, issue, acceptor);
} | java | @Fix(io.sarl.lang.validation.IssueCodes.USED_RESERVED_SARL_ANNOTATION)
public void fixDiscouragedAnnotationUse(final Issue issue, IssueResolutionAcceptor acceptor) {
AnnotationRemoveModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"io",
".",
"sarl",
".",
"lang",
".",
"validation",
".",
"IssueCodes",
".",
"USED_RESERVED_SARL_ANNOTATION",
")",
"public",
"void",
"fixDiscouragedAnnotationUse",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",... | Quick fix for the discouraged annotation uses.
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"the",
"discouraged",
"annotation",
"uses",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L974-L977 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixManualInlineDefinition | @Fix(io.sarl.lang.validation.IssueCodes.MANUAL_INLINE_DEFINITION)
public void fixManualInlineDefinition(final Issue issue, IssueResolutionAcceptor acceptor) {
AnnotationRemoveModification.accept(this, issue, acceptor);
} | java | @Fix(io.sarl.lang.validation.IssueCodes.MANUAL_INLINE_DEFINITION)
public void fixManualInlineDefinition(final Issue issue, IssueResolutionAcceptor acceptor) {
AnnotationRemoveModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"io",
".",
"sarl",
".",
"lang",
".",
"validation",
".",
"IssueCodes",
".",
"MANUAL_INLINE_DEFINITION",
")",
"public",
"void",
"fixManualInlineDefinition",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
"Ann... | Quick fix for the manual definition of inline statements.
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"the",
"manual",
"definition",
"of",
"inline",
"statements",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L984-L987 | train |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.ui/src/io/sarl/pythongenerator/ui/PyGeneratorUiPlugin.java | PyGeneratorUiPlugin.getDialogSettingsSection | public IDialogSettings getDialogSettingsSection(String name) {
final IDialogSettings dialogSettings = getDialogSettings();
IDialogSettings section = dialogSettings.getSection(name);
if (section == null) {
section = dialogSettings.addNewSection(name);
}
return section;
} | java | public IDialogSettings getDialogSettingsSection(String name) {
final IDialogSettings dialogSettings = getDialogSettings();
IDialogSettings section = dialogSettings.getSection(name);
if (section == null) {
section = dialogSettings.addNewSection(name);
}
return section;
} | [
"public",
"IDialogSettings",
"getDialogSettingsSection",
"(",
"String",
"name",
")",
"{",
"final",
"IDialogSettings",
"dialogSettings",
"=",
"getDialogSettings",
"(",
")",
";",
"IDialogSettings",
"section",
"=",
"dialogSettings",
".",
"getSection",
"(",
"name",
")",
... | Returns a section in the SARL Eclipse plugin's dialog settings.
If the section doesn't exist yet, it is created.
@param name the name of the section
@return the section of the given name | [
"Returns",
"a",
"section",
"in",
"the",
"SARL",
"Eclipse",
"plugin",
"s",
"dialog",
"settings",
".",
"If",
"the",
"section",
"doesn",
"t",
"exist",
"yet",
"it",
"is",
"created",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.ui/src/io/sarl/pythongenerator/ui/PyGeneratorUiPlugin.java#L77-L84 | train |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/configuration/PyGeneratorConfigurationProvider.java | PyGeneratorConfigurationProvider.install | public PyGeneratorConfiguration install(ResourceSet resourceSet, PyGeneratorConfiguration config) {
assert config != null;
PyGeneratorConfigAdapter adapter = PyGeneratorConfigAdapter.findInEmfObject(resourceSet);
if (adapter == null) {
adapter = new PyGeneratorConfigAdapter();
}
adapter.attachToEmfObject(resourceSet);
return adapter.getLanguage2GeneratorConfig().put(this.languageId, config);
} | java | public PyGeneratorConfiguration install(ResourceSet resourceSet, PyGeneratorConfiguration config) {
assert config != null;
PyGeneratorConfigAdapter adapter = PyGeneratorConfigAdapter.findInEmfObject(resourceSet);
if (adapter == null) {
adapter = new PyGeneratorConfigAdapter();
}
adapter.attachToEmfObject(resourceSet);
return adapter.getLanguage2GeneratorConfig().put(this.languageId, config);
} | [
"public",
"PyGeneratorConfiguration",
"install",
"(",
"ResourceSet",
"resourceSet",
",",
"PyGeneratorConfiguration",
"config",
")",
"{",
"assert",
"config",
"!=",
"null",
";",
"PyGeneratorConfigAdapter",
"adapter",
"=",
"PyGeneratorConfigAdapter",
".",
"findInEmfObject",
... | Install the given configuration into the context.
@param resourceSet the target of the installation.
@param config the configuration to install.
@return the old configuration if one was previously installed. | [
"Install",
"the",
"given",
"configuration",
"into",
"the",
"context",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/configuration/PyGeneratorConfigurationProvider.java#L94-L102 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/pygments/PygmentsGenerator2.java | PygmentsGenerator2.generatePythonSetup | protected void generatePythonSetup(IStyleAppendable it, String basename) {
it.appendNl("# -*- coding: {0} -*-", getCodeConfig().getEncoding().toLowerCase()); //$NON-NLS-1$
it.appendHeader();
it.newLine();
it.append("from setuptools import setup"); //$NON-NLS-1$
it.newLine().newLine();
it.append("setup ("); //$NON-NLS-1$
it.increaseIndentation().newLine();
it.append("name='").append(basename).append("lexer',"); //$NON-NLS-1$ //$NON-NLS-2$
it.newLine();
it.append("version='").append(getLanguageVersion()).append("',"); //$NON-NLS-1$ //$NON-NLS-2$
it.newLine();
it.append("packages=['").append(basename).append("lexer'],"); //$NON-NLS-1$ //$NON-NLS-2$
it.newLine();
it.append("entry_points ="); //$NON-NLS-1$
it.newLine();
it.append("\"\"\""); //$NON-NLS-1$
it.newLine();
it.append("[pygments.lexers]"); //$NON-NLS-1$
it.newLine();
it.append("sarllexer = ").append(basename).append("lexer.").append(basename); //$NON-NLS-1$ //$NON-NLS-2$
it.append(":SarlLexer"); //$NON-NLS-1$
it.newLine();
it.append("\"\"\","); //$NON-NLS-1$
it.decreaseIndentation().newLine();
it.append(")"); //$NON-NLS-1$
it.newLine();
} | java | protected void generatePythonSetup(IStyleAppendable it, String basename) {
it.appendNl("# -*- coding: {0} -*-", getCodeConfig().getEncoding().toLowerCase()); //$NON-NLS-1$
it.appendHeader();
it.newLine();
it.append("from setuptools import setup"); //$NON-NLS-1$
it.newLine().newLine();
it.append("setup ("); //$NON-NLS-1$
it.increaseIndentation().newLine();
it.append("name='").append(basename).append("lexer',"); //$NON-NLS-1$ //$NON-NLS-2$
it.newLine();
it.append("version='").append(getLanguageVersion()).append("',"); //$NON-NLS-1$ //$NON-NLS-2$
it.newLine();
it.append("packages=['").append(basename).append("lexer'],"); //$NON-NLS-1$ //$NON-NLS-2$
it.newLine();
it.append("entry_points ="); //$NON-NLS-1$
it.newLine();
it.append("\"\"\""); //$NON-NLS-1$
it.newLine();
it.append("[pygments.lexers]"); //$NON-NLS-1$
it.newLine();
it.append("sarllexer = ").append(basename).append("lexer.").append(basename); //$NON-NLS-1$ //$NON-NLS-2$
it.append(":SarlLexer"); //$NON-NLS-1$
it.newLine();
it.append("\"\"\","); //$NON-NLS-1$
it.decreaseIndentation().newLine();
it.append(")"); //$NON-NLS-1$
it.newLine();
} | [
"protected",
"void",
"generatePythonSetup",
"(",
"IStyleAppendable",
"it",
",",
"String",
"basename",
")",
"{",
"it",
".",
"appendNl",
"(",
"\"# -*- coding: {0} -*-\"",
",",
"getCodeConfig",
"(",
")",
".",
"getEncoding",
"(",
")",
".",
"toLowerCase",
"(",
")",
... | Create the content of the "setup.py" file.
@param it the content.
@param basename the basename. | [
"Create",
"the",
"content",
"of",
"the",
"setup",
".",
"py",
"file",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/pygments/PygmentsGenerator2.java#L254-L281 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/appenders/SarlBehaviorUnitSourceAppender.java | SarlBehaviorUnitSourceAppender.newTypeRef | public JvmParameterizedTypeReference newTypeRef(Notifier context, String typeName) {
return this.builder.newTypeRef(context, typeName);
} | java | public JvmParameterizedTypeReference newTypeRef(Notifier context, String typeName) {
return this.builder.newTypeRef(context, typeName);
} | [
"public",
"JvmParameterizedTypeReference",
"newTypeRef",
"(",
"Notifier",
"context",
",",
"String",
"typeName",
")",
"{",
"return",
"this",
".",
"builder",
".",
"newTypeRef",
"(",
"context",
",",
"typeName",
")",
";",
"}"
] | Find the reference to the type with the given name.
@param context the context for the type reference use
@param typeName the fully qualified name of the type
@return the type reference. | [
"Find",
"the",
"reference",
"to",
"the",
"type",
"with",
"the",
"given",
"name",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/appenders/SarlBehaviorUnitSourceAppender.java#L67-L69 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/codemining/SARLCodeMiningProvider.java | SARLCodeMiningProvider.getLightweightType | protected LightweightTypeReference getLightweightType(XExpression expr) {
final IResolvedTypes resolvedTypes = getResolvedTypes(expr);
final LightweightTypeReference expressionType = resolvedTypes.getActualType(expr);
if (expr instanceof AnonymousClass) {
final List<LightweightTypeReference> superTypes = expressionType.getSuperTypes();
if (superTypes.size() == 1) {
return superTypes.get(0);
}
}
return expressionType;
} | java | protected LightweightTypeReference getLightweightType(XExpression expr) {
final IResolvedTypes resolvedTypes = getResolvedTypes(expr);
final LightweightTypeReference expressionType = resolvedTypes.getActualType(expr);
if (expr instanceof AnonymousClass) {
final List<LightweightTypeReference> superTypes = expressionType.getSuperTypes();
if (superTypes.size() == 1) {
return superTypes.get(0);
}
}
return expressionType;
} | [
"protected",
"LightweightTypeReference",
"getLightweightType",
"(",
"XExpression",
"expr",
")",
"{",
"final",
"IResolvedTypes",
"resolvedTypes",
"=",
"getResolvedTypes",
"(",
"expr",
")",
";",
"final",
"LightweightTypeReference",
"expressionType",
"=",
"resolvedTypes",
".... | Replies the inferred type for the given expression.
@param expr the expression.
@return the type of the expression. | [
"Replies",
"the",
"inferred",
"type",
"for",
"the",
"given",
"expression",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/codemining/SARLCodeMiningProvider.java#L174-L184 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/codemining/SARLCodeMiningProvider.java | SARLCodeMiningProvider.createImplicitVariableType | private void createImplicitVariableType(XtextResource resource, IAcceptor<? super ICodeMining> acceptor) {
createImplicitVarValType(resource, acceptor, XtendVariableDeclaration.class,
it -> it.getType(),
it -> {
LightweightTypeReference type = getLightweightType(it.getRight());
if (type.isAny()) {
type = getTypeForVariableDeclaration(it.getRight());
}
return type.getSimpleName();
},
it -> it.getRight(),
() -> this.grammar.getXVariableDeclarationAccess().getRightAssignment_3_1());
} | java | private void createImplicitVariableType(XtextResource resource, IAcceptor<? super ICodeMining> acceptor) {
createImplicitVarValType(resource, acceptor, XtendVariableDeclaration.class,
it -> it.getType(),
it -> {
LightweightTypeReference type = getLightweightType(it.getRight());
if (type.isAny()) {
type = getTypeForVariableDeclaration(it.getRight());
}
return type.getSimpleName();
},
it -> it.getRight(),
() -> this.grammar.getXVariableDeclarationAccess().getRightAssignment_3_1());
} | [
"private",
"void",
"createImplicitVariableType",
"(",
"XtextResource",
"resource",
",",
"IAcceptor",
"<",
"?",
"super",
"ICodeMining",
">",
"acceptor",
")",
"{",
"createImplicitVarValType",
"(",
"resource",
",",
"acceptor",
",",
"XtendVariableDeclaration",
".",
"class... | Add an annotation when the variable's type is implicit and inferred by the SARL compiler.
@param resource the resource to parse.
@param acceptor the code mining acceptor. | [
"Add",
"an",
"annotation",
"when",
"the",
"variable",
"s",
"type",
"is",
"implicit",
"and",
"inferred",
"by",
"the",
"SARL",
"compiler",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/codemining/SARLCodeMiningProvider.java#L214-L226 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/codemining/SARLCodeMiningProvider.java | SARLCodeMiningProvider.createImplicitFieldType | private void createImplicitFieldType(XtextResource resource, IAcceptor<? super ICodeMining> acceptor) {
createImplicitVarValType(resource, acceptor, XtendField.class,
it -> it.getType(),
it -> {
final JvmField inferredField = (JvmField) this.jvmModelAssocitions.getPrimaryJvmElement(it);
if (inferredField == null || inferredField.getType() == null || inferredField.getType().eIsProxy()) {
return null;
}
return inferredField.getType().getSimpleName();
},
null,
() -> this.grammar.getAOPMemberAccess().getInitialValueAssignment_2_3_3_1());
} | java | private void createImplicitFieldType(XtextResource resource, IAcceptor<? super ICodeMining> acceptor) {
createImplicitVarValType(resource, acceptor, XtendField.class,
it -> it.getType(),
it -> {
final JvmField inferredField = (JvmField) this.jvmModelAssocitions.getPrimaryJvmElement(it);
if (inferredField == null || inferredField.getType() == null || inferredField.getType().eIsProxy()) {
return null;
}
return inferredField.getType().getSimpleName();
},
null,
() -> this.grammar.getAOPMemberAccess().getInitialValueAssignment_2_3_3_1());
} | [
"private",
"void",
"createImplicitFieldType",
"(",
"XtextResource",
"resource",
",",
"IAcceptor",
"<",
"?",
"super",
"ICodeMining",
">",
"acceptor",
")",
"{",
"createImplicitVarValType",
"(",
"resource",
",",
"acceptor",
",",
"XtendField",
".",
"class",
",",
"it",... | Add an annotation when the field's type is implicit and inferred by the SARL compiler.
@param resource the resource to parse.
@param acceptor the code mining acceptor. | [
"Add",
"an",
"annotation",
"when",
"the",
"field",
"s",
"type",
"is",
"implicit",
"and",
"inferred",
"by",
"the",
"SARL",
"compiler",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/codemining/SARLCodeMiningProvider.java#L233-L245 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.