proj_name stringclasses 26
values | relative_path stringlengths 42 165 | class_name stringlengths 3 46 | func_name stringlengths 2 44 | masked_class stringlengths 80 7.9k | func_body stringlengths 76 5.98k | len_input int64 30 1.88k | len_output int64 25 1.43k | total int64 73 2.03k | initial_context stringclasses 74
values |
|---|---|---|---|---|---|---|---|---|---|
PlayEdu_PlayEdu | PlayEdu/playedu-api/src/main/java/xyz/playedu/api/controller/frontend/HourController.java | HourController | detail | class HourController {
@Autowired private CourseService courseService;
@Autowired private CourseHourService hourService;
@Autowired private ResourceService resourceService;
@Autowired private UserCourseHourRecordService userCourseHourRecordService;
// ------- CACHE ----------
@Autowired pri... |
Course course = courseService.findOrFail(courseId);
CourseHour courseHour = hourService.findOrFail(id, courseId);
UserCourseHourRecord userCourseHourRecord = null;
if (FCtx.getId() != null && FCtx.getId() > 0) {
// 学员已登录
userCourseHourRecord = userCourseHourReco... | 1,247 | 189 | 1,436 | |
graphhopper_graphhopper | graphhopper/core/src/main/java/com/graphhopper/routing/weighting/custom/CustomWeightingHelper.java | CustomWeightingHelper | calcMaxSpeed | class CustomWeightingHelper {
static double GLOBAL_MAX_SPEED = 999;
static double GLOBAL_PRIORITY = 1;
protected EncodedValueLookup lookup;
protected CustomModel customModel;
protected CustomWeightingHelper() {
}
public void init(CustomModel customModel, EncodedValueLookup lookup, Map<Str... |
MinMax minMaxSpeed = new MinMax(0, GLOBAL_MAX_SPEED);
FindMinMax.findMinMax(minMaxSpeed, customModel.getSpeed(), lookup);
if (minMaxSpeed.min < 0)
throw new IllegalArgumentException("speed has to be >=0 but can be negative (" + minMaxSpeed.min + ")");
if (minMaxSpeed.max <= ... | 648 | 194 | 842 | |
google_truth | truth/core/src/main/java/com/google/common/truth/OptionalDoubleSubject.java | OptionalDoubleSubject | isEmpty | class OptionalDoubleSubject extends Subject {
private final OptionalDouble actual;
OptionalDoubleSubject(
FailureMetadata failureMetadata,
@Nullable OptionalDouble subject,
@Nullable String typeDescription) {
super(failureMetadata, subject, typeDescription);
this.actual = subject;
}
... |
if (actual == null) {
failWithActual(simpleFact("expected empty optional"));
} else if (actual.isPresent()) {
failWithoutActual(
simpleFact("expected to be empty"),
fact("but was present with value", actual.getAsDouble()));
}
| 670 | 72 | 742 | /**
* An object that lets you perform checks on the value under test. For example, {@code Subject}contains {@link #isEqualTo(Object)} and {@link #isInstanceOf(Class)}, and {@link StringSubject}contains {@link StringSubject#startsWith startsWith(String)}. <p>To create a {@code Subject} instance, most users will c... |
ainilili_ratel | ratel/landlords-common/src/main/java/org/nico/ratel/landlords/utils/OptionsUtils.java | OptionsUtils | getOptions | class OptionsUtils {
public static int getOptions(String line) {<FILL_FUNCTION_BODY>}
} |
int option = -1;
try {
option = Integer.parseInt(line);
} catch (Exception ignored) {}
return option;
| 31 | 42 | 73 | |
docker-java_docker-java | docker-java/docker-java-core/src/main/java/com/github/dockerjava/core/exec/ListImagesCmdExec.java | ListImagesCmdExec | execute | class ListImagesCmdExec extends AbstrSyncDockerCmdExec<ListImagesCmd, List<Image>> implements ListImagesCmd.Exec {
private static final Logger LOGGER = LoggerFactory.getLogger(ListImagesCmdExec.class);
public ListImagesCmdExec(WebTarget baseResource, DockerClientConfig dockerClientConfig) {
super(base... |
WebTarget webTarget = getBaseResource().path("/images/json");
webTarget = booleanQueryParam(webTarget, "all", command.hasShowAllEnabled());
if (command.getFilters() != null && !command.getFilters().isEmpty()) {
webTarget = webTarget.queryParam("filters", FiltersEncoder.jsonEncode(... | 126 | 218 | 344 | |
houbb_sensitive-word | sensitive-word/src/main/java/com/github/houbb/sensitive/word/utils/InnerWordFormatUtils.java | InnerWordFormatUtils | formatCharsMapping | class InnerWordFormatUtils {
private InnerWordFormatUtils(){}
/**
* 空字符数组
* @since 0.6.0
*/
private static final char[] EMPTY_CHARS = new char[0];
/**
* 格式化
* @param original 原始
* @param context 上下文
* @return 结果
* @since 0.1.1
*/
public static String f... |
if(StringUtil.isEmpty(original)) {
return Collections.emptyMap();
}
final int len = original.length();
char[] rawChars = original.toCharArray();
Map<Character, Character> map = new HashMap<>(rawChars.length);
IWordFormat charFormat = context.wordFormat();
... | 508 | 155 | 663 | |
eirslett_frontend-maven-plugin | frontend-maven-plugin/frontend-maven-plugin/src/main/java/com/github/eirslett/maven/plugins/frontend/mojo/AbstractFrontendMojo.java | AbstractFrontendMojo | execute | class AbstractFrontendMojo extends AbstractMojo {
@Component
protected MojoExecution execution;
/**
* Whether you should skip while running in the test phase (default is false)
*/
@Parameter(property = "skipTests", required = false, defaultValue = "false")
protected Boolean skipTests;
... |
if (testFailureIgnore && !isTestingPhase()) {
getLog().info("testFailureIgnore property is ignored in non test phases");
}
if (!(skipTestPhase() || skipExecution())) {
if (installDirectory == null) {
installDirectory = workingDirectory;
}
... | 576 | 233 | 809 | |
joelittlejohn_jsonschema2pojo | jsonschema2pojo/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/MinItemsMaxItemsRule.java | MinItemsMaxItemsRule | isApplicableType | class MinItemsMaxItemsRule implements Rule<JFieldVar, JFieldVar> {
private final RuleFactory ruleFactory;
protected MinItemsMaxItemsRule(RuleFactory ruleFactory) {
this.ruleFactory = ruleFactory;
}
@Override
public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar... |
try {
String typeName = field.type().boxify().fullName();
// For collections, the full name will be something like 'java.util.List<String>' and we
// need just 'java.util.List'.
int genericsPos = typeName.indexOf('<');
if (genericsPos > -1) {
... | 329 | 217 | 546 | |
DerekYRC_mini-spring | mini-spring/src/main/java/org/springframework/aop/framework/ReflectiveMethodInvocation.java | ReflectiveMethodInvocation | proceed | class ReflectiveMethodInvocation implements MethodInvocation {
protected final Object proxy;
protected final Object target;
protected final Method method;
protected final Object[] arguments;
protected final Class<?> targetClass;
protected final List<Object> interceptorsAndDynamicMethodMatchers;
private in... |
// 初始currentInterceptorIndex为-1,每调用一次proceed就把currentInterceptorIndex+1
if (this.currentInterceptorIndex == this.interceptorsAndDynamicMethodMatchers.size() - 1) {
// 当调用次数 = 拦截器个数时
// 触发当前method方法
return method.invoke(this.target, this.arguments);
}
Object interceptorOrInterceptionAdvice =
this.... | 289 | 187 | 476 | |
jitsi_jitsi | jitsi/modules/impl/gui/src/main/java/net/java/sip/communicator/impl/gui/main/chat/menus/HelpMenu.java | HelpMenu | dispose | class HelpMenu
extends SIPCommMenu
implements ActionListener,
PluginComponentListener
{
private final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(HelpMenu.class.getName());
/**
* Creates an instance of <tt>HelpMenu</tt>.
* @param chatWindow The parent <tt>MainFr... |
GuiActivator.getUIService().removePluginComponentListener(this);
/*
* Let go of all Components contributed by PluginComponents because the
* latter will still live in the contribution store.
*/
removeAll();
| 870 | 63 | 933 | /**
* The <tt>SIPCommMenu</tt> is very similar to a JComboBox. The main component here is a JLabel only with an icon. When user clicks on the icon a popup menu is opened, containing a list of icon-text pairs from which the user could choose one item. When user selects the desired item, the icon of the selected item i... |
zhkl0228_unidbg | unidbg/backend/dynarmic/src/main/java/com/github/unidbg/arm/backend/dynarmic/EventMemHookNotifier.java | EventMemHookNotifier | handleMemoryReadFailed | class EventMemHookNotifier {
private final EventMemHook callback;
private final int type;
private final Object user_data;
public EventMemHookNotifier(EventMemHook callback, int type, Object user_data) {
this.callback = callback;
this.type = type;
this.user_data = user_data;
... |
if ((type & UnicornConst.UC_HOOK_MEM_READ_UNMAPPED) != 0) {
callback.hook(backend, vaddr, size, 0, user_data, EventMemHook.UnmappedType.Read);
}
| 216 | 68 | 284 | |
jeecgboot_jeecg-boot | jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/mock/vxe/websocket/VxeSocket.java | VxeSocket | sendMessage | class VxeSocket {
/**
* 当前 session
*/
private Session session;
/**
* 当前用户id
*/
private String userId;
/**
* 页面id,用于标识同一用户,不同页面的数据
*/
private String pageId;
/**
* 当前socket唯一id
*/
private String socketId;
/**
* 用户连接池,包含单个用户的所有socket连接;
... |
try {
this.session.getAsyncRemote().sendText(message);
} catch (Exception e) {
log.error("【vxeSocket】消息发送失败:" + e.getMessage());
}
| 1,589 | 57 | 1,646 | |
pmd_pmd | pmd/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/internal/infer/ast/BaseInvocMirror.java | BaseInvocMirror | isEquivalentToUnderlyingAst | class BaseInvocMirror<T extends InvocationNode> extends BasePolyMirror<T> implements InvocationMirror {
private MethodCtDecl ctDecl;
private List<ExprMirror> args;
BaseInvocMirror(JavaExprMirrors mirrors, T call, @Nullable ExprMirror parent, MirrorMaker subexprMaker) {
super(mirrors, call, parent,... |
MethodCtDecl ctDecl = getCtDecl();
AssertionUtil.validateState(ctDecl != null, "overload resolution is not complete");
if (ctDecl.isFailed()) {
return false; // be conservative
}
if (!myNode.getMethodType().getSymbol().equals(ctDecl.getMethodType().getSymbol())) {
... | 577 | 291 | 868 | |
YunaiV_ruoyi-vue-pro | ruoyi-vue-pro/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictTypeServiceImpl.java | DictTypeServiceImpl | validateDictTypeUnique | class DictTypeServiceImpl implements DictTypeService {
@Resource
private DictDataService dictDataService;
@Resource
private DictTypeMapper dictTypeMapper;
@Override
public PageResult<DictTypeDO> getDictTypePage(DictTypePageReqVO pageReqVO) {
return dictTypeMapper.selectPage(pageReqVO)... |
if (StrUtil.isEmpty(type)) {
return;
}
DictTypeDO dictType = dictTypeMapper.selectByType(type);
if (dictType == null) {
return;
}
// 如果 id 为空,说明不用比较是否为相同 id 的字典类型
if (id == null) {
throw exception(DICT_TYPE_TYPE_DUPLICATE);
... | 983 | 143 | 1,126 | |
DerekYRC_mini-spring | mini-spring/src/main/java/org/springframework/core/convert/support/StringToNumberConverterFactory.java | StringToNumber | convert | class StringToNumber<T extends Number> implements Converter<String, T> {
private final Class<T> targetType;
public StringToNumber(Class<T> targetType) {
this.targetType = targetType;
}
@Override
public T convert(String source) {<FILL_FUNCTION_BODY>}
} |
if (source.length() == 0) {
return null;
}
if (targetType.equals(Integer.class)) {
return (T) Integer.valueOf(source);
} else if (targetType.equals(Long.class)) {
return (T) Long.valueOf(source);
}
//TODO 其他数字类型
else {
throw new IllegalArgumentException(
"Cannot convert Str... | 89 | 134 | 223 | |
graphhopper_graphhopper | graphhopper/core/src/main/java/com/graphhopper/routing/Path.java | Path | forEveryEdge | class Path {
final Graph graph;
private final NodeAccess nodeAccess;
private double weight = Double.MAX_VALUE;
private double distance;
private long time;
private IntArrayList edgeIds = new IntArrayList();
private int fromNode = -1;
private int endNode = -1;
private List<String> desc... |
int tmpNode = getFromNode();
int len = edgeIds.size();
int prevEdgeId = EdgeIterator.NO_EDGE;
for (int i = 0; i < len; i++) {
EdgeIteratorState edgeBase = graph.getEdgeIteratorState(edgeIds.get(i), tmpNode);
if (edgeBase == null)
throw new Illegal... | 1,725 | 238 | 1,963 | |
javamelody_javamelody | javamelody/javamelody-core/src/main/java/net/bull/javamelody/JdbcDriver.java | JdbcDriver | connect | class JdbcDriver implements Driver {
// cette classe est publique pour être déclarée dans une configuration jdbc
static final JdbcDriver SINGLETON = new JdbcDriver();
// initialisation statique du driver
static {
try {
DriverManager.registerDriver(SINGLETON);
LOG.debug("JDBC driver registered");
... |
if ("false".equals(info.get("javamelody"))) {
// if property javamelody=false then it's not for us
// (we pass here from the DriverManager.getConnection below)
return null;
}
String myUrl = url;
// we load first the driver class from the info or the url, to be sure that it will be found
Stri... | 865 | 680 | 1,545 | |
YunaiV_ruoyi-vue-pro | ruoyi-vue-pro/yudao-server/src/main/java/cn/iocoder/yudao/server/YudaoServerApplication.java | YudaoServerApplication | main | class YudaoServerApplication {
public static void main(String[] args) {<FILL_FUNCTION_BODY>}
} |
// 如果你碰到启动的问题,请认真阅读 https://doc.iocoder.cn/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 https://doc.iocoder.cn/quick-start/ 文章
// 如果你碰到启动的问题,请认真阅读 https://doc.iocoder.cn/quick-start/ 文章
SpringApplication.run(YudaoServerApplication.class, args);
// new SpringApplicationBuilder(YudaoServer... | 36 | 241 | 277 | |
graphhopper_graphhopper | graphhopper/core/src/main/java/com/graphhopper/routing/lm/PrepareLandmarks.java | PrepareLandmarks | doWork | class PrepareLandmarks {
private static final Logger LOGGER = LoggerFactory.getLogger(PrepareLandmarks.class);
private final BaseGraph graph;
private final LandmarkStorage lms;
private final LMConfig lmConfig;
private long totalPrepareTime;
private boolean prepared = false;
public PrepareLa... |
if (prepared)
throw new IllegalStateException("Call doWork only once!");
prepared = true;
StopWatch sw = new StopWatch().start();
LOGGER.info("Start calculating " + lms.getLandmarkCount() + " landmarks, weighting:" + lms.getLmSelectionWeighting() + ", " + Helper.getMemInfo()... | 711 | 230 | 941 | |
Kong_unirest-java | unirest-java/unirest-modules-mocks/src/main/java/kong/unirest/core/MockWebSocket.java | MockWebSocket | sendToOtherSide | class MockWebSocket implements WebSocket {
private SocketSet remoteSocketSet;
private CompletableFuture<WebSocket> sendToOtherSide(BiConsumer<WebSocket, Listener> consumer){<FILL_FUNCTION_BODY>}
@Override
public CompletableFuture<WebSocket> sendText(CharSequence data, boolean last) {
return se... |
if(remoteSocketSet == null){
throw new UnirestAssertion("Socket is not initialized. Make sure to call init(SocketSet) with the remote set.");
}
consumer.accept(remoteSocketSet.getSocket(), remoteSocketSet.getListener());
return CompletableFuture.completedFuture(this);
| 461 | 78 | 539 | |
eirslett_frontend-maven-plugin | frontend-maven-plugin/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/ProcessExecutor.java | ProcessExecutor | executeAndRedirectOutput | class ProcessExecutor {
private final static String PATH_ENV_VAR = "PATH";
private final Map<String, String> environment;
private CommandLine commandLine;
private final Executor executor;
public ProcessExecutor(File workingDirectory, List<String> paths, List<String> command, Platform platform, Map... |
OutputStream stdout = new LoggerOutputStream(logger, 0);
return execute(logger, stdout, stdout);
| 1,229 | 33 | 1,262 | |
houbb_sensitive-word | sensitive-word/src/main/java/com/github/houbb/sensitive/word/utils/InnerWordCharUtils.java | InnerWordCharUtils | getMappingChar | class InnerWordCharUtils {
private InnerWordCharUtils() {
}
/**
* 英文字母1
* @since 0.0.4
*/
private static final String LETTERS_ONE =
"ⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏ" +
"ⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩ" +
"⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵";
/**
... |
final Character mapChar = LETTER_MAP.get(character);
if(ObjectUtil.isNotNull(mapChar)) {
return mapChar;
}
return character;
| 838 | 47 | 885 | |
logfellow_logstash-logback-encoder | logstash-logback-encoder/src/main/java/net/logstash/logback/appender/listener/FailureSummaryAppenderListener.java | FailingState | recordSuccess | class FailingState implements State, FailureSummary {
private final Throwable firstThrowable;
private final long firstFailureTime;
private final AtomicLong consecutiveFailures = new AtomicLong();
private volatile Throwable mostRecentThrowable;
private FailingState(Throwable fir... |
State currentState = stateRef.get();
if (!currentState.isSucceeding() && stateRef.compareAndSet(currentState, SUCCEEDING_STATE)) {
FailingState oldFailingState = (FailingState) currentState;
handleFailureSummary(oldFailingState, callbackType);
}
| 617 | 82 | 699 | |
zhkl0228_unidbg | unidbg/unidbg-android/src/main/java/com/github/unidbg/linux/file/Stdout.java | Stdout | dup2 | class Stdout extends SimpleFileIO {
private static final Log log = LogFactory.getLog(Stdout.class);
private final boolean err;
private final PrintStream out;
private final StdoutCallback callback;
public Stdout(int oflags, File file, String path, boolean err, StdoutCallback callback) {
su... |
Stdout dup = new Stdout(0, file, path, err, callback);
dup.debugStream = debugStream;
dup.op = op;
dup.oflags = oflags;
return dup;
| 624 | 65 | 689 | public class SimpleFileIO extends BaseAndroidFileIO implements NewFileIO {
private static final Log log=LogFactory.getLog(SimpleFileIO.class);
protected final File file;
protected final String path;
private RandomAccessFile _randomAccessFile;
private synchronized RandomAccessFile checkOpenFile();
public Sim... |
pmd_pmd | pmd/pmd-core/src/main/java/net/sourceforge/pmd/util/database/SourceObject.java | SourceObject | getSuffixFromType | class SourceObject {
private static final Logger LOG = LoggerFactory.getLogger(SourceObject.class);
/**
* Database Schema/Owner - SYS,SYSTEM,SCOTT
*
*/
String schema;
/**
* Source Code Name - DBMS_METADATA
*
*/
String name;
/**
* Source Code Type -
*... |
LOG.trace("Entering getSuffixFromType");
if (null == type || type.isEmpty()) {
return "";
} else if (type.toUpperCase(Locale.ROOT).contains("JAVA")) {
return ".java";
} else if (type.toUpperCase(Locale.ROOT).contains("TRIGGER")) {
return ".trg";
... | 770 | 314 | 1,084 | |
PlayEdu_PlayEdu | PlayEdu/playedu-api/src/main/java/xyz/playedu/api/listener/AdminUserLoginListener.java | AdminUserLoginListener | updateLoginInfo | class AdminUserLoginListener {
@Autowired private AdminUserService adminUserService;
@EventListener
public void updateLoginInfo(AdminUserLoginEvent event) {<FILL_FUNCTION_BODY>}
} |
AdminUser adminUser = new AdminUser();
adminUser.setId(event.getAdminId());
adminUser.setLoginAt(event.getLoginAt());
adminUser.setLoginTimes(event.getLoginTimes() + 1);
adminUser.setLoginIp(event.getIp());
adminUserService.updateById(adminUser);
| 58 | 93 | 151 | |
ainilili_ratel | ratel/landlords-server/src/main/java/org/nico/ratel/landlords/server/event/ServerEventListener_CODE_GAME_WATCH_EXIT.java | ServerEventListener_CODE_GAME_WATCH_EXIT | call | class ServerEventListener_CODE_GAME_WATCH_EXIT implements ServerEventListener {
@Override
public void call(ClientSide clientSide, String data) {<FILL_FUNCTION_BODY>}
} |
Room room = ServerContains.getRoom(clientSide.getRoomId());
if (room != null) {
// 房间如果存在,则将观战者从房间观战列表中移除
clientSide.setRoomId(room.getId());
boolean successful = room.getWatcherList().remove(clientSide);
if (successful) {
SimplePrinter.s... | 53 | 129 | 182 | |
houbb_sensitive-word | sensitive-word/src/main/java/com/github/houbb/sensitive/word/support/result/WordResult.java | WordResult | toString | class WordResult implements IWordResult {
private int startIndex;
private int endIndex;
/**
* 词类别
* @since 0.14.0
*/
private String type;
private WordResult(){}
public static WordResult newInstance() {
return new WordResult();
}
@Override
public int start... |
return "WordResult{" +
"startIndex=" + startIndex +
", endIndex=" + endIndex +
", type='" + type + '\'' +
'}';
| 270 | 50 | 320 | |
Kong_unirest-java | unirest-java/unirest/src/main/java/kong/unirest/core/java/JavaResponse.java | JavaResponse | getEncoding | class JavaResponse extends RawResponseBase {
private final HttpResponse<InputStream> response;
public JavaResponse(HttpResponse<InputStream> response, Config config, HttpRequestSummary summary) {
super(config, summary);
this.response = response;
}
@Override
public int getStatus() {... |
if (hasContent()) {
String s = response.headers().firstValue(HeaderNames.CONTENT_ENCODING)
.orElse("");
return s;
}
return "";
| 903 | 54 | 957 | public abstract class RawResponseBase implements RawResponse {
private static final Pattern CHARSET_PATTERN=Pattern.compile("(?i)\\bcharset=\\s*\"?([^\\s;\"]*)");
private final HttpRequestSummary reqSummary;
protected Config config;
protected RawResponseBase( Config config, HttpRequestSummary summary);
prot... |
jitsi_jitsi | jitsi/modules/launcher/src/main/java/net/java/sip/communicator/argdelegation/ArgDelegationPeerImpl.java | ArgDelegationPeerImpl | handleUri | class ArgDelegationPeerImpl
implements ArgDelegationPeer, ServiceListener
{
/**
* The list of uriHandlers that we are currently aware of.
*/
private final Map<String, UriHandler> uriHandlers = new Hashtable<>();
private final List<URI> recordedArgs = new ArrayList<>();
private final UISe... |
logger.trace("Handling URI: {}", uriArg);
//first parse the uri and determine the scheme/protocol
if (uriArg == null || StringUtils.isEmpty(uriArg.getScheme()))
{
//no scheme, we don't know how to handle the URI
uiService.getPopupDialog()
.showMe... | 926 | 488 | 1,414 | |
Kong_unirest-java | unirest-java/unirest/src/main/java/kong/unirest/core/CompoundInterceptor.java | CompoundInterceptor | register | class CompoundInterceptor implements Interceptor {
private List<Interceptor> interceptors;
CompoundInterceptor() {
this(Collections.singletonList(new DefaultInterceptor()));
}
CompoundInterceptor(List<Interceptor> interceptors) {
this.interceptors = interceptors;
}
@Override
... |
if(interceptors.stream().anyMatch(i -> i instanceof DefaultInterceptor)){
interceptors = new ArrayList<>();
}
if(!interceptors.contains(t1)){
interceptors.add(t1);
}
| 367 | 66 | 433 | |
PlayEdu_PlayEdu | PlayEdu/playedu-common/src/main/java/xyz/playedu/common/domain/UserDepartment.java | UserDepartment | equals | class UserDepartment implements Serializable {
@JsonProperty("user_id")
private Integer userId;
@JsonProperty("dep_id")
private Integer depId;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
@Override
public boolean equals(Object that) {<FILL_FUNCTION_BODY>... |
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
UserDepartment other = (UserDepartment) that;
return (this.getUserId() == null
... | 315 | 154 | 469 | |
spring-cloud_spring-cloud-gateway | spring-cloud-gateway/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/config/ConfigurableHintsRegistrationProcessor.java | ConfigurableHintsRegistrationProcessor | getClassesToAdd | class ConfigurableHintsRegistrationProcessor implements BeanFactoryInitializationAotProcessor {
private static final Log LOG = LogFactory.getLog(ConfigurableHintsRegistrationProcessor.class);
private static final String ROOT_GATEWAY_PACKAGE_NAME = "org.springframework.cloud.gateway";
private static final Set<Stri... |
Set<Class<?>> classesToAdd = new HashSet<>();
ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false);
provider.addIncludeFilter(new AssignableTypeFilter(Configurable.class));
Set<BeanDefinition> components = provider.findCandidateComponents(ROOT_GATEWAY_PA... | 1,263 | 224 | 1,487 | |
qiujiayu_AutoLoadCache | AutoLoadCache/autoload-cache-script/autoload-cache-script-js/src/main/java/com/jarvis/cache/script/JavaScriptParser.java | JavaScriptParser | addFunction | class JavaScriptParser extends AbstractScriptParser {
private final ScriptEngineManager manager = new ScriptEngineManager();
private final ConcurrentHashMap<String, CompiledScript> expCache = new ConcurrentHashMap<String, CompiledScript>();
private final StringBuffer funcs = new StringBuffer();
priv... |
try {
String clsName = method.getDeclaringClass().getName();
String methodName = method.getName();
funcs.append("function " + name + "(obj){return " + clsName + "." + methodName + "(obj);}");
} catch (Exception e) {
e.printStackTrace();
}
| 487 | 88 | 575 | /**
* 表达式处理
*/
public abstract class AbstractScriptParser {
protected static final String TARGET="target";
protected static final String ARGS="args";
protected static final String RET_VAL="retVal";
protected static final String HASH="hash";
protected static final String EMPTY="empty";
/**
* 为了简化表达式,方便调... |
orientechnologies_orientdb | orientdb/core/src/main/java/com/orientechnologies/orient/core/security/authenticator/ODatabaseUserAuthenticator.java | ODatabaseUserAuthenticator | authenticate | class ODatabaseUserAuthenticator extends OSecurityAuthenticatorAbstract {
private OTokenSign tokenSign;
@Override
public void config(ODocument jsonConfig, OSecuritySystem security) {
super.config(jsonConfig, security);
tokenSign = security.getTokenSign();
}
@Override
public OSecurityUser authentic... |
if (session == null) {
return null;
}
String dbName = session.getName();
OSecurityShared databaseSecurity =
(OSecurityShared) ((ODatabaseDocumentInternal) session).getSharedContext().getSecurity();
OUser user = databaseSecurity.getUserInternal(session, username);
if (user == null... | 518 | 263 | 781 | /**
* Provides an abstract implementation of OSecurityAuthenticator.
* @author S. Colin Leister
*/
public abstract class OSecurityAuthenticatorAbstract implements OSecurityAuthenticator {
private String name="";
private boolean debug=false;
private boolean enabled=true;
private boolean caseSensitive=true;
... |
orientechnologies_orientdb | orientdb/client/src/main/java/com/orientechnologies/orient/client/remote/message/OCommit38Request.java | OCommit38Request | write | class OCommit38Request implements OBinaryRequest<OCommit37Response> {
private int txId;
private boolean hasContent;
private boolean usingLog;
private List<ORecordOperationRequest> operations;
private List<IndexChange> indexChanges;
public OCommit38Request() {}
public OCommit38Request(
int txId,
... |
// from 3.0 the the serializer is bound to the protocol
ORecordSerializerNetworkV37Client serializer = ORecordSerializerNetworkV37Client.INSTANCE;
network.writeInt(txId);
network.writeBoolean(hasContent);
network.writeBoolean(usingLog);
if (hasContent) {
for (ORecordOperationRequest txEnt... | 1,168 | 192 | 1,360 | |
google_truth | truth/core/src/main/java/com/google/common/truth/OptionalSubject.java | OptionalSubject | hasValue | class OptionalSubject extends Subject {
@SuppressWarnings("NullableOptional") // Truth always accepts nulls, no matter the type
private final @Nullable Optional<?> actual;
OptionalSubject(
FailureMetadata failureMetadata,
@SuppressWarnings("NullableOptional") // Truth always accepts nulls, no matter ... |
if (expected == null) {
throw new NullPointerException("Optional cannot have a null value.");
}
if (actual == null) {
failWithActual("expected an optional with value", expected);
} else if (!actual.isPresent()) {
failWithoutActual(fact("expected to have value", expected), simpleFact("... | 676 | 120 | 796 | /**
* An object that lets you perform checks on the value under test. For example, {@code Subject}contains {@link #isEqualTo(Object)} and {@link #isInstanceOf(Class)}, and {@link StringSubject}contains {@link StringSubject#startsWith startsWith(String)}. <p>To create a {@code Subject} instance, most users will c... |
elunez_eladmin | eladmin/eladmin-tools/src/main/java/me/zhengjie/rest/LocalStorageController.java | LocalStorageController | uploadPicture | class LocalStorageController {
private final LocalStorageService localStorageService;
@GetMapping
@ApiOperation("查询文件")
@PreAuthorize("@el.check('storage:list')")
public ResponseEntity<PageResult<LocalStorageDto>> queryFile(LocalStorageQueryCriteria criteria, Pageable pageable){
return new... |
// 判断文件是否为图片
String suffix = FileUtil.getExtensionName(file.getOriginalFilename());
if(!FileUtil.IMAGE.equals(FileUtil.getFileType(suffix))){
throw new BadRequestException("只能上传图片");
}
LocalStorage localStorage = localStorageService.create(null, file);
return... | 499 | 103 | 602 | |
joelittlejohn_jsonschema2pojo | jsonschema2pojo/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/util/MakeUniqueClassName.java | MakeUniqueClassName | makeUnique | class MakeUniqueClassName {
private static final Pattern UNIQUE_NAMING_PATTERN = Pattern.compile("(^.+__)(\\d+)$");
/**
* When the class name is not unique we will use two underscore '__' and a digit representing the number of time
* this class was found
*/
public static String makeUniq... |
final Matcher m = UNIQUE_NAMING_PATTERN.matcher(className);
if (m.matches()) {
// get the current number
final Integer number = Integer.parseInt(m.group(2));
// replace the current number in the string with the number +1
return m.group(1... | 114 | 112 | 226 | |
joelittlejohn_jsonschema2pojo | jsonschema2pojo/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/ArrayRule.java | ArrayRule | apply | class ArrayRule implements Rule<JPackage, JClass> {
private final RuleFactory ruleFactory;
protected ArrayRule(RuleFactory ruleFactory) {
this.ruleFactory = ruleFactory;
}
/**
* <p>Applies this schema rule to take the required code generation steps.</p>
*
* <p>When constructs o... |
boolean uniqueItems = node.has("uniqueItems") && node.get("uniqueItems").asBoolean();
boolean rootSchemaIsArray = !schema.isGenerated();
JType itemType;
if (node.has("items")) {
String pathToItems;
if (schema.getId() == null || schema.getId().getFragment() == n... | 496 | 370 | 866 | |
PlexPt_chatgpt-java | chatgpt-java/src/main/java/com/plexpt/chatgpt/util/TokensUtil.java | TokensUtil | tokens | class TokensUtil {
private static final Map<String, Encoding> modelEncodingMap = new HashMap<>();
private static final EncodingRegistry encodingRegistry = Encodings.newDefaultEncodingRegistry();
static {
for (ChatCompletion.Model model : ChatCompletion.Model.values()) {
Optional<Encodi... |
Encoding encoding = modelEncodingMap.get(modelName);
if (encoding == null) {
throw new IllegalArgumentException("Unsupported model: " + modelName);
}
int tokensPerMessage = 0;
int tokensPerName = 0;
if (modelName.startsWith("gpt-4")) {
tokensPerM... | 205 | 291 | 496 | |
subhra74_snowflake | snowflake/muon-jediterm/src/main/java/com/jediterm/terminal/emulator/charset/GraphicSet.java | GraphicSet | map | class GraphicSet
{
private final int myIndex; // 0..3
private CharacterSet myDesignation;
public GraphicSet( int index )
{
if ( index < 0 || index > 3 )
{
throw new IllegalArgumentException( "Invalid index!" );
}
myIndex = index;
// The default mapping, based on XTerm...
myDesigna... |
int result = myDesignation.map( index );
if ( result < 0 )
{
// No mapping, simply return the given original one...
result = original;
}
return result;
| 359 | 54 | 413 | |
PlayEdu_PlayEdu | PlayEdu/playedu-api/src/main/java/xyz/playedu/api/controller/backend/AppConfigController.java | AppConfigController | index | class AppConfigController {
@Autowired private AppConfigService configService;
@BackendPermission(slug = BPermissionConstant.SYSTEM_CONFIG)
@GetMapping("")
@Log(title = "系统配置-读取", businessType = BusinessTypeConstant.GET)
public JsonResponse index() {<FILL_FUNCTION_BODY>}
@BackendPermission(sl... |
List<AppConfig> configs = configService.allShow();
List<AppConfig> data = new ArrayList<>();
for (AppConfig item : configs) {
if (item.getIsPrivate() == 1 && StringUtil.isNotEmpty(item.getKeyValue())) {
item.setKeyValue(SystemConstant.CONFIG_MASK);
}
... | 360 | 111 | 471 | |
Pay-Group_best-pay-sdk | best-pay-sdk/src/main/java/com/lly835/bestpay/service/impl/alipay/AlipayAppServiceImpl.java | AlipayAppServiceImpl | pay | class AlipayAppServiceImpl extends AliPayServiceImpl {
private final Retrofit retrofit = new Retrofit.Builder()
.baseUrl(AliPayConstants.ALIPAY_GATEWAY_OPEN)
.addConverterFactory(GsonConverterFactory.create(
//下划线驼峰互转
new GsonBuilder().setFieldNamingP... |
AliPayTradeCreateRequest aliPayOrderQueryRequest = new AliPayTradeCreateRequest();
aliPayOrderQueryRequest.setMethod(AliPayConstants.ALIPAY_TRADE_APP_PAY);
aliPayOrderQueryRequest.setAppId(aliPayConfig.getAppId());
aliPayOrderQueryRequest.setTimestamp(LocalDateTime.now().format(formatte... | 414 | 375 | 789 | /**
* Created by this on 2019/9/8 15:50
*/
@Slf4j public class AliPayServiceImpl extends BestPayServiceImpl {
protected final static DateTimeFormatter formatter=DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
protected AliPayConfig aliPayConfig;
@Override public void setAliPayConfig( AliPayConfig aliPayCo... |
joelittlejohn_jsonschema2pojo | jsonschema2pojo/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Jsonb1Annotator.java | Jsonb1Annotator | dateTimeField | class Jsonb1Annotator extends AbstractAnnotator {
public Jsonb1Annotator(GenerationConfig generationConfig) {
super(generationConfig);
}
@Override
public void propertyOrder(JDefinedClass clazz, JsonNode propertiesNode) {
JAnnotationArrayMember annotationValue = clazz.annotate(JsonbProp... |
String pattern = null;
if (node.has("customDateTimePattern")) {
pattern = node.get("customDateTimePattern").asText();
} else if (node.has("customPattern")) {
pattern = node.get("customPattern").asText();
} else if (isNotEmpty(getGenerationConfig().getCustomDateTi... | 897 | 215 | 1,112 | /**
* A default implementation of the Annotator interface that makes it easier to plug in different Annotator implementations. <p> Annotators that need the generation configuration should add a constructor with {@link GenerationConfig} arg. Annotators that don't need theconfiguration need only add a default construc... |
graphhopper_graphhopper | graphhopper/core/src/main/java/com/graphhopper/storage/GHNodeAccess.java | GHNodeAccess | setTurnCostIndex | class GHNodeAccess implements NodeAccess {
private final BaseGraphNodesAndEdges store;
public GHNodeAccess(BaseGraphNodesAndEdges store) {
this.store = store;
}
@Override
public void ensureNode(int nodeId) {
store.ensureNodeCapacity(nodeId);
}
@Override
public final vo... |
if (store.withTurnCosts()) {
// todo: remove ensure?
store.ensureNodeCapacity(index);
store.setTurnCostRef(store.toNodePointer(index), turnCostIndex);
} else {
throw new AssertionError("This graph does not support turn costs");
}
| 552 | 79 | 631 | |
google_truth | truth/core/src/main/java/com/google/common/truth/Expect.java | ExpectationGatherer | doCheckInRuleContext | class ExpectationGatherer implements FailureStrategy {
@GuardedBy("this")
private final List<AssertionError> failures = new ArrayList<>();
@GuardedBy("this")
private TestPhase inRuleContext = BEFORE;
ExpectationGatherer() {}
@Override
public synchronized void fail(AssertionError failure) ... |
switch (inRuleContext) {
case BEFORE:
throw new IllegalStateException(
"assertion made on Expect instance, but it's not enabled as a @Rule.", failure);
case DURING:
return;
case AFTER:
throw new IllegalStateException(
"assertion ma... | 1,135 | 221 | 1,356 | |
obsidiandynamics_kafdrop | kafdrop/src/main/java/kafdrop/model/TopicPartitionVO.java | PartitionReplica | toString | class PartitionReplica {
private final Integer id;
private final boolean inSync;
private final boolean leader;
private final boolean offline;
public PartitionReplica(Integer id, boolean inSync, boolean leader, boolean offline) {
this.id = id;
this.inSync = inSync;
this.leader = le... |
return TopicPartitionVO.class.getSimpleName() + " [id=" + id + ", firstOffset=" + firstOffset + ", size=" + size
+ "]";
| 194 | 47 | 241 | |
elunez_eladmin | eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictDetailController.java | DictDetailController | getDictDetailMaps | class DictDetailController {
private final DictDetailService dictDetailService;
private static final String ENTITY_NAME = "dictDetail";
@ApiOperation("查询字典详情")
@GetMapping
public ResponseEntity<PageResult<DictDetailDto>> queryDictDetail(DictDetailQueryCriteria criteria,
... |
String[] names = dictName.split("[,,]");
Map<String, List<DictDetailDto>> dictMap = new HashMap<>(16);
for (String name : names) {
dictMap.put(name, dictDetailService.getDictByName(name));
}
return new ResponseEntity<>(dictMap, HttpStatus.OK);
| 547 | 94 | 641 | |
orientechnologies_orientdb | orientdb/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OTraverseProjectionItem.java | OTraverseProjectionItem | equals | class OTraverseProjectionItem extends SimpleNode {
protected OBaseIdentifier base;
protected OModifier modifier;
public OTraverseProjectionItem(int id) {
super(id);
}
public OTraverseProjectionItem(OrientSql p, int id) {
super(p, id);
}
public Object execute(OResult iCurrentRecord, OCommandCon... |
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
OTraverseProjectionItem that = (OTraverseProjectionItem) o;
if (base != null ? !base.equals(that.base) : that.base != null) return false;
if (modifier != null ? !modifier.equals(that.modifier) : that.modifier !... | 901 | 125 | 1,026 | public abstract class SimpleNode implements Node {
public static final String PARAMETER_PLACEHOLDER="?";
protected Node parent;
protected Node[] children;
protected int id;
protected Object value;
protected OrientSql parser;
protected Token firstToken;
protected Token lastToken;
public SimpleNode();
... |
google_truth | truth/core/src/main/java/com/google/common/truth/GuavaOptionalSubject.java | GuavaOptionalSubject | hasValue | class GuavaOptionalSubject extends Subject {
@SuppressWarnings("NullableOptional") // Truth always accepts nulls, no matter the type
private final @Nullable Optional<?> actual;
GuavaOptionalSubject(
FailureMetadata metadata,
@SuppressWarnings("NullableOptional") // Truth always accepts nulls, no matt... |
if (expected == null) {
throw new NullPointerException("Optional cannot have a null value.");
}
if (actual == null) {
failWithActual("expected an optional with value", expected);
} else if (!actual.isPresent()) {
failWithoutActual(fact("expected to have value", expected), simpleFact("... | 452 | 120 | 572 | /**
* An object that lets you perform checks on the value under test. For example, {@code Subject}contains {@link #isEqualTo(Object)} and {@link #isInstanceOf(Class)}, and {@link StringSubject}contains {@link StringSubject#startsWith startsWith(String)}. <p>To create a {@code Subject} instance, most users will c... |
mapstruct_mapstruct | mapstruct/processor/src/main/java/org/mapstruct/ap/internal/model/common/Parameter.java | Parameter | hashCode | class Parameter extends ModelElement {
private final Element element;
private final String name;
private final String originalName;
private final Type type;
private final boolean mappingTarget;
private final boolean targetType;
private final boolean mappingContext;
private final boolean... |
int result = name != null ? name.hashCode() : 0;
result = 31 * result + ( type != null ? type.hashCode() : 0 );
return result;
| 1,636 | 51 | 1,687 | /**
* Base class of all model elements. Implements the {@link Writable} contract to write model elements into source codefiles.
* @author Gunnar Morling
*/
public abstract class ModelElement extends FreeMarkerWritable {
/**
* Returns a set containing those {@link Type}s referenced by this model element for wh... |
docker-java_docker-java | docker-java/docker-java-core/src/main/java/com/github/dockerjava/core/exec/UnpauseContainerCmdExec.java | UnpauseContainerCmdExec | execute | class UnpauseContainerCmdExec extends AbstrSyncDockerCmdExec<UnpauseContainerCmd, Void> implements
UnpauseContainerCmd.Exec {
private static final Logger LOGGER = LoggerFactory.getLogger(UnpauseContainerCmdExec.class);
public UnpauseContainerCmdExec(WebTarget baseResource, DockerClientConfig dockerCli... |
WebTarget webResource = getBaseResource().path("/containers/{id}/unpause").resolveTemplate("id",
command.getContainerId());
LOGGER.trace("POST: {}", webResource);
try {
webResource.request().accept(MediaType.APPLICATION_JSON).post(null).close();
} catch (IOE... | 138 | 108 | 246 | |
google_truth | truth/core/src/main/java/com/google/common/truth/Correspondence.java | ExceptionStore | truncateStackTrace | class ExceptionStore {
private final String argumentLabel;
private @Nullable StoredException firstCompareException = null;
private @Nullable StoredException firstPairingException = null;
private @Nullable StoredException firstFormatDiffException = null;
static ExceptionStore forIterable() {
... |
StackTraceElement[] original = exception.getStackTrace();
int keep = 0;
while (keep < original.length
&& !original[keep].getClassName().equals(callingClass.getName())) {
keep++;
}
exception.setStackTrace(Arrays.copyOf(original, keep));
| 1,703 | 80 | 1,783 | |
spring-cloud_spring-cloud-gateway | spring-cloud-gateway/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/support/HttpStatusHolder.java | HttpStatusHolder | parse | class HttpStatusHolder {
private final HttpStatus httpStatus;
private final Integer status;
public HttpStatusHolder(HttpStatus httpStatus, Integer status) {
Assert.isTrue(httpStatus != null || status != null, "httpStatus and status may not both be null");
this.httpStatus = httpStatus;
this.status = status;
... |
final HttpStatus httpStatus = ServerWebExchangeUtils.parse(status);
final Integer intStatus;
if (httpStatus == null) {
intStatus = Integer.parseInt(status);
}
else {
intStatus = null;
}
return new HttpStatusHolder(httpStatus, intStatus);
| 837 | 84 | 921 | |
qiujiayu_AutoLoadCache | AutoLoadCache/autoload-cache-serializer/autoload-cache-serializer-fastjson/src/main/java/com/jarvis/cache/serializer/FastjsonSerializer.java | FastjsonSerializer | deepCloneMethodArgs | class FastjsonSerializer implements ISerializer<Object> {
private final Charset charset;
private static final SerializerFeature[] FEATURES = {SerializerFeature.DisableCircularReferenceDetect};
private static final Map<Type, ParameterizedTypeImpl> TYPE_CACHE = new ConcurrentHashMap<>(1024);
public Fa... |
if (null == args || args.length == 0) {
return args;
}
Type[] genericParameterTypes = method.getGenericParameterTypes();
if (args.length != genericParameterTypes.length) {
throw new Exception("the length of " + method.getDeclaringClass().getName() + "." + method.... | 1,174 | 300 | 1,474 | |
jeecgboot_jeecg-boot | jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/service/impl/BaseCommonServiceImpl.java | BaseCommonServiceImpl | addLog | class BaseCommonServiceImpl implements BaseCommonService {
@Resource
private BaseCommonMapper baseCommonMapper;
@Override
public void addLog(LogDTO logDTO) {
if(oConvertUtils.isEmpty(logDTO.getId())){
logDTO.setId(String.valueOf(IdWorker.getId()));
}
//保存日志(异常捕获处理,防... |
LogDTO sysLog = new LogDTO();
sysLog.setId(String.valueOf(IdWorker.getId()));
//注解上的描述,操作日志内容
sysLog.setLogContent(logContent);
sysLog.setLogType(logType);
sysLog.setOperateType(operatetype);
try {
//获取request
HttpServletRequest request = ... | 288 | 377 | 665 | |
PlayEdu_PlayEdu | PlayEdu/playedu-resource/src/main/java/xyz/playedu/resource/service/impl/ResourceVideoServiceImpl.java | ResourceVideoServiceImpl | create | class ResourceVideoServiceImpl extends ServiceImpl<ResourceVideoMapper, ResourceVideo>
implements ResourceVideoService {
@Override
public void create(Integer resourceId, Integer duration, String poster) {<FILL_FUNCTION_BODY>}
@Override
public void removeByRid(Integer resourceId) {
remov... |
ResourceVideo video = new ResourceVideo();
video.setRid(resourceId);
video.setDuration(duration);
video.setPoster(poster);
video.setCreatedAt(new Date());
save(video);
| 172 | 61 | 233 | |
eirslett_frontend-maven-plugin | frontend-maven-plugin/frontend-maven-plugin/src/main/java/com/github/eirslett/maven/plugins/frontend/mojo/MojoUtils.java | MojoUtils | shouldExecute | class MojoUtils {
private static final Logger LOGGER = LoggerFactory.getLogger(MojoUtils.class);
static <E extends Throwable> MojoFailureException toMojoFailureException(E e) {
String causeMessage = e.getCause() != null ? ": " + e.getCause().getMessage() : "";
return new MojoFailureException(e... |
// If there is no buildContext, or this is not an incremental build, always execute.
if (buildContext == null || !buildContext.isIncremental()) {
return true;
}
if (triggerfiles != null) {
for (File triggerfile : triggerfiles) {
if (buildContext.hasDelta(triggerfile)) {
... | 743 | 197 | 940 | |
zhkl0228_unidbg | unidbg/unidbg-ios/src/main/java/com/github/unidbg/ios/file/ByteArrayFileIO.java | ByteArrayFileIO | read | class ByteArrayFileIO extends BaseDarwinFileIO {
protected final byte[] bytes;
protected final String path;
public ByteArrayFileIO(int oflags, String path, byte[] bytes) {
super(oflags);
this.path = path;
this.bytes = bytes;
}
private int pos;
@Override
public voi... |
if (pos >= bytes.length) {
return 0;
}
int remain = bytes.length - pos;
if (count > remain) {
count = remain;
}
buffer.write(0, bytes, pos, count);
pos += count;
return count;
| 630 | 78 | 708 | public abstract class BaseDarwinFileIO extends BaseFileIO implements DarwinFileIO {
private static final Log log=LogFactory.getLog(BaseDarwinFileIO.class);
public static File createAttrFile( File dest);
public BaseDarwinFileIO( int oflags);
public int fstat( Emulator<?> emulator, StatStructure stat);
priv... |
Kong_unirest-java | unirest-java/unirest/src/main/java/kong/unirest/core/ByteResponse.java | ByteResponse | getBytes | class ByteResponse extends BaseResponse<byte[]> {
private final byte[] body;
public ByteResponse(RawResponse r, ProgressMonitor downloadMonitor) {
super(r);
if(downloadMonitor == null) {
this.body = r.getContentAsBytes();
} else {
MonitoringInputStream ip = new M... |
try {
int len;
int size = 1024;
byte[] buf;
if (is instanceof ByteArrayInputStream) {
size = is.available();
buf = new byte[size];
len = is.read(buf, 0, size);
} else {
ByteArrayOutputSt... | 250 | 169 | 419 | |
Pay-Group_best-pay-sdk | best-pay-sdk/src/main/java/com/lly835/bestpay/config/PayConfig.java | PayConfig | check | class PayConfig {
/**
* 支付完成后的异步通知地址.
*/
private String notifyUrl;
/**
* 支付完成后的同步返回地址.
*/
private String returnUrl;
/**
* 默认非沙箱测试
*/
private boolean sandbox = false;
public boolean isSandbox() {
return sandbox;
}
public void setSandbox(boole... |
Objects.requireNonNull(notifyUrl, "config param 'notifyUrl' is null.");
if (!notifyUrl.startsWith("http") && !notifyUrl.startsWith("https")) {
throw new IllegalArgumentException("config param 'notifyUrl' does not start with http/https.");
}
if (notifyUrl.length() > 256) {
... | 251 | 219 | 470 | |
subhra74_snowflake | snowflake/muon-app/src/main/java/muon/app/ui/components/session/files/view/FolderViewKeyHandler.java | FolderViewKeyHandler | keyPressed | class FolderViewKeyHandler extends KeyAdapter {
private JTable table;
private FolderViewTableModel model;
private String prefix = "";
private String typedString = "";
private long lastTime = 0L;
private long timeFactor = 1000L;
public FolderViewKeyHandler(JTable table, FolderV... |
System.out.println("Table key press");
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
return;
}
if (isNavigationKey(e)) {
prefix = "";
typedString = "";
lastTime = 0L;
}
| 1,129 | 86 | 1,215 | |
mapstruct_mapstruct | mapstruct/processor/src/main/java/org/mapstruct/ap/internal/model/source/SubclassMappingOptions.java | SubclassMappingOptions | validateTypeMirrors | class SubclassMappingOptions extends DelegatingOptions {
private final TypeMirror source;
private final TypeMirror target;
private final TypeUtils typeUtils;
private final SelectionParameters selectionParameters;
private final SubclassMappingGem subclassMapping;
public SubclassMappingOptions(T... |
for ( TypeMirror typeMirror : typeMirrors ) {
if ( typeMirror == null ) {
// When a class used in uses or imports is created by another annotation processor
// then javac will not return correct TypeMirror with TypeKind#ERROR, but rather a string "<error>"
... | 1,754 | 148 | 1,902 | /**
* Chain Of Responsibility Pattern.
*/
public abstract class DelegatingOptions {
private final DelegatingOptions next;
public DelegatingOptions( DelegatingOptions next);
public String implementationName();
public String implementationPackage();
public Set<DeclaredType> uses();
public Set<DeclaredType... |
PlexPt_chatgpt-java | chatgpt-java/src/main/java/com/plexpt/chatgpt/Embedding.java | Embedding | init | class Embedding {
/**
* keys
*/
private String apiKey;
private List<String> apiKeyList;
/**
* 自定义api host使用builder的方式构造client
*/
@Builder.Default
private String apiHost = Api.DEFAULT_API_HOST;
private Api apiClient;
private OkHttpClient okHttpClient;
/**
* ... |
OkHttpClient.Builder client = new OkHttpClient.Builder();
client.addInterceptor(chain -> {
Request original = chain.request();
String key = apiKey;
if (apiKeyList != null && !apiKeyList.isEmpty()) {
key = RandomUtil.randomEle(apiKeyList);
... | 413 | 496 | 909 | |
PlayEdu_PlayEdu | PlayEdu/playedu-api/src/main/java/xyz/playedu/api/schedule/LDAPSchedule.java | LDAPSchedule | sync | class LDAPSchedule {
@Autowired private LDAPBus ldapBus;
private int times;
@Scheduled(fixedRate = 3600000)
public void sync() {<FILL_FUNCTION_BODY>}
} |
// 系统刚启动不执行
if (times == 0) {
times++;
return;
}
if (!ldapBus.enabledLDAP()) {
log.info("未配置LDAP服务");
return;
}
try {
ldapBus.departmentSync();
} catch (Exception e) {
log.error("LDAP-部门同步失... | 71 | 168 | 239 | |
houbb_sensitive-word | sensitive-word/src/main/java/com/github/houbb/sensitive/word/support/tag/FileWordTag.java | FileWordTag | initWordTagMap | class FileWordTag extends AbstractWordTag {
/**
* 文件路径
*/
protected final String filePath;
/**
* 词和标签的分隔符
*/
protected final String wordSplit;
/**
* 标签的分隔符
*/
protected final String tagSplit;
protected Map<String, Set<String>> wordTagMap = new HashMap<>();
... |
List<String> lines = FileUtil.readAllLines(filePath);
if(CollectionUtil.isEmpty(lines)) {
return;
}
for(String line : lines) {
if(StringUtil.isEmpty(line)) {
continue;
}
// 处理每一行
handleInitLine(line);
... | 437 | 90 | 527 | /**
* 抽象的单词标签
* @since 0.10.0
*/
public abstract class AbstractWordTag implements IWordTag {
/**
* 获取标签
* @param word 单词
* @return 结果
*/
protected abstract Set<String> doGetTag( String word);
@Override public Set<String> getTag( String word);
}
|
jeecgboot_jeecg-boot | jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/SysDataLog.java | SysDataLog | autoSetCreateName | class SysDataLog implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
/**
* id
*/
private String id;
/**
* 创建人登录名称
*/
private String createBy;
/**
* 创建人真实名称
*/
private String createName;
/**
* 创建日期
... |
try {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
this.setCreateName(sysUser.getRealname());
} catch (Exception e) {
log.warn("SecurityUtils.getSubject() 获取用户信息异常:" + e.getMessage());
}
| 483 | 80 | 563 | |
DerekYRC_mini-spring | mini-spring/src/main/java/org/springframework/beans/factory/support/DisposableBeanAdapter.java | DisposableBeanAdapter | destroy | class DisposableBeanAdapter implements DisposableBean {
private final Object bean;
private final String beanName;
private final String destroyMethodName;
public DisposableBeanAdapter(Object bean, String beanName, BeanDefinition beanDefinition) {
this.bean = bean;
this.beanName = beanName;
this.destroyMeth... |
if (bean instanceof DisposableBean) {
((DisposableBean) bean).destroy();
}
//避免同时继承自DisposableBean,且自定义方法与DisposableBean方法同名,销毁方法执行两次的情况
if (StrUtil.isNotEmpty(destroyMethodName) && !(bean instanceof DisposableBean && "destroy".equals(this.destroyMethodName))) {
//执行自定义方法
Method destroyMethod = Class... | 123 | 195 | 318 | |
mapstruct_mapstruct | mapstruct/processor/src/main/java/org/mapstruct/ap/spi/FreeBuilderAccessorNamingStrategy.java | FreeBuilderAccessorNamingStrategy | isFluentSetter | class FreeBuilderAccessorNamingStrategy extends DefaultAccessorNamingStrategy {
@Override
protected boolean isFluentSetter(ExecutableElement method) {<FILL_FUNCTION_BODY>}
} |
// When using FreeBuilder one needs to use the JavaBean convention, which means that all setters will start
// with set
return false;
| 54 | 37 | 91 | /**
* The default JavaBeans-compliant implementation of the {@link AccessorNamingStrategy} service provider interface.
* @author Christian Schuster, Sjaak Derken
*/
public class DefaultAccessorNamingStrategy implements AccessorNamingStrategy {
private static final Pattern JAVA_JAVAX_PACKAGE=Pattern.compile("^jav... |
ainilili_ratel | ratel/landlords-client/src/main/java/org/nico/ratel/landlords/client/event/ClientEventListener_CODE_CLIENT_KICK.java | ClientEventListener_CODE_CLIENT_KICK | call | class ClientEventListener_CODE_CLIENT_KICK extends ClientEventListener {
@Override
public void call(Channel channel, String data) {<FILL_FUNCTION_BODY>}
} |
SimplePrinter.printNotice("You have been kicked from the room for being idle.\n");
get(ClientEventCode.CODE_SHOW_OPTIONS).call(channel, data);
| 47 | 52 | 99 | public abstract class ClientEventListener {
public abstract void call( Channel channel, String data);
public final static Map<ClientEventCode,ClientEventListener> LISTENER_MAP=new HashMap<>();
private final static String LISTENER_PREFIX="org.nico.ratel.landlords.client.event.ClientEventListener_";
protected s... |
jitsi_jitsi | jitsi/modules/impl/protocol-jabber/src/main/java/net/java/sip/communicator/impl/protocol/jabber/JingleNodesCandidate.java | JingleNodesCandidate | getRelayedCandidateDatagramSocket | class JingleNodesCandidate
extends LocalCandidate
{
/**
* The socket used to communicate with relay.
*/
private IceSocketWrapper socket = null;
/**
* The <tt>RelayedCandidateDatagramSocket</tt> of this
* <tt>JingleNodesCandidate</tt>.
*/
private JingleNodesCandidateDatagram... |
if (jingleNodesCandidateDatagramSocket == null)
{
try
{
jingleNodesCandidateDatagramSocket
= new JingleNodesCandidateDatagramSocket(
this, localEndPoint);
}
catch (SocketException sex)
... | 792 | 108 | 900 | |
obsidiandynamics_kafdrop | kafdrop/src/main/java/kafdrop/model/AclVO.java | AclVO | equals | class AclVO implements Comparable<AclVO> {
private final String name;
private final String resourceType;
private final String patternType;
private final String principal;
private final String host;
private final String operation;
private final String permissionType;
public AclVO(String resourceType, S... |
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AclVO aclVO = (AclVO) o;
return name.equals(aclVO.name);
| 385 | 64 | 449 | |
Kong_unirest-java | unirest-java/unirest/src/main/java/kong/unirest/core/java/Prefetcher.java | Prefetcher | update | class Prefetcher {
public static final int PREFETCH = 16;
public static final int PREFETCH_THRESHOLD = (int) (PREFETCH * (50 / 100f));
private final int prefetch;
private final int prefetchThreshold;
private volatile int upstreamWindow;
public Prefetcher() {
prefetch = PREFETCH;
... |
// Decrement current window and bring it back to
// prefetch if became <= prefetchThreshold
int update = upstreamWindow - 1;
if (update <= prefetchThreshold) {
upstreamWindow = prefetch;
upstream.request(prefetch - update);
} else {
upstreamWi... | 207 | 89 | 296 | |
eirslett_frontend-maven-plugin | frontend-maven-plugin/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/YarnInstaller.java | YarnInstaller | installYarn | class YarnInstaller {
public static final String INSTALL_PATH = "/node/yarn";
public static final String DEFAULT_YARN_DOWNLOAD_ROOT =
"https://github.com/yarnpkg/yarn/releases/download/";
private static final Object LOCK = new Object();
private static final String YARN_ROOT_DIRECTORY = "dist... |
try {
logger.info("Installing Yarn version {}", yarnVersion);
String downloadUrl = yarnDownloadRoot + yarnVersion;
String extension = "tar.gz";
String fileending = "/yarn-" + yarnVersion + "." + extension;
downloadUrl += fileending;
Cach... | 1,365 | 493 | 1,858 | |
jitsi_jitsi | jitsi/modules/impl/gui/src/main/java/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommLookAndFeel.java | SIPCommLookAndFeel | loadSkin | class SIPCommLookAndFeel
extends MetalLookAndFeel
implements Skinnable
{
private static final long serialVersionUID = 0L;
/**
* Returns <tt>false</tt> to indicate that this is not a native look&feel.
*
* @return <tt>false</tt> to indicate that this is not a native look&feel
*/
@... |
initClassDefaults(UIManager.getDefaults());
if(getCurrentTheme() != null
&& getCurrentTheme() instanceof SIPCommDefaultTheme)
{
((SIPCommDefaultTheme)getCurrentTheme()).loadSkin();
setCurrentTheme(getCurrentTheme());
}
| 1,199 | 77 | 1,276 | |
pmd_pmd | pmd/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/ast/ASTExtractExpression.java | ASTExtractExpression | getNamespace | class ASTExtractExpression extends AbstractPLSQLNode {
private boolean xml;
ASTExtractExpression(int id) {
super(id);
}
@Override
protected <P, R> R acceptPlsqlVisitor(PlsqlVisitor<? super P, ? extends R> visitor, P data) {
return visitor.visit(this, data);
}
void setXml(... |
if (xml) {
List<ASTStringLiteral> literals = children(ASTStringLiteral.class).toList();
if (literals.size() == 2) {
return literals.get(1).getString();
}
}
return "";
| 194 | 67 | 261 | |
google_truth | truth/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/AnyUtils.java | AnyUtils | unpack | class AnyUtils {
private static final FieldDescriptor TYPE_URL_FIELD_DESCRIPTOR =
Any.getDescriptor().findFieldByNumber(Any.TYPE_URL_FIELD_NUMBER);
static FieldDescriptor typeUrlFieldDescriptor() {
return TYPE_URL_FIELD_DESCRIPTOR;
}
private static final SubScopeId TYPE_URL_SUB_SCOPE_ID = SubScopeId... |
Preconditions.checkArgument(
any.getDescriptorForType().equals(Any.getDescriptor()),
"Expected type google.protobuf.Any, but was: %s",
any.getDescriptorForType().getFullName());
String typeUrl = (String) any.getField(typeUrlFieldDescriptor());
ByteString value = (ByteString) any.ge... | 445 | 195 | 640 | |
mapstruct_mapstruct | mapstruct/processor/src/main/java/org/mapstruct/ap/internal/model/AnnotationMapperReference.java | AnnotationMapperReference | getImportTypes | class AnnotationMapperReference extends MapperReference {
private final List<Annotation> annotations;
private final boolean fieldFinal;
private final boolean includeAnnotationsOnField;
public AnnotationMapperReference(Type type, String variableName, List<Annotation> annotations, boolean isUsed,
... |
Set<Type> types = new HashSet<>();
types.add( getType() );
for ( Annotation annotation : annotations ) {
types.addAll( annotation.getImportTypes() );
}
return types;
| 305 | 62 | 367 | /**
* A reference to another mapper class, which itself may be generated or hand-written.
* @author Gunnar Morling
*/
public abstract class MapperReference extends Field {
public MapperReference( Type type, String variableName);
public MapperReference( Type type, String variableName, boolean isUsed);
pub... |
zhkl0228_unidbg | unidbg/unidbg-android/src/main/java/com/github/unidbg/linux/file/PipedSocketIO.java | PipedSocketIO | sendto | class PipedSocketIO extends TcpSocket implements FileIO {
private final PipedInputStream pipedInputStream = new PipedInputStream();
public PipedSocketIO(Emulator<?> emulator) {
super(emulator);
this.inputStream = new BufferedInputStream(pipedInputStream);
this.outputStream = new PipedO... |
flags &= ~MSG_NOSIGNAL;
final int MSG_EOR = 0x80;
if (flags == MSG_EOR && dest_addr == null && addrlen == 0) {
return write(data);
}
return super.sendto(data, flags, dest_addr, addrlen);
| 225 | 86 | 311 | public class TcpSocket extends SocketIO implements FileIO {
private static final Log log=LogFactory.getLog(TcpSocket.class);
private final Socket socket;
private ServerSocket serverSocket;
private final Emulator<?> emulator;
public TcpSocket( Emulator<?> emulator);
private TcpSocket( Emulator<?> emulator,... |
javamelody_javamelody | javamelody/javamelody-core/src/main/java/net/bull/javamelody/internal/model/JCacheInformations.java | JCacheInformations | buildJCacheInformationsList | class JCacheInformations implements Serializable {
private static final long serialVersionUID = -3025833425994923286L;
private static final MBeanServer MBEAN_SERVER = MBeans.getPlatformMBeanServer();
private static final boolean JCACHE_AVAILABLE = isJCacheAvailable();
private final String name;
private final long... |
if (!JCACHE_AVAILABLE) {
return Collections.emptyList();
}
final List<JCacheInformations> result = new ArrayList<>();
final Set<ObjectName> cacheStatistics = getJsr107CacheStatistics();
for (final ObjectName cache : cacheStatistics) {
final JCacheInformations jcacheInformations = new JCacheInformation... | 1,164 | 405 | 1,569 | |
PlayEdu_PlayEdu | PlayEdu/playedu-course/src/main/java/xyz/playedu/course/domain/UserCourseRecord.java | UserCourseRecord | hashCode | class UserCourseRecord implements Serializable {
/** */
@TableId(type = IdType.AUTO)
private Integer id;
/** */
@JsonProperty("user_id")
private Integer userId;
/** */
@JsonProperty("course_id")
private Integer courseId;
/** 课时数量 */
@JsonProperty("hour_count")
private ... |
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getCourseId() == null) ? 0 : getCourseId().hashCode());
... | 1,050 | 301 | 1,351 | |
eirslett_frontend-maven-plugin | frontend-maven-plugin/frontend-maven-plugin/src/main/java/com/github/eirslett/maven/plugins/frontend/mojo/NpxMojo.java | NpxMojo | getProxyConfig | class NpxMojo extends AbstractFrontendMojo {
private static final String NPM_REGISTRY_URL = "npmRegistryURL";
/**
* npm arguments. Default is "install".
*/
@Parameter(defaultValue = "install", property = "frontend.npx.arguments", required = false)
private String arguments;
@Paramete... |
if (npmInheritsProxyConfigFromMaven) {
return MojoUtils.getProxyConfig(session, decrypter);
} else {
getLog().info("npm not inheriting proxy config from Maven");
return new ProxyConfig(Collections.<ProxyConfig.Proxy>emptyList());
}
| 568 | 81 | 649 | public abstract class AbstractFrontendMojo extends AbstractMojo {
@Component protected MojoExecution execution;
/**
* Whether you should skip while running in the test phase (default is false)
*/
@Parameter(property="skipTests",required=false,defaultValue="false") protected Boolean skipTests;
/**
* Set thi... |
graphhopper_graphhopper | graphhopper/core/src/main/java/com/graphhopper/routing/util/NameSimilarityEdgeFilter.java | NameSimilarityEdgeFilter | isLevenshteinSimilar | class NameSimilarityEdgeFilter implements EdgeFilter {
private static final Map<String, String> DEFAULT_REWRITE_MAP = new HashMap<String, String>() {{
// Words with 2 characters like "Dr" (Drive) will be ignored, so it is not required to list them here.
// Words with 3 and more characters should be... |
// too big length difference
if (Math.min(name.length(), hint.length()) * 4 < Math.max(name.length(), hint.length()))
return false;
// The part 'abs(pointHint.length - name.length)' tries to make differences regarding length less important
// Ie. 'hauptstraßedresden' vs. 'h... | 1,504 | 210 | 1,714 | |
graphhopper_graphhopper | graphhopper/core/src/main/java/com/graphhopper/routing/util/countryrules/europe/MaltaCountryRule.java | MaltaCountryRule | getToll | class MaltaCountryRule implements CountryRule {
@Override
public Toll getToll(ReaderWay readerWay, Toll currentToll) {<FILL_FUNCTION_BODY>}
} |
if (currentToll != Toll.MISSING) {
return currentToll;
}
return Toll.NO;
| 52 | 39 | 91 | |
jeecgboot_jeecg-boot | jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/gpt/service/impl/ChatServiceImpl.java | ChatServiceImpl | createChat | class ChatServiceImpl implements ChatService {
//update-begin---author:chenrui ---date:20240223 for:[QQYUN-8225]聊天记录保存------------
private static final String CACHE_KEY_PREFIX = "ai:chart:";
/**
*
*/
private static final String CACHE_KEY_MSG_CONTEXT = "msg_content";
/**
*
*/... |
String uid = getUserId();
//默认30秒超时,设置为0L则永不超时
SseEmitter sseEmitter = new SseEmitter(-0L);
//完成后回调
sseEmitter.onCompletion(() -> {
log.info("[{}]结束连接...................",uid);
LocalCache.CACHE.remove(uid);
});
//超时回调
sseEmitter.on... | 1,597 | 419 | 2,016 | |
Kong_unirest-java | unirest-java/unirest/src/main/java/kong/unirest/core/java/NeverUseInProdTrustManager.java | NeverUseInProdTrustManager | create | class NeverUseInProdTrustManager extends X509ExtendedTrustManager {
public static SSLContext create() {<FILL_FUNCTION_BODY>}
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType, Socket socket) throws CertificateException {
}
@Override
public void checkServerTrust... |
try {
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(null,
new TrustManager[]{new NeverUseInProdTrustManager()},
new SecureRandom());
return sslContext;
}catch (Exception e){
throw new Unires... | 319 | 87 | 406 | |
qiujiayu_AutoLoadCache | AutoLoadCache/autoload-cache-common/src/main/java/com/jarvis/cache/comparator/AutoLoadRequestTimesComparator.java | AutoLoadRequestTimesComparator | compare | class AutoLoadRequestTimesComparator implements Comparator<AutoLoadTO> {
@Override
public int compare(AutoLoadTO autoLoadTO1, AutoLoadTO autoLoadTO2) {<FILL_FUNCTION_BODY>}
} |
if (autoLoadTO1 == null && autoLoadTO2 != null) {
return 1;
} else if (autoLoadTO1 != null && autoLoadTO2 == null) {
return -1;
} else if (autoLoadTO1 == null && autoLoadTO2 == null) {
return 0;
}
if (autoLoadTO1.getRequestTimes() > autoLoadTO... | 62 | 158 | 220 | |
spring-cloud_spring-cloud-gateway | spring-cloud-gateway/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/route/InMemoryRouteDefinitionRepository.java | InMemoryRouteDefinitionRepository | delete | class InMemoryRouteDefinitionRepository implements RouteDefinitionRepository {
private final Map<String, RouteDefinition> routes = synchronizedMap(new LinkedHashMap<String, RouteDefinition>());
@Override
public Mono<Void> save(Mono<RouteDefinition> route) {
return route.flatMap(r -> {
if (ObjectUtils.isEmpty(... |
return routeId.flatMap(id -> {
if (routes.containsKey(id)) {
routes.remove(id);
return Mono.empty();
}
return Mono.defer(() -> Mono.error(new NotFoundException("RouteDefinition not found: " + routeId)));
});
| 236 | 84 | 320 | |
graphhopper_graphhopper | graphhopper/core/src/main/java/com/graphhopper/routing/util/HeadingEdgeFilter.java | HeadingEdgeFilter | getHeadingOfGeometryNearPoint | class HeadingEdgeFilter implements EdgeFilter {
private final double heading;
private final DirectedEdgeFilter directedEdgeFilter;
private final GHPoint pointNearHeading;
public HeadingEdgeFilter(DirectedEdgeFilter directedEdgeFilter, double heading, GHPoint pointNearHeading) {
this.directedEd... |
final DistanceCalc calcDist = DistanceCalcEarth.DIST_EARTH;
double closestDistance = Double.POSITIVE_INFINITY;
PointList points = edgeState.fetchWayGeometry(FetchMode.ALL);
int closestPoint = -1;
for (int i = 1; i < points.size(); i++) {
double fromLat = points.getLa... | 446 | 525 | 971 | |
graphhopper_graphhopper | graphhopper/core/src/main/java/com/graphhopper/reader/ReaderElement.java | ReaderElement | getFirstIndex | class ReaderElement {
public enum Type {
NODE,
WAY,
RELATION,
FILEHEADER;
}
private final long id;
private final Type type;
private final Map<String, Object> properties;
protected ReaderElement(long id, Type type) {
this(id, type, new LinkedHashMap<>(4))... |
for (int i = 0; i < searchedTags.size(); i++) {
String str = searchedTags.get(i);
Object value = properties.get(str);
if (value != null)
return i;
}
return -1;
| 1,223 | 69 | 1,292 | |
YunaiV_ruoyi-vue-pro | ruoyi-vue-pro/yudao-framework/yudao-spring-boot-starter-mq/src/main/java/cn/iocoder/yudao/framework/mq/redis/core/stream/AbstractRedisStreamMessageListener.java | AbstractRedisStreamMessageListener | consumeMessageBefore | class AbstractRedisStreamMessageListener<T extends AbstractRedisStreamMessage>
implements StreamListener<String, ObjectRecord<String, String>> {
/**
* 消息类型
*/
private final Class<T> messageType;
/**
* Redis Channel
*/
@Getter
private final String streamKey;
/**
... |
assert redisMQTemplate != null;
List<RedisMessageInterceptor> interceptors = redisMQTemplate.getInterceptors();
// 正序
interceptors.forEach(interceptor -> interceptor.consumeMessageBefore(message));
| 757 | 71 | 828 | |
jeecgboot_jeecg-boot | jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysDataLogController.java | SysDataLogController | queryDataVerList | class SysDataLogController {
@Autowired
private ISysDataLogService service;
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysDataLog>> queryPageList(SysDataLog dataLog,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaul... |
Result<List<SysDataLog>> result = new Result<>();
String dataTable = req.getParameter("dataTable");
String dataId = req.getParameter("dataId");
QueryWrapper<SysDataLog> queryWrapper = new QueryWrapper<SysDataLog>();
queryWrapper.eq("data_table", dataTable);
queryWrapper.eq("data_id", dataId);
//update-be... | 684 | 316 | 1,000 | |
eirslett_frontend-maven-plugin | frontend-maven-plugin/frontend-maven-plugin/src/main/java/com/github/eirslett/maven/plugins/frontend/mojo/GulpMojo.java | GulpMojo | shouldExecute | class GulpMojo extends AbstractFrontendMojo {
/**
* Gulp arguments. Default is empty (runs just the "gulp" command).
*/
@Parameter(property = "frontend.gulp.arguments")
private String arguments;
/**
* Files that should be checked for changes, in addition to the srcdir files.
* Defa... |
if (triggerfiles == null || triggerfiles.isEmpty()) {
triggerfiles = Arrays.asList(new File(workingDirectory, "gulpfile.js"));
}
return MojoUtils.shouldExecute(buildContext, triggerfiles, srcdir);
| 508 | 67 | 575 | public abstract class AbstractFrontendMojo extends AbstractMojo {
@Component protected MojoExecution execution;
/**
* Whether you should skip while running in the test phase (default is false)
*/
@Parameter(property="skipTests",required=false,defaultValue="false") protected Boolean skipTests;
/**
* Set thi... |
graphhopper_graphhopper | graphhopper/core/src/main/java/com/graphhopper/routing/util/countryrules/europe/CzechiaCountryRule.java | CzechiaCountryRule | getToll | class CzechiaCountryRule implements CountryRule {
@Override
public Toll getToll(ReaderWay readerWay, Toll currentToll) {<FILL_FUNCTION_BODY>}
} |
if (currentToll != Toll.MISSING) {
return currentToll;
}
RoadClass roadClass = RoadClass.find(readerWay.getTag("highway", ""));
if (RoadClass.MOTORWAY == roadClass)
return Toll.ALL;
return currentToll;
| 54 | 87 | 141 | |
subhra74_snowflake | snowflake/muon-jediterm/src/main/java/com/jediterm/terminal/HyperlinkStyle.java | Builder | build | class Builder extends TextStyle.Builder {
private LinkInfo myLinkInfo;
private TextStyle myHighlightStyle;
private TextStyle myPrevTextStyle;
private HighlightMode myHighlightMode;
private Builder( HyperlinkStyle style) {
myLinkInfo = style.myLinkInfo;
myHighligh... |
TerminalColor foreground = myHighlightStyle.getForeground();
TerminalColor background = myHighlightStyle.getBackground();
if (keepColors) {
TextStyle style = super.build();
foreground = style.getForeground() != null ? style.getForeground() : myHighlightStyle.getForeground();
b... | 187 | 145 | 332 | |
PlexPt_chatgpt-java | chatgpt-java/src/main/java/com/plexpt/chatgpt/ChatGPTStream.java | ChatGPTStream | streamChatCompletion | class ChatGPTStream {
private String apiKey;
private List<String> apiKeyList;
private OkHttpClient okHttpClient;
/**
* 连接超时
*/
@Builder.Default
private long timeout = 90;
/**
* 网络代理
*/
@Builder.Default
private Proxy proxy = Proxy.NO_PROXY;
/**
* 反向代理
... |
chatCompletion.setStream(true);
try {
EventSource.Factory factory = EventSources.createFactory(okHttpClient);
ObjectMapper mapper = new ObjectMapper();
String requestBody = mapper.writeValueAsString(chatCompletion);
String key = apiKey;
if (... | 414 | 232 | 646 | |
eirslett_frontend-maven-plugin | frontend-maven-plugin/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/ArgumentsParser.java | ArgumentsParser | parse | class ArgumentsParser {
private final List<String> additionalArguments;
ArgumentsParser() {
this(Collections.<String>emptyList());
}
ArgumentsParser(List<String> additionalArguments) {
this.additionalArguments = additionalArguments;
}
/**
* Parses a given string of argum... |
if (args == null || "null".equals(args) || args.isEmpty()) {
return Collections.emptyList();
}
final List<String> arguments = new LinkedList<>();
final StringBuilder argumentBuilder = new StringBuilder();
Character quote = null;
for (int i = 0, l = args.len... | 382 | 324 | 706 | |
mapstruct_mapstruct | mapstruct/processor/src/main/java/org/mapstruct/ap/internal/model/MapMappingMethod.java | Builder | build | class Builder extends AbstractMappingMethodBuilder<Builder, MapMappingMethod> {
private FormattingParameters keyFormattingParameters;
private FormattingParameters valueFormattingParameters;
private SelectionParameters keySelectionParameters;
private SelectionParameters valueSelectionPar... |
List<Type> sourceTypeParams =
first( method.getSourceParameters() ).getType().determineTypeArguments( Map.class );
List<Type> resultTypeParams = method.getResultType().determineTypeArguments( Map.class );
// find mapping method or conversion for key
Typ... | 369 | 1,290 | 1,659 | |
DerekYRC_mini-spring | mini-spring/src/main/java/org/springframework/aop/framework/ProxyFactory.java | ProxyFactory | createAopProxy | class ProxyFactory extends AdvisedSupport {
public ProxyFactory() {
}
public Object getProxy() {
return createAopProxy().getProxy();
}
private AopProxy createAopProxy() {<FILL_FUNCTION_BODY>}
} |
if (this.isProxyTargetClass() || this.getTargetSource().getTargetClass().length == 0) {
return new CglibAopProxy(this);
}
return new JdkDynamicAopProxy(this);
| 68 | 60 | 128 | /**
* @author zqc
* @date 2022/12/16
*/
public class AdvisedSupport {
private boolean proxyTargetClass=true;
private TargetSource targetSource;
private MethodMatcher methodMatcher;
private transient Map<Integer,List<Object>> methodCache;
AdvisorChainFactory advisorChainFactory=new DefaultAdvisorChainFacto... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.