hexsha
stringlengths
40
40
size
int64
3
1.05M
ext
stringclasses
1 value
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
5
1.02k
max_stars_repo_name
stringlengths
4
126
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
list
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
5
1.02k
max_issues_repo_name
stringlengths
4
114
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
list
max_issues_count
float64
1
92.2k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
5
1.02k
max_forks_repo_name
stringlengths
4
136
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
list
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
avg_line_length
float64
2.55
99.9
max_line_length
int64
3
1k
alphanum_fraction
float64
0.25
1
index
int64
0
1M
content
stringlengths
3
1.05M
3e0d4533b8b47bfabef1df89da31569cb43366af
358
java
Java
qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/local/bean/LocalSFSBean.java
joansmith2/camunda-bpm-platform
fca40c811a2e3c0cdd60ec7026f845aacb790f03
[ "Apache-2.0" ]
4
2016-10-28T13:10:55.000Z
2017-04-25T07:12:40.000Z
qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/local/bean/LocalSFSBean.java
joansmith2/camunda-bpm-platform
fca40c811a2e3c0cdd60ec7026f845aacb790f03
[ "Apache-2.0" ]
1
2022-03-31T21:02:16.000Z
2022-03-31T21:02:16.000Z
qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/local/bean/LocalSFSBean.java
joansmith2/camunda-bpm-platform
fca40c811a2e3c0cdd60ec7026f845aacb790f03
[ "Apache-2.0" ]
1
2019-09-07T01:31:19.000Z
2019-09-07T01:31:19.000Z
17.047619
66
0.740223
5,626
package org.camunda.bpm.integrationtest.functional.ejb.local.bean; import javax.ejb.Local; import javax.ejb.Stateful; /** * A SFSB with a local business interface * * @author Daniel Meyer * */ @Stateful @Local(BusinessInterface.class) public class LocalSFSBean implements BusinessInterface { public boolean doBusiness() { return true; } }
3e0d47b03ddab055d6d155db1a0eb7724c981332
648
java
Java
app/src/main/java/subway/ggikko/com/hellosubway/fragment/MadeByFragment.java
MobileSeoul/2015seoul-17
d171eb10bda6ea60ea4b85698124f264ed21f8ef
[ "MIT" ]
4
2019-05-23T01:08:58.000Z
2019-05-24T08:18:48.000Z
app/src/main/java/subway/ggikko/com/hellosubway/fragment/MadeByFragment.java
MobileSeoul/2015seoul-17
d171eb10bda6ea60ea4b85698124f264ed21f8ef
[ "MIT" ]
null
null
null
app/src/main/java/subway/ggikko/com/hellosubway/fragment/MadeByFragment.java
MobileSeoul/2015seoul-17
d171eb10bda6ea60ea4b85698124f264ed21f8ef
[ "MIT" ]
1
2019-05-23T01:08:59.000Z
2019-05-23T01:08:59.000Z
19.636364
82
0.705247
5,627
package subway.ggikko.com.hellosubway.fragment; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import subway.ggikko.com.hellosubway.R; /** * A simple {@link Fragment} subclass. */ public class MadeByFragment extends Fragment { public MadeByFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_made_by, container, false); return view; } }
3e0d480b405bb2356289f7ade2bead118c50ae5d
1,660
java
Java
modules/hibernate4/src/net/oschina/j2cache/hibernate4/J2CacheCacheRegion.java
YuriLuo/J2Cache
9b93f810d0274a1b3f8a72ca250cb46e0870314a
[ "Apache-2.0" ]
51
2018-01-23T10:48:16.000Z
2022-03-15T18:18:26.000Z
modules/hibernate4/src/net/oschina/j2cache/hibernate4/J2CacheCacheRegion.java
oschina/J2Cache
7838cabb19c44df88257561fc6f53b5d7ffbbb80
[ "Apache-2.0" ]
4
2020-04-26T04:53:55.000Z
2020-11-26T03:54:54.000Z
modules/hibernate4/src/net/oschina/j2cache/hibernate4/J2CacheCacheRegion.java
YuriLuo/J2Cache
9b93f810d0274a1b3f8a72ca250cb46e0870314a
[ "Apache-2.0" ]
22
2018-02-06T08:10:52.000Z
2022-03-30T09:56:28.000Z
27.666667
75
0.687349
5,628
/** * Copyright (c) 2015-2017. * <p> * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.oschina.j2cache.hibernate4; import net.oschina.j2cache.CacheChannel; import net.oschina.j2cache.CacheObject; public class J2CacheCacheRegion implements CacheRegion { private CacheChannel cacheChannel; private String region; public J2CacheCacheRegion(CacheChannel channel, String region) { this.cacheChannel = channel; this.region = region; } @Override public String getName() { return this.region; } @Override public void clear() { this.cacheChannel.clear(this.region); } @Override public CacheObject get(Object key) { return this.cacheChannel.get(this.region, key.toString()); } @Override public void put(Object key, Object value) { this.cacheChannel.set(this.region, key.toString(), value); } @Override public void evict(Object key) { this.cacheChannel.evict(this.region, key.toString()); } public Iterable<? extends Object> keys() { return this.cacheChannel.keys(this.region); } }
3e0d4869d29d06daab5e7aad5b13747012892efb
4,003
java
Java
dependencyLibs/Mavlink/src/com/MAVLink/common/msg_attitude_quaternion.java
lixiaowei123/HelloDrone
1795bf1bf26286359fb2e9f6782daf90a6575552
[ "Apache-2.0" ]
210
2015-08-06T21:31:20.000Z
2022-03-23T01:06:12.000Z
dependencyLibs/Mavlink/src/com/MAVLink/common/msg_attitude_quaternion.java
lixiaowei123/HelloDrone
1795bf1bf26286359fb2e9f6782daf90a6575552
[ "Apache-2.0" ]
152
2015-07-30T22:43:55.000Z
2021-01-16T11:45:34.000Z
dependencyLibs/Mavlink/src/com/MAVLink/common/msg_attitude_quaternion.java
lixiaowei123/HelloDrone
1795bf1bf26286359fb2e9f6782daf90a6575552
[ "Apache-2.0" ]
226
2015-08-03T01:58:13.000Z
2022-02-21T01:56:32.000Z
27.231293
230
0.597052
5,629
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * java mavlink generator tool. It should not be modified by hand. */ // MESSAGE ATTITUDE_QUATERNION PACKING package com.MAVLink.common; import com.MAVLink.MAVLinkPacket; import com.MAVLink.Messages.MAVLinkMessage; import com.MAVLink.Messages.MAVLinkPayload; /** * The attitude in the aeronautical frame (right-handed, Z-down, X-front, Y-right), expressed as quaternion. Quaternion order is w, x, y, z and a zero rotation would be expressed as (1 0 0 0). */ public class msg_attitude_quaternion extends MAVLinkMessage{ public static final int MAVLINK_MSG_ID_ATTITUDE_QUATERNION = 31; public static final int MAVLINK_MSG_LENGTH = 32; private static final long serialVersionUID = MAVLINK_MSG_ID_ATTITUDE_QUATERNION; /** * Timestamp (milliseconds since system boot) */ public long time_boot_ms; /** * Quaternion component 1, w (1 in null-rotation) */ public float q1; /** * Quaternion component 2, x (0 in null-rotation) */ public float q2; /** * Quaternion component 3, y (0 in null-rotation) */ public float q3; /** * Quaternion component 4, z (0 in null-rotation) */ public float q4; /** * Roll angular speed (rad/s) */ public float rollspeed; /** * Pitch angular speed (rad/s) */ public float pitchspeed; /** * Yaw angular speed (rad/s) */ public float yawspeed; /** * Generates the payload for a mavlink message for a message of this type * @return */ public MAVLinkPacket pack(){ MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); packet.sysid = 255; packet.compid = 190; packet.msgid = MAVLINK_MSG_ID_ATTITUDE_QUATERNION; packet.payload.putUnsignedInt(time_boot_ms); packet.payload.putFloat(q1); packet.payload.putFloat(q2); packet.payload.putFloat(q3); packet.payload.putFloat(q4); packet.payload.putFloat(rollspeed); packet.payload.putFloat(pitchspeed); packet.payload.putFloat(yawspeed); return packet; } /** * Decode a attitude_quaternion message into this class fields * * @param payload The message to decode */ public void unpack(MAVLinkPayload payload) { payload.resetIndex(); this.time_boot_ms = payload.getUnsignedInt(); this.q1 = payload.getFloat(); this.q2 = payload.getFloat(); this.q3 = payload.getFloat(); this.q4 = payload.getFloat(); this.rollspeed = payload.getFloat(); this.pitchspeed = payload.getFloat(); this.yawspeed = payload.getFloat(); } /** * Constructor for a new message, just initializes the msgid */ public msg_attitude_quaternion(){ msgid = MAVLINK_MSG_ID_ATTITUDE_QUATERNION; } /** * Constructor for a new message, initializes the message with the payload * from a mavlink packet * */ public msg_attitude_quaternion(MAVLinkPacket mavLinkPacket){ this.sysid = mavLinkPacket.sysid; this.compid = mavLinkPacket.compid; this.msgid = MAVLINK_MSG_ID_ATTITUDE_QUATERNION; unpack(mavLinkPacket.payload); } /** * Returns a string with the MSG name and data */ public String toString(){ return "MAVLINK_MSG_ID_ATTITUDE_QUATERNION - sysid:"+sysid+" compid:"+compid+" time_boot_ms:"+time_boot_ms+" q1:"+q1+" q2:"+q2+" q3:"+q3+" q4:"+q4+" rollspeed:"+rollspeed+" pitchspeed:"+pitchspeed+" yawspeed:"+yawspeed+""; } }
3e0d48ac86fd1115157d06d3102e25b05b1c485f
3,052
java
Java
src/org/sing/tcode/entity/Users.java
NF-Sing-Team/TCODE-BBS
f1c1bf7e431a92a4cf317ef3440646666f62d973
[ "MIT" ]
1
2022-01-30T06:49:27.000Z
2022-01-30T06:49:27.000Z
src/org/sing/tcode/entity/Users.java
NF-Sing-Team/TCODE-BBS
f1c1bf7e431a92a4cf317ef3440646666f62d973
[ "MIT" ]
null
null
null
src/org/sing/tcode/entity/Users.java
NF-Sing-Team/TCODE-BBS
f1c1bf7e431a92a4cf317ef3440646666f62d973
[ "MIT" ]
null
null
null
23.84375
116
0.699214
5,630
package org.sing.tcode.entity; import java.sql.Date; public class Users { private String u_account; //用户账号 private String u_email; //用户邮箱 private String u_regtime; //注册时间 private Boolean u_state; //是否可用 private String utype_name; //等级 private String sex; //用户性别 private String u_nick; //用户昵称 private String u_name; //真实姓名 private String u_constellation; //星座 private String u_tel; //手机号码 private String u_idcard; //身份证 private String u_university; //毕业院校 public String getU_account() { return u_account; } public void setU_account(String u_account) { this.u_account = u_account; } public String getU_email() { return u_email; } public void setU_email(String u_email) { this.u_email = u_email; } public String getU_nick() { return u_nick; } public void setU_nick(String u_nick) { this.u_nick = u_nick; } public Boolean getU_state() { return u_state; } public void setU_state(Boolean u_state) { this.u_state = u_state; } public String getU_regtime() { return u_regtime; } public void setU_regtime(String u_regtime) { this.u_regtime = u_regtime; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } public String getU_name() { return u_name; } public void setU_name(String u_name) { this.u_name = u_name; } public String getU_constellation() { return u_constellation; } public void setU_constellation(String u_constellation) { this.u_constellation = u_constellation; } public String getU_tel() { return u_tel; } public void setU_tel(String u_tel) { this.u_tel = u_tel; } public String getU_university() { return u_university; } public void setU_university(String u_university) { this.u_university = u_university; } public String getUtype_name() { return utype_name; } public void setUtype_name(String utype_name) { this.utype_name = utype_name; } public String getU_idcard() { return u_idcard; } public void setU_idcard(String u_idcard) { this.u_idcard = u_idcard; } public Users() { } public Users(String u_account, String u_email, String u_nick, Boolean u_state, String utype_name, String u_regtime, String sex, String u_name, String u_constellation, String u_tel, String u_idcard, String u_university) { this.u_account = u_account; this.u_email = u_email; this.u_nick = u_nick; this.u_state = u_state; this.utype_name = utype_name; this.u_regtime = u_regtime; this.sex = sex; this.u_name = u_name; this.u_constellation = u_constellation; this.u_tel = u_tel; this.u_idcard = u_idcard; this.u_university = u_university; } @Override public String toString() { return "Users [u_account=" + u_account + ", u_email=" + u_email + ", u_regtime=" + u_regtime + ", u_state=" + u_state + ", utype_name=" + utype_name + ", sex=" + sex + ", u_nick=" + u_nick + ", u_name=" + u_name + ", u_constellation=" + u_constellation + ", u_tel=" + u_tel + ", u_idcard=" + u_idcard + ", u_university=" + u_university + "]"; } }
3e0d494066f3f0d7537f9c44e9b91a1356879871
54
java
Java
scala/scala-impl/testdata/move/bothJavaAndScala/before/org/J.java
FogInTheFrog/intellij-scala
e6a149d1b1e43f54bacc7935b402a27825d022b4
[ "Apache-2.0" ]
909
2015-01-01T06:24:24.000Z
2022-03-17T12:36:38.000Z
scala/scala-impl/testdata/move/bothJavaAndScala/before/org/J.java
FogInTheFrog/intellij-scala
e6a149d1b1e43f54bacc7935b402a27825d022b4
[ "Apache-2.0" ]
313
2015-01-02T17:19:30.000Z
2022-03-24T16:29:34.000Z
scala/scala-impl/testdata/move/bothJavaAndScala/before/org/J.java
FogInTheFrog/intellij-scala
e6a149d1b1e43f54bacc7935b402a27825d022b4
[ "Apache-2.0" ]
391
2015-01-15T16:00:54.000Z
2022-03-23T10:55:42.000Z
10.8
21
0.648148
5,631
package org; public class J { private B b = null; }
3e0d4984901c4e0224dfaadd114cf7805109210a
2,855
java
Java
multithreading/src/main/java/ru/job4j/lift/Engine.java
wolfdog007/aruzhev
90e1fc0dfd14c167e1ee9c65ee1c11c90321e629
[ "Apache-2.0" ]
null
null
null
multithreading/src/main/java/ru/job4j/lift/Engine.java
wolfdog007/aruzhev
90e1fc0dfd14c167e1ee9c65ee1c11c90321e629
[ "Apache-2.0" ]
null
null
null
multithreading/src/main/java/ru/job4j/lift/Engine.java
wolfdog007/aruzhev
90e1fc0dfd14c167e1ee9c65ee1c11c90321e629
[ "Apache-2.0" ]
null
null
null
27.990196
78
0.500876
5,632
package ru.job4j.lift; /** * @author Ruzhev Alexander * @since 03.08.2018 */ public class Engine extends Thread { /** * Elevator current position. */ private int position; /** * Elevator. */ private Elevator elevator; /** * Direction. */ private int direction = 1; /** * Constructor. * * @param elevator - elevator. */ public Engine(Elevator elevator) { this.elevator = elevator; } @Override public void run() { System.out.println("Start."); this.position = elevator.getCurrentLevel(); int target = 0; try { while (!Thread.currentThread().isInterrupted()) { if (direction > 0) { if (elevator.upIsEmpty()) { direction = -1; } else { target = elevator.getUp(); } } if (direction < 0) { if (elevator.downIsEmpty()) { direction = 1; } else { target = elevator.getDown(); } } if (target > 0 && target == position) { elevator.delete(target, direction); target = -1; parkingLift(); } else { if (target > 0) { move(target - this.position); } } } } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Stop."); } /** * Parking lift. * @throws InterruptedException interrupted exception */ private void parkingLift() throws InterruptedException { System.out.println("двери лифта открываются..."); Thread.sleep(this.elevator.getDoorTime()); System.out.println("двери лифта открыты."); System.out.println("погрузка/выгрузка..."); Thread.sleep(1000); System.out.println("двери лифта закрываются..."); Thread.sleep(this.elevator.getDoorTime()); System.out.println("двери лифта закрыты."); } /** * Move to next level. * * @param direct - moving direction. * @throws InterruptedException interrupted exception */ private void move(int direct) throws InterruptedException { System.out.println(direct); this.direction = direct / Math.abs(direct); System.out.println("движение на след. этаж " + direction); Thread.sleep((long) (elevator.getHeight() * elevator.getSpeedMove())); this.position += direction; System.out.println("лифт на этаже:" + this.position); elevator.setCurrentLevel(this.position); } }
3e0d4b8c208466ee89fb8303ed259c5d7e8fe2fc
2,181
java
Java
core/src/main/java/org/narrative/common/persistence/hibernate/integrator/ListenerIntegrator.java
NarrativeCompany/narrative
84829f0178a0b34d4efc5b7dfa82a8929b5b06b5
[ "MIT" ]
8
2020-01-08T20:13:42.000Z
2020-06-19T23:10:17.000Z
core/src/main/java/org/narrative/common/persistence/hibernate/integrator/ListenerIntegrator.java
NarrativeCompany/narrative
84829f0178a0b34d4efc5b7dfa82a8929b5b06b5
[ "MIT" ]
5
2020-01-09T17:49:55.000Z
2020-06-15T19:31:04.000Z
core/src/main/java/org/narrative/common/persistence/hibernate/integrator/ListenerIntegrator.java
NarrativeCompany/narrative
84829f0178a0b34d4efc5b7dfa82a8929b5b06b5
[ "MIT" ]
5
2020-01-09T02:01:47.000Z
2021-06-01T13:34:46.000Z
36.966102
135
0.755158
5,633
package org.narrative.common.persistence.hibernate.integrator; import org.hibernate.boot.Metadata; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.integrator.spi.Integrator; import org.hibernate.service.ServiceRegistry; import org.hibernate.service.spi.SessionFactoryServiceRegistry; import java.util.function.Consumer; /** * Register listeners via {@link Consumer} with the supplied {@link ServiceRegistry}. */ public class ListenerIntegrator implements Integrator { private Consumer<ServiceRegistry> listenerRegistrationConsumer; public ListenerIntegrator(){}; public ListenerIntegrator(Consumer<ServiceRegistry> listenerRegistrationConsumer) { this.listenerRegistrationConsumer = listenerRegistrationConsumer; } /** * * We need this for cases where the listener is not initialized at ListenerIntegrator construction time. * * @param listenerRegistrationConsumer The consumer function to use */ public void setListenerRegistrationConsumer(Consumer<ServiceRegistry> listenerRegistrationConsumer) { this.listenerRegistrationConsumer = listenerRegistrationConsumer; } /** * Perform integration. * * @param metadata The "compiled" representation of the mapping information * @param sessionFactory The session factory being created * @param serviceRegistry The session factory's service registry */ @Override public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) { if (listenerRegistrationConsumer == null) { throw new IllegalArgumentException("listenerRegistrationConsumer has not been bound"); } listenerRegistrationConsumer.accept(serviceRegistry); } /** * Tongue-in-cheek name for a shutdown callback. * * @param sessionFactory The session factory being closed. * @param serviceRegistry That session factory's service registry */ @Override public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) { } }
3e0d4bb30074d4eacae9ed57459828fe47800284
1,665
java
Java
android/src/main/java/com/something/liberty/SettingsActivity.java
Steppenwolf007/skunkworks.paintball
ef32605236b6ecc09878ffe79b530658a9f17234
[ "Apache-2.0" ]
null
null
null
android/src/main/java/com/something/liberty/SettingsActivity.java
Steppenwolf007/skunkworks.paintball
ef32605236b6ecc09878ffe79b530658a9f17234
[ "Apache-2.0" ]
null
null
null
android/src/main/java/com/something/liberty/SettingsActivity.java
Steppenwolf007/skunkworks.paintball
ef32605236b6ecc09878ffe79b530658a9f17234
[ "Apache-2.0" ]
null
null
null
33.3
101
0.720721
5,634
package com.something.liberty; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceActivity; import android.preference.PreferenceManager; import com.something.liberty.messaging.GameMessagingService; /** * @author Alexander Pringle */ public class SettingsActivity extends PreferenceActivity { SharedPreferences.OnSharedPreferenceChangeListener twitterUsernameChangeListener = null; SharedPreferences mSharedPreferences = null; @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); addPreferencesFromResource(R.xml.pref_general); mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); twitterUsernameChangeListener = new SharedPreferences.OnSharedPreferenceChangeListener() { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if(getString(R.string.pref_twitter_username).equals(key)) { GameMessagingService.stopService(getApplicationContext()); GameMessagingService.ensureServiceStarted(getApplicationContext()); } } }; } @Override protected void onResume() { super.onResume(); mSharedPreferences.registerOnSharedPreferenceChangeListener(twitterUsernameChangeListener); } @Override protected void onPause() { super.onPause(); mSharedPreferences.unregisterOnSharedPreferenceChangeListener(twitterUsernameChangeListener); } }
3e0d4c79fab44e5274c46bf924c50d6d408745a1
530
java
Java
src/main/java/cn/iocoder/dashboard/framework/apollo/internals/ConfigFrameworkDAO.java
asas6559/ruoyi-vue-pro
a29818dbded446f1b80913cb9fa2e3601f265273
[ "MIT" ]
1
2021-04-29T08:26:06.000Z
2021-04-29T08:26:06.000Z
src/main/java/cn/iocoder/dashboard/framework/apollo/internals/ConfigFrameworkDAO.java
pcyw/ruoyi-vue-pro
135acaf7ba5bb3f7e0e12225b38e8b489c5b616a
[ "MIT" ]
1
2021-03-14T15:09:19.000Z
2021-03-14T15:09:19.000Z
src/main/java/cn/iocoder/dashboard/framework/apollo/internals/ConfigFrameworkDAO.java
pcyw/ruoyi-vue-pro
135acaf7ba5bb3f7e0e12225b38e8b489c5b616a
[ "MIT" ]
null
null
null
18.275862
76
0.673585
5,635
package cn.iocoder.dashboard.framework.apollo.internals; import cn.iocoder.dashboard.modules.infra.dal.dataobject.config.InfConfigDO; import java.util.Date; import java.util.List; /** * 配置 Framework DAO 接口 */ public interface ConfigFrameworkDAO { /** * 查询是否存在比 maxUpdateTime 更新记录更晚的配置 * * @param maxUpdateTime 最大更新时间 * @return 是否存在 */ boolean selectExistsByUpdateTimeAfter(Date maxUpdateTime); /** * 查询配置列表 * * @return 配置列表 */ List<InfConfigDO> selectList(); }
3e0d4e1c58937e0db532cb7b82a9206bae6ad320
2,967
java
Java
commons/buildtools/checkstyle/contrib/usage/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/usage/transmogrify/ExternalPackage.java
deleidos/digitaledge-platform
1eafdb92f6a205936ab4e08ef62be6bb0b9c9ec9
[ "Apache-2.0" ]
4
2015-07-09T14:57:07.000Z
2022-02-23T17:48:24.000Z
lib/checkstyle-5.6/contrib/usage/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/usage/transmogrify/ExternalPackage.java
jenrsparks/RedditDailyProgrammer
018238716b9a111826363925516df38871822b76
[ "MIT" ]
1
2016-04-20T01:13:29.000Z
2016-04-20T01:13:29.000Z
lib/checkstyle-5.6/contrib/usage/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/usage/transmogrify/ExternalPackage.java
jenrsparks/RedditDailyProgrammer
018238716b9a111826363925516df38871822b76
[ "MIT" ]
4
2016-03-10T00:23:17.000Z
2022-03-02T11:17:02.000Z
30.90625
78
0.703741
5,636
// Transmogrify License // // Copyright (c) 2001, ThoughtWorks, Inc. // All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // - Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // - Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // Neither the name of the ThoughtWorks, Inc. nor the names of its // contributors may be used to endorse or promote products derived from this // software without specific prior written permission. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package com.puppycrawl.tools.checkstyle.checks.usage.transmogrify; import java.util.HashMap; import java.util.Map; /** * <code>PackageDef</code> contains all pertinent information about a * package. */ public class ExternalPackage extends ExternalDefinition implements IPackage { String _name; IPackage _parent; Map _packages; public ExternalPackage(String name, IPackage parent) { _name = name; _parent = parent; _packages = new HashMap(); } public IClass getClass(String name) { IClass result = null; try { Class theClass = ClassManager.getClassLoader().loadClass(getQualifiedName() + "." + name); result = new ExternalClass(theClass); } catch (ClassNotFoundException e) { // look elsewhere for the class } return result; } public void addDefinition(IPackage pkg) { _packages.put(pkg.getName(), pkg); } public IPackage getEnclosingPackage() { return _parent; } public String getName() { return _name; } public String getQualifiedName() { StringBuffer result = new StringBuffer(); if (_parent != null) { result.append(_parent.getQualifiedName()); result.append("."); } result.append(getName()); return result.toString(); } }
3e0d4e4ae05eaa4959d30d4c4c7e9fd5c4d4c42d
928
java
Java
app/src/main/java/org/softeg/slartus/forpdaplus/classes/LazyGallery/FileCache.java
slartus/4pdaClient-plus
b9dc5c2db85da052dd69c68f5070c0966cc68339
[ "Apache-2.0" ]
64
2015-01-20T17:20:08.000Z
2022-03-13T13:40:14.000Z
app/src/main/java/org/softeg/slartus/forpdaplus/classes/LazyGallery/FileCache.java
slartus/4pdaClient-plus
b9dc5c2db85da052dd69c68f5070c0966cc68339
[ "Apache-2.0" ]
38
2015-02-14T15:07:00.000Z
2022-02-14T02:43:09.000Z
app/src/main/java/org/softeg/slartus/forpdaplus/classes/LazyGallery/FileCache.java
slartus/4pdaClient-plus
b9dc5c2db85da052dd69c68f5070c0966cc68339
[ "Apache-2.0" ]
30
2015-01-02T15:02:08.000Z
2021-05-31T02:13:26.000Z
23.2
83
0.628233
5,637
package org.softeg.slartus.forpdaplus.classes.LazyGallery; /** * User: slinkin * Date: 25.11.11 * Time: 13:11 */ import android.content.Context; import java.io.File; import java.io.IOException; public class FileCache { private final File cacheDir; public FileCache(Context context) throws IOException { cacheDir = context.getCacheDir(); if (!cacheDir.exists()) cacheDir.mkdirs(); } public File getFile(String url) { //I identify images by hashcode. Not a perfect solution, good for the demo. String filename = String.valueOf(url.hashCode()); //Another possible solution (thanks to grantland) //String filename = URLEncoder.encode(url); File f = new File(cacheDir, filename); return f; } public void clear() { File[] files = cacheDir.listFiles(); for (File f : files) f.delete(); } }
3e0d4e831423d924012290c1376be69c13d63407
210
java
Java
adcom/adcore.lib/src/main/java/org/adorsys/adcore/xls/Converter.java
francis-pouatcha/adcom
0e3ea1ce6c2045d31c7003fc87dbda533c09c767
[ "Apache-2.0" ]
null
null
null
adcom/adcore.lib/src/main/java/org/adorsys/adcore/xls/Converter.java
francis-pouatcha/adcom
0e3ea1ce6c2045d31c7003fc87dbda533c09c767
[ "Apache-2.0" ]
null
null
null
adcom/adcore.lib/src/main/java/org/adorsys/adcore/xls/Converter.java
francis-pouatcha/adcom
0e3ea1ce6c2045d31c7003fc87dbda533c09c767
[ "Apache-2.0" ]
null
null
null
26.25
103
0.809524
5,638
package org.adorsys.adcore.xls; import org.apache.poi.ss.usermodel.Cell; public interface Converter { public void setProperty(Cell propertyCell, String propertyName, Object target, CellParser cellParser); }
3e0d4f439bf7023d04b78622554865734d12611e
1,272
java
Java
mgicode-frame-web/src/main/java/com/kuiren/common/easyui/RetPageData.java
mgicode/mgicode-frame-spring
13faa11032275c3e51ac2abc0c9daa88bfb61447
[ "Apache-2.0" ]
null
null
null
mgicode-frame-web/src/main/java/com/kuiren/common/easyui/RetPageData.java
mgicode/mgicode-frame-spring
13faa11032275c3e51ac2abc0c9daa88bfb61447
[ "Apache-2.0" ]
null
null
null
mgicode-frame-web/src/main/java/com/kuiren/common/easyui/RetPageData.java
mgicode/mgicode-frame-spring
13faa11032275c3e51ac2abc0c9daa88bfb61447
[ "Apache-2.0" ]
null
null
null
17.424658
72
0.697327
5,639
package com.kuiren.common.easyui; import com.kuiren.common.page.Page; public class RetPageData extends RetData { private int totalCount = -1; private int totalPages = -1; protected int pageNo = 1; protected int pageSize = -1; public static RetPageData convertPage(Page<?> pages) { RetPageData rpd = new RetPageData(); return convertPage(pages, rpd); } public static RetPageData convertPage(Page<?> pages, RetPageData rpd) { if (rpd == null) { rpd = new RetPageData(); } if (pages == null) { return rpd; } rpd.setData(pages.getResult()); rpd.setPageNo(pages.getPageNo()); rpd.setPageSize(pages.getPageSize()); rpd.setTotalCount(pages.getTotalCount()); rpd.setTotalPages(pages.getTotalPages()); return rpd; } public int getTotalCount() { return totalCount; } public void setTotalCount(int totalCount) { this.totalCount = totalCount; } public int getTotalPages() { return totalPages; } public void setTotalPages(int totalPages) { this.totalPages = totalPages; } public int getPageNo() { return pageNo; } public void setPageNo(int pageNo) { this.pageNo = pageNo; } public int getPageSize() { return pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; } }
3e0d4facbf31987d34d6a5759550496096754819
1,201
java
Java
src/main/java/spet/sbwo/control/importer/person/PersonBankAccountImporter.java
serban-petrescu/swbo
9b7b912c21ddd199164975d20eed4ec0e8b1b752
[ "Apache-2.0" ]
null
null
null
src/main/java/spet/sbwo/control/importer/person/PersonBankAccountImporter.java
serban-petrescu/swbo
9b7b912c21ddd199164975d20eed4ec0e8b1b752
[ "Apache-2.0" ]
null
null
null
src/main/java/spet/sbwo/control/importer/person/PersonBankAccountImporter.java
serban-petrescu/swbo
9b7b912c21ddd199164975d20eed4ec0e8b1b752
[ "Apache-2.0" ]
null
null
null
34.314286
91
0.746878
5,640
package spet.sbwo.control.importer.person; import spet.sbwo.control.importer.Utils; import spet.sbwo.control.importer.base.BaseListImporter; import spet.sbwo.control.importer.base.IEntityProvider; import spet.sbwo.data.table.Person; import spet.sbwo.data.table.PersonBankAccount; import java.util.Arrays; import java.util.List; import java.util.Map; class PersonBankAccountImporter extends BaseListImporter<PersonBankAccount> { private IEntityProvider<Person> personProvider; public PersonBankAccountImporter(IEntityProvider<Person> personProvider) { this.personProvider = personProvider; } public static List<String> fields() { return Arrays.asList("person_number", "account_number", "bank_name", "is_primary"); } @Override protected PersonBankAccount build(Map<String, String> entry) { PersonBankAccount result = new PersonBankAccount(); result.setAccountNumber(entry.get("account_number")); result.setBank(entry.get("bank_name")); result.setPrimary(Utils.toBoolean(entry.get("is_primary"))); personProvider.getEntity(entry.get("person_number")).getBankAccounts().add(result); return result; } }
3e0d508dd5df0a6176fab362f873ea49bb02c4fb
4,043
java
Java
gpff-dao/src/main/java/ve/com/sios/gpff/jdbc/procedure/aa2cocor/UpdateAa2cocorProcedure.java
jestevez/portfolio-trusts-funds
0ec2e8431587209f7b59b55b3692ec24a84a8b78
[ "Apache-2.0" ]
1
2019-07-02T10:01:31.000Z
2019-07-02T10:01:31.000Z
gpff-dao/src/main/java/ve/com/sios/gpff/jdbc/procedure/aa2cocor/UpdateAa2cocorProcedure.java
jestevez/portfolio-trusts-funds
0ec2e8431587209f7b59b55b3692ec24a84a8b78
[ "Apache-2.0" ]
null
null
null
gpff-dao/src/main/java/ve/com/sios/gpff/jdbc/procedure/aa2cocor/UpdateAa2cocorProcedure.java
jestevez/portfolio-trusts-funds
0ec2e8431587209f7b59b55b3692ec24a84a8b78
[ "Apache-2.0" ]
1
2021-04-21T18:52:59.000Z
2021-04-21T18:52:59.000Z
36.423423
109
0.703685
5,641
/* * UpdateAa2cocorProcedure.java * * Copyright 2014 - Soluciones Integrales Open-Source SiOS * Copyright 2014 - Fundacion para la Investigacion y Desarrollo del Software Libre en Venezuela * * http://www.sios.com.ve * http://www.indesoft.org.ve * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ve.com.sios.gpff.jdbc.procedure.aa2cocor; import java.sql.Types; import java.util.HashMap; import java.util.Map; import javax.sql.DataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.SqlOutParameter; import org.springframework.jdbc.core.SqlParameter; import org.springframework.jdbc.object.StoredProcedure; import org.springframework.stereotype.Service; import ve.com.sios.gpff.beans.Aa2cocor; import ve.com.sios.gpff.common.beans.AuthorizationData; import ve.com.sios.gpff.exception.GpffDaoException; /** * The Class UpdateAa2cocorProcedure. * * @author Soluciones Integrales Open-Source SiOS http://www.sios.com.ve * @version 1.0 * @date 13/03/2014 */ @Service public class UpdateAa2cocorProcedure extends StoredProcedure { /** The Constant SP_NAME. */ private static final String SP_NAME = "procUpdateAa2cocor"; /** * Instantiates a new update aa 2 cocor procedure. * * @param dataSource the data source */ @Autowired public UpdateAa2cocorProcedure(DataSource dataSource) { super(dataSource, SP_NAME); declareParameter(new SqlParameter("P_CODARE", Types.VARCHAR)); declareParameter(new SqlParameter("P_CODCOR", Types.INTEGER)); declareParameter(new SqlParameter("P_CODNOM", Types.VARCHAR)); declareParameter(new SqlParameter("P_CODUSU", Types.VARCHAR)); declareParameter(new SqlParameter("P_CODPAN", Types.VARCHAR)); declareParameter(new SqlParameter("P_CODFEC", Types.INTEGER)); declareParameter(new SqlParameter("P_USERNAME", Types.VARCHAR)); declareParameter(new SqlParameter("P_IPADDRESS", Types.VARCHAR)); declareParameter(new SqlParameter("P_USERAGENT", Types.VARCHAR)); declareParameter(new SqlOutParameter("P_MSGCODE", Types.INTEGER)); compile(); } /** * Execute. * * @param aa2cocor the aa 2 cocor * @param authorizationData the authorization data * @return the int * @throws GpffDaoException the exception */ public int execute(Aa2cocor aa2cocor, AuthorizationData authorizationData) throws GpffDaoException { if (aa2cocor == null || authorizationData == null) { throw new IllegalArgumentException("El metodo execute no se puede llamar con paramentros nulos"); } Map<String, Object> inParams = new HashMap<String, Object>(); inParams.put("P_CODARE", aa2cocor.getCodare()); inParams.put("P_CODCOR", aa2cocor.getCodcor()); inParams.put("P_CODNOM", aa2cocor.getCodnom()); inParams.put("P_CODUSU", aa2cocor.getCodusu()); inParams.put("P_CODPAN", aa2cocor.getCodpan()); inParams.put("P_CODFEC", aa2cocor.getCodfec()); inParams.put("P_USERNAME", authorizationData.getUserName()); inParams.put("P_IPADDRESS", authorizationData.getIpAddress()); inParams.put("P_USERAGENT", authorizationData.getUserAgent()); try { Map<String, Object> maps = super.execute(inParams); return (Integer) maps.get("P_MSGCODE"); } catch (Exception e) { throw new GpffDaoException(e); } } }
3e0d50b4010b04d458b49611695ad4f2c5c4a80a
7,044
java
Java
implementations/tic-tac-toe/app/src/main/java/com/example/tic_tac_toe/MainActivity.java
Chayan199916/android-journey
db237b93aff7a400453317e42e7f14724eec4e99
[ "MIT" ]
3
2020-07-09T03:52:47.000Z
2020-07-09T16:17:12.000Z
implementations/tic-tac-toe/app/src/main/java/com/example/tic_tac_toe/MainActivity.java
Chayan199916/android-journey
db237b93aff7a400453317e42e7f14724eec4e99
[ "MIT" ]
null
null
null
implementations/tic-tac-toe/app/src/main/java/com/example/tic_tac_toe/MainActivity.java
Chayan199916/android-journey
db237b93aff7a400453317e42e7f14724eec4e99
[ "MIT" ]
null
null
null
46.039216
227
0.582198
5,642
package com.example.tic_tac_toe; import androidx.appcompat.app.AppCompatActivity; import androidx.constraintlayout.widget.ConstraintLayout; import android.os.Bundle; import android.text.Layout; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import org.w3c.dom.Text; public class MainActivity extends AppCompatActivity { boolean gameValid = true; int imgSrc; String winTeam; int player1_score = 0; int player2_score = 0; int curPosOfGame[] = {2, 2, 2, 2, 2, 2, 2, 2, 2}; int activePlayer = 0; int validWinPositions[][] = {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 3, 6}, {1, 4, 7}, {2, 5, 8}, {0, 4, 8}, {2, 4, 6}}; public void tap_to_play(View view){ int flag = 1; TextView player1 = findViewById(R.id.score1); TextView player2 = findViewById(R.id.score2); player1.setText("Player 1 : " + Integer.toString(player1_score)); player2.setText("Player 2 : " + Integer.toString(player2_score)); if(!gameValid){ gameReset(); } ImageView img = (ImageView) view; int tappedImg = Integer.parseInt(img.getTag().toString()); if(curPosOfGame[tappedImg] == 2 && gameValid) { curPosOfGame[tappedImg] = activePlayer; img.setTranslationY(-500f); TextView status = findViewById(R.id.status); if(activePlayer == 0){ status.setText("Player 2, Now your turn."); imgSrc = R.drawable.x; img.setImageResource(imgSrc); activePlayer = 1; } else{ status.setText("Player 1, Now your turn."); imgSrc = R.drawable.o; img.setImageResource(imgSrc); activePlayer = 0; } img.animate().translationYBy(500f).setDuration(70); for(int i = 0; i < 8; i++){ if(curPosOfGame[validWinPositions[i][0]] == curPosOfGame[validWinPositions[i][1]] && curPosOfGame[validWinPositions[i][1]] == curPosOfGame[validWinPositions[i][2]] && curPosOfGame[validWinPositions[i][1]] != 2){ winTeam = curPosOfGame[validWinPositions[i][0]] == 0 ? "Player 1" : "Player 2"; Toast.makeText(this, "GAME OVER !", Toast.LENGTH_LONG).show(); status.setText(winTeam + " has won, yaay!"); if(winTeam.equals("Player 1")){ player1_score++; player1.setText("Player 1 : " + Integer.toString(player1_score)); }else{ player2_score++; player2.setText("Player 2 : " + Integer.toString(player2_score)); } gameValid = false; break; } } if(player1_score == 2){ Toast.makeText(this, "SERIES OVER !", Toast.LENGTH_LONG).show(); LinearLayout playAgain = (LinearLayout) findViewById(R.id.playAgainLayout); TextView winningMessage = (TextView) findViewById(R.id.winningMessage); winningMessage.setText("Player 1 has won, Congrats!"); playAgain.setVisibility(View.VISIBLE); LinearLayout mainLayout = (LinearLayout) findViewById(R.id.linearLayout); mainLayout.animate().alpha(0.2f).setDuration(2000); player1_score = player2_score = 0; }else if (player2_score == 2){ Toast.makeText(this, "SERIES OVER !", Toast.LENGTH_LONG).show(); LinearLayout playAgain = (LinearLayout) findViewById(R.id.playAgainLayout); TextView winningMessage = (TextView) findViewById(R.id.winningMessage); winningMessage.setText("Player 2 has won, Congrats!"); playAgain.setVisibility(View.VISIBLE); LinearLayout mainLayout = (LinearLayout) findViewById(R.id.linearLayout); mainLayout.animate().alpha(0.2f).setDuration(2000); player1_score = player2_score = 0; } for(int i = 0; i < curPosOfGame.length; i++){ if(curPosOfGame[i] == 2){ flag = 0; break; } } if(flag == 1 && gameValid != false){ Toast.makeText(this, "GAME OVER !", Toast.LENGTH_LONG).show(); status.setText("Match tied! Tap to start again."); // LinearLayout playAgain = (LinearLayout) findViewById(R.id.playAgainLayout); // TextView winningMessage = (TextView) findViewById(R.id.winningMessage); // winningMessage.setText("Match Draw!"); // playAgain.setVisibility(View.VISIBLE); // LinearLayout mainLayout = (LinearLayout) findViewById(R.id.linearLayout); // mainLayout.animate().alpha(0.2f).setDuration(2000); gameValid = false; } } } public void matchReset(View view){ player1_score = 0; player2_score = 0; LinearLayout playAgain = (LinearLayout) findViewById(R.id.playAgainLayout); TextView player1 = findViewById(R.id.score1); TextView player2 = findViewById(R.id.score2); player1.setText("Player 1 : " + Integer.toString(player1_score)); player2.setText("Player 2 : " + Integer.toString(player2_score)); playAgain.setVisibility(View.INVISIBLE); LinearLayout mainLayout = (LinearLayout) findViewById(R.id.linearLayout); mainLayout.animate().alpha(1f).setDuration(2000); gameReset(); } public void gameReset(){ activePlayer = 0; for(int i = 0; i < curPosOfGame.length; i++){ curPosOfGame[i] = 2; } ImageView img = (ImageView) findViewById(R.id.imageView11); img.setImageResource(0); img = (ImageView) findViewById(R.id.imageView10); img.setImageResource(0); img = (ImageView) findViewById(R.id.imageView9); img.setImageResource(0); img = (ImageView) findViewById(R.id.imageView8); img.setImageResource(0); img = (ImageView) findViewById(R.id.imageView7); img.setImageResource(0); img = (ImageView) findViewById(R.id.imageView6); img.setImageResource(0); img = (ImageView) findViewById(R.id.imageView5); img.setImageResource(0); img = (ImageView) findViewById(R.id.imageView4); img.setImageResource(0); img = (ImageView) findViewById(R.id.imageView3); img.setImageResource(0); TextView status = findViewById(R.id.status); status.setText("X's turn - tap to play"); gameValid = true; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
3e0d5166d2796a9064ffdf9d095527643a817365
4,585
java
Java
src/main/java/org/datanucleus/enhancer/EnhancerClassLoader.java
tear-gas/datanucleus-core
ffc9561ab2ec318d39f8ecd099b66fededc5c6f8
[ "Apache-2.0" ]
103
2015-03-01T01:13:29.000Z
2022-03-17T16:10:54.000Z
src/main/java/org/datanucleus/enhancer/EnhancerClassLoader.java
tear-gas/datanucleus-core
ffc9561ab2ec318d39f8ecd099b66fededc5c6f8
[ "Apache-2.0" ]
412
2016-02-03T07:20:32.000Z
2022-03-31T09:41:04.000Z
src/main/java/org/datanucleus/enhancer/EnhancerClassLoader.java
tear-gas/datanucleus-core
ffc9561ab2ec318d39f8ecd099b66fededc5c6f8
[ "Apache-2.0" ]
69
2015-02-07T01:19:59.000Z
2022-02-01T19:19:10.000Z
30.566667
117
0.556598
5,643
/********************************************************************** Copyright (c) 2007 Erik Bengtson and others. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Contributors: ... **********************************************************************/ package org.datanucleus.enhancer; import java.net.URL; import org.datanucleus.ClassLoaderResolver; import org.datanucleus.exceptions.ClassNotResolvedException; /** * ClassLoader for newly defined classes. Parent classloader is the context classloader * obtained during instantiation of this class */ public final class EnhancerClassLoader extends ClassLoader { /** Delegate ClassLoaderResolver may be used during class definition if the class has links to other classes. */ ClassLoaderResolver delegate; /** flag to avoid reentrant invocations to loading operations **/ boolean loadingClass = false; /** flag to avoid reentrant invocations to loading operations **/ boolean loadingResource = false; public EnhancerClassLoader() { super(Thread.currentThread().getContextClassLoader()); } public EnhancerClassLoader(ClassLoaderResolver iDelegate) { super(); this.delegate = iDelegate; } /** * Define a class in this ClassLoader. * @param fullClassName the class name * @param bytes the bytes representation of the class * @param clr the ClassLoaderResolver to load linked classes */ public synchronized void defineClass(String fullClassName, byte[] bytes, ClassLoaderResolver clr) { ClassLoaderResolver oldDelegate = this.delegate; this.delegate = clr; try { defineClass(fullClassName, bytes, 0, bytes.length); } finally { this.delegate = oldDelegate; } } /** * Overwrite to have an opportunity to load classes from the delegate ClassLoaderResolver */ public synchronized Class loadClass(String name) throws ClassNotFoundException { //avoid reentrant calls if (loadingClass) { throw new ClassNotFoundException("Class " + name + " not found"); } loadingClass = true; try { // Load from delegate if found, otherwise fallback if (delegate != null) { try { return delegate.classForName(name); } catch (ClassNotResolvedException cnrex) { throw new ClassNotFoundException(cnrex.toString(), cnrex); } } return super.loadClass(name); } catch (ClassNotFoundException ex) { // Can't see how this can be useful, since tried both delegate already if (delegate != null) { try { return delegate.classForName(name); } catch (ClassNotResolvedException cnrex) { throw new ClassNotFoundException(cnrex.toString(), cnrex); } } throw ex; } finally { loadingClass = false; } } /** * Overwrite to have an opportunity to find resources from the delegate ClassLoaderResolver */ protected synchronized URL findResource(String name) { //avoid reentrant calls if (loadingResource) { return null; } loadingResource = true; try { URL url = super.findResource(name); if (url == null) { if (delegate != null) { url = delegate.getResource(name, null); } } return url; } finally { loadingResource = false; } } }
3e0d51b31fbed3eb2261dbf45a1407c8e13ce554
833
java
Java
String_functions.java
allenalvin333/10
62bd55d2470171e0474775c3e11c6671bd30c06b
[ "MIT" ]
null
null
null
String_functions.java
allenalvin333/10
62bd55d2470171e0474775c3e11c6671bd30c06b
[ "MIT" ]
null
null
null
String_functions.java
allenalvin333/10
62bd55d2470171e0474775c3e11c6671bd30c06b
[ "MIT" ]
null
null
null
20.825
50
0.4994
5,644
import java.util.*; public class String_functions { public String input() { Scanner sc=new Scanner(System.in); System.out.println("Enter a String: "); String a=sc.nextLine(); return(a); } public int l(String a) { int b=a.length(); return(b); } public char ca(String a,int b) { int l=a.length();char c=' '; if(b<l) c=a.charAt(b); else c=' '; return(c); } public int indexOf(String a,char c,int start) { int b=a.indexOf(c,start); return(b); } public String rep(String a,char o,char n) { String b=a.replace(o,n); return(b); } public String sub_string(String a,int s,int l) { String b=a.substring(s,l); return(b); } }
3e0d51b43d6e19e77ba70db5b1fc6ad9d8b48b8c
21,310
java
Java
src/main/java/com/novacloud/data/formula/impl/ReflectUtil.java
novadata/formula-engine
bcc8ab5a52a7b6b9fec98ded26570ad91d5d8ee7
[ "Apache-2.0" ]
null
null
null
src/main/java/com/novacloud/data/formula/impl/ReflectUtil.java
novadata/formula-engine
bcc8ab5a52a7b6b9fec98ded26570ad91d5d8ee7
[ "Apache-2.0" ]
null
null
null
src/main/java/com/novacloud/data/formula/impl/ReflectUtil.java
novadata/formula-engine
bcc8ab5a52a7b6b9fec98ded26570ad91d5d8ee7
[ "Apache-2.0" ]
3
2019-11-14T03:45:03.000Z
2020-07-20T16:54:14.000Z
38.121646
100
0.48184
5,645
package com.novacloud.data.formula.impl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.lang.reflect.*; import java.util.*; public abstract class ReflectUtil { private static final Logger log = LoggerFactory.getLogger(ReflectUtil.class); private static final String LENGTH = "length"; private static final Map<Class<?>, Map<String, Method>> readerMap = newMap(); private static final Map<Class<?>, Map<String, Method>> writerMap = newMap(); private static final Map<Class<?>, Map<String, Type[]>> typeMap = newMap(); private static final Map<Class<?>, Map<String, Field>> fieldMap = newMap(); private static final Map<Class<?>, Constructor<?>> constructorMap = newMap(); private static final Map<Class<? extends Enum<?>>, Enum<?>[]> enumMap = newMap(); private static final Object initLock = new Object(); @SuppressWarnings({"rawtypes", "unchecked"}) private static <T> T newMap() { return (T) new HashMap();// WeakHashMap(); } public static Map<String, Method> getGetterMap(final Class<?> clazz) { Map<String, Method> propertyMap = readerMap.get(clazz); if (propertyMap == null) { initProperties(clazz); propertyMap = readerMap.get(clazz); } return propertyMap; } public static Map<String, Method> getSetterMap(final Class<?> clazz) { Map<String, Method> propertyMap = writerMap.get(clazz); if (propertyMap == null) { initProperties(clazz); propertyMap = writerMap.get(clazz); } return propertyMap; } private static Map<String, Type[]> getTypeMap(final Class<?> clazz) { Map<String, Type[]> tMap = typeMap.get(clazz); if (tMap == null) { initProperties(clazz); tMap = typeMap.get(clazz); } return tMap; } public static Map<String, Field> getFieldMap(final Class<?> clazz) { Map<String, Field> fMap = fieldMap.get(clazz); if (fMap == null) { initProperties(clazz); fMap = fieldMap.get(clazz); } return fMap; } public static Set<String> getPropertySet(final Class<?> clazz) { return getTypeMap(clazz).keySet(); } private static void initProperties(final Class<?> clazz) { synchronized (ReflectUtil.class) { try { Constructor<?> cons = clazz.getDeclaredConstructor(); if (!cons.isAccessible()) { cons.setAccessible(true); } constructorMap.put(clazz, cons); } catch (Exception ignored) { log.debug("",ignored); } HashMap<String, Method> getterMap = new HashMap<>(); HashMap<String, Method> setterMap = new HashMap<>(); HashMap<String, Type[]> propertyMap = new HashMap<>(); HashMap<String, Field> fieldMap_ = new HashMap<>(); try { if (!clazz.equals(Object.class)) { getterMap.putAll(getGetterMap(clazz.getSuperclass())); setterMap.putAll(getSetterMap(clazz.getSuperclass())); propertyMap.putAll(getTypeMap(clazz.getSuperclass())); fieldMap_.putAll(getFieldMap(clazz.getSuperclass())); } Method[] methods = clazz.getDeclaredMethods(); for (Method m : methods) { if ((m.getModifiers() & Modifier.PUBLIC) > 0) { Class<?> type = m.getReturnType(); Class<?>[] params = m .getParameterTypes(); String name = m.getName(); if (type == Void.TYPE) { if (params.length == 1 && name.startsWith("set")) { // type = params[0]; initMethod(setterMap, propertyMap, m, name.substring(3)); } } else { if (params.length == 0) { if (name.startsWith("get") && !name.equals("getClass")) { initMethod(getterMap, propertyMap, m, name.substring(3)); } else if (type == Boolean.TYPE && name.startsWith("is")) { initMethod(getterMap, propertyMap, m, name.substring(2)); } } } } } boolean nogs = propertyMap.isEmpty(); boolean isMember = clazz.isMemberClass(); Field[] fields = clazz.getDeclaredFields(); for (Field f : fields) { f.setAccessible(true); String name = f.getName(); if (nogs && (isMember || 0 < (f.getModifiers() & Modifier.PUBLIC))) { propertyMap.put(name, new Type[]{f.getGenericType(), clazz}); } fieldMap_.put(name, f); } } catch (Exception e) { log.warn("初始化属性集合异常", e); } finally { readerMap.put(clazz, Collections.unmodifiableMap(getterMap)); writerMap.put(clazz, Collections.unmodifiableMap(setterMap)); typeMap.put(clazz, Collections.unmodifiableMap(propertyMap)); fieldMap.put(clazz, Collections.unmodifiableMap(fieldMap_)); } } } private static void initMethod(Map<String, Method> propertyMap, Map<String, Type[]> typeMap, Method m, String name) { if (name.length() > 0) { char c = name.charAt(0); if (Character.isUpperCase(c)) { name = Character.toLowerCase(c) + name.substring(1); m.setAccessible(true); propertyMap.put(name, m); Type type = m.getGenericReturnType(); if (type == Void.TYPE) { type = m.getParameterTypes()[0]; } Type[] ot = typeMap.get(name); if (ot != null) { if (ot[0] != type) { log.warn("属性类型冲突:{} != {}" , ot[0], type); } } typeMap.put(name, new Type[]{type, m.getDeclaringClass()}); } } } @SuppressWarnings("unchecked") public static Map<String, ?> map(final Object context) { if (context == null) { return Collections.EMPTY_MAP; } else if (context instanceof Map) { return (Map<String, ?>) context; } return new ProxyMap(context, getTypeMap(context.getClass()).keySet()); } private static int toIndex(Object key) { return key instanceof Number ? ((Number) key).intValue() : Integer .parseInt(String.valueOf(key)); } public static Class<?> getValueType(Type type) { Type result = null; Class<?> clazz = null; if (type instanceof ParameterizedType) { clazz = (Class<?>) ((ParameterizedType) type).getRawType(); } else { clazz = (Class<?>) type; } if (Collection.class.isAssignableFrom(clazz)) { result = getParameterizedType(type, Collection.class, 0); } else if (Map.class.isAssignableFrom(clazz)) { result = getParameterizedType(type, Map.class, 1); } if (result != null) { return baseClass(result); } return Object.class; } public static Class<?> getKeyType(Type type) { Class<?> clazz = null; if (type instanceof ParameterizedType) { clazz = (Class<?>) ((ParameterizedType) type).getRawType(); } else { clazz = (Class<?>) type; } if (Map.class.isAssignableFrom(clazz)) { Type result = getParameterizedType(type, Map.class, 0); if (result != null) { return baseClass(result); } } return Integer.TYPE; } public static Type getParameterizedType(final Type ownerType, final Class<?> declaredClass, final Type declaredType) { if (declaredType instanceof TypeVariable) { String name = ((TypeVariable<?>) declaredType).getName(); TypeVariable<?>[] typeVariables = declaredClass.getTypeParameters(); if (typeVariables != null) { for (int i = 0; i < typeVariables.length; i++) { if (name.equals(typeVariables[i].getName())) { return getParameterizedType(ownerType, declaredClass, i); } } } return declaredType; } else if (declaredType instanceof ParameterizedType) { final ParameterizedType parameterizedType = (ParameterizedType) declaredType; final Type[] types = parameterizedType.getActualTypeArguments(); boolean changed = false; for (int i = 0; i < types.length; i++) { Type argumentType = types[i]; Type trueType = getParameterizedType(ownerType, declaredClass, argumentType); if (!Objects.equals(argumentType , trueType)) { types[i] = trueType; changed = true; } } if (changed) { return changedParameterizedType(parameterizedType, types); } } // class // parameterizedType return declaredType; } private static Type changedParameterizedType(final ParameterizedType parameterizedType, final Type[] changedTypes) { return new ParameterizedType() { public Type getRawType() { return parameterizedType.getRawType(); } public Type getOwnerType() { return parameterizedType.getOwnerType(); } public Type[] getActualTypeArguments() { return changedTypes; } }; } public static Type getParameterizedType(final Type ownerType, final Class<?> declaredClass, int paramIndex) { Class<?> clazz = null; ParameterizedType pt = null; Type[] ats = null; TypeVariable<?>[] tps = null; if (ownerType instanceof ParameterizedType) { pt = (ParameterizedType) ownerType; clazz = (Class<?>) pt.getRawType(); ats = pt.getActualTypeArguments(); tps = clazz.getTypeParameters(); } else { clazz = (Class<?>) ownerType; } if (Objects.equals(declaredClass , clazz)) { if (pt != null) { return pt.getActualTypeArguments()[paramIndex]; } return Object.class; } Class<?>[] ifs = clazz.getInterfaces(); for (int i = 0; i < ifs.length; i++) { Class<?> ifc = ifs[i]; if (declaredClass.isAssignableFrom(ifc)) { return getTureType( getParameterizedType(clazz.getGenericInterfaces()[i], declaredClass, paramIndex), tps, ats); } } Class<?> superClass = clazz.getSuperclass(); if (superClass != null) { if (declaredClass.isAssignableFrom(superClass)) { return getTureType( getParameterizedType(clazz.getGenericSuperclass(), declaredClass, paramIndex), tps, ats); } } throw new IllegalArgumentException("查找真实类型失败:" + ownerType); } private static Type getTureType(Type type, TypeVariable<?>[] typeVariables, Type[] actualTypes) { if (type instanceof TypeVariable<?>) { TypeVariable<?> tv = (TypeVariable<?>) type; String name = tv.getName(); if (actualTypes != null) { for (int i = 0; i < typeVariables.length; i++) { if (name.equals(typeVariables[i].getName())) { return actualTypes[i]; } } } return tv; // }else if (type instanceof Class<?>) { // return type; } return type; } @SuppressWarnings({"rawtypes", "unchecked"}) public static <T> T newInstance(Class<T> clazz) { try { Constructor cons = constructorMap.get(clazz); if (cons != null) { initProperties(clazz); cons = constructorMap.get(clazz); if (cons != null) { return (T) cons.newInstance(); } } return clazz.newInstance(); } catch (Exception ignored) { log.debug("",ignored); return null; } } public static Class<?> baseClass(Type result) { if (result instanceof Class<?>) { return (Class<?>) result; } else if (result instanceof ParameterizedType) { return baseClass(((ParameterizedType) result).getRawType()); } else if (result instanceof WildcardType) { return baseClass(((WildcardType) result).getUpperBounds()[0]); } return null; } @SuppressWarnings({"unchecked", "rawtypes"}) public static Enum getEnum(Object value, Class clazz) { if (value instanceof String) { return Enum.valueOf(clazz, (String) value); } else if (value instanceof Number) { Enum[] es = enumMap.get(clazz); try { if (es == null) { Method method = clazz.getMethod("values"); enumMap.put(clazz, es = (Enum[]) method.invoke(null)); } int i = ((Number) value).intValue(); return es[i]; } catch (Exception ignored) { log.debug("",ignored); } } return null; } public static Class<?> getPropertyClass(Type type, Object key) { return baseClass(getPropertyType(type, key)); } public static Type getPropertyType(Type type, Object key) { Class<?> clazz = baseClass(type); if (clazz != null) { if (Collection.class.isAssignableFrom(clazz)) { return getValueType(type); } else if (Map.class.isAssignableFrom(clazz)) { return getValueType(type); } else if (clazz.isArray()) { if (LENGTH.equals(key)) { return Integer.TYPE; } else if (Number.class.isInstance(key)) { return clazz.getComponentType(); } } else { Type pd[] = getTypeMap(clazz).get(String.valueOf(key)); if (pd != null) { return getParameterizedType(type, (Class<?>) pd[1], pd[0]); } } } return null; } public static Object getValue(Object context, Object key) { if (context == null) { return null; } Class<?> clazz = context.getClass(); try { if (context instanceof Map<?, ?>) { return ((Map<?, ?>) context).get(key); } if (key instanceof String) { Method method = getGetterMap(clazz).get( key); if (method == null) { Field field; if (context instanceof Class<?>) { field = getFieldMap((Class<?>) context).get(key); } else { field = getFieldMap(clazz).get(key); } if (field != null) { return field.get(context); } } else { return method.invoke(context); } if (LENGTH.equals(key)) { if (clazz.isArray()) { return Array.getLength(context); } else if (context instanceof Collection<?>) { return ((Collection<?>) context).size(); } else if (context instanceof String) { return ((String) context).length(); } } if (context instanceof Map<?, ?>) { return ((Map<?, ?>) context).get(key); } else if (clazz.isArray()) { return Array.getLength(context); } else { return Array.get(context, toIndex(key)); } } else if (context instanceof List<?>) { return ((List<?>) context).get(toIndex(key)); } } catch (Exception e) { if (log.isDebugEnabled()) { log.debug("", e); } } return null; } public static void setValues(Object base, Map<String, Object> attributeMap) { for (Map.Entry<String, Object> entry : attributeMap.entrySet()) { ReflectUtil.setValue(base, entry.getKey(), entry.getValue()); } } @SuppressWarnings("unchecked") public static void setValue(Object base, Object key, Object value) { if (base != null) { try { Class<?> clazz = base.getClass(); if (clazz.isArray()) { Array.set(base, toIndex(key), value); } else if (base instanceof List<?>) { ((List<Object>) base).set(toIndex(key), value); } if (base instanceof Map) { ((Map<Object, Object>) base).put(key, value); } String name = String.valueOf(key); Method method = getSetterMap(clazz).get(name); if (method != null) { if (value != null) { Class<?> type = method.getParameterTypes()[0]; value = toWrapper(value, type); } method.invoke(base, value); } else { Field field = fieldMap.get(clazz).get(name); if (value != null) { Class<?> type = field.getType(); value = toWrapper(value, type); } field.set(base, value); } } catch (Exception e) { if (log.isDebugEnabled()) { log.debug("", e); } } } } private static Object toWrapper(Object value, Class<?> type) { if (!type.isInstance(value)) { type = toWrapper(type); if (Number.class.isAssignableFrom(type)) { value = toValue((Number) value, type); } } return value; } public static Number toValue(Number value, Class<?> type) { if (type == Long.class) { return value.longValue(); } else if (type == Integer.class) { return value.intValue(); } else if (type == Short.class) { return value.shortValue(); } else if (type == Byte.class) { return value.byteValue(); } else if (type == Double.class) { return value.doubleValue(); } else if (type == Float.class) { return value.floatValue(); } else { Class<?> clazz = ReflectUtil.toWrapper(type); if (Objects.equals(clazz , type)) { return null; } else { return toValue(value, clazz); } } } public static Class<?> toWrapper( Class<?> type) { if (type.isPrimitive()) { if (Byte.TYPE == type) { return Byte.class; } else if (Short.TYPE == type) { return Short.class; } else if (Integer.TYPE == type) { return Integer.class; } else if (Long.TYPE == type) { return Long.class; } else if (Float.TYPE == type) { return Float.class; } else if (Double.TYPE == type) { return Double.class; } else if (Character.TYPE == type) { return Character.class; } else if (Boolean.TYPE == type) { return Boolean.class; } } return type; } }
3e0d52e24ec89a0b6b227e04ed93e52efa981205
1,240
java
Java
java后台代码/qshop-seller/src/main/java/co/lq/modules/system/repository/SellerMenuRepository.java
arraycto/qshop_bbc
ba9e51ae1a8aa4b73ffbbcfc600dba348fac314b
[ "Apache-2.0" ]
5
2020-09-07T02:33:29.000Z
2021-06-17T13:30:44.000Z
java后台代码/qshop-seller/src/main/java/co/lq/modules/system/repository/SellerMenuRepository.java
2227422/qshop_bbc
ba9e51ae1a8aa4b73ffbbcfc600dba348fac314b
[ "Apache-2.0" ]
null
null
null
java后台代码/qshop-seller/src/main/java/co/lq/modules/system/repository/SellerMenuRepository.java
2227422/qshop_bbc
ba9e51ae1a8aa4b73ffbbcfc600dba348fac314b
[ "Apache-2.0" ]
11
2020-09-07T02:33:30.000Z
2021-11-15T14:06:10.000Z
20.666667
117
0.642742
5,646
package co.lq.modules.system.repository; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import co.lq.modules.system.domain.SellerMenu; /** * @author billy * @date 2018-12-17 */ @SuppressWarnings("all") public interface SellerMenuRepository extends JpaRepository<SellerMenu, Long>, JpaSpecificationExecutor<SellerMenu> { /** * 根据菜单名称查询 * * @param name 菜单名称 * @return / */ SellerMenu findByName(String name); /** * 根据组件名称查询 * * @param name 组件名称 * @return / */ SellerMenu findByComponentName(String name); /** * 根据菜单的 PID 查询 * * @param pid / * @return / */ List<SellerMenu> findByPid(long pid); /** * 根据角色ID与菜单类型查询菜单 * * @param roleIds roleIDs * @param type 类型 * @return / */ LinkedHashSet<SellerMenu> findBySellerRoles_IdInAndTypeNotOrderBySortAsc(Set<Long> roleIds, int type); /** * 根据菜单的 storeId 查询 * * @param storeId / * @return / */ List<SellerMenu> findByTypeNotOrderBySortAsc(int type); }
3e0d53297666ce669beda13936d6d22823c09910
595
java
Java
opscloud-ssh-server/src/main/java/com/baiyi/opscloud/sshserver/command/kubernetes/base/PodContext.java
acheng-floyd/opscloud4
6ecf12a73db46146d80717dab58abba826c5eec1
[ "Apache-2.0" ]
91
2021-09-28T07:20:33.000Z
2022-03-31T06:46:04.000Z
opscloud-ssh-server/src/main/java/com/baiyi/opscloud/sshserver/command/kubernetes/base/PodContext.java
acheng-floyd/opscloud4
6ecf12a73db46146d80717dab58abba826c5eec1
[ "Apache-2.0" ]
15
2021-10-07T10:41:34.000Z
2022-03-31T09:45:53.000Z
opscloud-ssh-server/src/main/java/com/baiyi/opscloud/sshserver/command/kubernetes/base/PodContext.java
acheng-floyd/opscloud4
6ecf12a73db46146d80717dab58abba826c5eec1
[ "Apache-2.0" ]
48
2021-09-30T07:37:38.000Z
2022-03-30T05:32:35.000Z
17
61
0.715966
5,647
package com.baiyi.opscloud.sshserver.command.kubernetes.base; import com.baiyi.opscloud.common.util.JSONUtil; import lombok.Builder; import lombok.Data; import java.util.Set; /** * @Author baiyi * @Date 2021/7/8 9:29 上午 * @Version 1.0 */ @Data @Builder public class PodContext { private String kubernetesInstanceName; private String instanceUuid; private String namespace; private String podName; private String podIp; private Set<String> containerNames; @Override public String toString(){ return JSONUtil.writeValueAsString(this); } }
3e0d5365e3df36571c899db6af92b7523ad8d079
740
java
Java
database/entities-client/src/main/java/br/com/strn/ec/database/entities/client/Risk.java
IvoSestren/strn-ec
a21f8d6a36979b211525249c20084425ebd4e2ab
[ "Unlicense" ]
null
null
null
database/entities-client/src/main/java/br/com/strn/ec/database/entities/client/Risk.java
IvoSestren/strn-ec
a21f8d6a36979b211525249c20084425ebd4e2ab
[ "Unlicense" ]
null
null
null
database/entities-client/src/main/java/br/com/strn/ec/database/entities/client/Risk.java
IvoSestren/strn-ec
a21f8d6a36979b211525249c20084425ebd4e2ab
[ "Unlicense" ]
null
null
null
18.5
48
0.639189
5,648
package br.com.strn.ec.database.entities.client; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import java.io.Serializable; @Entity @Table(name = "risk") public class Risk implements Serializable { private String id; private Integer percent; private String color; @Id public String getId() { return id; } public void setId(String id) { this.id = id; } public Integer getPercent() { return percent; } public void setPercent(Integer percent) { this.percent = percent; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } }
3e0d53dd1a22bd1cc96483ecaf2042ac90bf3a4c
714
java
Java
sphairas-libs/library/src/org/thespheres/betula/util/Int2Adapter.java
sphairas/sphairas-desktop
f47c8d4ea62c1fc2876c0ffa44e5925bfaebc316
[ "Apache-2.0" ]
1
2021-11-09T20:33:07.000Z
2021-11-09T20:33:07.000Z
sphairas-libs/library/src/org/thespheres/betula/util/Int2Adapter.java
sphairas/sphairas-desktop
f47c8d4ea62c1fc2876c0ffa44e5925bfaebc316
[ "Apache-2.0" ]
null
null
null
sphairas-libs/library/src/org/thespheres/betula/util/Int2Adapter.java
sphairas/sphairas-desktop
f47c8d4ea62c1fc2876c0ffa44e5925bfaebc316
[ "Apache-2.0" ]
1
2021-11-09T20:34:30.000Z
2021-11-09T20:34:30.000Z
21.636364
61
0.662465
5,649
/* * Int2Adapter.java * * Created on 1. November 2007, 09:57 * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package org.thespheres.betula.util; import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.adapters.XmlAdapter; /** * * @author Boris Heithecker */ @XmlTransient public class Int2Adapter extends XmlAdapter<Integer, Int2> { @Override public Int2 unmarshal(Integer v) throws Exception { return Int2.fromInternalValue(v); } @Override public Integer marshal(Int2 v) throws Exception { return v != null ? v.getInternalValue() : null; } }
3e0d54599750f9102aa0f78b58a2b51ce2975034
9,843
java
Java
src/main/java/org/graylog2/plugins/slack/callback/SlackAlarmCallback.java
omise/graylog-plugin-slack
a76c000e37020567900c4a9870edd5d677c85d98
[ "Apache-2.0" ]
3
2017-04-27T05:31:40.000Z
2017-11-23T09:29:06.000Z
src/main/java/org/graylog2/plugins/slack/callback/SlackAlarmCallback.java
omise/graylog-plugin-slack
a76c000e37020567900c4a9870edd5d677c85d98
[ "Apache-2.0" ]
null
null
null
src/main/java/org/graylog2/plugins/slack/callback/SlackAlarmCallback.java
omise/graylog-plugin-slack
a76c000e37020567900c4a9870edd5d677c85d98
[ "Apache-2.0" ]
2
2019-05-07T16:59:07.000Z
2019-09-01T17:53:05.000Z
38.751969
144
0.679163
5,650
package org.graylog2.plugins.slack.callback; import static com.google.common.base.Strings.isNullOrEmpty; import com.google.common.collect.Lists; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; import org.graylog2.plugin.Message; import org.graylog2.plugin.MessageSummary; import org.graylog2.plugin.alarms.AlertCondition; import org.graylog2.plugin.alarms.callbacks.AlarmCallback; import org.graylog2.plugin.alarms.callbacks.AlarmCallbackConfigurationException; import org.graylog2.plugin.alarms.callbacks.AlarmCallbackException; import org.graylog2.plugin.configuration.Configuration; import org.graylog2.plugin.configuration.ConfigurationException; import org.graylog2.plugin.configuration.ConfigurationRequest; import org.graylog2.plugin.streams.Stream; import org.graylog2.plugins.slack.SlackClient; import org.graylog2.plugins.slack.SlackMessage; import org.graylog2.plugins.slack.SlackPluginBase; import org.graylog2.plugins.slack.StringReplacement; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; /** * Call by Graylog when Alarm was occured. */ public class SlackAlarmCallback extends SlackPluginBase implements AlarmCallback { private Configuration configuration; @Override public void initialize(final Configuration config) throws AlarmCallbackConfigurationException { this.configuration = config; try { checkConfiguration(config); } catch (ConfigurationException e) { throw new AlarmCallbackConfigurationException("Configuration error. " + e.getMessage()); } } @Override public void call(Stream stream, AlertCondition.CheckResult result) throws AlarmCallbackException { final SlackClient client = new SlackClient(configuration); final String color = configuration.getString(CK_COLOR); final String footerIconUrl = configuration.getString(CK_FOOTER_ICON_URL); final String footerText = configuration.getString(CK_FOOTER_TEXT); final String tsField = configuration.getString(CK_FOOTER_TS_FIELD); final String customFields = configuration.getString(CK_FIELDS); final boolean isAcknowledge = configuration.getBoolean(CK_ACKNOWLEDGE); final String graylogUri = configuration.getString(CK_GRAYLOG2_URL); final boolean isPreFormat = configuration.getBoolean(CK_PREFORMAT); // Create Message SlackMessage message = new SlackMessage( buildMessage(stream, result), configuration.getString(CK_CHANNEL), configuration.getString(CK_USER_NAME), configuration.getString(CK_MESSAGE_ICON), configuration.getBoolean(CK_LINK_NAMES)); // Create Attachment for Stream section if (configuration.getBoolean(CK_ADD_STREAM_INFO)) { SlackMessage.Attachment attachment = message.addAttachment("Stream", color, null, null, null); attachment.addField(new SlackMessage.AttachmentField("Stream ID", stream.getId(), true)); attachment.addField( new SlackMessage.AttachmentField("Stream Title", stream.getTitle(), false)); attachment.addField( new SlackMessage.AttachmentField("Stream Description", stream.getDescription(), false)); } // Create Attachment for Backlog and Fields section final List<Message> backlogItems = getAlarmBacklog(result); int count = configuration.getInt(CK_ADD_BLITEMS); if (count > 0) { final int blSize = backlogItems.size(); if (blSize < count) { count = blSize; } boolean shortMode = configuration.getBoolean(CK_SHORT_MODE); final String[] fields; if (!isNullOrEmpty(customFields)) { fields = customFields.split(","); } else { fields = new String[0]; } for (int i = 0; i < count; i++) { Message backlogItem = backlogItems.get(i); String footer = null; Long ts = null; if (!isNullOrEmpty(footerText)) { footer = StringReplacement.replace(footerText, backlogItem.getFields()).trim(); if (!isNullOrEmpty(graylogUri)) footer = new StringBuilder("<").append(buildMessageLink(graylogUri, backlogItem)).append('|').append(footer).append('>').toString(); try { DateTime timestamp = null; if ("timestamp".equals(tsField)) { // timestamp is reserved field in org.graylog2.notifications.NotificationImpl timestamp = backlogItem.getTimestamp(); } else { Object value = backlogItem.getField(tsField); if (value instanceof DateTime) { timestamp = (DateTime) value; } else { timestamp = new DateTime(value, DateTimeZone.UTC); } } ts = timestamp.getMillis() / 1000; } catch (NullPointerException | IllegalArgumentException e) { // ignore } } List<SlackMessage.Action> actionList = null; if (isAcknowledge) { actionList = Lists.newArrayList( new SlackMessage.Action("acknowledge", "Acknowledge", "true", "primary"), new SlackMessage.Action("decline", "It is not me!!", "true", "danger")); } StringBuilder backLogMessage = new StringBuilder(backlogItem.getMessage()); if (isPreFormat) backLogMessage.insert(0, "```").append("```"); final SlackMessage.Attachment attachment = message.addAttachment( backLogMessage.toString(), color, footer, footerIconUrl, ts, backlogItem.getId(), actionList); if (isPreFormat) attachment.setMarkdownIn("text"); // Add custom fields from backlog list if (fields.length > 0) { Arrays.stream(fields) .map(String::trim) .forEach(f -> addField(backlogItem, f, shortMode, attachment)); } } } // Send message to Slack try { client.send(message); } catch (SlackClient.SlackClientException e) { throw new RuntimeException("Could not send message to Slack.", e); } } /** * Collect all backlog from Alert result. */ protected List<Message> getAlarmBacklog(AlertCondition.CheckResult result) { final AlertCondition alertCondition = result.getTriggeredCondition(); final List<MessageSummary> matchingMessages = result.getMatchingMessages(); final int effectiveBacklogSize = Math.min(alertCondition.getBacklog(), matchingMessages.size()); if (effectiveBacklogSize == 0) { return Collections.emptyList(); } final List<MessageSummary> backlogSummaries = matchingMessages.subList(0, effectiveBacklogSize); final List<Message> backlog = Lists.newArrayListWithCapacity(effectiveBacklogSize); for (MessageSummary messageSummary : backlogSummaries) { Message message = messageSummary.getRawMessage(); message.addField("gl2_document_index", messageSummary.getIndex()); backlog.add(message); } return backlog; } /** * Shortcut method to add a backlog field into Slack attachment. * * @param message Graylog Message * @param fieldName field in backlog to be added * @param shortMode true to use Slack attachment short mode * @param attachment a Slack attachment object */ private void addField( Message message, String fieldName, boolean shortMode, SlackMessage.Attachment attachment) { Object value = message.getField(fieldName); if (value != null) { attachment.addField(new SlackMessage.AttachmentField(fieldName, value.toString(), shortMode)); } } /** * Create a slack <code>text</code> message from alert condition result. * * @param stream a Graylog stream * @param result a Graylog alert condition result * @return a text to be used in Slack message */ private String buildMessage(Stream stream, AlertCondition.CheckResult result) { String graylogUri = configuration.getString(CK_GRAYLOG2_URL); String notifyUser = configuration.getString(CK_NOTIFY_USER); StringBuilder message = new StringBuilder(); if (!isNullOrEmpty(notifyUser)) { List<MessageSummary> messageList = result.getMatchingMessages(); if (messageList.size() > 0) { for (MessageSummary messageSummary : result.getMatchingMessages()) { notifyUser = StringReplacement.replaceWithPrefix( notifyUser, "@", messageSummary.getRawMessage().getFields()); } } else { notifyUser = StringReplacement.replace(notifyUser, Collections.emptyMap()); } message.append(notifyUser.trim()).append(' '); } if (!isNullOrEmpty(graylogUri)) { message .append(" <") .append(buildStreamLink(graylogUri, stream)) .append('|') .append(stream.getTitle()) .append("> "); } else { message.append(" _").append(stream.getTitle()).append("_ "); } // Original Graylog message is too redundant. Try to make it short but it must compatible with all 3 Alerts type // message.append(result.getResultDescription()); String description = result.getResultDescription(); if (description != null) { message.append(description.replaceFirst("Stream", "").trim()); } return message.toString(); } @Override public Map<String, Object> getAttributes() { return configuration.getSource(); } @Override public void checkConfiguration() throws ConfigurationException { /* Never actually called by graylog-server */ } @Override public ConfigurationRequest getRequestedConfiguration() { return configuration(); } @Override public String getName() { return "Slack Alarm Callback"; } }
3e0d555abe2640bb5a6d9da65a6a18d89f096091
7,217
java
Java
src/sqlancer/sqlite3/oracle/SQLite3NoRECOracle.java
citusdata/sqlancer
e62224edcb43fe421dc87601f75090739e34e595
[ "MIT" ]
1
2021-03-02T21:32:42.000Z
2021-03-02T21:32:42.000Z
src/sqlancer/sqlite3/oracle/SQLite3NoRECOracle.java
citusdata/sqlancer
e62224edcb43fe421dc87601f75090739e34e595
[ "MIT" ]
null
null
null
src/sqlancer/sqlite3/oracle/SQLite3NoRECOracle.java
citusdata/sqlancer
e62224edcb43fe421dc87601f75090739e34e595
[ "MIT" ]
null
null
null
41.24
119
0.673271
5,651
package sqlancer.sqlite3.oracle; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; import sqlancer.IgnoreMeException; import sqlancer.Main.StateLogger; import sqlancer.MainOptions; import sqlancer.QueryAdapter; import sqlancer.Randomly; import sqlancer.StateToReproduce.SQLite3StateToReproduce; import sqlancer.TestOracle; import sqlancer.sqlite3.SQLite3Errors; import sqlancer.sqlite3.SQLite3Provider.SQLite3GlobalState; import sqlancer.sqlite3.SQLite3Visitor; import sqlancer.sqlite3.ast.SQLite3Aggregate; import sqlancer.sqlite3.ast.SQLite3Expression; import sqlancer.sqlite3.ast.SQLite3Expression.Join; import sqlancer.sqlite3.ast.SQLite3Expression.SQLite3ColumnName; import sqlancer.sqlite3.ast.SQLite3Expression.SQLite3PostfixText; import sqlancer.sqlite3.ast.SQLite3Expression.SQLite3PostfixUnaryOperation; import sqlancer.sqlite3.ast.SQLite3Expression.SQLite3PostfixUnaryOperation.PostfixUnaryOperator; import sqlancer.sqlite3.ast.SQLite3Select; import sqlancer.sqlite3.gen.SQLite3Common; import sqlancer.sqlite3.gen.SQLite3ExpressionGenerator; import sqlancer.sqlite3.schema.SQLite3Schema; import sqlancer.sqlite3.schema.SQLite3Schema.SQLite3Column; import sqlancer.sqlite3.schema.SQLite3Schema.SQLite3Table; import sqlancer.sqlite3.schema.SQLite3Schema.SQLite3Tables; public class SQLite3NoRECOracle implements TestOracle { private static final int NO_VALID_RESULT = -1; private final SQLite3Schema s; private final SQLite3StateToReproduce state; private final Set<String> errors = new HashSet<>(); private final StateLogger logger; private final MainOptions options; private final SQLite3GlobalState globalState; private SQLite3ExpressionGenerator gen; private String firstQueryString; private String secondQueryString; public SQLite3NoRECOracle(SQLite3GlobalState globalState) { this.s = globalState.getSchema(); this.state = (SQLite3StateToReproduce) globalState.getState(); this.logger = globalState.getLogger(); this.options = globalState.getOptions(); this.globalState = globalState; SQLite3Errors.addExpectedExpressionErrors(errors); SQLite3Errors.addMatchQueryErrors(errors); SQLite3Errors.addQueryErrors(errors); errors.add("misuse of aggregate"); errors.add("misuse of window function"); errors.add("second argument to nth_value must be a positive integer"); errors.add("no such table"); errors.add("no query solution"); errors.add("unable to use function MATCH in the requested context"); } @Override public void check() throws SQLException { SQLite3Tables randomTables = s.getRandomTableNonEmptyTables(); List<SQLite3Column> columns = randomTables.getColumns(); gen = new SQLite3ExpressionGenerator(globalState).setColumns(columns); SQLite3Expression randomWhereCondition = gen.generateExpression(); List<SQLite3Table> tables = randomTables.getTables(); List<Join> joinStatements = gen.getRandomJoinClauses(tables); List<SQLite3Expression> tableRefs = SQLite3Common.getTableRefs(tables, s); SQLite3Select select = new SQLite3Select(); select.setFromTables(tableRefs); select.setJoinClauses(joinStatements); int optimizedCount = getOptimizedQuery(select, randomWhereCondition); int unoptimizedCount = getUnoptimizedQuery(select, randomWhereCondition); if (optimizedCount == NO_VALID_RESULT || unoptimizedCount == NO_VALID_RESULT) { throw new IgnoreMeException(); } if (optimizedCount != unoptimizedCount) { state.queryString = firstQueryString + ";\n" + secondQueryString + ";"; throw new AssertionError(optimizedCount + " " + unoptimizedCount); } } private int getUnoptimizedQuery(SQLite3Select select, SQLite3Expression randomWhereCondition) throws SQLException { SQLite3PostfixUnaryOperation isTrue = new SQLite3PostfixUnaryOperation(PostfixUnaryOperator.IS_TRUE, randomWhereCondition); SQLite3PostfixText asText = new SQLite3PostfixText(isTrue, " as count", null); select.setFetchColumns(Arrays.asList(asText)); select.setWhereClause(null); secondQueryString = "SELECT SUM(count) FROM (" + SQLite3Visitor.asString(select) + ")"; if (options.logEachSelect()) { logger.writeCurrent(secondQueryString); } QueryAdapter q = new QueryAdapter(secondQueryString, errors); return extractCounts(q); } private int getOptimizedQuery(SQLite3Select select, SQLite3Expression randomWhereCondition) throws SQLException { boolean useAggregate = Randomly.getBoolean(); if (Randomly.getBoolean()) { select.setOrderByExpressions(gen.generateOrderBys()); } if (useAggregate) { select.setFetchColumns(Arrays.asList(new SQLite3Aggregate(Collections.emptyList(), SQLite3Aggregate.SQLite3AggregateFunction.COUNT_ALL))); } else { SQLite3ColumnName aggr = new SQLite3ColumnName(SQLite3Column.createDummy("*"), null); select.setFetchColumns(Arrays.asList(aggr)); } select.setWhereClause(randomWhereCondition); firstQueryString = SQLite3Visitor.asString(select); if (options.logEachSelect()) { logger.writeCurrent(firstQueryString); } QueryAdapter q = new QueryAdapter(firstQueryString, errors); return useAggregate ? extractCounts(q) : countRows(q); } private int countRows(QueryAdapter q) { int count = 0; try (ResultSet rs = q.executeAndGet(globalState)) { if (rs == null) { return NO_VALID_RESULT; } else { try { while (rs.next()) { count++; } } catch (SQLException e) { count = NO_VALID_RESULT; } rs.getStatement().close(); } } catch (Exception e) { if (e instanceof IgnoreMeException) { throw (IgnoreMeException) e; } throw new AssertionError(secondQueryString, e); } return count; } private int extractCounts(QueryAdapter q) { int count = 0; try (ResultSet rs = q.executeAndGet(globalState)) { if (rs == null) { return NO_VALID_RESULT; } else { try { while (rs.next()) { count += rs.getInt(1); } } catch (SQLException e) { count = NO_VALID_RESULT; } rs.getStatement().close(); } } catch (Exception e) { if (e instanceof IgnoreMeException) { throw (IgnoreMeException) e; } throw new AssertionError(secondQueryString, e); } return count; } }
3e0d557da5d8da90773dd74f889fe024cd2679d2
12,508
java
Java
main/plugins/org.talend.core.runtime/src/main/java/org/talend/core/classloader/ClassLoaderFactory.java
RyanSkraba/tcommon-studio-se
89093ea2bf24b29dc83dffcba0aa0bfd6b9549ae
[ "Apache-2.0" ]
null
null
null
main/plugins/org.talend.core.runtime/src/main/java/org/talend/core/classloader/ClassLoaderFactory.java
RyanSkraba/tcommon-studio-se
89093ea2bf24b29dc83dffcba0aa0bfd6b9549ae
[ "Apache-2.0" ]
null
null
null
main/plugins/org.talend.core.runtime/src/main/java/org/talend/core/classloader/ClassLoaderFactory.java
RyanSkraba/tcommon-studio-se
89093ea2bf24b29dc83dffcba0aa0bfd6b9549ae
[ "Apache-2.0" ]
null
null
null
41.144737
152
0.599936
5,652
// ============================================================================ // // Copyright (C) 2006-2016 Talend Inc. - www.talend.com // // This source code is available under agreement available at // %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt // // You should have received a copy of the agreement // along with this program; if not, write to Talend SA // 9 rue Pages 92150 Suresnes, France // // ============================================================================ package org.talend.core.classloader; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.lang.StringUtils; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExtensionRegistry; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Platform; import org.talend.commons.exception.ExceptionHandler; import org.talend.commons.utils.workbench.resources.ResourceUtils; import org.talend.core.GlobalServiceRegister; import org.talend.core.ILibraryManagerService; import org.talend.core.database.conn.ConnParameterKeys; import org.talend.core.model.general.Project; import org.talend.core.model.metadata.IMetadataConnection; import org.talend.core.model.metadata.connection.hive.HiveConnUtils; import org.talend.repository.ProjectManager; import org.talend.utils.io.FilesUtils; /** * DOC ycbai class global comment. Detailled comment */ public class ClassLoaderFactory { private final static String EXTENSION_POINT_ID = "org.talend.core.runtime.classloader_provider"; //$NON-NLS-1$ private static IConfigurationElement[] configurationElements = null; private static Map<String, DynamicClassLoader> classLoadersMap = null; private final static String SEPARATOR = ";"; //$NON-NLS-1$ private final static String PATH_SEPARATOR = "/"; //$NON-NLS-1$ private final static String INDEX_ATTR = "index"; //$NON-NLS-1$ private final static String LIB_ATTR = "libraries"; //$NON-NLS-1$ private final static String PARENT_ATTR = "parent"; //$NON-NLS-1$ static { IExtensionRegistry registry = Platform.getExtensionRegistry(); configurationElements = registry.getConfigurationElementsFor(EXTENSION_POINT_ID); } /** * DOC ycbai Comment method "getClassLoader". * * @param index * @return the classLoader by index */ public static DynamicClassLoader getClassLoader(String index) { return getClassLoader(index, true); } public static DynamicClassLoader getClassLoader(String index, boolean showDownloadIfNotExist) { if (classLoadersMap == null) { init(); } DynamicClassLoader classLoader = classLoadersMap.get(index); if (classLoader == null) { classLoader = findLoader(index, null, showDownloadIfNotExist); } return classLoader; } public static DynamicClassLoader getClassLoader(String index, ClassLoader parentClassLoader) { if (classLoadersMap == null) { init(); } DynamicClassLoader classLoader = classLoadersMap.get(index); if (classLoader == null) { classLoader = findLoader(index, parentClassLoader, true); } return classLoader; } public static DynamicClassLoader getCustomClassLoader(String index, String jarsStr) { return getCustomClassLoader(index, jarsStr, SEPARATOR); } protected static DynamicClassLoader getCustomClassLoader(String index, String jars, String jarSeparator) { Set<String> jarSet = new HashSet<String>(); if (StringUtils.isNotBlank(jars)) { String[] jarsArray = jars.split(jarSeparator); for (String jar : jarsArray) { jarSet.add(jar); } } return getCustomClassLoader(index, jarSet); } /** * DOC ycbai Comment method "getCustomClassLoader". * * @param index * @param libraries * @return the classLoader by specific libraries */ public static DynamicClassLoader getCustomClassLoader(String index, Set<String> libraries) { if (libraries == null || libraries.size() == 0) { return null; } DynamicClassLoader classLoader = getClassLoader(index); if (classLoader == null) { classLoader = createCustomClassLoader(index, libraries); } else { boolean changed; Set<String> oldLibraries = classLoader.getLibraries(); Set<String> oldLibrariesClone = new HashSet<String>(oldLibraries); changed = oldLibrariesClone.retainAll(libraries); if (!changed) { Set<String> newLibrariesClone = new HashSet<String>(libraries); changed = newLibrariesClone.retainAll(oldLibraries); } if (changed) { File libFolder = new File(classLoader.getLibStorePath()); if (libFolder.exists()) { FilesUtils.removeFolder(libFolder, true); } classLoader = createCustomClassLoader(index, libraries); } } return classLoader; } private static DynamicClassLoader createCustomClassLoader(String index, Set<String> libraries) { DynamicClassLoader classLoader = new DynamicClassLoader(); loadLibraries(classLoader, libraries.toArray(new String[0]), true); classLoadersMap.put(index, classLoader); return classLoader; } private static void init() { File tmpFolder = getTmpFolder(); if (tmpFolder.exists()) { FilesUtils.removeFolder(tmpFolder, true); } classLoadersMap = new ConcurrentHashMap<String, DynamicClassLoader>(); } private static synchronized DynamicClassLoader findLoader(String index, ClassLoader parentLoader, boolean showDownloadIfNotExist) { if (index != null && configurationElements != null) { for (IConfigurationElement current : configurationElements) { String key = current.getAttribute(INDEX_ATTR); if (index.equals(key)) { String libraries = current.getAttribute(LIB_ATTR); if (StringUtils.isNotEmpty(index)) { DynamicClassLoader classLoader = null; ClassLoader parentClassLoader = null; String parentKey = current.getAttribute(PARENT_ATTR); // take parent classlaoder in extensions first if (StringUtils.isNotEmpty(parentKey)) { parentClassLoader = getClassLoader(parentKey, showDownloadIfNotExist); } if (parentClassLoader == null) { parentClassLoader = parentLoader; } if (parentClassLoader == null) { classLoader = new DynamicClassLoader(); } else { classLoader = new DynamicClassLoader(parentClassLoader); } boolean putInCache = true; if (StringUtils.isNotEmpty(libraries)) { String[] librariesArray = libraries.split(SEPARATOR); putInCache = loadLibraries(classLoader, librariesArray, showDownloadIfNotExist); } if (putInCache) { // if any libraries can't be retreived , do not put it in cache classLoadersMap.put(index, classLoader); } return classLoader; } } } } return null; } private static boolean loadLibraries(DynamicClassLoader classLoader, String[] driversArray, boolean showDownloadIfNotExist) { List<String> jarPathList = new ArrayList<String>(); if (driversArray == null || driversArray.length == 0) { return true; } ILibraryManagerService librairesManagerService = (ILibraryManagerService) GlobalServiceRegister.getDefault().getService( ILibraryManagerService.class); String libPath = getLibPath(); List<String> driverNotExist = new ArrayList<String>(); for (String driverName : driversArray) { String jarPath = libPath + PATH_SEPARATOR + driverName; File jarFile = new File(jarPath); if (!jarFile.exists()) { driverNotExist.add(driverName); } jarPathList.add(jarFile.getAbsolutePath()); } // retreive all needed libs in one time boolean putInCache = false; if (!driverNotExist.isEmpty()) { putInCache = librairesManagerService.retrieve(driverNotExist, libPath, showDownloadIfNotExist, new NullProgressMonitor()); } classLoader.setLibStorePath(libPath); classLoader.addLibraries(jarPathList); return putInCache; } public static String getLibPath() { File tmpFolder = getTmpFolder(); if (!tmpFolder.exists()) { tmpFolder.mkdirs(); } try { tmpFolder = File.createTempFile("libs", null, tmpFolder); //$NON-NLS-1$ if (tmpFolder.exists() && tmpFolder.isFile()) { tmpFolder.delete(); tmpFolder.mkdirs(); } } catch (IOException e) { // do nothing } return tmpFolder.getAbsolutePath(); } private static File getTmpFolder() { Project project = ProjectManager.getInstance().getCurrentProject(); IProject physProject; String tmpFolderPath = System.getProperty("user.dir"); //$NON-NLS-1$ try { physProject = ResourceUtils.getProject(project.getTechnicalLabel()); tmpFolderPath = physProject.getFolder("temp").getLocation().toPortableString(); //$NON-NLS-1$ } catch (Exception e) { ExceptionHandler.process(e); } tmpFolderPath = tmpFolderPath + "/libraries"; //$NON-NLS-1$ return new File(tmpFolderPath); } public static String[] getDriverModuleList(IMetadataConnection metadataConn) { String[] moduleList; String distroKey = (String) metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_HIVE_DISTRIBUTION); String distroVersion = (String) metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_HIVE_VERSION); String hiveModel = (String) metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_HIVE_MODE); if (HiveConnUtils.isCustomDistro(distroKey)) { String jarsStr = (String) metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CUSTOM_JARS); moduleList = jarsStr.split(";"); //$NON-NLS-1$ } else { String index = "HIVE" + ":" + distroKey + ":" + distroVersion + ":" + hiveModel; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ moduleList = getDriverModuleList(index); } return moduleList; } public static String[] getDriverModuleList(String connKeyString) { if (connKeyString != null && configurationElements != null) { for (IConfigurationElement current : configurationElements) { String key = current.getAttribute(INDEX_ATTR); if (connKeyString.equals(key)) { String libraries = current.getAttribute(LIB_ATTR); if (StringUtils.isNotEmpty(libraries)) { String[] librariesArray = libraries.split(SEPARATOR); return librariesArray; } } } } return null; } }
3e0d565732beb3118f2370ce39fa38ec52ad184a
2,236
java
Java
Java/FileSpace01/src/cn/chenxhusky/FileSpace/po/User.java
husky00/Java
b2e72d320492ac1dd7d089e62c6a5e169975a619
[ "Apache-2.0" ]
null
null
null
Java/FileSpace01/src/cn/chenxhusky/FileSpace/po/User.java
husky00/Java
b2e72d320492ac1dd7d089e62c6a5e169975a619
[ "Apache-2.0" ]
null
null
null
Java/FileSpace01/src/cn/chenxhusky/FileSpace/po/User.java
husky00/Java
b2e72d320492ac1dd7d089e62c6a5e169975a619
[ "Apache-2.0" ]
null
null
null
19.443478
112
0.604204
5,653
package cn.chenxhusky.FileSpace.po; /** * 用户类(标识用户的基本信息,其中用is administrator标示是否是管理员 1表示这是管理员) * @author husky * */ public class User { //基本属性 private int userid; private String uname; private String upass; private String email; private int isadmin; //判断是否是管理员,0不是,1是 private int sex; //判断性别 1男0女 private String phone; //构造方法 /** * 全参构造函数,用于修改个人信息 * @param userid * @param uname * @param upass * @param email * @param isadmin * @param sex * @param phone */ public User(int userid, String uname, String upass, String email, int isadmin, int sex, String phone) { super(); this.userid = userid; this.uname = uname; this.upass = upass; this.email = email; this.isadmin = isadmin; this.sex = sex; this.phone = phone; } /** * 四参构造函数,用于管理员添加用户 * @param uname * @param upass * @param isadmin * @param sex */ public User(String uname, String upass, int isadmin, int sex) { super(); this.uname = uname; this.upass = upass; this.isadmin = isadmin; this.sex = sex; } /** * 无参构造函数,用于读取数据库 */ public User() { super(); } //getter与setter方法 public int getUserid() { return userid; } public void setUserid(int userid) { this.userid = userid; } public String getUname() { return uname; } public void setUname(String uname) { this.uname = uname; } public String getUpass() { return upass; } public void setUpass(String upass) { this.upass = upass; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public int getIsadmin() { return isadmin; } public void setIsadmin(int isadmin) { this.isadmin = isadmin; } public int getSex() { return sex; } public void setSex(int sex) { this.sex = sex; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } /** * toString重写 */ @Override public String toString() { return "User [userid=" + userid + ", uname=" + uname + ", upass=" + upass + ", email=" + email + ", isadmin=" + isadmin + ", sex=" + sex + ", phone=" + phone + "]"; } }
3e0d56acb6c1c8b09d58ca33656db1d53b75f6ce
37
java
Java
Jan13/src/uic/edu/MainTest.java
0x1DOCD00D/ProgLangDesign_Spring2021
9fa076586cb83e4f4e6b49e57027deb43593abe4
[ "Apache-2.0" ]
3
2021-02-19T22:50:08.000Z
2021-04-14T22:58:14.000Z
Jan13/src/uic/edu/MainTest.java
0x1DOCD00D/ProgLangDesign_Spring2021
9fa076586cb83e4f4e6b49e57027deb43593abe4
[ "Apache-2.0" ]
null
null
null
Jan13/src/uic/edu/MainTest.java
0x1DOCD00D/ProgLangDesign_Spring2021
9fa076586cb83e4f4e6b49e57027deb43593abe4
[ "Apache-2.0" ]
8
2021-02-08T21:04:11.000Z
2021-02-25T01:17:12.000Z
7.4
16
0.702703
5,654
package uic.edu; class MainTest { }
3e0d58874128caa1c9e7a3b81e91978b6df6af88
2,421
java
Java
corvus-main/src/main/java/hk/hku/cecid/piazza/corvus/core/main/listener/WSPingService.java
iamhuwjones/hermes
594b2849c4f3290955ee33d02574a1856be212f9
[ "BSD-2-Clause" ]
null
null
null
corvus-main/src/main/java/hk/hku/cecid/piazza/corvus/core/main/listener/WSPingService.java
iamhuwjones/hermes
594b2849c4f3290955ee33d02574a1856be212f9
[ "BSD-2-Clause" ]
null
null
null
corvus-main/src/main/java/hk/hku/cecid/piazza/corvus/core/main/listener/WSPingService.java
iamhuwjones/hermes
594b2849c4f3290955ee33d02574a1856be212f9
[ "BSD-2-Clause" ]
null
null
null
39.688525
97
0.589839
5,655
package hk.hku.cecid.piazza.corvus.core.main.listener; import hk.hku.cecid.piazza.commons.Sys; import hk.hku.cecid.piazza.commons.soap.SOAPFaultException; import hk.hku.cecid.piazza.commons.soap.SOAPRequestException; import hk.hku.cecid.piazza.commons.soap.WebServicesAdaptor; import javax.xml.soap.Name; import javax.xml.soap.SOAPElement; /** * WSPingService is a simple web service which provides a ping-pong function. * * @author Hugo Y. K. Lam * */ public class WSPingService extends WebServicesAdaptor { /** * Processes the web service ping and replies with a pong message. * * @throws SOAPRequestException if unable to process the ping request. */ public SOAPElement[] serviceRequested(SOAPElement[] bodies) throws SOAPRequestException { try { Name actionName = super.soapFactory.createName("action", "", "http://service.main.core.corvus.piazza.cecid.hku.hk/"); Name actionTypeName = super.soapFactory.createName("type", "", "http://www.w3.org/2001/XMLSchema-instance"); if (bodies.length > 0 && "ping".equalsIgnoreCase(bodies[0].getValue() ) && "action".equals(bodies[0].getElementName().getLocalName() )) { Sys.main.log.debug("Web Services Ping request received"); SOAPElement actionElement = super.soapFactory.createElement(actionName); actionElement.addNamespaceDeclaration("xsd", "http://www.w3.org/2001/XMLSchema"); actionElement.addAttribute(actionTypeName, "xsd:string"); actionElement.addTextNode("pong"); return new SOAPElement[]{actionElement}; } else { Sys.main.log .debug("Invalid Web Services Ping request received"); SOAPFaultException sfe = new SOAPFaultException( SOAPFaultException.SOAP_FAULT_CLIENT, "Invalid body content"); sfe.addDetailEntry(actionName, "Action not specified or invalid"); throw sfe; } } catch (Exception e) { throw new SOAPRequestException( "Error in processing WS ping request", e); } } }
3e0d5906acd827be5bac30d8200e1bd189b8e70c
1,661
java
Java
src/lms/CreateStudent.java
GrayHat12/GRAY-LMS
b9376df84c730e3fc64a23e32fbcb2079d7202a9
[ "MIT" ]
1
2019-03-29T14:37:11.000Z
2019-03-29T14:37:11.000Z
src/lms/CreateStudent.java
GrayHat12/GRAY-LMS
b9376df84c730e3fc64a23e32fbcb2079d7202a9
[ "MIT" ]
null
null
null
src/lms/CreateStudent.java
GrayHat12/GRAY-LMS
b9376df84c730e3fc64a23e32fbcb2079d7202a9
[ "MIT" ]
null
null
null
26.365079
79
0.568332
5,656
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package lms; import java.io.File; import java.io.FileWriter; import java.io.IOException; /** * * @author GrayHat */ public class CreateStudent { private String NAME="#nill#"; private int[] phno=new int[10]; private String id="#sample-id#"; public CreateStudent(String name, String phone)throws Exception { NAME=name; int[] phn=new int[10]; for(int i=0;i<phone.length();i++) phn[i]=Integer.parseInt(""+phone.charAt(i)); phno=phn; createId(); createDatabse(); } private void createId() { id=""+NAME.substring(NAME.length()/2)+phno[6]+phno[7]+phno[8]+phno[9]; id=id.trim(); } private void createDatabse()throws Exception { File dir = new File("student//"+id);//.mkdirs(); dir.mkdirs(); File filename=new File(dir,"name"); File filephne=new File(dir,"phone"); File filedown=new File(dir,"downloads"); try (FileWriter fw = new FileWriter(filename)) { fw.write(NAME); fw.close(); } catch (IOException err) { } try (FileWriter fw = new FileWriter(filephne)) { fw.write(phno.toString()); fw.close(); } catch (IOException err) { } try (FileWriter fw = new FileWriter(filedown)) { fw.write(""); fw.close(); } catch (IOException err) { } } String getId() { return id; } }
3e0d590d35b8fbd000e24c127e8c50c31df97086
2,538
java
Java
src/main/java/weblogic/logging/exporter/config/FilterConfig.java
bluetree24/weblogic-logging-exporter
62e6c513c1c0f4d7e01963fd7ab87b3e915cf645
[ "UPL-1.0", "Apache-2.0" ]
null
null
null
src/main/java/weblogic/logging/exporter/config/FilterConfig.java
bluetree24/weblogic-logging-exporter
62e6c513c1c0f4d7e01963fd7ab87b3e915cf645
[ "UPL-1.0", "Apache-2.0" ]
null
null
null
src/main/java/weblogic/logging/exporter/config/FilterConfig.java
bluetree24/weblogic-logging-exporter
62e6c513c1c0f4d7e01963fd7ab87b3e915cf645
[ "UPL-1.0", "Apache-2.0" ]
null
null
null
29.172414
104
0.674941
5,657
/* * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. */ package weblogic.logging.exporter.config; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import weblogic.diagnostics.logging.LogVariablesImpl; import weblogic.diagnostics.query.Query; import weblogic.diagnostics.query.QueryException; import weblogic.diagnostics.query.QueryFactory; public class FilterConfig { private static final String EXPRESSION = "FilterExpression"; private static final String SERVERS = "FilterServers"; private String expression; private String[] servers = new String[0]; private Query query = null; private FilterConfig(Map<String, Object> map) { for (String key : map.keySet()) { switch (key) { case EXPRESSION: expression = MapUtils.getStringValue(map, EXPRESSION); try { LogVariablesImpl lv = LogVariablesImpl.getInstance(); query = QueryFactory.createQuery(lv, lv, expression); } catch (QueryException ex) { System.out.println("Error Parsing expression: " + expression); } break; case SERVERS: setServers(MapUtils.getStringArray(map, SERVERS)); break; default: break; } } } static FilterConfig create(Map<String, Object> map) { return new FilterConfig(map); } private void setServers(String[] values) { if (values.length == 0) throw new ConfigurationException("Values specified as empty array"); Set<String> uniqueValues = new HashSet<>(Arrays.asList(values)); if (values.length != uniqueValues.size()) reportDuplicateValues(values, uniqueValues); this.servers = values; } private void reportDuplicateValues(String[] values, Set<String> uniqueValues) { ArrayList<String> duplicate = new ArrayList<>(Arrays.asList(values)); for (String unique : uniqueValues) duplicate.remove(unique); throw new ConfigurationException("Duplicate values for " + duplicate); } public Query getQuery() { return query; } public List<String> getServers() { return Arrays.asList(servers); } @Override public String toString() { return "FilterConfig{" + "expression='" + expression + '\'' + ", servers=" + Arrays.toString(servers) + '}'; } }
3e0d5ae4b1454f4c524dce84472f7e906b083d3c
16,680
java
Java
projects/OG-Bloomberg/src/main/java/com/opengamma/bbg/component/BloombergReferenceDataProviderComponentFactory.java
antikas/OG-Platform
aa683c63e58d33e34cca691290370d71a454077c
[ "Apache-2.0" ]
1
2020-04-07T12:04:40.000Z
2020-04-07T12:04:40.000Z
projects/OG-Bloomberg/src/main/java/com/opengamma/bbg/component/BloombergReferenceDataProviderComponentFactory.java
antikas/OG-Platform
aa683c63e58d33e34cca691290370d71a454077c
[ "Apache-2.0" ]
null
null
null
projects/OG-Bloomberg/src/main/java/com/opengamma/bbg/component/BloombergReferenceDataProviderComponentFactory.java
antikas/OG-Platform
aa683c63e58d33e34cca691290370d71a454077c
[ "Apache-2.0" ]
null
null
null
35.414013
148
0.688429
5,658
/** * Copyright (C) 2012 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.opengamma.bbg.component; import java.util.LinkedHashMap; import java.util.Map; import net.sf.ehcache.CacheManager; import org.joda.beans.BeanBuilder; import org.joda.beans.BeanDefinition; import org.joda.beans.JodaBeanUtils; import org.joda.beans.MetaProperty; import org.joda.beans.Property; import org.joda.beans.PropertyDefinition; import org.joda.beans.impl.direct.DirectBeanBuilder; import org.joda.beans.impl.direct.DirectMetaProperty; import org.joda.beans.impl.direct.DirectMetaPropertyMap; import com.opengamma.bbg.BloombergConnector; import com.opengamma.bbg.referencedata.ReferenceDataProvider; import com.opengamma.bbg.referencedata.cache.EHValueCachingReferenceDataProvider; import com.opengamma.bbg.referencedata.cache.InMemoryInvalidFieldCachingReferenceDataProvider; import com.opengamma.bbg.referencedata.cache.MongoDBInvalidFieldCachingReferenceDataProvider; import com.opengamma.bbg.referencedata.cache.MongoDBValueCachingReferenceDataProvider; import com.opengamma.bbg.referencedata.impl.BloombergReferenceDataProvider; import com.opengamma.bbg.referencedata.impl.DataReferenceDataProviderResource; import com.opengamma.bbg.referencedata.impl.RemoteReferenceDataProvider; import com.opengamma.component.ComponentInfo; import com.opengamma.component.ComponentRepository; import com.opengamma.component.factory.AbstractComponentFactory; import com.opengamma.component.factory.ComponentInfoAttributes; import com.opengamma.util.mongo.MongoConnector; /** * Component factory for the Bloomberg reference data provider. */ @BeanDefinition public class BloombergReferenceDataProviderComponentFactory extends AbstractComponentFactory { /** * The classifier that the factory should publish under. */ @PropertyDefinition(validate = "notNull") private String _classifier; /** * The flag determining whether the component should be published by REST (default true). */ @PropertyDefinition private boolean _publishRest = true; /** * The Bloomberg connector. */ @PropertyDefinition(validate = "notNull") private BloombergConnector _bloombergConnector; /** * The Mongo connector. * If a Mongo connector is specified, then it is used for caching. */ @PropertyDefinition private MongoConnector _mongoConnector; /** * The cache manager. * If a Mongo connector is specified, then this is not used. * If a Mongo connector is not specified and this is, then EH cache is used. */ @PropertyDefinition private CacheManager _cacheManager; //------------------------------------------------------------------------- @Override public void init(ComponentRepository repo, LinkedHashMap<String, String> configuration) throws Exception { final ReferenceDataProvider provider = initReferenceDataProvider(repo); final ComponentInfo info = new ComponentInfo(ReferenceDataProvider.class, getClassifier()); info.addAttribute(ComponentInfoAttributes.LEVEL, 1); info.addAttribute(ComponentInfoAttributes.REMOTE_CLIENT_JAVA, RemoteReferenceDataProvider.class); repo.registerComponent(info, provider); if (isPublishRest()) { repo.getRestComponents().publish(info, new DataReferenceDataProviderResource(provider)); } } /** * Creates the provider. * * @param repo the repository, not null * @return the provider, not null */ protected ReferenceDataProvider initReferenceDataProvider(ComponentRepository repo) { BloombergConnector bloombergConnector = getBloombergConnector(); BloombergReferenceDataProvider underlying = new BloombergReferenceDataProvider(bloombergConnector); repo.registerLifecycle(underlying); MongoConnector mongoConnector = getMongoConnector(); CacheManager cacheManager = getCacheManager(); if (mongoConnector != null) { MongoDBInvalidFieldCachingReferenceDataProvider fieldCached = new MongoDBInvalidFieldCachingReferenceDataProvider(underlying, mongoConnector); return new MongoDBValueCachingReferenceDataProvider(fieldCached, mongoConnector); } else if (cacheManager != null) { ReferenceDataProvider fieldCached = new InMemoryInvalidFieldCachingReferenceDataProvider(underlying); // TODO: EHcached version return new EHValueCachingReferenceDataProvider(fieldCached, cacheManager); } else { return new InMemoryInvalidFieldCachingReferenceDataProvider(underlying); } } //------------------------- AUTOGENERATED START ------------------------- ///CLOVER:OFF /** * The meta-bean for {@code BloombergReferenceDataProviderComponentFactory}. * @return the meta-bean, not null */ public static BloombergReferenceDataProviderComponentFactory.Meta meta() { return BloombergReferenceDataProviderComponentFactory.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(BloombergReferenceDataProviderComponentFactory.Meta.INSTANCE); } @Override public BloombergReferenceDataProviderComponentFactory.Meta metaBean() { return BloombergReferenceDataProviderComponentFactory.Meta.INSTANCE; } @Override protected Object propertyGet(String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case -281470431: // classifier return getClassifier(); case -614707837: // publishRest return isPublishRest(); case 2061648978: // bloombergConnector return getBloombergConnector(); case 224118201: // mongoConnector return getMongoConnector(); case -1452875317: // cacheManager return getCacheManager(); } return super.propertyGet(propertyName, quiet); } @Override protected void propertySet(String propertyName, Object newValue, boolean quiet) { switch (propertyName.hashCode()) { case -281470431: // classifier setClassifier((String) newValue); return; case -614707837: // publishRest setPublishRest((Boolean) newValue); return; case 2061648978: // bloombergConnector setBloombergConnector((BloombergConnector) newValue); return; case 224118201: // mongoConnector setMongoConnector((MongoConnector) newValue); return; case -1452875317: // cacheManager setCacheManager((CacheManager) newValue); return; } super.propertySet(propertyName, newValue, quiet); } @Override protected void validate() { JodaBeanUtils.notNull(_classifier, "classifier"); JodaBeanUtils.notNull(_bloombergConnector, "bloombergConnector"); super.validate(); } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj != null && obj.getClass() == this.getClass()) { BloombergReferenceDataProviderComponentFactory other = (BloombergReferenceDataProviderComponentFactory) obj; return JodaBeanUtils.equal(getClassifier(), other.getClassifier()) && JodaBeanUtils.equal(isPublishRest(), other.isPublishRest()) && JodaBeanUtils.equal(getBloombergConnector(), other.getBloombergConnector()) && JodaBeanUtils.equal(getMongoConnector(), other.getMongoConnector()) && JodaBeanUtils.equal(getCacheManager(), other.getCacheManager()) && super.equals(obj); } return false; } @Override public int hashCode() { int hash = 7; hash += hash * 31 + JodaBeanUtils.hashCode(getClassifier()); hash += hash * 31 + JodaBeanUtils.hashCode(isPublishRest()); hash += hash * 31 + JodaBeanUtils.hashCode(getBloombergConnector()); hash += hash * 31 + JodaBeanUtils.hashCode(getMongoConnector()); hash += hash * 31 + JodaBeanUtils.hashCode(getCacheManager()); return hash ^ super.hashCode(); } //----------------------------------------------------------------------- /** * Gets the classifier that the factory should publish under. * @return the value of the property, not null */ public String getClassifier() { return _classifier; } /** * Sets the classifier that the factory should publish under. * @param classifier the new value of the property, not null */ public void setClassifier(String classifier) { JodaBeanUtils.notNull(classifier, "classifier"); this._classifier = classifier; } /** * Gets the the {@code classifier} property. * @return the property, not null */ public final Property<String> classifier() { return metaBean().classifier().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the flag determining whether the component should be published by REST (default true). * @return the value of the property */ public boolean isPublishRest() { return _publishRest; } /** * Sets the flag determining whether the component should be published by REST (default true). * @param publishRest the new value of the property */ public void setPublishRest(boolean publishRest) { this._publishRest = publishRest; } /** * Gets the the {@code publishRest} property. * @return the property, not null */ public final Property<Boolean> publishRest() { return metaBean().publishRest().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the Bloomberg connector. * @return the value of the property, not null */ public BloombergConnector getBloombergConnector() { return _bloombergConnector; } /** * Sets the Bloomberg connector. * @param bloombergConnector the new value of the property, not null */ public void setBloombergConnector(BloombergConnector bloombergConnector) { JodaBeanUtils.notNull(bloombergConnector, "bloombergConnector"); this._bloombergConnector = bloombergConnector; } /** * Gets the the {@code bloombergConnector} property. * @return the property, not null */ public final Property<BloombergConnector> bloombergConnector() { return metaBean().bloombergConnector().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the Mongo connector. * If a Mongo connector is specified, then it is used for caching. * @return the value of the property */ public MongoConnector getMongoConnector() { return _mongoConnector; } /** * Sets the Mongo connector. * If a Mongo connector is specified, then it is used for caching. * @param mongoConnector the new value of the property */ public void setMongoConnector(MongoConnector mongoConnector) { this._mongoConnector = mongoConnector; } /** * Gets the the {@code mongoConnector} property. * If a Mongo connector is specified, then it is used for caching. * @return the property, not null */ public final Property<MongoConnector> mongoConnector() { return metaBean().mongoConnector().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the cache manager. * If a Mongo connector is specified, then this is not used. * If a Mongo connector is not specified and this is, then EH cache is used. * @return the value of the property */ public CacheManager getCacheManager() { return _cacheManager; } /** * Sets the cache manager. * If a Mongo connector is specified, then this is not used. * If a Mongo connector is not specified and this is, then EH cache is used. * @param cacheManager the new value of the property */ public void setCacheManager(CacheManager cacheManager) { this._cacheManager = cacheManager; } /** * Gets the the {@code cacheManager} property. * If a Mongo connector is specified, then this is not used. * If a Mongo connector is not specified and this is, then EH cache is used. * @return the property, not null */ public final Property<CacheManager> cacheManager() { return metaBean().cacheManager().createProperty(this); } //----------------------------------------------------------------------- /** * The meta-bean for {@code BloombergReferenceDataProviderComponentFactory}. */ public static class Meta extends AbstractComponentFactory.Meta { /** * The singleton instance of the meta-bean. */ static final Meta INSTANCE = new Meta(); /** * The meta-property for the {@code classifier} property. */ private final MetaProperty<String> _classifier = DirectMetaProperty.ofReadWrite( this, "classifier", BloombergReferenceDataProviderComponentFactory.class, String.class); /** * The meta-property for the {@code publishRest} property. */ private final MetaProperty<Boolean> _publishRest = DirectMetaProperty.ofReadWrite( this, "publishRest", BloombergReferenceDataProviderComponentFactory.class, Boolean.TYPE); /** * The meta-property for the {@code bloombergConnector} property. */ private final MetaProperty<BloombergConnector> _bloombergConnector = DirectMetaProperty.ofReadWrite( this, "bloombergConnector", BloombergReferenceDataProviderComponentFactory.class, BloombergConnector.class); /** * The meta-property for the {@code mongoConnector} property. */ private final MetaProperty<MongoConnector> _mongoConnector = DirectMetaProperty.ofReadWrite( this, "mongoConnector", BloombergReferenceDataProviderComponentFactory.class, MongoConnector.class); /** * The meta-property for the {@code cacheManager} property. */ private final MetaProperty<CacheManager> _cacheManager = DirectMetaProperty.ofReadWrite( this, "cacheManager", BloombergReferenceDataProviderComponentFactory.class, CacheManager.class); /** * The meta-properties. */ private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap( this, (DirectMetaPropertyMap) super.metaPropertyMap(), "classifier", "publishRest", "bloombergConnector", "mongoConnector", "cacheManager"); /** * Restricted constructor. */ protected Meta() { } @Override protected MetaProperty<?> metaPropertyGet(String propertyName) { switch (propertyName.hashCode()) { case -281470431: // classifier return _classifier; case -614707837: // publishRest return _publishRest; case 2061648978: // bloombergConnector return _bloombergConnector; case 224118201: // mongoConnector return _mongoConnector; case -1452875317: // cacheManager return _cacheManager; } return super.metaPropertyGet(propertyName); } @Override public BeanBuilder<? extends BloombergReferenceDataProviderComponentFactory> builder() { return new DirectBeanBuilder<BloombergReferenceDataProviderComponentFactory>(new BloombergReferenceDataProviderComponentFactory()); } @Override public Class<? extends BloombergReferenceDataProviderComponentFactory> beanType() { return BloombergReferenceDataProviderComponentFactory.class; } @Override public Map<String, MetaProperty<?>> metaPropertyMap() { return _metaPropertyMap$; } //----------------------------------------------------------------------- /** * The meta-property for the {@code classifier} property. * @return the meta-property, not null */ public final MetaProperty<String> classifier() { return _classifier; } /** * The meta-property for the {@code publishRest} property. * @return the meta-property, not null */ public final MetaProperty<Boolean> publishRest() { return _publishRest; } /** * The meta-property for the {@code bloombergConnector} property. * @return the meta-property, not null */ public final MetaProperty<BloombergConnector> bloombergConnector() { return _bloombergConnector; } /** * The meta-property for the {@code mongoConnector} property. * @return the meta-property, not null */ public final MetaProperty<MongoConnector> mongoConnector() { return _mongoConnector; } /** * The meta-property for the {@code cacheManager} property. * @return the meta-property, not null */ public final MetaProperty<CacheManager> cacheManager() { return _cacheManager; } } ///CLOVER:ON //-------------------------- AUTOGENERATED END -------------------------- }
3e0d5c0a962c6bb5e66e0561f61d4946a775d70d
5,989
java
Java
client/app/src/main/java/us/grahn/trojanow/logic/Utilities.java
dgrahn/csci578
129dd204fdbeeed0596f8bdc482baa2e9b3f6e04
[ "MIT" ]
2
2015-04-29T23:06:58.000Z
2020-07-19T02:36:35.000Z
client/app/src/main/java/us/grahn/trojanow/logic/Utilities.java
dgrahn/csci578
129dd204fdbeeed0596f8bdc482baa2e9b3f6e04
[ "MIT" ]
null
null
null
client/app/src/main/java/us/grahn/trojanow/logic/Utilities.java
dgrahn/csci578
129dd204fdbeeed0596f8bdc482baa2e9b3f6e04
[ "MIT" ]
null
null
null
30.556122
104
0.641843
5,659
package us.grahn.trojanow.logic; import android.app.AlertDialog; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.util.JsonReader; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import java.util.List; import us.grahn.trojanow.R; import us.grahn.trojanow.data.Result; /** * Collection of utility methods. * * Created by Dan on 4/23/2015. */ public class Utilities { /** * The server where our data is located. */ private static final String SERVER = "http://69.133.29.104:3000/"; /** * Gets a URL. Returns null if the url isn't valid. Prepends the base server path. * * @param path the path from which to build the URL. * @return the URL */ public static URL getURL(final String path) { try { return new URL(SERVER + path); } catch(MalformedURLException e) { e.printStackTrace(); return null; } } /** * Gets a URL and interpolate the arguments. * * @param path the path from which to build the URL. * @param args the arguments to interpolate into the path * @return the URL */ public static URL getURL(final String path, final Object... args) { return getURL(String.format(path, args)); } /** * Creates a JSON reader from a URL. * * @param path the path from which to build the URL. * @param args the arguments to interpolate into the path * @return the JSON Reader * @throws IOException if there is an IO exception or the URL cannot be built. */ public static JsonReader getReader(final String path, final Object... args) throws IOException { URL url = getURL(path, args); if(url == null) { throw new IOException("Unable to create URL"); } URLConnection urlConnection = url.openConnection(); InputStream in = new BufferedInputStream(urlConnection.getInputStream()); return new JsonReader(new InputStreamReader(in, "UTF-8")); } /** * Posts values to a URL and returns the {@link JsonReader} * @param path * @param args * @return * @throws IOException */ public static JsonReader getReaderPost(final String path, final String... args) throws IOException { if(args.length % 2 != 0) throw new IllegalArgumentException("Invalid key/value combo."); // Build the post HttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(getURL(path).toExternalForm()); // Build the ARgs List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); for(int i = 0; i < args.length; i += 2) { nameValuePairs.add(new BasicNameValuePair(args[i], args[i + 1])); } httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); // Issue the command / Get the response HttpResponse response = httpClient.execute(httpPost); InputStream in = response.getEntity().getContent(); return new JsonReader(new InputStreamReader(in, "UTF-8")); } /** * Show's a dialog with an OK button. * * @param context the context for the dialog * @param title the title for the dialog * @param message the message for the dialog */ public static void showDialog(final Context context, final int title, final int message) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage(message); builder.setTitle(title); builder.setPositiveButton(R.string.ok, null); AlertDialog dialog = builder.create(); dialog.show(); } /** * Shows a dialog from a result. * * @param context the context for the dialog * @param result the result for the dialog */ public static void showDialog(final Context context, final Result result) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage(result.getMessage()); builder.setTitle(result.getTitle()); builder.setPositiveButton(R.string.ok, null); AlertDialog dialog = builder.create(); dialog.show(); } /** * Reads a result from a JsonReader. Closes the reader. * * @param reader the reader from which to read the result * @return the result * @throws IOException if there is an exception in the reader */ public static Result getResult(JsonReader reader) throws IOException { reader.beginObject(); Result result = new Result(); while(reader.hasNext()) { String name = reader.nextName(); if("code".equals(name)) { result.setCode(reader.nextInt()); } else if("message".equals(name)) { result.setMessage(reader.nextString()); } } reader.endObject(); reader.close(); return result; } /** * Gets an image from a URL. * * @param path the URL for the image * @return the image */ public static Bitmap getImage(final String path) { URL url = getURL(path); if(url == null) return null; try { InputStream stream = url.openStream(); return BitmapFactory.decodeStream(stream); } catch(IOException e) { return null; } } }
3e0d5cdb645f73129209e5df9da51231f9153415
2,619
java
Java
src/main/java/com/fasterxml/jackson/annotation/JsonUnwrapped.java
santosh653/jackson-annotations
1b49671e691c3be8ed724ac899d7ccb66665c203
[ "Apache-2.0" ]
74
2015-02-20T00:47:02.000Z
2021-12-28T12:40:50.000Z
src/main/java/com/fasterxml/jackson/annotation/JsonUnwrapped.java
santosh653/jackson-annotations
1b49671e691c3be8ed724ac899d7ccb66665c203
[ "Apache-2.0" ]
48
2015-04-17T06:15:14.000Z
2021-10-01T09:37:32.000Z
src/main/java/com/fasterxml/jackson/annotation/JsonUnwrapped.java
santosh653/jackson-annotations
1b49671e691c3be8ed724ac899d7ccb66665c203
[ "Apache-2.0" ]
35
2015-03-02T21:34:46.000Z
2022-02-25T10:48:33.000Z
29.1
100
0.666667
5,660
package com.fasterxml.jackson.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation used to indicate that a property should be serialized * "unwrapped"; that is, if it would be serialized as JSON Object, its * properties are instead included as properties of its containing * Object. For example, consider case of POJO like: * *<pre> * public class Parent { * public int age; * public Name name; * } * public class Name { * public String first, last; * } *</pre> * which would normally be serialized as follows (assuming @JsonUnwrapped * had no effect): *<pre> * { * "age" : 18, * "name" : { * "first" : "Joey", * "last" : "Sixpack" * } * } *</pre> * can be changed to this: *<pre> * { * "age" : 18, * "first" : "Joey", * "last" : "Sixpack" * } *</pre> * by changing Parent class to: *<pre> * public class Parent { * public int age; * &#064;JsonUnwrapped * public Name name; * } *</pre> * Annotation can only be added to properties, and not classes, as it is contextual. *<p> * Also note that annotation only applies if *<ul> * <li>Value is serialized as JSON Object (can not unwrap JSON arrays using this * mechanism) * </li> * <li>Serialization is done using <code>BeanSerializer</code>, not a custom serializer * </li> * <li>No type information is added; if type information needs to be added, structure can * not be altered regardless of inclusion strategy; so annotation is basically ignored. * </li> * </ul> */ @Target({ElementType.ANNOTATION_TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotation public @interface JsonUnwrapped { /** * Property that is usually only used when overriding (masking) annotations, * using mix-in annotations. Otherwise default value of 'true' is fine, and * value need not be explicitly included. */ boolean enabled() default true; /** * Optional property that can be used to add prefix String to use in front * of names of properties that are unwrapped: this can be done for example to prevent * name collisions. */ String prefix() default ""; /** * Optional property that can be used to add suffix String to append at the end * of names of properties that are unwrapped: this can be done for example to prevent * name collisions. */ String suffix() default ""; }
3e0d5d294da5ea8ef4ba0f9ee4490db99b48b6d2
1,113
java
Java
sample/src/main/java/ru/alexbykov/norecyclerviewadaptersample/SampleRecyclerViewAdapter.java
NoNews/NoRecyclerViewAdapter
ff12da898add9d816760664f51c702410b2013cc
[ "Apache-2.0" ]
3
2019-10-03T00:01:21.000Z
2021-05-03T10:17:02.000Z
sample/src/main/java/ru/alexbykov/norecyclerviewadaptersample/SampleRecyclerViewAdapter.java
NoNews/NoRecyclerViewAdapter
ff12da898add9d816760664f51c702410b2013cc
[ "Apache-2.0" ]
null
null
null
sample/src/main/java/ru/alexbykov/norecyclerviewadaptersample/SampleRecyclerViewAdapter.java
NoNews/NoRecyclerViewAdapter
ff12da898add9d816760664f51c702410b2013cc
[ "Apache-2.0" ]
2
2019-02-07T20:19:35.000Z
2020-03-28T08:01:37.000Z
25.837209
116
0.710171
5,661
package ru.alexbykov.norecyclerviewadaptersample; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import ru.alexbykov.norecyclerviewadapter.NoRecyclerViewAdapter; /** * @author Alex Bykov * Date: 08.01.2018. * <p> * You can contact me at nnheo@example.com */ public class SampleRecyclerViewAdapter extends NoRecyclerViewAdapter<String, SampleRecyclerViewAdapter.ViewHolder> { private static final int LAYOUT = R.layout.item_sample; @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { return new ViewHolder(inflate(parent, LAYOUT)); } @Override public void onBindViewHolder(ViewHolder holder, int position) { holder.tvSample.setText(items.get(position)); } public static class ViewHolder extends RecyclerView.ViewHolder { private TextView tvSample; public ViewHolder(View itemView) { super(itemView); tvSample = itemView.findViewById(R.id.tvSample); } } }
3e0d5e3b90d1b6df5eb635d8dba57031f2793599
1,698
java
Java
src/main/java/com/tibco/dovetail/core/model/metadata/Metadata.java
mwenyan/dovetail-java-lib-1
ed44727bfdb41050fc8bd764e72d7531d9898042
[ "BSD-3-Clause" ]
1
2020-05-28T16:17:56.000Z
2020-05-28T16:17:56.000Z
src/main/java/com/tibco/dovetail/core/model/metadata/Metadata.java
mwenyan/dovetail-java-lib-1
ed44727bfdb41050fc8bd764e72d7531d9898042
[ "BSD-3-Clause" ]
62
2019-04-04T14:22:41.000Z
2021-12-09T20:43:05.000Z
src/main/java/com/tibco/dovetail/core/model/metadata/Metadata.java
mwenyan/dovetail-java-lib-1
ed44727bfdb41050fc8bd764e72d7531d9898042
[ "BSD-3-Clause" ]
3
2018-11-30T22:01:48.000Z
2019-08-29T09:44:07.000Z
24.970588
93
0.689635
5,662
/* * Copyright © 2018. TIBCO Software Inc. * This file is subject to the license terms contained * in the license file that is distributed with this file. */ package com.tibco.dovetail.core.model.metadata; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @JsonIgnoreProperties(ignoreUnknown = true) public class Metadata { private String name; private ResourceType type; private String asset = null; private Map<String, String> authorizedUserAndCerts = new LinkedHashMap<String, String>(); private TimeWindow timewindow; public String getName() { return name; } public void setName(String name) { this.name = name; } public ResourceType getType() { return type; } public void setType(String type) { this.type = ResourceType.valueOf(type); } public Map<String, String> getAuthorizedUserAndCerts() { return authorizedUserAndCerts; } public void setActors(List<String> actors) { if(actors != null) { actors.forEach(a -> { String[] callers = a.split("\\|"); if(callers.length == 1) authorizedUserAndCerts.put(callers[0], null); else authorizedUserAndCerts.put(callers[0], callers[1]); }); } } public String getAsset() { return asset; } public void setAsset(String asset) { this.asset = asset; } public TimeWindow getTimewindow() { return timewindow; } public void setTimewindow(TimeWindow timewindow) { this.timewindow = timewindow; } public static enum ResourceType { Asset, Participant, Transaction, Event, Concept, ScheduledEvent } }
3e0d5eb67324fee7c796c074c8048f31912c8e8c
5,718
java
Java
corpus-index/src/main/java/com/github/poetry/pipeline/DistinctPipeline.java
YuyuZha0/corpus
fc74ad6f3c3262c1c0f6852b36f9504c5e46202c
[ "Apache-2.0" ]
1
2020-07-30T13:40:19.000Z
2020-07-30T13:40:19.000Z
corpus-index/src/main/java/com/github/poetry/pipeline/DistinctPipeline.java
YuyuZha0/corpus
fc74ad6f3c3262c1c0f6852b36f9504c5e46202c
[ "Apache-2.0" ]
1
2021-02-15T08:29:19.000Z
2021-02-15T08:29:19.000Z
corpus-index/src/main/java/com/github/poetry/pipeline/DistinctPipeline.java
YuyuZha0/corpus
fc74ad6f3c3262c1c0f6852b36f9504c5e46202c
[ "Apache-2.0" ]
null
null
null
34.035714
100
0.673662
5,663
package com.github.poetry.pipeline; import com.github.poetry.entity.GeneralChinesePoetry; import com.github.poetry.text.TextUtil; import com.google.common.graph.GraphBuilder; import com.google.common.graph.Graphs; import com.google.common.graph.MutableGraph; import com.google.common.util.concurrent.MoreExecutors; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.commons.text.similarity.JaroWinklerSimilarity; import java.text.DecimalFormat; import java.time.Duration; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; /** * @author zhaoyuyu * @since 2020/2/4 */ @Slf4j public final class DistinctPipeline extends ForwardingPipeline { private static final double SIMILAR_THRESHOLD = 0.9; private static final int MAX_CMP_LEN = 64; private final JaroWinklerSimilarity jaroWinklerSimilarity = new JaroWinklerSimilarity(); public DistinctPipeline(Pipeline next) { super(DistinctPipeline.class.getSimpleName(), next); } private static String toRawRepresentation(String content) { if (StringUtils.isEmpty(content)) { return content; } StringBuilder builder = new StringBuilder(MAX_CMP_LEN); for (int i = 0, len = content.length(); i < len; ++i) { if (TextUtil.isChineseCharacter(content, i)) { builder.append(content.charAt(i)); } if (builder.length() > MAX_CMP_LEN) { break; } } return builder.toString(); } private static String formatDiv(double a, double b) { return new DecimalFormat("#.##%").format(a / b); } @SuppressWarnings("UnstableApiUsage") private List<GeneralChinesePoetry> distinctForEachAuthor( String author, List<GeneralChinesePoetry> authorPoetryList) { final int size = authorPoetryList.size(); if (size < 2) { return authorPoetryList; } List<GeneralChinesePoetry> dump = new ArrayList<>(size); GeneralChinesePoetry[] a = authorPoetryList.toArray(new GeneralChinesePoetry[0]); MutableGraph<Integer> poetryIdGraph = GraphBuilder.undirected().allowsSelfLoops(false).expectedNodeCount(size).build(); String[] contents = new String[size]; for (int i = 0; i < size; ++i) { poetryIdGraph.addNode(i); contents[i] = toRawRepresentation(a[i].getContent()); } for (int i = 0; i < contents.length - 1; ++i) { for (int j = i + 1; j < contents.length; ++j) { if (isSimilar(contents[i], contents[j])) { poetryIdGraph.putEdge(i, j); } } } int distinctCount = 0; for (int i = 0; i < size; ++i) { if (poetryIdGraph.nodes().contains(i)) { Set<Integer> similarSet = Graphs.reachableNodes(poetryIdGraph, i); GeneralChinesePoetry poetry = a[i]; for (Integer id : similarSet) { poetry = prefer(poetry, a[id]); poetryIdGraph.removeNode(id); } poetryIdGraph.removeNode(i); dump.add(poetry); distinctCount++; } } log.info( "distinct[{}/{}:{}] finished for author [{}]", distinctCount, size, formatDiv(distinctCount, size), author); return dump; } private GeneralChinesePoetry prefer(GeneralChinesePoetry a, GeneralChinesePoetry b) { if (a.getTitle() == null) { return b; } if (b.getTitle() == null) { return a; } return a.getTitle().length() > b.getTitle().length() ? a : b; } private boolean isSimilar(String s1, String s2) { return jaroWinklerSimilarity.apply(s1, s2) >= SIMILAR_THRESHOLD; } @Override public void process(IndexContext ctx, Iterable<GeneralChinesePoetry> poetries) { Map<String, List<GeneralChinesePoetry>> authorPoetryMap = new HashMap<>(512); for (GeneralChinesePoetry poetry : poetries) { authorPoetryMap .compute( StringUtils.trimToEmpty(poetry.getAuthor()), (k, v) -> v == null ? new ArrayList<>() : v) .add(poetry); } int poetryCount = authorPoetryMap.values().stream().mapToInt(List::size).sum(); log.info("[{}] authors found, [{}] records found.", authorPoetryMap.size(), poetryCount); BlockingQueue<GeneralChinesePoetry> distinctResultQueue = new ArrayBlockingQueue<>(poetryCount); List<CompletableFuture<?>> futureList = new ArrayList<>(); ExecutorService executor = Executors.newWorkStealingPool(5); authorPoetryMap.forEach( (k, v) -> { CompletableFuture<?> future = CompletableFuture.supplyAsync(() -> distinctForEachAuthor(k, v), executor) .whenComplete( ((generalChinesePoetries, throwable) -> distinctResultQueue.addAll(generalChinesePoetries))); futureList.add(future); }); CompletableFuture.allOf(futureList.toArray(new CompletableFuture[0])).join(); //noinspection UnstableApiUsage MoreExecutors.shutdownAndAwaitTermination(executor, Duration.ofSeconds(2)); int distinctResultSize = distinctResultQueue.size(); log.info( "distinct finished, [{}/{}:{}] records after distinct.", distinctResultSize, poetryCount, formatDiv(distinctResultSize, poetryCount)); ctx.setApproxCount(distinctResultSize); List<GeneralChinesePoetry> poetries1 = new ArrayList<>(distinctResultSize); distinctResultQueue.drainTo(poetries1); forward(ctx, poetries1); } }
3e0d5f6ad2f1691f1ba3c738eb97bb21d440e166
2,959
java
Java
core/src/test/java/org/elasticsearch/index/fielddata/ordinals/SingleOrdinalsTests.java
diendt/elasticsearch
60465d5e04b9722064aff63a3ceba177ceaefdae
[ "Apache-2.0" ]
4
2015-05-15T20:08:35.000Z
2021-04-02T02:19:07.000Z
core/src/test/java/org/elasticsearch/index/fielddata/ordinals/SingleOrdinalsTests.java
diendt/elasticsearch
60465d5e04b9722064aff63a3ceba177ceaefdae
[ "Apache-2.0" ]
1
2021-07-06T08:41:41.000Z
2021-07-06T08:41:41.000Z
core/src/test/java/org/elasticsearch/index/fielddata/ordinals/SingleOrdinalsTests.java
diendt/elasticsearch
60465d5e04b9722064aff63a3ceba177ceaefdae
[ "Apache-2.0" ]
15
2017-01-12T10:16:22.000Z
2019-04-18T21:18:41.000Z
36.530864
92
0.694829
5,664
/* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch licenses this file to you under * the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.elasticsearch.index.fielddata.ordinals; import org.apache.lucene.index.DocValues; import org.apache.lucene.index.RandomAccessOrds; import org.apache.lucene.index.SortedDocValues; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESTestCase; import java.io.IOException; import java.util.HashMap; import java.util.Map; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.not; /** */ public class SingleOrdinalsTests extends ESTestCase { public void testSvValues() throws IOException { int numDocs = 1000000; int numOrdinals = numDocs / 4; Map<Integer, Long> controlDocToOrdinal = new HashMap<>(); OrdinalsBuilder builder = new OrdinalsBuilder(numDocs); long ordinal = builder.currentOrdinal(); for (int doc = 0; doc < numDocs; doc++) { if (doc % numOrdinals == 0) { ordinal = builder.nextOrdinal(); } controlDocToOrdinal.put(doc, ordinal); builder.addDoc(doc); } Ordinals ords = builder.build(Settings.EMPTY); assertThat(ords, instanceOf(SinglePackedOrdinals.class)); RandomAccessOrds docs = ords.ordinals(); final SortedDocValues singleOrds = DocValues.unwrapSingleton(docs); assertNotNull(singleOrds); for (Map.Entry<Integer, Long> entry : controlDocToOrdinal.entrySet()) { assertThat(entry.getValue(), equalTo((long) singleOrds.getOrd(entry.getKey()))); } } public void testMvOrdinalsTrigger() throws IOException { int numDocs = 1000000; OrdinalsBuilder builder = new OrdinalsBuilder(numDocs); builder.nextOrdinal(); for (int doc = 0; doc < numDocs; doc++) { builder.addDoc(doc); } Ordinals ords = builder.build(Settings.EMPTY); assertThat(ords, instanceOf(SinglePackedOrdinals.class)); builder.nextOrdinal(); builder.addDoc(0); ords = builder.build(Settings.EMPTY); assertThat(ords, not(instanceOf(SinglePackedOrdinals.class))); } }
3e0d62012ca97c300ed8effc98d56072d2cbf2d7
3,035
java
Java
main/plugins/org.talend.designer.components.libs/libs_src/crm4client/com/microsoft/schemas/crm/_2006/webservices/impl/DuplicateCollectionDocumentImpl.java
bgunics-talend/tdi-studio-se
3f54f55acb4d214f2d02532667bae98420068170
[ "Apache-2.0" ]
114
2015-03-05T15:34:59.000Z
2022-02-22T03:48:44.000Z
main/plugins/org.talend.designer.components.libs/libs_src/crm4client/com/microsoft/schemas/crm/_2006/webservices/impl/DuplicateCollectionDocumentImpl.java
bgunics-talend/tdi-studio-se
3f54f55acb4d214f2d02532667bae98420068170
[ "Apache-2.0" ]
1,137
2015-03-04T01:35:42.000Z
2022-03-29T06:03:17.000Z
main/plugins/org.talend.designer.components.libs/libs_src/crm4client/com/microsoft/schemas/crm/_2006/webservices/impl/DuplicateCollectionDocumentImpl.java
bgunics-talend/tdi-studio-se
3f54f55acb4d214f2d02532667bae98420068170
[ "Apache-2.0" ]
219
2015-01-21T10:42:18.000Z
2022-02-17T07:57:20.000Z
39.415584
190
0.666886
5,665
/* * An XML document type. * Localname: DuplicateCollection * Namespace: http://schemas.microsoft.com/crm/2006/WebServices * Java type: com.microsoft.schemas.crm._2006.webservices.DuplicateCollectionDocument * * Automatically generated - do not modify. */ package com.microsoft.schemas.crm._2006.webservices.impl; /** * A document containing one DuplicateCollection(@http://schemas.microsoft.com/crm/2006/WebServices) element. * * This is a complex type. */ public class DuplicateCollectionDocumentImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements com.microsoft.schemas.crm._2006.webservices.DuplicateCollectionDocument { public DuplicateCollectionDocumentImpl(org.apache.xmlbeans.SchemaType sType) { super(sType); } private static final javax.xml.namespace.QName DUPLICATECOLLECTION$0 = new javax.xml.namespace.QName("http://schemas.microsoft.com/crm/2006/WebServices", "DuplicateCollection"); /** * Gets the "DuplicateCollection" element */ public com.microsoft.schemas.crm._2006.webservices.BusinessEntityCollection getDuplicateCollection() { synchronized (monitor()) { check_orphaned(); com.microsoft.schemas.crm._2006.webservices.BusinessEntityCollection target = null; target = (com.microsoft.schemas.crm._2006.webservices.BusinessEntityCollection)get_store().find_element_user(DUPLICATECOLLECTION$0, 0); if (target == null) { return null; } return target; } } /** * Sets the "DuplicateCollection" element */ public void setDuplicateCollection(com.microsoft.schemas.crm._2006.webservices.BusinessEntityCollection duplicateCollection) { synchronized (monitor()) { check_orphaned(); com.microsoft.schemas.crm._2006.webservices.BusinessEntityCollection target = null; target = (com.microsoft.schemas.crm._2006.webservices.BusinessEntityCollection)get_store().find_element_user(DUPLICATECOLLECTION$0, 0); if (target == null) { target = (com.microsoft.schemas.crm._2006.webservices.BusinessEntityCollection)get_store().add_element_user(DUPLICATECOLLECTION$0); } target.set(duplicateCollection); } } /** * Appends and returns a new empty "DuplicateCollection" element */ public com.microsoft.schemas.crm._2006.webservices.BusinessEntityCollection addNewDuplicateCollection() { synchronized (monitor()) { check_orphaned(); com.microsoft.schemas.crm._2006.webservices.BusinessEntityCollection target = null; target = (com.microsoft.schemas.crm._2006.webservices.BusinessEntityCollection)get_store().add_element_user(DUPLICATECOLLECTION$0); return target; } } }
3e0d625de40f11a3951caea0c3ff1f9ac7fe76fb
1,274
java
Java
dora-mvvm/src/main/java/dora/autosize/attr/MarginTopAttr.java
dora4/dora
1aaffc64f9c2d41b6245e4993ae77a0400d12ff9
[ "Apache-2.0" ]
11
2020-09-14T12:49:46.000Z
2021-12-31T19:28:37.000Z
dora-mvvm/src/main/java/dora/autosize/attr/MarginTopAttr.java
dora4/dora
1aaffc64f9c2d41b6245e4993ae77a0400d12ff9
[ "Apache-2.0" ]
null
null
null
dora-mvvm/src/main/java/dora/autosize/attr/MarginTopAttr.java
dora4/dora
1aaffc64f9c2d41b6245e4993ae77a0400d12ff9
[ "Apache-2.0" ]
4
2020-12-10T08:46:21.000Z
2022-03-15T17:52:28.000Z
27.106383
96
0.601256
5,666
package dora.autosize.attr; import android.view.View; import android.view.ViewGroup; public class MarginTopAttr extends AutoAttr { public MarginTopAttr(int pxVal, int baseWidth, int baseHeight) { super(pxVal, baseWidth, baseHeight); } public static MarginTopAttr generate(int val, int baseFlag) { MarginTopAttr attr = null; switch (baseFlag) { case AutoAttr.BASE_WIDTH: attr = new MarginTopAttr(val, Attrs.MARGIN_TOP, 0); break; case AutoAttr.BASE_HEIGHT: attr = new MarginTopAttr(val, 0, Attrs.MARGIN_TOP); break; case AutoAttr.BASE_DEFAULT: attr = new MarginTopAttr(val, 0, 0); break; } return attr; } @Override protected int attrVal() { return Attrs.MARGIN_TOP; } @Override protected boolean defaultBaseWidth() { return false; } @Override protected void execute(View view, int val) { if (!(view.getLayoutParams() instanceof ViewGroup.MarginLayoutParams)) { return; } ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) view.getLayoutParams(); lp.topMargin = val; } }
3e0d62a5ba961f757f5d333b9221831599b01fa0
5,478
java
Java
src/test/java/seedu/address/logic/commands/ListTagsCommandTest.java
CS2103-AY1819S2-W14-3/main
c22d41c2a8becf8d39c5caa9cb774411bbbc8b1f
[ "MIT" ]
2
2019-02-23T17:47:58.000Z
2019-03-17T01:23:34.000Z
src/test/java/seedu/address/logic/commands/ListTagsCommandTest.java
CS2103-AY1819S2-W14-3/main
c22d41c2a8becf8d39c5caa9cb774411bbbc8b1f
[ "MIT" ]
198
2019-02-18T07:47:23.000Z
2019-07-26T07:19:05.000Z
src/test/java/seedu/address/logic/commands/ListTagsCommandTest.java
CS2103-AY1819S2-W14-3/main
c22d41c2a8becf8d39c5caa9cb774411bbbc8b1f
[ "MIT" ]
19
2019-02-03T14:59:57.000Z
2019-09-04T07:30:32.000Z
34.45283
107
0.697517
5,667
package seedu.address.logic.commands; import static org.junit.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.assertEquals; import static seedu.address.logic.commands.CommandTestUtil.assertCommandSuccess; import java.util.HashSet; import java.util.Set; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import seedu.address.battle.state.BattleState; import seedu.address.logic.CommandHistory; import seedu.address.logic.Logic; import seedu.address.logic.commands.exceptions.CommandException; import seedu.address.model.Model; import seedu.address.model.ModelManager; import seedu.address.model.battleship.Battleship; import seedu.address.model.battleship.DestroyerBattleship; import seedu.address.model.battleship.Orientation; import seedu.address.model.cell.Coordinates; import seedu.address.model.tag.Tag; /** * Contains integration tests (interaction with the Model) and unit tests for ListCommand. */ public class ListTagsCommandTest { @Rule public ExpectedException thrown = ExpectedException.none(); private Model model; private Model expectedModel; private Logic logic; private CommandHistory commandHistory = new CommandHistory(); private Set<Tag> testTags1 = new HashSet<>(); private Set<Tag> testTags2 = new HashSet<>(); private Tag testTag1 = new Tag("testTag1"); private Tag testTag2 = new Tag("testTag2"); private Tag testTag3 = new Tag("testTag3"); private Battleship battleshipOne; private Battleship battleshipTwo; @Before public void setUp() { model = new ModelManager(); expectedModel = new ModelManager(); // set the tests in the context of deploying ships model.setBattleState(BattleState.PLAYER_PUT_SHIP); expectedModel.setBattleState(BattleState.PLAYER_PUT_SHIP); testTags1.add(testTag1); testTags1.add(testTag2); testTags2.add(testTag3); battleshipOne = new DestroyerBattleship(testTags1); battleshipTwo = new DestroyerBattleship(testTags2); model.deployBattleship(battleshipOne, new Coordinates("a1"), new Orientation("v")); model.deployBattleship(battleshipTwo, new Coordinates("a2"), new Orientation("v")); } @Test public void execute_testTags_showsSame() { Set<Tag> modelTags = model.getHumanPlayer().getFleet().getAllTags(); boolean allTagsContained = true; for (Tag testTag : testTags1) { if (!modelTags.contains(testTag)) { allTagsContained = false; } } for (Tag testTag : testTags2) { if (!modelTags.contains(testTag)) { allTagsContained = false; } } assertEquals(allTagsContained, true); } @Test public void execute_testTags_fail() { Set<Tag> tags = model.getHumanPlayer().getFleet().getAllTags(); assertFalse(tags.contains(new Tag("nonExistentTag"))); } @Test public void execute_invalidState_throwAssertionError() throws CommandException { thrown.expect(AssertionError.class); ListTagsCommand cmd = new ListTagsCommand(); model.setBattleState(BattleState.PRE_BATTLE); cmd.execute(model, new CommandHistory()); } @Test public void execute_testCommandResult_success() { ListTagsCommand cmd = new ListTagsCommand(); StringBuilder expectedOutput = new StringBuilder(); expectedOutput.append(ListTagsCommand.MESSAGE_SUCCESS) .append(model.getHumanPlayer().getFleet().getAllTags().size()) .append(ListTagsCommand.TAGS_FOUND); int counter = 0; for (Tag tag : model.getHumanPlayer().getFleet().getAllTags()) { expectedOutput.append(tag.getTagName()); if (++counter < model.getHumanPlayer().getFleet().getAllTags().size()) { expectedOutput.append(", "); } } CommandResult expectedCommandResult = new CommandResult(expectedOutput.toString(), false, false); assertCommandSuccess(cmd, model, commandHistory, expectedCommandResult, expectedModel); } @Test public void execute_testEmptyCommandResult_success() { ListTagsCommand listTagsCommand = new ListTagsCommand(); InitialiseMapCommand initialiseMapCommand = new InitialiseMapCommand(10); try { initialiseMapCommand.execute(model, commandHistory); initialiseMapCommand.execute(expectedModel, commandHistory); } catch (CommandException ce) { assert false; // error should not occur } StringBuilder expectedOutput = new StringBuilder(); expectedOutput.append(ListTagsCommand.MESSAGE_SUCCESS) .append(ListTagsCommand.TAGS_NOT_FOUND); CommandResult expectedCommandResult = new CommandResult(expectedOutput.toString(), false, false); assertCommandSuccess(listTagsCommand, model, commandHistory, expectedCommandResult, expectedModel); } @Test public void trivial_commandEqualityTest_success() { ListTagsCommand listTagsCommand1 = new ListTagsCommand(); ListTagsCommand listTagsCommand2 = new ListTagsCommand(); listTagsCommand1.execute(model, commandHistory); listTagsCommand2.execute(model, commandHistory); assertEquals(listTagsCommand1, listTagsCommand2); } }
3e0d6350623813157f9665b76f25e8e6f8bf89e8
4,686
java
Java
samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/UserApi.java
lucassales2/swagger-codegen
0bf7926a5eee9394e1aac564374db5efc2324852
[ "Apache-2.0" ]
14,570
2015-01-01T21:46:46.000Z
2022-03-31T22:28:15.000Z
samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/UserApi.java
lucassales2/swagger-codegen
0bf7926a5eee9394e1aac564374db5efc2324852
[ "Apache-2.0" ]
9,058
2015-01-08T15:49:17.000Z
2022-03-31T13:10:01.000Z
samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/UserApi.java
lucassales2/swagger-codegen
0bf7926a5eee9394e1aac564374db5efc2324852
[ "Apache-2.0" ]
6,907
2015-01-02T05:29:47.000Z
2022-03-31T00:55:45.000Z
31.033113
162
0.625694
5,668
package io.swagger.api; import java.util.List; import io.swagger.model.User; import java.io.InputStream; import java.io.OutputStream; import java.util.List; import java.util.Map; import javax.ws.rs.*; import javax.ws.rs.core.Response; import javax.ws.rs.core.MediaType; import org.apache.cxf.jaxrs.ext.multipart.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponse; import io.swagger.jaxrs.PATCH; import javax.validation.constraints.*; import javax.validation.Valid; /** * Swagger Petstore * * <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * */ @Path("/") @Api(value = "/", description = "") public interface UserApi { /** * Create user * * This can only be done by the logged in user. * */ @POST @Path("/user") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Create user", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) public void createUser(@Valid User body); /** * Creates list of users with given input array * * * */ @POST @Path("/user/createWithArray") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Creates list of users with given input array", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) public void createUsersWithArrayInput(@Valid List<User> body); /** * Creates list of users with given input array * * * */ @POST @Path("/user/createWithList") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Creates list of users with given input array", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) public void createUsersWithListInput(@Valid List<User> body); /** * Delete user * * This can only be done by the logged in user. * */ @DELETE @Path("/user/{username}") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Delete user", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied"), @ApiResponse(code = 404, message = "User not found") }) public void deleteUser(@PathParam("username") String username); /** * Get user by user name * * * */ @GET @Path("/user/{username}") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Get user by user name", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = User.class), @ApiResponse(code = 400, message = "Invalid username supplied"), @ApiResponse(code = 404, message = "User not found") }) public User getUserByName(@PathParam("username") String username); /** * Logs user into the system * * * */ @GET @Path("/user/login") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Logs user into the system", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 400, message = "Invalid username/password supplied") }) public String loginUser(@QueryParam("username") @NotNull String username, @QueryParam("password") @NotNull String password); /** * Logs out current logged in user session * * * */ @GET @Path("/user/logout") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Logs out current logged in user session", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) public void logoutUser(); /** * Updated user * * This can only be done by the logged in user. * */ @PUT @Path("/user/{username}") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Updated user", tags={ "user" }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied"), @ApiResponse(code = 404, message = "User not found") }) public void updateUser(@PathParam("username") String username, @Valid User body); }
3e0d64cdbfbe6140128c83f6cc53bca6b7896978
450
java
Java
src/main/java/com/crazylemon/yantu/mapper/ScenicPhotoMapper.java
guancgsuccess/yantu
ca694d7ea0545eb01ef9b5353b83db74edc877fa
[ "Apache-2.0" ]
1
2021-12-29T12:56:52.000Z
2021-12-29T12:56:52.000Z
src/main/java/com/crazylemon/yantu/mapper/ScenicPhotoMapper.java
guancgsuccess/yantu
ca694d7ea0545eb01ef9b5353b83db74edc877fa
[ "Apache-2.0" ]
null
null
null
src/main/java/com/crazylemon/yantu/mapper/ScenicPhotoMapper.java
guancgsuccess/yantu
ca694d7ea0545eb01ef9b5353b83db74edc877fa
[ "Apache-2.0" ]
null
null
null
23.684211
71
0.753333
5,669
package com.crazylemon.yantu.mapper; import com.crazylemon.yantu.entity.ScenicPhoto; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Select; import java.util.List; /** * <p> * Mapper 接口 * </p> * */ public interface ScenicPhotoMapper extends BaseMapper<ScenicPhoto> { @Select("select * from scenic_photo where scenic_id = #{scenicId}") List<ScenicPhoto> getByScenicId(Integer scenicId); }
3e0d65c7151bce3adb691192530970d54afc1c98
93
java
Java
spring-boot-mybatis/src/main/java/com/wangtk/mybatis/types/ABService.java
chiyanking/nacos-seata-example
c0f09e6b4453f152f3062d17c44d75b2a5c56fc5
[ "Apache-2.0" ]
null
null
null
spring-boot-mybatis/src/main/java/com/wangtk/mybatis/types/ABService.java
chiyanking/nacos-seata-example
c0f09e6b4453f152f3062d17c44d75b2a5c56fc5
[ "Apache-2.0" ]
null
null
null
spring-boot-mybatis/src/main/java/com/wangtk/mybatis/types/ABService.java
chiyanking/nacos-seata-example
c0f09e6b4453f152f3062d17c44d75b2a5c56fc5
[ "Apache-2.0" ]
null
null
null
18.6
55
0.741935
5,670
package com.wangtk.mybatis.types; public class ABService<A, B> implements Service<A, B> { }
3e0d66274e0a7f8ecbcbadb55c1b23b7e37bd572
701
java
Java
coursera/week3/coind.java
Ritikgarg1773/Java-Programming
0d6ebb0cc0c241249c0452782aca0ff762f1a481
[ "MIT" ]
1
2021-01-06T12:46:56.000Z
2021-01-06T12:46:56.000Z
coursera/week3/coind.java
Ritikgarg1773/Java-Programming
0d6ebb0cc0c241249c0452782aca0ff762f1a481
[ "MIT" ]
null
null
null
coursera/week3/coind.java
Ritikgarg1773/Java-Programming
0d6ebb0cc0c241249c0452782aca0ff762f1a481
[ "MIT" ]
1
2019-10-23T19:56:42.000Z
2019-10-23T19:56:42.000Z
25.035714
50
0.510699
5,671
package coursera.week3; import java.util.Scanner; import java.util.Vector; public class coind { static int coins[] = {1,5, 10}; static int n= coins.length; private static int getChange(int m) { //write your code here Vector<Integer> answer = new Vector<>(); for (int i = n-1; i >=0 ; i--) { while (m>= coins[i]){ m -= coins[i]; answer.add(coins[i]); } } return answer.size(); } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int v = scanner.nextInt(); System.out.println(getChange(v)); } }
3e0d6628f59d56a1f41ca19cbbb4d08c8009036a
1,901
java
Java
src/contest/ccc/CCC_2004_S2.java
anshika581/competitive-programming-1
c34fb89820cd7260661daa2283f492b07cd9f8d2
[ "Apache-2.0", "MIT" ]
83
2017-08-30T01:20:03.000Z
2022-02-12T13:50:27.000Z
src/contest/ccc/CCC_2004_S2.java
anshika581/competitive-programming-1
c34fb89820cd7260661daa2283f492b07cd9f8d2
[ "Apache-2.0", "MIT" ]
1
2015-08-20T13:37:59.000Z
2015-08-26T00:56:39.000Z
src/contest/ccc/CCC_2004_S2.java
anshika581/competitive-programming-1
c34fb89820cd7260661daa2283f492b07cd9f8d2
[ "Apache-2.0", "MIT" ]
41
2017-11-09T06:10:08.000Z
2022-01-11T14:10:25.000Z
26.402778
124
0.556023
5,672
package contest.ccc; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class CCC_2004_S2 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; public static void main(String[] args) throws IOException { int n = readInt(); int k = readInt(); int[] score = new int[n]; int[] highestRank = new int[n]; int[] currRank = new int[n]; boolean[] isMax = new boolean[n]; int greatest = Integer.MIN_VALUE; for (; k > 0; k--) { for (int x = 0; x < n; x++) { score[x] += readInt(); currRank[x] = 0; if (k == 1 && score[x] > greatest) { greatest = score[x]; } } for (int x = 0; x < n; x++) { for (int y = 0; y < n; y++) { if (x != y) { if (score[x] > score[y]) currRank[y]++; } } } for (int x = 0; x < n; x++) { highestRank[x] = Math.max(highestRank[x], currRank[x]); if (k == 1) { if (greatest == score[x]) isMax[x] = true; } } } for (int x = 0; x < n; x++) if (isMax[x]) System.out.printf("Yodeller %d is the TopYodeller: score %d, worst rank %d%n", x + 1, score[x], highestRank[x] + 1); } static String next() throws IOException { while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine().trim()); return st.nextToken(); } static long readLong() throws IOException { return Long.parseLong(next()); } static int readInt() throws IOException { return Integer.parseInt(next()); } static double readDouble() throws IOException { return Double.parseDouble(next()); } static String readLine() throws IOException { return br.readLine().trim(); } }
3e0d668d1101d1d5e3088632b0fce0aef2541f2f
4,834
java
Java
te2m-service-model-plugin/src/de/te2m/eclipse/service/wizards/bo/ManageBOWizardPage.java
fafischer/eclipse-services
44f216b9aab4da89b1dd05b02f9b9796106cb91c
[ "Apache-2.0" ]
null
null
null
te2m-service-model-plugin/src/de/te2m/eclipse/service/wizards/bo/ManageBOWizardPage.java
fafischer/eclipse-services
44f216b9aab4da89b1dd05b02f9b9796106cb91c
[ "Apache-2.0" ]
null
null
null
te2m-service-model-plugin/src/de/te2m/eclipse/service/wizards/bo/ManageBOWizardPage.java
fafischer/eclipse-services
44f216b9aab4da89b1dd05b02f9b9796106cb91c
[ "Apache-2.0" ]
null
null
null
18.941176
96
0.663354
5,673
/* * ManageBOWizardPage.java * * Copyright 2009 - 2015 Frank Fischer (email: efpyi@example.com) * * This file is part of the te2m-service-model-plugin project which is a sub project of temtools * (http://temtools.sf.net). * */ package de.te2m.eclipse.service.wizards.bo; import java.util.UUID; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; import de.te2m.api.ext.project.bo.ClassInfo; /** * The Class ManageBOWizardPage. * * @author ffischer * @version 1.0 * @since 1.0 */ public class ManageBOWizardPage extends WizardPage { /** * The ci. */ private ClassInfo ci; /** * The nametext. */ private Text nametext; /** * The pkg text. */ private Text pkgText; /** * The descText. */ private Text desc; /** * The generate button. */ private Button generateButton; /** * The selection. */ private ISelection selection; /** * Instantiates a new service2 code wizard page. * * @param info the info * @param selection the selection */ public ManageBOWizardPage(ClassInfo info, ISelection selection) { super("wizardPage"); setTitle("Manage Business Object"); setDescription("Manage a master data for a business object"); this.selection = selection; this.ci=info; } /* * (non-Javadoc) * * @see * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets * .Composite) */ public void createControl(Composite parent) { Composite container = new Composite(parent, 0); GridLayout layout = new GridLayout(); container.setLayout(layout); layout.numColumns = 2; layout.verticalSpacing = 4; Label label = new Label(container, 0); label.setText("&Name:"); nametext = new Text(container, 2052); GridData gd = new GridData(768); nametext.setLayoutData(gd); nametext.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); label = new Label(container, 0); label.setText("&Package:"); pkgText = new Text(container, SWT.SINGLE); gd = new GridData(768); //gd.heightHint=40; pkgText.setLayoutData(gd); pkgText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); label = new Label(container, 0); label.setText("&Description:"); desc = new Text(container, SWT.MULTI); gd = new GridData(768); gd.heightHint=80; desc.setLayoutData(gd); desc.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); generateButton = new Button(container, SWT.CHECK); generateButton.setText("Generate Code"); initialize(); dialogChanged(); setControl(container); } /** * Dialog changed. */ private void dialogChanged() { String key = getName(); if (key.length() == 0) { updateStatus("Name must be specified"); return; } else { updateStatus(null); return; } } /** * Gets the class info. * * @return the class info */ public ClassInfo getClassInfo() { if(null==ci) { ci = new ClassInfo(); } if(null==ci.getId()) { ci.setId(UUID.randomUUID().toString()); } ci.setName(getName()); ci.setPkg(getPackage()); ci.setDescription(getDescription()); ci.setGenerate(generateButton.getSelection()); return ci; } /* (non-Javadoc) * @see org.eclipse.jface.dialogs.DialogPage#getDescription() */ public String getDescription() { return desc.getText().trim(); } /* (non-Javadoc) * @see org.eclipse.jface.wizard.WizardPage#getName() */ public String getName() { return nametext.getText().trim(); } /** * Gets the package. * * @return the package */ public String getPackage() { return pkgText.getText().trim(); } /** * Initialize. */ private void initialize() { if (null != ci) { if (null != ci.getName()) { nametext.setText(ci.getName()); } if (null != ci.getDescription()) { desc.setText(ci.getDescription()); } if (null != ci.getPkg()) { pkgText.setText(ci.getPkg()); } generateButton.setSelection(ci.isGenerate()); } } /** * Sets the class info. * * @param info the new class info */ public void setClassInfo(ClassInfo info) { ci = info; } /** * Update status. * * @param message * the message */ private void updateStatus(String message) { setErrorMessage(message); setPageComplete(message == null); } }
3e0d66c3e52a13d1fb2992d6f567ddaaa1583d15
2,563
java
Java
src/com/ros/entity/UserDetailInfo.java
hyf8989/Rosemary
442669bebe71eaa3297628f48c80d3d484f03a07
[ "MIT" ]
6
2019-12-02T12:18:39.000Z
2021-11-07T04:04:41.000Z
src/com/ros/entity/UserDetailInfo.java
hyf8989/Rosemary
442669bebe71eaa3297628f48c80d3d484f03a07
[ "MIT" ]
null
null
null
src/com/ros/entity/UserDetailInfo.java
hyf8989/Rosemary
442669bebe71eaa3297628f48c80d3d484f03a07
[ "MIT" ]
4
2020-02-11T01:08:44.000Z
2021-12-31T09:39:04.000Z
24.179245
109
0.669918
5,674
package com.ros.entity; /** * 用户详情信息实体类 * @author Administrator * */ public class UserDetailInfo { private int id; private int userId; private String name; private String userTel; private String userEmail; private String createTime; private String updateTime; public int getId() { return id; } public void setId(int id) { this.id = id; } public int getUserId() { return userId; } public void setUserId(int userId) { this.userId = userId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getUserTel() { return userTel; } public void setUserTel(String userTel) { this.userTel = userTel; } public String getUserEmail() { return userEmail; } public void setUserEmail(String userEmail) { this.userEmail = userEmail; } public String getCreateTime() { return createTime; } public void setCreateTime(String createTime) { this.createTime = createTime; } public String getUpdateTime() { return updateTime; } public void setUpdateTime(String updateTime) { this.updateTime = updateTime; } @Override public String toString() { return "UserDetailInfo [Id=" + id + ", userId=" + userId + ", name=" + name + ", userTel=" + userTel + ", userEmail=" + userEmail + ", createTime=" + createTime + ", updateTime=" + updateTime + "]"; } public UserDetailInfo(int id, int userId, String name, String userTel, String userEmail, String createTime, String updateTime) { super(); id = id; this.userId = userId; this.name = name; this.userTel = userTel; this.userEmail = userEmail; this.createTime = createTime; this.updateTime = updateTime; } public UserDetailInfo() { // TODO Auto-generated constructor stub } public UserDetailInfo(int id, int userId, String userTel, String createTime, String updateTime) { super(); id = id; this.userId = userId; this.userTel = userTel; this.createTime = createTime; this.updateTime = updateTime; } public UserDetailInfo(int userId, String userTel, String createTime, String updateTime) { super(); this.userId = userId; this.userTel = userTel; this.createTime = createTime; this.updateTime = updateTime; } public UserDetailInfo(String name, String userTel, String userEmail, int userId) { // TODO Auto-generated constructor stub super(); this.name = name; this.userTel = userTel; this.userEmail = userEmail; this.userId = userId; } }
3e0d67d77d05f14c9421444791ebda6479cee2e6
1,285
java
Java
Algorithms/src/main/java/hard/j/JumpGameTwo.java
jsong00505/LeetCode
7eae1df4dfa88de6e7435f6238199d92d42c7032
[ "MIT" ]
3
2019-05-13T03:29:48.000Z
2020-05-14T01:25:23.000Z
Algorithms/src/main/java/hard/j/JumpGameTwo.java
jsong00505/LeetCode
7eae1df4dfa88de6e7435f6238199d92d42c7032
[ "MIT" ]
null
null
null
Algorithms/src/main/java/hard/j/JumpGameTwo.java
jsong00505/LeetCode
7eae1df4dfa88de6e7435f6238199d92d42c7032
[ "MIT" ]
1
2021-08-23T01:09:05.000Z
2021-08-23T01:09:05.000Z
24.769231
79
0.544255
5,675
package hard.j; /** * Created by jsong on 2019-04-03. * * @leetcode https://leetcode.com/jsong00505/ * @github https://github.com/jsong00505/ * @linkedin https://www.linkedin.com/in/junesongskorea/ * @email anpch@example.com * @challenge Hard - Jump Game II (https://leetcode.com/problems/jump-game-ii/) */ public class JumpGameTwo { // this solution is so beautiful and clean. public int jump(int[] nums) { int jumps = 0, currentEnd = 0, currentFarthest = 0; for (int i = 0; i < nums.length - 1; i++) { currentFarthest = Math.max(currentFarthest, i + nums[i]); if (i == currentEnd) { jumps++; currentEnd = currentFarthest; } } return jumps; } public int myOwnSolution(int[] nums) { int minimum = 0; int i = 0; while (i < nums.length) { if (i + 1 >= nums.length) { break; } else if (i + nums[i] + 1 >= nums.length) { minimum++; break; } int step = nums[i]; int biggest = nums[i]; int biggestIndex = i; for (int j = 1; j <= step; j++) { if (biggest <= nums[j + i] + j) { biggest = nums[j + i] + j; biggestIndex = i + j; } } i = biggestIndex; minimum++; } return minimum; } }
3e0d681df8fe4b50f06c8c3cea27a4d09deabc92
1,619
java
Java
dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/bean/vo/DSSWorkspaceRoleVO.java
Zosimer/DataSphereStudio
1b25c07a0dcc55ed59d138fee328fc5b03a7992f
[ "Apache-2.0" ]
2,071
2019-11-24T13:59:45.000Z
2022-03-31T03:53:03.000Z
dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/bean/vo/DSSWorkspaceRoleVO.java
Zosimer/DataSphereStudio
1b25c07a0dcc55ed59d138fee328fc5b03a7992f
[ "Apache-2.0" ]
380
2019-11-27T10:31:40.000Z
2022-03-31T08:12:03.000Z
dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/bean/vo/DSSWorkspaceRoleVO.java
Zosimer/DataSphereStudio
1b25c07a0dcc55ed59d138fee328fc5b03a7992f
[ "Apache-2.0" ]
790
2019-11-24T14:01:19.000Z
2022-03-30T05:13:55.000Z
25.698413
75
0.65596
5,676
/* * Copyright 2019 WeBank * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.webank.wedatasphere.dss.framework.workspace.bean.vo; import java.io.Serializable; public class DSSWorkspaceRoleVO implements Serializable { private static final long serialVersionUID=1L; private int roleId; private String roleName; private String roleFrontName; public int getRoleId() { return roleId; } public void setRoleId(int roleId) { this.roleId = roleId; } public String getRoleName() { return roleName; } public void setRoleName(String roleName) { this.roleName = roleName; } public String getRoleFrontName() { return roleFrontName; } public void setRoleFrontName(String roleFrontName) { this.roleFrontName = roleFrontName; } @Override public String toString() { return "DSSWorkspaceRoleVO{" + "roleId=" + roleId + ", roleName='" + roleName + '\'' + ", roleFrontName='" + roleFrontName + '\'' + '}'; } }
3e0d6868000e55898ece771779705dba4b9dab5a
10,264
java
Java
android/Markit/app/src/main/java/com/markit/android/chat/files/MainChatActivity.java
adrianlu95/Markit
4e6ebd4c87e5992dfe7a5f547449f669b0ddc8cc
[ "Apache-2.0" ]
null
null
null
android/Markit/app/src/main/java/com/markit/android/chat/files/MainChatActivity.java
adrianlu95/Markit
4e6ebd4c87e5992dfe7a5f547449f669b0ddc8cc
[ "Apache-2.0" ]
null
null
null
android/Markit/app/src/main/java/com/markit/android/chat/files/MainChatActivity.java
adrianlu95/Markit
4e6ebd4c87e5992dfe7a5f547449f669b0ddc8cc
[ "Apache-2.0" ]
null
null
null
34.911565
152
0.633476
5,677
package com.markit.android.chat.files; import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.design.widget.FloatingActionButton; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.format.DateFormat; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.TextView; import com.firebase.client.Firebase; import com.firebase.client.core.Context; import com.firebase.ui.database.FirebaseListAdapter; import com.firebase.ui.database.FirebaseRecyclerAdapter; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.ChildEventListener; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.Query; import com.markit.android.R; import com.markit.android.base.files.BaseActivity; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import com.markit.android.ItemDetail; import static com.markit.android.ItemDetail.conversationKey; import static com.markit.android.R.id.backButton; import static com.markit.android.R.id.conversationID; import static com.markit.android.R.id.message_text; public class MainChatActivity extends BaseActivity implements FirebaseAuth.AuthStateListener { public static final String TAG = "Chat"; private FirebaseAuth firebaseAuth; private Button sendButton; private EditText editMessage; private Button backButton; private RecyclerView recyclerView; private LinearLayoutManager llm; private FirebaseRecyclerAdapter<Chat, ChatHolder> recViewAdapter; String chatKey; FirebaseDatabase database = FirebaseDatabase.getInstance(); DatabaseReference convoRef = database.getReference().child("users/" + getUID() + "/chats/"); DatabaseReference chatRef = convoRef.child(ItemDetail.conversationKey + "/messages"); DatabaseReference sellerRef = database.getReference().child("users/" + ItemDetail.otherUser + "/chats/" + ItemDetail.conversationKey + "/messages"); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_chat); firebaseAuth = FirebaseAuth.getInstance(); firebaseAuth.addAuthStateListener(this); backButton = (Button) findViewById(R.id.backButton); sendButton = (Button) findViewById(R.id.sendButton); editMessage = (EditText) findViewById(R.id.messageEdit); // backButton.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View view) { // startActivity(new Intent(MainChatActivity.this, ChatListView.class)); // } // }); sendButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //fix to get username not uid String uid = firebaseAuth.getCurrentUser().getUid(); String user = uid.substring(0, 6); Date date = new Date(); SimpleDateFormat fmt = new SimpleDateFormat("EEE MMM dd yyyy HH:mm:ss 'GMT'Z '('z')'"); String newDate = fmt.format(date);; Chat message = new Chat(editMessage.getText().toString(), user, newDate); //chatKey = chatRef.push().getKey(); chatRef.push().setValue(message, new DatabaseReference.CompletionListener() { @Override public void onComplete(DatabaseError databaseError, DatabaseReference reference) { if (databaseError != null) { Log.e(TAG, "Failed to write message", databaseError.toException()); } } }); sellerRef.push().setValue(message, new DatabaseReference.CompletionListener() { @Override public void onComplete(DatabaseError databaseError, DatabaseReference reference) { if (databaseError != null) { Log.e(TAG, "Failed to write message", databaseError.toException()); } } }); editMessage.setText(""); } }); recyclerView = (RecyclerView) findViewById(R.id.messagesList); llm = new LinearLayoutManager(this); llm.setReverseLayout(false); recyclerView.setHasFixedSize(false); recyclerView.setLayoutManager(llm); } @Override public void onStart() { super.onStart(); attachRecyclerViewAdapter(); } @Override public void onStop() { super.onStop(); if (recViewAdapter != null) { recViewAdapter.cleanup(); } } @Override public void onDestroy() { super.onDestroy(); if (firebaseAuth != null) { firebaseAuth.removeAuthStateListener(this); } } @Override public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { updateUI(); } //This sends messages & attaches all messages to the activity //need to specify conversation private void attachRecyclerViewAdapter() { Query lastFifty = chatRef.limitToLast(50); recViewAdapter = new FirebaseRecyclerAdapter<Chat, ChatHolder>( Chat.class, R.layout.chat_message, ChatHolder.class, lastFifty) { @Override public void populateViewHolder(ChatHolder chatView, Chat chat, int position) { //chatView.setUser(chat.getUser()); chatView.setText(chat.getText()); // FirebaseUser currentUser = firebaseAuth.getCurrentUser(); // if (currentUser != null && chat.getUid().equals(currentUser.getUid())) { // chatView.setIsSender(true); // } else { // chatView.setIsSender(false); // } FirebaseUser currentUser = firebaseAuth.getCurrentUser(); if (currentUser != null) { chatView.setIsSender(true); } else { chatView.setIsSender(false); } } }; // Scroll to bottom on new messages recViewAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() { @Override public void onItemRangeInserted(int positionStart, int itemCount) { llm.smoothScrollToPosition(recyclerView, null, recViewAdapter.getItemCount()); } }); recyclerView.setAdapter(recViewAdapter); } public boolean isSignedIn() { return (firebaseAuth.getCurrentUser() != null); } public void updateUI() { // Sending only allowed when signed in sendButton.setEnabled(isSignedIn()); editMessage.setEnabled(isSignedIn()); } public static class Chat { String user; String text; String uid; String date; //Date newDate; //String chatId; //private long messageTime; public Chat() { } Chat(String text, String sender, String date) { this.text = text; this.date = date; this.user = sender; } public String getUser() { return user; } public String getUid() { return uid; } public String getText() { return text; } } public static class ChatHolder extends RecyclerView.ViewHolder { View view; public ChatHolder(View itemView) { super(itemView); view = itemView; } public void setIsSender(Boolean isSender) { FrameLayout left_arrow = (FrameLayout) view.findViewById(R.id.left_arrow); FrameLayout right_arrow = (FrameLayout) view.findViewById(R.id.right_arrow); RelativeLayout messageContainer = (RelativeLayout) view.findViewById(R.id.message_container); LinearLayout lmessage = (LinearLayout) view.findViewById(R.id.lmessage); int color; if (isSender) { color = ContextCompat.getColor(view.getContext(), R.color.wallet_holo_blue_light); left_arrow.setVisibility(View.GONE); right_arrow.setVisibility(View.VISIBLE); messageContainer.setGravity(Gravity.END); } else { color = ContextCompat.getColor(view.getContext(), R.color.wallet_secondary_text_holo_dark); left_arrow.setVisibility(View.VISIBLE); right_arrow.setVisibility(View.GONE); messageContainer.setGravity(Gravity.START); } lmessage.setBackgroundColor(color); // ((RotateDrawable) left_arrow.getBackground()).getDrawable() // .setColorFilter(color, PorterDuff.Mode.SRC); // ((RotateDrawable) right_arrow.getBackground()).getDrawable() // .setColorFilter(color, PorterDuff.Mode.SRC); } // public void setUser(String user) { // TextView field = (TextView) view.findViewById(R.id.user); // field.setText(user); // } public void setText(String text) { TextView field = (TextView) view.findViewById(message_text); field.setText(text); } } }
3e0d695493dbee9f4ce38ff801a8e0f83dafd570
666
java
Java
src/test/java/com/alibaba/json/bvt/parser/deser/asm/TestASM_boolean.java
contextshuffling/fastjson
3f72c76aebb4c0a60ad8ed9e7afa7126a011cf8d
[ "Apache-2.0" ]
28,056
2015-01-01T12:01:05.000Z
2022-03-31T14:16:43.000Z
src/test/java/com/alibaba/json/bvt/parser/deser/asm/TestASM_boolean.java
contextshuffling/fastjson
3f72c76aebb4c0a60ad8ed9e7afa7126a011cf8d
[ "Apache-2.0" ]
3,688
2015-01-03T15:42:09.000Z
2022-03-31T19:01:45.000Z
src/test/java/com/alibaba/json/bvt/parser/deser/asm/TestASM_boolean.java
contextshuffling/fastjson
3f72c76aebb4c0a60ad8ed9e7afa7126a011cf8d
[ "Apache-2.0" ]
7,752
2015-01-03T08:37:26.000Z
2022-03-31T09:59:18.000Z
20.8125
55
0.608108
5,678
package com.alibaba.json.bvt.parser.deser.asm; import org.junit.Assert; import junit.framework.TestCase; import com.alibaba.fastjson.JSON; public class TestASM_boolean extends TestCase { public void test_asm() throws Exception { V0 v = new V0(); String text = JSON.toJSONString(v); V0 v1 = JSON.parseObject(text, V0.class); Assert.assertEquals(v.isValue(), v1.isValue()); } public static class V0 { private boolean value = true; public boolean isValue() { return value; } public void setValue(boolean value) { this.value = value; } } }
3e0d6a0a10838cd2a9de1a6894a357f272bb46ae
3,288
java
Java
presto-main/src/test/java/com/facebook/presto/operator/aggregation/AbstractTestAggregationFunction.java
sameeragarwal/presto
25f921fb81be4d23a68e52634ed763568188df05
[ "Apache-2.0" ]
58
2015-01-14T09:41:49.000Z
2022-02-18T08:15:29.000Z
presto-main/src/test/java/com/facebook/presto/operator/aggregation/AbstractTestAggregationFunction.java
sameeragarwal/presto
25f921fb81be4d23a68e52634ed763568188df05
[ "Apache-2.0" ]
null
null
null
presto-main/src/test/java/com/facebook/presto/operator/aggregation/AbstractTestAggregationFunction.java
sameeragarwal/presto
25f921fb81be4d23a68e52634ed763568188df05
[ "Apache-2.0" ]
21
2015-01-14T09:41:56.000Z
2021-07-05T03:42:45.000Z
33.55102
128
0.715024
5,679
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.facebook.presto.operator.aggregation; import com.facebook.presto.block.Block; import com.facebook.presto.block.BlockBuilder; import com.facebook.presto.block.BlockCursor; import com.facebook.presto.block.rle.RunLengthEncodedBlock; import org.testng.annotations.Test; import static com.facebook.presto.operator.aggregation.AggregationTestUtils.assertAggregation; import static com.facebook.presto.tuple.Tuples.nullTuple; public abstract class AbstractTestAggregationFunction { public abstract Block getSequenceBlock(int start, int length); public abstract AggregationFunction getFunction(); public abstract Object getExpectedValue(int start, int length); public double getConfidence() { return 1.0; } public Object getExpectedValueIncludingNulls(int start, int length, int lengthIncludingNulls) { return getExpectedValue(start, length); } @Test public void testNoPositions() { assertAggregation(getFunction(), getConfidence(), getExpectedValue(0, 0), 0); } @Test public void testSinglePosition() { assertAggregation(getFunction(), getConfidence(), getExpectedValue(0, 1), 1, getSequenceBlock(0, 1)); } @Test public void testMultiplePositions() { assertAggregation(getFunction(), getConfidence(), getExpectedValue(0, 5), 5, getSequenceBlock(0, 5)); } @Test public void testAllPositionsNull() throws Exception { Block block = new RunLengthEncodedBlock(nullTuple(getSequenceBlock(0, 10).getTupleInfo()), 10); assertAggregation(getFunction(), getConfidence(), getExpectedValueIncludingNulls(0, 0, 10), 10, block); } @Test public void testMixedNullAndNonNullPositions() { Block alternatingNullsBlock = createAlternatingNullsBlock(getSequenceBlock(0, 10)); assertAggregation(getFunction(), getConfidence(), getExpectedValueIncludingNulls(0, 10, 20), 20, alternatingNullsBlock); } @Test public void testNegativeOnlyValues() { assertAggregation(getFunction(), getConfidence(), getExpectedValue(-10, 5), 5, getSequenceBlock(-10, 5)); } @Test public void testPositiveOnlyValues() { assertAggregation(getFunction(), getConfidence(), getExpectedValue(2, 4), 4, getSequenceBlock(2, 4)); } public Block createAlternatingNullsBlock(Block sequenceBlock) { BlockBuilder blockBuilder = new BlockBuilder(sequenceBlock.getTupleInfo()); BlockCursor cursor = sequenceBlock.cursor(); while (cursor.advanceNextPosition()) { blockBuilder.appendNull().append(cursor.getTuple()); } return blockBuilder.build(); } }
3e0d6a8324fa1217a3f934a300f34c53f81dc41b
312
java
Java
src/main/java/org/touchhome/bundle/api/entity/dependency/RequireExecutableDependency.java
touchhome/touchhome-bundle-api
7247bbd89786293b6a4b4aa9138e28f0a5296f96
[ "MIT" ]
1
2021-09-28T01:04:41.000Z
2021-09-28T01:04:41.000Z
src/main/java/org/touchhome/bundle/api/entity/dependency/RequireExecutableDependency.java
touchhome/touchhome-bundle-api
7247bbd89786293b6a4b4aa9138e28f0a5296f96
[ "MIT" ]
null
null
null
src/main/java/org/touchhome/bundle/api/entity/dependency/RequireExecutableDependency.java
touchhome/touchhome-bundle-api
7247bbd89786293b6a4b4aa9138e28f0a5296f96
[ "MIT" ]
1
2021-02-28T06:10:40.000Z
2021-02-28T06:10:40.000Z
28.363636
63
0.820513
5,680
package org.touchhome.bundle.api.entity.dependency; import java.lang.annotation.*; @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Repeatable(RequireExecutableDependencies.class) public @interface RequireExecutableDependency { Class<? extends DependencyExecutableInstaller> installer(); }
3e0d6c4cfa50d189d88876a0329879bff91f82c9
3,914
java
Java
src/test/java/com/icthh/xm/uaa/repository/kafka/SystemQueueConsumerUnitTest.java
BulkSecurityGeneratorProject/xm-uaa
4fb0487cf846150d8682917c909e5ff91239e482
[ "Apache-2.0" ]
12
2017-10-03T09:19:26.000Z
2020-08-10T05:43:39.000Z
src/test/java/com/icthh/xm/uaa/repository/kafka/SystemQueueConsumerUnitTest.java
BulkSecurityGeneratorProject/xm-uaa
4fb0487cf846150d8682917c909e5ff91239e482
[ "Apache-2.0" ]
20
2018-07-04T22:40:44.000Z
2021-10-15T07:18:24.000Z
src/test/java/com/icthh/xm/uaa/repository/kafka/SystemQueueConsumerUnitTest.java
BulkSecurityGeneratorProject/xm-uaa
4fb0487cf846150d8682917c909e5ff91239e482
[ "Apache-2.0" ]
3
2020-05-13T07:36:40.000Z
2022-02-25T09:28:59.000Z
32.890756
108
0.617016
5,681
package com.icthh.xm.uaa.repository.kafka; import com.icthh.xm.commons.security.XmAuthenticationContext; import com.icthh.xm.commons.security.XmAuthenticationContextHolder; import com.icthh.xm.commons.tenant.PrivilegedTenantContext; import com.icthh.xm.commons.tenant.TenantContextHolder; import com.icthh.xm.lep.api.LepManager; import com.icthh.xm.uaa.domain.User; import com.icthh.xm.uaa.service.UserService; import lombok.extern.slf4j.Slf4j; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import java.util.Optional; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @Slf4j public class SystemQueueConsumerUnitTest { private static final String USER_KEY = "f81d3142-a259-4ff8-99e4-be533d68ca99"; private static final String UPDATE_ACCOUNT_EVENT = "{ \n" + " \"eventId\":\"f81d3142-a259-4ff8-99e4-be533d68ca88\",\n" + " \"messageSource\":\"ms-uaa\",\n" + " \"tenantInfo\":{ \n" + " \"tenant\":\"XM\",\n" + " \"xmToken\":\"\",\n" + " \"xmCookie\":\"\",\n" + " \"xmUserId\":\"\",\n" + " \"xmLocale\":\"en\",\n" + " \"userLogin\":\"\",\n" + " \"userKey\":\"" + USER_KEY + "\"\n" + " },\n" + " \"eventType\":\"UPDATE_ACCOUNT\",\n" + " \"startDate\":\"2017-11-20T13:15:30Z\",\n" + " \"data\":{ \n" + " \"id\":1234,\n" + " \"firstName\":\"Olena\",\n" + " \"lastName\":\"Kashyna\",\n" + " \"imageUrl\":\"\",\n" + " \"activated\":true,\n" + " \"langKey\":\"en\",\n" + " \"createdBy\":\"system\",\n" + " \"createdDate\":\"2017-11-20T13:15:30Z\",\n" + " \"lastModifiedBy\":\"\",\n" + " \"lastModifiedDate\":\"\",\n" + "\n" + " \"userKey\":\"" + USER_KEY + "\"\n" + " }\n" + "}"; private SystemQueueConsumer consumer; @Mock private UserService userService; @Mock private TenantContextHolder tenantContextHolder; @Mock private XmAuthenticationContextHolder authContextHolder; @Mock private XmAuthenticationContext authContext; @Mock private PrivilegedTenantContext privilegedTenantContext; @Mock private LepManager lepManager; @Before public void init() { MockitoAnnotations.initMocks(this); when(authContextHolder.getContext()).thenReturn(authContext); when(tenantContextHolder.getPrivilegedContext()).thenReturn(privilegedTenantContext); consumer = new SystemQueueConsumer(tenantContextHolder, authContextHolder, lepManager, userService); } @After public void destroy() { } @Test public void updateProfile() { when(authContext.getLogin()).thenReturn(Optional.empty()); when(userService.getUser(USER_KEY)).thenReturn(new User()); doNothing().when(userService).saveUser(any()); consumer.consumeEvent(new ConsumerRecord<>("test", 0, 0, "", UPDATE_ACCOUNT_EVENT)); verify(userService).getUser(USER_KEY); verify(userService).saveUser(any()); } @Test public void updateNotExistsProfile() { when(authContext.getLogin()).thenReturn(Optional.empty()); when(userService.getUser(USER_KEY)).thenReturn(null); doNothing().when(userService).saveUser(any()); consumer.consumeEvent(new ConsumerRecord<>("test", 0, 0, "", UPDATE_ACCOUNT_EVENT)); verify(userService).getUser(USER_KEY); verify(userService, times(0)).saveUser(any()); } }
3e0d6ca0a3f6f8d82f4b3d0b293e3807af9403f8
1,713
java
Java
src/main/java/chapter05/VehicleManagerLazy.java
v-yves-es/jdpe2
7152904f2980f3dd8aef8fb76c153379b51e6a1a
[ "ADSL" ]
23
2015-01-16T20:08:04.000Z
2022-01-02T20:45:02.000Z
src/chapter05/VehicleManagerLazy.java
abraxabooks/jdpe2
77415f29c39113c4e3158391fee65c3f0bcb01e5
[ "ADSL" ]
null
null
null
src/chapter05/VehicleManagerLazy.java
abraxabooks/jdpe2
77415f29c39113c4e3158391fee65c3f0bcb01e5
[ "ADSL" ]
25
2015-01-06T18:52:00.000Z
2022-02-14T12:47:40.000Z
26.765625
106
0.556334
5,682
/* * Java Design Pattern Essentials - Second Edition, by Tony Bevis * Copyright 2012, Ability First Limited * * This source code is provided to accompany the book and is provided AS-IS without warranty of any kind. * It is intended for educational and illustrative purposes only, and may not be re-published * without the express written permission of the publisher. */ package chapter05; public class VehicleManagerLazy { private Vehicle saloon, coupe, sport, boxVan, pickup; public VehicleManagerLazy() { } public Vehicle createSaloon() { if (saloon == null) { saloon = new Saloon(new StandardEngine(1300)); return saloon; } else { return (Vehicle)saloon.clone(); } } public Vehicle createCoupe() { if (coupe == null) { coupe = new Coupe(new StandardEngine(1300)); return coupe; } else { return (Vehicle) coupe.clone(); } } public Vehicle createSport() { if (sport == null) { sport = new Sport(new StandardEngine(1300)); return sport; } else { return (Vehicle) sport.clone(); } } public Vehicle createBoxVan() { if (boxVan == null) { boxVan = new BoxVan(new StandardEngine(1300)); return boxVan; } else { return (Vehicle) boxVan.clone(); } } public Vehicle createPickup() { if (pickup == null) { pickup = new Pickup(new StandardEngine(1300)); return pickup; } else { return (Vehicle) pickup.clone(); } } }
3e0d6d327f376296fbca1a4766bd96f5fc6cd20e
5,997
java
Java
src/main/java/com/hamusuke/jece/client/joystick/JoystickKeybinding.java
hamusuke0323/JavaEditionToConsoleEditionFabric
1bd3d5e7681157b1f9e6289cc311f1d26b427771
[ "MIT" ]
3
2021-05-28T10:54:52.000Z
2022-01-04T23:20:09.000Z
src/main/java/com/hamusuke/jece/client/joystick/JoystickKeybinding.java
hamusuke0323/JavaEditionToConsoleEditionFabric
1bd3d5e7681157b1f9e6289cc311f1d26b427771
[ "MIT" ]
null
null
null
src/main/java/com/hamusuke/jece/client/joystick/JoystickKeybinding.java
hamusuke0323/JavaEditionToConsoleEditionFabric
1bd3d5e7681157b1f9e6289cc311f1d26b427771
[ "MIT" ]
null
null
null
32.950549
263
0.670335
5,683
package com.hamusuke.jece.client.joystick; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.hamusuke.jece.client.JECEClient; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.resource.language.I18n; import net.minecraft.text.Text; import net.minecraft.text.TranslatableText; import net.minecraft.util.Util; import org.jetbrains.annotations.Nullable; import java.util.Map; import java.util.Set; import java.util.function.Supplier; @Environment(EnvType.CLIENT) public class JoystickKeybinding implements Comparable<JoystickKeybinding> { private static final Map<String, JoystickKeybinding> keysById = Maps.newHashMap(); private static final Map<JoystickInputUtil.Key, JoystickKeybinding> keyToBindings = Maps.newHashMap(); private static final Set<String> keyCategories = Sets.newHashSet(); private static final Map<String, Integer> categoryOrderMap = Util.make(Maps.newHashMap(), (hashMap) -> { hashMap.put("key.categories.movement", 1); hashMap.put("key.categories.gameplay", 2); hashMap.put("key.categories.inventory", 3); hashMap.put("key.categories.creative", 4); hashMap.put("key.categories.multiplayer", 5); hashMap.put("key.categories.ui", 6); hashMap.put("key.categories.misc", 7); }); private final String translationKey; private final JoystickInputUtil.Key defaultKey; private final String category; private JoystickInputUtil.Key boundKey; private boolean pressed; private int timesPressed; private int timer; public static void onKeyPressed(JoystickInputUtil.Key key) { JoystickKeybinding joystickKeybinding = keyToBindings.get(key); if (joystickKeybinding != null) { if (joystickKeybinding.timer > 120) { ++joystickKeybinding.timesPressed; joystickKeybinding.timer = 0; } joystickKeybinding.timer++; } } @Nullable public static JoystickKeybinding getKeyBind(JoystickInputUtil.Key key) { return keyToBindings.get(key); } public int getTimer() { return this.timer; } public static void setKeyPressed(JoystickInputUtil.Key key, boolean pressed) { JoystickKeybinding joystickKeybinding = keyToBindings.get(key); if (joystickKeybinding != null) { joystickKeybinding.setPressed(pressed); } } public static void updatePressedStates() { if (JECEClient.joystickWorker.get() != null) { for (JoystickKeybinding joystickKeybinding : keysById.values()) { if (joystickKeybinding.boundKey.getCode() != -1) { joystickKeybinding.setPressed(JoystickInputUtil.isJoystickKeyDown(JECEClient.joystickWorker.get().getStickId(), joystickKeybinding.boundKey.getCode())); } } } } public static void unpressAll() { for (JoystickKeybinding joystickKeybinding : keysById.values()) { joystickKeybinding.reset(); } } public static void updateKeysByCode() { keyToBindings.clear(); for (JoystickKeybinding joystickKeybinding : keysById.values()) { keyToBindings.put(joystickKeybinding.boundKey, joystickKeybinding); } } public JoystickKeybinding(String translationKey, int code, String category) { this.translationKey = translationKey; this.boundKey = JoystickInputUtil.JoyKeys.createFromCode(code); this.defaultKey = this.boundKey; this.category = category; keysById.put(translationKey, this); keyToBindings.put(this.boundKey, this); keyCategories.add(category); } public boolean isPressed() { return this.pressed; } public String getCategory() { return this.category; } public boolean wasPressed() { if (this.timesPressed == 0) { return false; } else { --this.timesPressed; return true; } } private void reset() { this.timesPressed = 0; this.timer = 0; this.setPressed(false); } public String getTranslationKey() { return this.translationKey; } public JoystickInputUtil.Key getDefaultKey() { return this.defaultKey; } public void setBoundKey(JoystickInputUtil.Key boundKey) { this.boundKey = boundKey; } public int compareTo(JoystickKeybinding joystickKeybinding) { return this.category.equals(joystickKeybinding.category) ? I18n.translate(this.translationKey).compareTo(I18n.translate(joystickKeybinding.translationKey)) : categoryOrderMap.get(this.category).compareTo(categoryOrderMap.get(joystickKeybinding.category)); } public static Supplier<Text> getLocalizedName(String id) { JoystickKeybinding joystickKeybinding = keysById.get(id); return joystickKeybinding == null ? () -> new TranslatableText(id) : joystickKeybinding::getBoundKeyLocalizedText; } public boolean equals(JoystickKeybinding other) { return this.boundKey.equals(other.boundKey); } public boolean isUnbound() { return this.boundKey.equals(JoystickInputUtil.UNKNOWN_KEY); } public boolean matchesKey(int keyCode) { return keyCode != JoystickInputUtil.UNKNOWN_KEY.getCode() && this.boundKey.getCode() == keyCode; } public Text getBoundKeyLocalizedText() { return this.boundKey.getLocalizedText(); } public boolean isDefault() { return this.boundKey.equals(this.defaultKey); } public String getBoundKeyTranslationKey() { return this.boundKey.getTranslationKey(); } public void setPressed(boolean pressed) { if (this.timer == 0) { this.timer = 121; } this.pressed = pressed; if (!pressed) { this.timer = 0; } } }
3e0d6d8cb9e7334220779c5b2b0378dc0d7f3561
863
java
Java
src/main/java/jnr/constants/platform/fake/RLIMIT.java
merore/jnr-constants
e24abb268cd85f5d761f8a0b7267d75bf81a285d
[ "Apache-2.0" ]
8
2015-07-13T16:21:14.000Z
2021-12-31T22:17:41.000Z
src/main/java/jnr/constants/platform/fake/RLIMIT.java
merore/jnr-constants
e24abb268cd85f5d761f8a0b7267d75bf81a285d
[ "Apache-2.0" ]
52
2015-04-29T21:05:05.000Z
2022-03-31T23:02:59.000Z
src/main/java/jnr/constants/platform/fake/RLIMIT.java
merore/jnr-constants
e24abb268cd85f5d761f8a0b7267d75bf81a285d
[ "Apache-2.0" ]
17
2015-05-05T18:30:40.000Z
2021-10-16T14:36:40.000Z
26.96875
54
0.755504
5,684
// WARNING: This file is autogenerated. DO NOT EDIT! // Generated 2018-09-20 16:28:49 +0000 package jnr.constants.platform.fake; public enum RLIMIT implements jnr.constants.Constant { RLIMIT_AS(1), RLIMIT_CORE(2), RLIMIT_CPU(3), RLIMIT_DATA(4), RLIMIT_FSIZE(5), RLIMIT_LOCKS(6), RLIMIT_MEMLOCK(7), RLIMIT_MSGQUEUE(8), RLIMIT_NICE(9), RLIMIT_NLIMITS(10), RLIMIT_NOFILE(11), RLIMIT_NPROC(12), RLIMIT_OFILE(13), RLIMIT_RSS(14), RLIMIT_RTPRIO(15), RLIMIT_RTTIME(16), RLIMIT_SIGPENDING(17), RLIMIT_STACK(18); private final long value; private RLIMIT(long value) { this.value = value; } public static final long MIN_VALUE = 1L; public static final long MAX_VALUE = 18L; public final int value() { return (int) value; } public final int intValue() { return (int) value; } public final long longValue() { return value; } public final boolean defined() { return true; } }
3e0d6dce292fd9f95a3f95b50ed0d892d66ac709
1,775
java
Java
community/graphviz/src/main/java/org/neo4j/visualization/graphviz/DefaultNodeStyle.java
jexp/neo4j
fcc121f9f0456e21f609f3f8e895255052242ff1
[ "CNRI-Python", "Apache-1.1" ]
1
2015-12-14T07:35:29.000Z
2015-12-14T07:35:29.000Z
community/graphviz/src/main/java/org/neo4j/visualization/graphviz/DefaultNodeStyle.java
jexp/neo4j
fcc121f9f0456e21f609f3f8e895255052242ff1
[ "CNRI-Python", "Apache-1.1" ]
null
null
null
community/graphviz/src/main/java/org/neo4j/visualization/graphviz/DefaultNodeStyle.java
jexp/neo4j
fcc121f9f0456e21f609f3f8e895255052242ff1
[ "CNRI-Python", "Apache-1.1" ]
null
null
null
30.603448
90
0.719437
5,685
/** * Copyright (c) 2002-2013 "Neo Technology," * Network Engine for Objects in Lund AB [http://neotechnology.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.neo4j.visualization.graphviz; import java.io.IOException; import org.neo4j.graphdb.Node; import org.neo4j.visualization.PropertyType; class DefaultNodeStyle implements NodeStyle { protected final DefaultStyleConfiguration config; DefaultNodeStyle( DefaultStyleConfiguration configuration ) { this.config = configuration; } public void emitNodeStart( Appendable stream, Node node ) throws IOException { stream.append( " N" + node.getId() + " [\n" ); config.emit( node, stream ); stream.append( " label = \"{" + config.escapeLabel( config.getTitle( node )) + "|" ); } public void emitEnd( Appendable stream ) throws IOException { stream.append( "}\"\n ]\n" ); } public void emitProperty( Appendable stream, String key, Object value ) throws IOException { if ( config.acceptNodeProperty( key ) ) { PropertyType type = PropertyType.getTypeOf( value ); config.emitNodeProperty( stream, key, type, value ); } } }
3e0d6f1fef7b77b406234bfa942fa5c4f1e0b89f
892
java
Java
audit-core/src/main/java/com/jn/audit/core/resource/idresource/EntityLoaderRegistry.java
CoderYang112/audit
255ef55a7006a6323f27446c72b975cb347832e1
[ "Apache-2.0" ]
22
2020-04-10T22:40:21.000Z
2022-03-18T16:15:17.000Z
audit-core/src/main/java/com/jn/audit/core/resource/idresource/EntityLoaderRegistry.java
CoderYang112/audit
255ef55a7006a6323f27446c72b975cb347832e1
[ "Apache-2.0" ]
2
2021-05-17T07:45:51.000Z
2022-01-21T23:41:16.000Z
audit-core/src/main/java/com/jn/audit/core/resource/idresource/EntityLoaderRegistry.java
CoderYang112/audit
255ef55a7006a6323f27446c72b975cb347832e1
[ "Apache-2.0" ]
8
2020-05-09T10:19:12.000Z
2022-01-07T02:53:25.000Z
29.733333
110
0.717489
5,686
package com.jn.audit.core.resource.idresource; import com.jn.langx.registry.Registry; import com.jn.langx.util.Preconditions; import java.util.concurrent.ConcurrentHashMap; public class EntityLoaderRegistry implements Registry<String, EntityLoader> { private final ConcurrentHashMap<String, EntityLoader> map = new ConcurrentHashMap<String, EntityLoader>(); @Override public void register(EntityLoader entityLoader) { register(entityLoader.getName(), entityLoader); } @Override public void register(String name, EntityLoader entityLoader) { if(entityLoader instanceof EntityLoaderDispatcher){ return; } Preconditions.checkNotEmpty(name,"the entity loader name is null or empty"); map.put(name, entityLoader); } @Override public EntityLoader get(String name) { return map.get(name); } }
3e0d6f59a83cc29b0730f9149e9d89b04b7e7b22
446
java
Java
backend/src/main/java/com/velpe/jwtAuth/qna/dto/AnswerDTO.java
Team-Velpe/spring_jwt
a17a886181e7dba35c486d98c73d6ff8e18106fe
[ "MIT" ]
null
null
null
backend/src/main/java/com/velpe/jwtAuth/qna/dto/AnswerDTO.java
Team-Velpe/spring_jwt
a17a886181e7dba35c486d98c73d6ff8e18106fe
[ "MIT" ]
8
2022-01-16T11:41:12.000Z
2022-01-24T13:55:18.000Z
backend/src/main/java/com/velpe/jwtAuth/qna/dto/AnswerDTO.java
Team-Velpe/spring_jwt
a17a886181e7dba35c486d98c73d6ff8e18106fe
[ "MIT" ]
null
null
null
18.583333
57
0.695067
5,687
package com.velpe.jwtAuth.qna.dto; import com.velpe.jwtAuth.qna.domain.Answer; import lombok.AllArgsConstructor; import lombok.Data; @Data @AllArgsConstructor public class AnswerDTO { private Long a_id; private String body; private String nickname; public AnswerDTO(Answer answer) { this.a_id = answer.getId(); this.body = answer.getBody(); this.nickname = answer.getMember().getNickname(); } }
3e0d6f769dfff7cd8cc0e55aaff89356b8bb0284
615
java
Java
src/main/java/com/revature/mikeworks/components/CentralMenu.java
Michael-Kochis/Revature-eBank
125fc215fb21ec2443804f3509dc5d07afee945f
[ "MIT" ]
null
null
null
src/main/java/com/revature/mikeworks/components/CentralMenu.java
Michael-Kochis/Revature-eBank
125fc215fb21ec2443804f3509dc5d07afee945f
[ "MIT" ]
null
null
null
src/main/java/com/revature/mikeworks/components/CentralMenu.java
Michael-Kochis/Revature-eBank
125fc215fb21ec2443804f3509dc5d07afee945f
[ "MIT" ]
null
null
null
36.176471
80
0.702439
5,688
package com.revature.mikeworks.components; import com.revature.mikeworks.enums.BankSecurity; public class CentralMenu extends BankMenuAuth { public CentralMenu() { this.addMenuItem(0, "Log out"); this.addMenuItem(1, "Profile Options"); this.addMenuItem(2, "Bank Account Options"); this.addMenuItem(3, "View Customer Information", BankSecurity.EMPLOYEE); this.addMenuItem(4, "Approve/Deny Accounts", BankSecurity.EMPLOYEE); this.addMenuItem(5, "Edit Profiles", BankSecurity.ADMIN); this.addMenuItem(6, "Edit Bank Accounts", BankSecurity.ADMIN); } }
3e0d6fac33efa1aff8d138273b2a13412d54cafa
1,628
java
Java
panda-framework/src/main/java/org/panda_lang/language/interpreter/pattern/functional/verifiers/NextTokenTypeVerifier.java
CDFN/panda
18f207e6c8ec17c6bf1294beff1f61ba48506353
[ "Apache-2.0" ]
1
2020-12-26T19:33:11.000Z
2020-12-26T19:33:11.000Z
panda-framework/src/main/java/org/panda_lang/language/interpreter/pattern/functional/verifiers/NextTokenTypeVerifier.java
CDFN/panda
18f207e6c8ec17c6bf1294beff1f61ba48506353
[ "Apache-2.0" ]
null
null
null
panda-framework/src/main/java/org/panda_lang/language/interpreter/pattern/functional/verifiers/NextTokenTypeVerifier.java
CDFN/panda
18f207e6c8ec17c6bf1294beff1f61ba48506353
[ "Apache-2.0" ]
null
null
null
30.716981
111
0.708845
5,689
/* * Copyright (c) 2020 Dzikoysk * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.panda_lang.language.interpreter.pattern.functional.verifiers; import org.panda_lang.language.interpreter.token.Snippetable; import org.panda_lang.language.interpreter.token.TokenType; import org.panda_lang.language.interpreter.pattern.functional.Verifier; import org.panda_lang.language.interpreter.token.SynchronizedSource; import org.panda_lang.utilities.commons.collection.Pair; import java.util.List; public final class NextTokenTypeVerifier implements Verifier<Snippetable> { private final TokenType[] types; public NextTokenTypeVerifier(TokenType... types) { this.types = types; } @Override public boolean verify(List<Pair<String, Object>> results, SynchronizedSource source, Snippetable content) { if (!source.hasNext()) { return false; } TokenType next = source.getNext().getType(); for (TokenType type : types) { if (type == next) { return true; } } return false; } }
3e0d6fb8e463b0ece367b35bc48a461b7b611395
5,507
java
Java
LuxorMC Framework/src/com/faithfulmc/framework/command/module/essential/AutoRestartCommand.java
Tominous/Faithfulmc
c057628cdbf770e2892b5bf0cdfccdcb54bc8bfa
[ "Apache-2.0" ]
1
2020-01-13T14:42:54.000Z
2020-01-13T14:42:54.000Z
LuxorMC Framework/src/com/faithfulmc/framework/command/module/essential/AutoRestartCommand.java
NickGFX/Faithfulmc
dcaaa65f3c5f8c289ab4b757a91fb3b5c06e24d7
[ "Apache-2.0" ]
null
null
null
LuxorMC Framework/src/com/faithfulmc/framework/command/module/essential/AutoRestartCommand.java
NickGFX/Faithfulmc
dcaaa65f3c5f8c289ab4b757a91fb3b5c06e24d7
[ "Apache-2.0" ]
null
null
null
42.361538
286
0.640276
5,690
package com.faithfulmc.framework.command.module.essential; import com.faithfulmc.framework.BasePlugin; import com.faithfulmc.framework.command.BaseCommand; import com.faithfulmc.util.command.CommandArgument; import com.faithfulmc.util.command.CommandWrapper; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import java.util.ArrayList; import java.util.Collections; import java.util.List; @Deprecated public class AutoRestartCommand extends BaseCommand { private final CommandWrapper handler; public AutoRestartCommand(final BasePlugin plugin) { super("autore", "Allows management of server restarts."); this.setAliases(new String[]{"autorestart"}); this.setUsage("/(command) <cancel|time|schedule>"); final ArrayList<CommandArgument> arguments = new ArrayList<CommandArgument>(3); arguments.add(new AutoRestartCancelArgument(plugin)); arguments.add(new AutoRestartScheduleArgument(plugin)); arguments.add(new AutoRestartTimeArgument(plugin)); Collections.sort(arguments, new CommandWrapper.ArgumentComparator()); this.handler = new CommandWrapper(arguments); } @Override public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { return this.handler.onCommand(sender, command, label, args); } @Override public List<String> onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { return this.handler.onTabComplete(sender, command, label, args); } private static class AutoRestartTimeArgument extends CommandArgument { private final BasePlugin plugin; public AutoRestartTimeArgument(final BasePlugin plugin) { super("time", "Gets the remaining time until next restart."); this.plugin = plugin; this.aliases = new String[]{"remaining", "time"}; } @Override public String getUsage(final String label) { return '/' + label + ' ' + this.getName(); } @Override public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { /* if (!this.plugin.getAutoRestartHandler().isPendingRestart()) { sender.sendMessage(ChatColor.RED + "There is not a restart task pending."); return true; } final String reason = this.plugin.getAutoRestartHandler().getReason(); sender.sendMessage(BaseConstants.YELLOW + "Automatic restart task occurring in " + DurationFormatUtils.formatDurationWords(this.plugin.getAutoRestartHandler().getRemainingMilliseconds(), true, true) + (Strings.nullToEmpty(reason).isEmpty() ? "" : (" for " + reason)) + '.'); */ return true; } } private static class AutoRestartScheduleArgument extends CommandArgument { private final BasePlugin plugin; public AutoRestartScheduleArgument(final BasePlugin plugin) { super("schedule", "Schedule an automatic restart."); this.plugin = plugin; this.aliases = new String[]{"reschedule"}; } @Override public String getUsage(final String label) { return '/' + label + ' ' + this.getName() + " <time> [reason]"; } @Override public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { /* if (args.length < 2) { sender.sendMessage(ChatColor.RED + "Usage: /" + label + ' ' + args[0].toLowerCase() + " <time> [reason]"); return true; } final long millis = JavaUtils.parse(args[1]); if (millis == -1L) { sender.sendMessage(ChatColor.RED + "Invalid duration, use the correct format: 10m1s"); return true; } final String reason = StringUtils.join((Object[])args, ' ', 2, args.length); this.plugin.getAutoRestartHandler().scheduleRestart(millis, reason); Command.broadcastCommandMessage(sender, BaseConstants.YELLOW + "Scheduled a restart to occur in " + DurationFormatUtils.formatDurationWords(millis, true, true) + (reason.isEmpty() ? "" : (" for " + reason)) + '.'); */ return true; } } private static class AutoRestartCancelArgument extends CommandArgument { private final BasePlugin plugin; public AutoRestartCancelArgument(final BasePlugin plugin) { super("cancel", "Cancels the current automatic restart."); this.plugin = plugin; } @Override public String getUsage(final String label) { return '/' + label + ' ' + this.getName(); } @Override public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { /* if (!this.plugin.getAutoRestartHandler().isPendingRestart()) { sender.sendMessage(ChatColor.RED + "There is not a restart task pending."); return true; } this.plugin.getAutoRestartHandler().cancelRestart(); sender.sendMessage(BaseConstants.YELLOW + "Automatic restart task cancelled."); */ return true; } } }
3e0d6fc5f04e46331eb4610739def3924664c96e
519
java
Java
BattleArena/src/java/mc/alk/arena/events/BAEvent.java
Zarkopafilis/RFS
3d0b26faf54486bb6af6a2915b7f0649ff1b9f5c
[ "MIT" ]
null
null
null
BattleArena/src/java/mc/alk/arena/events/BAEvent.java
Zarkopafilis/RFS
3d0b26faf54486bb6af6a2915b7f0649ff1b9f5c
[ "MIT" ]
null
null
null
BattleArena/src/java/mc/alk/arena/events/BAEvent.java
Zarkopafilis/RFS
3d0b26faf54486bb6af6a2915b7f0649ff1b9f5c
[ "MIT" ]
null
null
null
19.961538
63
0.761079
5,691
package mc.alk.arena.events; import mc.alk.arena.Defaults; import org.bukkit.Bukkit; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; public class BAEvent extends Event{ private static final HandlerList handlers = new HandlerList(); public void callEvent(){ if (Defaults.TESTSERVER) return; Bukkit.getServer().getPluginManager().callEvent(this); } @Override public HandlerList getHandlers() { return handlers; } public static HandlerList getHandlerList() { return handlers; } }
3e0d6fdc88ba506e7efb54d3cb0c2482d7fa16ef
6,374
java
Java
blog-springboot/src/main/java/com/minzheng/blog/service/impl/MenuServiceImpl.java
zjy-oss/blog
13fe6a5b7277ed9861895d7886d1a7513979fe08
[ "Apache-2.0" ]
74
2021-10-16T06:55:31.000Z
2022-03-30T11:59:29.000Z
blog-springboot/src/main/java/com/minzheng/blog/service/impl/MenuServiceImpl.java
DarkKaras/thatblog
7b1b9bddf8c426231f7366ea431f399fa471f799
[ "Apache-2.0" ]
1
2022-01-14T08:38:01.000Z
2022-01-23T02:03:45.000Z
blog-springboot/src/main/java/com/minzheng/blog/service/impl/MenuServiceImpl.java
DarkKaras/thatblog
7b1b9bddf8c426231f7366ea431f399fa471f799
[ "Apache-2.0" ]
33
2021-10-31T11:11:40.000Z
2022-03-20T07:25:58.000Z
38.630303
116
0.593505
5,692
package com.minzheng.blog.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.minzheng.blog.constant.CommonConst; import com.minzheng.blog.dao.MenuDao; import com.minzheng.blog.dto.MenuDTO; import com.minzheng.blog.dto.labelOptionDTO; import com.minzheng.blog.dto.UserMenuDTO; import com.minzheng.blog.entity.Menu; import com.minzheng.blog.service.MenuService; import com.minzheng.blog.utils.BeanCopyUtil; import com.minzheng.blog.utils.UserUtil; import com.minzheng.blog.vo.ConditionVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.*; import java.util.stream.Collectors; import static com.minzheng.blog.constant.CommonConst.*; import static com.minzheng.blog.constant.CommonConst.COMPONENT; /** * @author: yezhiqiu * @date: 2021-01-23 **/ @Service public class MenuServiceImpl extends ServiceImpl<MenuDao, Menu> implements MenuService { @Autowired private MenuDao menuDao; @Override public List<MenuDTO> listMenus(ConditionVO conditionVO) { // 查询菜单数据 List<Menu> menuList = this.list(new LambdaQueryWrapper<Menu>() .like(StringUtils.isNotBlank(conditionVO.getKeywords()), Menu::getName, conditionVO.getKeywords())); // 获取目录列表 List<Menu> catalogList = listCatalog(menuList); // 获取目录下的子菜单 Map<Integer, List<Menu>> childrenMap = getMenuMap(menuList); // 组装目录菜单数据 return catalogList.stream().map(item -> { MenuDTO menuDTO = BeanCopyUtil.copyObject(item, MenuDTO.class); // 获取目录下的菜单排序 List<MenuDTO> list = BeanCopyUtil.copyList(childrenMap.get(item.getId()), MenuDTO.class).stream() .sorted(Comparator.comparing(MenuDTO::getOrderNum)) .collect(Collectors.toList()); menuDTO.setChildren(list); return menuDTO; }).sorted(Comparator.comparing(MenuDTO::getOrderNum)).collect(Collectors.toList()); } @Override public List<labelOptionDTO> listMenuOptions() { // 查询菜单数据 List<Menu> menuList = this.list(new LambdaQueryWrapper<Menu>() .select(Menu::getId, Menu::getName, Menu::getParentId, Menu::getOrderNum)); // 获取目录列表 List<Menu> catalogList = listCatalog(menuList); // 获取目录下的子菜单 Map<Integer, List<Menu>> childrenMap = getMenuMap(menuList); // 组装目录菜单数据 return catalogList.stream().map(item -> { // 获取目录下的菜单排序 List<labelOptionDTO> list = new ArrayList<>(); List<Menu> children = childrenMap.get(item.getId()); if (CollectionUtils.isNotEmpty(children)) { list = children.stream() .sorted(Comparator.comparing(Menu::getOrderNum)) .map(menu -> labelOptionDTO.builder() .id(menu.getId()) .label(menu.getName()) .build()) .collect(Collectors.toList()); } return labelOptionDTO.builder() .id(item.getId()) .label(item.getName()) .children(list) .build(); }).collect(Collectors.toList()); } @Override public List<UserMenuDTO> listUserMenus() { // 查询用户菜单信息 List<Menu> menuList = menuDao.listMenusByUserInfoId(UserUtil.getLoginUser().getUserInfoId()); // 获取目录列表 List<Menu> catalogList = listCatalog(menuList); // 获取目录下的子菜单 Map<Integer, List<Menu>> childrenMap = getMenuMap(menuList); // 转换前端菜单格式 return convertUserMenuList(catalogList, childrenMap); } /** * 获取目录列表 * * @param menuList 菜单列表 * @return 目录列表 */ private List<Menu> listCatalog(List<Menu> menuList) { return menuList.stream() .filter(item -> Objects.isNull(item.getParentId())) .sorted(Comparator.comparing(Menu::getOrderNum)) .collect(Collectors.toList()); } /** * 获取目录下菜单列表 * * @param menuList 菜单列表 * @return 目录下的菜单列表 */ private Map<Integer, List<Menu>> getMenuMap(List<Menu> menuList) { return menuList.stream() .filter(item -> Objects.nonNull(item.getParentId())) .collect(Collectors.groupingBy(Menu::getParentId)); } /** * 转换用户菜单格式 * * @param catalogList 目录 * @param childrenMap 子菜单 */ private List<UserMenuDTO> convertUserMenuList(List<Menu> catalogList, Map<Integer, List<Menu>> childrenMap) { return catalogList.stream().map(item -> { // 获取目录 UserMenuDTO userMenuDTO = new UserMenuDTO(); List<UserMenuDTO> list = new ArrayList<>(); // 获取目录下的子菜单 List<Menu> children = childrenMap.get(item.getId()); if (CollectionUtils.isNotEmpty(children)) { // 多级菜单处理 userMenuDTO = BeanCopyUtil.copyObject(item, UserMenuDTO.class); list = children.stream() .sorted(Comparator.comparing(Menu::getOrderNum)) .map(menu -> { UserMenuDTO dto = BeanCopyUtil.copyObject(menu, UserMenuDTO.class); dto.setHidden(menu.getIsHidden().equals(TURE)); return dto; }).collect(Collectors.toList()); } else { // 一级菜单处理 userMenuDTO.setPath(item.getPath()); userMenuDTO.setComponent(COMPONENT); list.add(UserMenuDTO.builder() .path("") .name(item.getName()) .icon(item.getIcon()) .component(item.getComponent()) .build()); } userMenuDTO.setHidden(item.getIsHidden().equals(TURE)); userMenuDTO.setChildren(list); return userMenuDTO; }).collect(Collectors.toList()); } }
3e0d70ba54af33f5b328dc9ad326f3fa5476ad20
4,538
java
Java
src/main/java/com/ainq/fhir/saner/tools/testcase/parser/CodeConstraint.java
AudaciousInquiry/saner-sample-data
f729426456b0a2013327370f52078f7a154039af
[ "Apache-2.0" ]
null
null
null
src/main/java/com/ainq/fhir/saner/tools/testcase/parser/CodeConstraint.java
AudaciousInquiry/saner-sample-data
f729426456b0a2013327370f52078f7a154039af
[ "Apache-2.0" ]
null
null
null
src/main/java/com/ainq/fhir/saner/tools/testcase/parser/CodeConstraint.java
AudaciousInquiry/saner-sample-data
f729426456b0a2013327370f52078f7a154039af
[ "Apache-2.0" ]
null
null
null
29.855263
79
0.540767
5,693
package com.ainq.fhir.saner.tools.testcase.parser; /* * Copyright 2020 Audiacious Inquiry, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ import org.hl7.fhir.r4.model.Base; import org.hl7.fhir.r4.model.CodeableConcept; import org.hl7.fhir.r4.model.Coding; /** * Pojo for CodeConstraint ::= MissingConstraint * | 'in' identifier{ValueSet} * | 'not' 'in' identifier{ValueSet} [is this really necessary] * | 'equals' CodeLiteral * */ class CodeConstraint extends Constraint { private String valueSet; private Coding code; private boolean notIn = false; public CodeConstraint(Cases cases, String fieldName, Base field) { super(cases, fieldName, field); } /** * @return the valueSet */ public String getValueSet() { return valueSet; } /** * @param valueSet the valueSet to set */ public CodeConstraint setValueSet(String valueSet) { this.valueSet = valueSet; return this; } /** * @return the code */ public Coding getCode() { return code; } /** * @param code the code to set */ public CodeConstraint setCode(Coding code) { this.code = code; return this; } /** * @return the notIn */ public boolean isNotIn() { return notIn; } /** * @param notIn the notIn to set */ public CodeConstraint setNotIn(boolean notIn) { this.notIn = notIn; return this; } @Override protected Base getNextValue() { if (code != null) { return typed(code); } if (valueSet != null) { ValueList vl = getCases().getValueList(valueSet); if (vl == null) { throw new RuntimeException(valueSet + " does not exist"); } String value = vl.nextValue(); String system = vl.getSystem(); return getCodeFromString(value, system); } return null; } @Override protected void resetState() { } private Base getCodeFromString(String value, String system) { if (value == null || value.length() == 0) { // Setting the code value to "" should result in a null code // This allows a valuelist to specify that nulls should be // sent some of the time. return null; } if (system != null) { value = system + "|" + value; } if (value.length() == 0) { return null; } String parts[] = value.split("\\|"); Coding coding = parseCodeParts(parts, 0); if (coding == null) { return null; } if (parts.length <= 3 || !"CodeableConcept".equals(getType())) { return typed(coding); } CodeableConcept cc = new CodeableConcept().addCoding(coding); for (int i = 3; i < parts.length; i += 3) { coding = parseCodeParts(parts, i); if (coding != null) { cc.addCoding(coding); } } return cc; } private Coding parseCodeParts(String parts[], int i) { Coding coding = new Coding(); coding.setSystem(parts[i].length() != 0 ? parts[i] : null); if (parts.length > i + 1) { if (parts[i + 1].length() == 0) { // Setting the code value to "" should result in a null code // This allows a valuelist to specify that nulls should be // sent some of the time. return null; } coding.setCode(parts[i + 1]); } if (parts.length > i + 2) { coding.setDisplay(parts[i + 2]); } return coding; } private Base typed(Coding code) { return typed(code, getType()); } }
3e0d7172176c61d23a4c3b9e9ea755b95c8d53a9
2,653
java
Java
hypertuner/src/main/java/com/huawei/kunpeng/hyper/tuner/toolview/renderer/user/UserTableRenderer.java
kunpengcompute/devkit-intellij-plugin
ca62556b8ab74cc6b5e21e119934c92643958de9
[ "Apache-2.0" ]
null
null
null
hypertuner/src/main/java/com/huawei/kunpeng/hyper/tuner/toolview/renderer/user/UserTableRenderer.java
kunpengcompute/devkit-intellij-plugin
ca62556b8ab74cc6b5e21e119934c92643958de9
[ "Apache-2.0" ]
null
null
null
hypertuner/src/main/java/com/huawei/kunpeng/hyper/tuner/toolview/renderer/user/UserTableRenderer.java
kunpengcompute/devkit-intellij-plugin
ca62556b8ab74cc6b5e21e119934c92643958de9
[ "Apache-2.0" ]
null
null
null
31.583333
100
0.710893
5,694
/* * Copyright (c) Huawei Technologies Co., Ltd. 2020-2022. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.huawei.kunpeng.hyper.tuner.toolview.renderer.user; import com.huawei.kunpeng.hyper.tuner.common.constant.TuningUserManageConstant; import com.huawei.kunpeng.hyper.tuner.toolview.panel.impl.userpanel.CSSConstant; import com.intellij.ui.components.JBLabel; import com.intellij.ui.components.JBPanel; import java.awt.Component; import java.awt.FlowLayout; import javax.swing.JTable; import javax.swing.table.TableCellRenderer; /** * 表格渲染器。 * * @since 2020-10-10 */ public class UserTableRenderer implements TableCellRenderer { private static final int ROLE_INDEX = 2; private JBLabel modifyLabel; private JBPanel mainPanel; private JBLabel deleteLabel; /** * 用户表格渲染器 */ public UserTableRenderer() { this.mainPanel = new JBPanel(); this.modifyLabel = new JBLabel(TuningUserManageConstant.OPERATE_RESET); this.modifyLabel.setForeground(CSSConstant.RESET_DELETE_LABEL_COLOR); this.deleteLabel = new JBLabel(TuningUserManageConstant.OPERATE_DEL); this.deleteLabel.setForeground(CSSConstant.RESET_DELETE_LABEL_COLOR); this.mainPanel.setLayout(new FlowLayout(10, 20, 5)); } @Override public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { this.mainPanel.removeAll(); Object role = table.getModel().getValueAt(row, ROLE_INDEX); if (TuningUserManageConstant.USER_ROLE_ADMIN.equals(role)) { this.mainPanel.add(modifyLabel); modifyLabel.setText(TuningUserManageConstant.TITLE_CHANGE_USER); } else { modifyLabel.setText(TuningUserManageConstant.OPERATE_RESET); this.mainPanel.add(modifyLabel); this.mainPanel.add(deleteLabel); } return this.mainPanel; } /** * 返回渲染器主界面。 * * @return 返回渲染器主界面 */ public JBPanel getComponent() { return this.mainPanel; } }
3e0d723ea2a4889896affa23fb25c34743baf1d7
146
java
Java
alura/carreira_java/example27/src/br/com/flaviogf/CanAuthenticate.java
flaviogf/Cursos
2b120dbcd24a907121f58482fdcdfa01b164872c
[ "MIT" ]
2
2021-02-20T23:50:07.000Z
2021-08-15T03:04:35.000Z
alura/carreira_java/example27/src/br/com/flaviogf/CanAuthenticate.java
flaviogf/Cursos
2b120dbcd24a907121f58482fdcdfa01b164872c
[ "MIT" ]
18
2019-08-07T02:33:00.000Z
2021-03-18T22:52:38.000Z
alura/carreira_java/example27/src/br/com/flaviogf/CanAuthenticate.java
flaviogf/Cursos
2b120dbcd24a907121f58482fdcdfa01b164872c
[ "MIT" ]
2
2020-09-28T13:00:09.000Z
2021-12-30T12:21:08.000Z
18.25
42
0.767123
5,695
package br.com.flaviogf; public interface CanAuthenticate { void setPassword(String password); boolean authenticate(String password); }
3e0d7271e171245135667d74770b217cdaf785f0
3,637
java
Java
com/mysql/cj/xdevapi/FindStatementImpl.java
BantorSchwanzVor/plotscanner-leak
cbf130076159711d939affb4b0343c46c3466107
[ "MIT" ]
null
null
null
com/mysql/cj/xdevapi/FindStatementImpl.java
BantorSchwanzVor/plotscanner-leak
cbf130076159711d939affb4b0343c46c3466107
[ "MIT" ]
null
null
null
com/mysql/cj/xdevapi/FindStatementImpl.java
BantorSchwanzVor/plotscanner-leak
cbf130076159711d939affb4b0343c46c3466107
[ "MIT" ]
null
null
null
34.971154
193
0.747319
5,696
package com.mysql.cj.xdevapi; import com.mysql.cj.MysqlxSession; import com.mysql.cj.protocol.Message; import com.mysql.cj.protocol.x.XMessage; import java.util.concurrent.CompletableFuture; public class FindStatementImpl extends FilterableStatement<FindStatement, DocResult> implements FindStatement { FindStatementImpl(MysqlxSession mysqlxSession, String schema, String collection, String criteria) { super(new DocFilterParams(schema, collection)); this.mysqlxSession = mysqlxSession; if (criteria != null && criteria.length() > 0) this.filterParams.setCriteria(criteria); if (!this.mysqlxSession.supportsPreparedStatements()) this.preparedState = PreparableStatement.PreparedState.UNSUPPORTED; } protected DocResult executeStatement() { return (DocResult)this.mysqlxSession.query((Message)getMessageBuilder().buildFind(this.filterParams), new StreamingDocResultBuilder(this.mysqlxSession)); } protected XMessage getPrepareStatementXMessage() { return getMessageBuilder().buildPrepareFind(this.preparedStatementId, this.filterParams); } protected DocResult executePreparedStatement() { return (DocResult)this.mysqlxSession.query((Message)getMessageBuilder().buildPrepareExecute(this.preparedStatementId, this.filterParams), new StreamingDocResultBuilder(this.mysqlxSession)); } public CompletableFuture<DocResult> executeAsync() { return this.mysqlxSession.queryAsync((Message)getMessageBuilder().buildFind(this.filterParams), new DocResultBuilder(this.mysqlxSession)); } public FindStatement fields(String... projection) { resetPrepareState(); this.filterParams.setFields(projection); return this; } public FindStatement fields(Expression docProjection) { resetPrepareState(); ((DocFilterParams)this.filterParams).setFields(docProjection); return this; } public FindStatement groupBy(String... groupBy) { resetPrepareState(); this.filterParams.setGrouping(groupBy); return this; } public FindStatement having(String having) { resetPrepareState(); this.filterParams.setGroupingCriteria(having); return this; } public FindStatement lockShared() { return lockShared(Statement.LockContention.DEFAULT); } public FindStatement lockShared(Statement.LockContention lockContention) { resetPrepareState(); this.filterParams.setLock(FilterParams.RowLock.SHARED_LOCK); switch (lockContention) { case NOWAIT: this.filterParams.setLockOption(FilterParams.RowLockOptions.NOWAIT); break; case SKIP_LOCKED: this.filterParams.setLockOption(FilterParams.RowLockOptions.SKIP_LOCKED); break; } return this; } public FindStatement lockExclusive() { return lockExclusive(Statement.LockContention.DEFAULT); } public FindStatement lockExclusive(Statement.LockContention lockContention) { resetPrepareState(); this.filterParams.setLock(FilterParams.RowLock.EXCLUSIVE_LOCK); switch (lockContention) { case NOWAIT: this.filterParams.setLockOption(FilterParams.RowLockOptions.NOWAIT); break; case SKIP_LOCKED: this.filterParams.setLockOption(FilterParams.RowLockOptions.SKIP_LOCKED); break; } return this; } @Deprecated public FindStatement where(String searchCondition) { return super.where(searchCondition); } } /* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\com\mysql\cj\xdevapi\FindStatementImpl.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
3e0d72eec8cb4ccc45dd9698dbcb9b5a90fced53
2,846
java
Java
app/src/main/java/com/cleverchuk/bakingfun/adapters/StepsAdapter.java
CleverChuk/baking-app
e5b2aecb24e0715f8489bc7f94bf3e4dcfbcef27
[ "MIT" ]
null
null
null
app/src/main/java/com/cleverchuk/bakingfun/adapters/StepsAdapter.java
CleverChuk/baking-app
e5b2aecb24e0715f8489bc7f94bf3e4dcfbcef27
[ "MIT" ]
null
null
null
app/src/main/java/com/cleverchuk/bakingfun/adapters/StepsAdapter.java
CleverChuk/baking-app
e5b2aecb24e0715f8489bc7f94bf3e4dcfbcef27
[ "MIT" ]
null
null
null
33.880952
93
0.720309
5,697
/* * MIT License * * Copyright (c) 2018 Chukwubuikem Ume-Ugwa * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.cleverchuk.bakingfun.adapters; import android.content.Context; import android.support.annotation.NonNull; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import com.cleverchuk.bakingfun.R; import com.cleverchuk.bakingfun.models.Step; /** * a subclass of {@link CleverChukBaseAdapter} for displaying * recipe steps * Created by chuk on 5/1/18,at 10:47. */ public class StepsAdapter extends CleverChukBaseAdapter<StepsAdapter.ViewHolder, Step> { public static final String KEY = "com.cleverchuk.bakingfun.steps.adapter"; private final Context mContext; public StepsAdapter(Context context, OnItemClickListener listener) { super(KEY); mContext = context; mListener = listener; } @NonNull @Override public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(mContext).inflate(R.layout.item_step, parent, false); return new ViewHolder(view); } @Override public void onBindViewHolder(@NonNull ViewHolder holder, int position) { Step step = getItem(position); holder.titleBtn.setText(step.getShortDescription()); } class ViewHolder extends CleverChukBaseAdapter.BaseHolder { final Button titleBtn; ViewHolder(View itemView) { super(itemView); titleBtn = itemView.findViewById(R.id.title_btn); itemView.setOnClickListener(this); } @Override public void onClick(View v) { int pos = getAdapterPosition(); mListener.itemClicked(pos); } } }
3e0d737f12169ebdb99a526994553d63625fa0c6
564
java
Java
src/main/java/jp/azw/wheel/function/ThrowablePredicate.java
azwjp/wheel
d5157845d9e3222d933f25a7845863464113d16f
[ "MIT" ]
null
null
null
src/main/java/jp/azw/wheel/function/ThrowablePredicate.java
azwjp/wheel
d5157845d9e3222d933f25a7845863464113d16f
[ "MIT" ]
null
null
null
src/main/java/jp/azw/wheel/function/ThrowablePredicate.java
azwjp/wheel
d5157845d9e3222d933f25a7845863464113d16f
[ "MIT" ]
null
null
null
29.684211
89
0.663121
5,698
package jp.azw.wheel.function; @FunctionalInterface public interface ThrowablePredicate<T, E extends Throwable> { boolean test(T t) throws E; default ThrowablePredicate<T, E> and (ThrowablePredicate<? super T, E> other) throws E { return other == null ? t -> test(t) : (t -> test(t) && other.test(t)); } default ThrowablePredicate<T, E> negate () throws E { return t -> !test(t); } default ThrowablePredicate<T, E> or (ThrowablePredicate<? super T, E> other) throws E { return other == null ? t -> test(t) : (t -> test(t) || other.test(t)); } }
3e0d743e485d9064909b5ec0dd62773a615acbb5
14,801
java
Java
Plugins/EASy-Producer/ScenariosTest/testdata/real/QualiMaster/sep17/expected/pipelines/eu/qualimaster/SwitchPip/topology/PipelineVar_2_FamilyElement0FamilyElement.java
SSEHUB/EASyProducer
769ebe97f9f83963ea814f5e811a562ded7db5d5
[ "Apache-2.0" ]
10
2016-02-09T14:55:59.000Z
2019-06-06T00:23:38.000Z
Plugins/EASy-Producer/ScenariosTest/testdata/real/QualiMaster/sep17/expected/pipelines/eu/qualimaster/SwitchPip/topology/PipelineVar_2_FamilyElement0FamilyElement.java
SSEHUB/EASyProducer
769ebe97f9f83963ea814f5e811a562ded7db5d5
[ "Apache-2.0" ]
88
2015-09-03T16:06:12.000Z
2021-05-26T12:10:12.000Z
Plugins/EASy-Producer/ScenariosTest/testdata/real/QualiMaster/sep17/expected/pipelines/eu/qualimaster/SwitchPip/topology/PipelineVar_2_FamilyElement0FamilyElement.java
SSEHUB/EASyProducer
769ebe97f9f83963ea814f5e811a562ded7db5d5
[ "Apache-2.0" ]
1
2016-03-21T16:12:51.000Z
2016-03-21T16:12:51.000Z
43.919881
139
0.607324
5,699
package eu.qualimaster.SwitchPip.topology; import java.util.*; import java.io.IOException; import java.lang.NoSuchMethodException; import java.lang.reflect.InvocationTargetException; import java.io.OutputStream; import java.io.Serializable; import java.net.Socket; import java.io.PrintWriter; import eu.qualimaster.common.logging.DataLogger; import java.net.UnknownHostException; import com.esotericsoftware.kryo.io.Output; import org.apache.log4j.Logger; import backtype.storm.tuple.*; import backtype.storm.task.*; import backtype.storm.topology.*; import eu.qualimaster.events.EventManager; import eu.qualimaster.monitoring.events.AlgorithmChangedMonitoringEvent; import eu.qualimaster.monitoring.events.ParameterChangedMonitoringEvent; import eu.qualimaster.families.inf.*; import eu.qualimaster.families.inf.ISwitchFamily.*; import eu.qualimaster.families.imp.*; import eu.qualimaster.common.signal.*; import eu.qualimaster.base.algorithm.*; import eu.qualimaster.base.algorithm.IFamily.State; import eu.qualimaster.infrastructure.PipelineOptions; import eu.qualimaster.pipeline.DefaultModeException; import eu.qualimaster.pipeline.DefaultModeMonitoringEvent; import eu.qualimaster.base.serializer.KryoSwitchTupleSerializer; import backtype.storm.Config; import eu.qualimaster.base.pipeline.CollectingTopologyInfo; import eu.qualimaster.pipeline.AlgorithmChangeParameter; import eu.qualimaster.algorithms.SwitchProcessor1; import eu.qualimaster.algorithms.SwitchProcessor2; import eu.qualimaster.data.inf.IRandomSource.*; import eu.qualimaster.base.algorithm.IItemEmitter; /** * Defines the FamilyElment in the pipeline(GEN). **/ @SuppressWarnings({ "rawtypes", "serial" }) public class PipelineVar_2_FamilyElement0FamilyElement extends BaseSignalBolt { final static Logger logger = Logger.getLogger(PipelineVar_2_FamilyElement0FamilyElement.class); transient OutputCollector _collector; private boolean algChange = false; private boolean firstTuple = false; private long record = 0; private int taskId; private transient SwitchFamily.ISwitchFamilyRandomDataOutput randomDataResult = new SwitchFamily.ISwitchFamilyRandomDataOutput(); private transient ISwitchFamily alg = null; transient IRandomSourceRandomDataOutput iTupleRandomData = null; transient IISwitchFamilyRandomDataInput inputRandomData = null; public PipelineVar_2_FamilyElement0FamilyElement(String name, String namespace) { super(name, namespace, true); } /** * Sends an algorithm change event and considers whether the coordination layer shall be bypassed for direct * testing. * @param algorithm the new algorithm * @param causeMsgId the message id of the causing message (may be empty or null) */ private void sendAlgorithmChangeEvent(String algorithm, String causeMsgId) { EventManager.send(new AlgorithmChangedMonitoringEvent(getPipeline(), getName(), algorithm, causeMsgId)); } /** * Sends an parameter change event and considers whether the coordination layer shall be bypassed for direct * testing. * @param parameter the parameter to be changed * @param value the new value * @param causeMsgId the message id of the causing message (may be empty or null) */ private void sendParameterChangeEvent(String parameter, Serializable value, String causeMsgId) { EventManager.send(new ParameterChangedMonitoringEvent(getPipeline(), getName(), parameter, value, causeMsgId)); } /** * Sends an a default mode monitoring event with a DefaultModeException case. * @param exceptionCase the DefaultModeException case */ private void sendDefaultModeMonitoringEvent(DefaultModeException exceptionCase) { EventManager.send(new DefaultModeMonitoringEvent(getPipeline(), getName(), exceptionCase)); } public void prepare(Map map, TopologyContext topologyContext, OutputCollector collector) { super.prepare(map, topologyContext, collector); _collector = collector; taskId = topologyContext.getThisTaskId(); algChange = false; randomDataResult = new SwitchFamily.ISwitchFamilyRandomDataOutput(); IItemEmitter<IISwitchFamilyRandomDataOutput> randomDataEmitter = new IItemEmitter<IISwitchFamilyRandomDataOutput>() { @Override public void emitDirect(String streamId, IISwitchFamilyRandomDataOutput item) { _collector.emit("PipelineVar_2_FamilyElement0RandomData", new Values(item)); } }; randomDataResult.setEmitter(randomDataEmitter); if("STATIC".equals(map.get(Constants.CONFIG_KEY_INIT_MODE))) { try { try { Class cls = Class.forName("eu.qualimaster.algorithms.SwitchProcessor1"); alg = (ISwitchFamily) cls.newInstance(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } alg.setParameterAggregationFactor(PipelineOptions.getExecutorIntArgument(map, getName(), "aggregationFactor", 0)); alg.setParameterDelay(PipelineOptions.getExecutorIntArgument(map, getName(), "delay", 0)); alg.setParameterFlag(PipelineOptions.getExecutorBooleanArgument(map, getName(), "flag", true)); alg.setParameterWindowSize(PipelineOptions.getExecutorIntArgument(map, getName(), "windowSize", 10)); if (alg != null) { alg.switchState(State.ACTIVATE); //activate the current algorithm } sendAlgorithmChangeEvent("SwitchProcessor1", null); algChange = true; } catch (Throwable e) { if (e instanceof DefaultModeException) { logger.error("Throwable caught - turning to default mode"); e.printStackTrace(); sendDefaultModeMonitoringEvent((DefaultModeException) e); } } } initMonitor(); logger.info("The end of the prepare method."); } @Override protected boolean initMonitorDuringPrepare() { return false; } public void forwardTuple(Object tupleItem) { startMonitoring(); // delegate to family "switchFamily" if (!firstTuple) {//the first tuple arrived firstTuple = true; record = System.currentTimeMillis(); } if(tupleItem instanceof IRandomSourceRandomDataOutput) { iTupleRandomData = (IRandomSourceRandomDataOutput)tupleItem; inputRandomData = new SwitchFamily.ISwitchFamilyRandomDataInput(); inputRandomData.setRandomInteger(iTupleRandomData.getRandomInteger()); inputRandomData.setTimestamp(iTupleRandomData.getTimestamp()); try { if(alg != null) { alg.calculate(inputRandomData, randomDataResult); } else { long now = System.currentTimeMillis(); if ((now - record) > 1000) {//print this error log once per second logger.error("Algorithm is not assigned!"); record = now; } } } catch(Throwable e) { long now = System.currentTimeMillis(); if ((now - record) > 1000) {//print this error log once per second e.printStackTrace(); record = now; } randomDataResult.setRandomInteger(0); randomDataResult.setTimestamp(0); if (e instanceof DefaultModeException) { sendDefaultModeMonitoringEvent((DefaultModeException) e); } } } if(!(alg instanceof ITopologyCreate)) { eu.qualimaster.base.algorithm.IOutputItemIterator<IISwitchFamilyRandomDataOutput> iterRandomData = randomDataResult.iterator(); iterRandomData.reset(); while (iterRandomData.hasNext()) { IISwitchFamilyRandomDataOutput out = iterRandomData.next(); _collector.emit("PipelineVar_2_FamilyElement0RandomData", new Values(out)); } } // _collector.ack(tuple); endMonitoring(); } @Override public void execute(Tuple tuple) { forwardTuple(tuple.getValue(0)); } @Override public void notifyParameterChange(ParameterChangeSignal signal) { try { for(int i = 0; alg!=null && i < signal.getChangeCount(); i++) { ParameterChange para = signal.getChange(i); switch (para.getName()) { case "aggregationFactor" : try { System.out.println("Received parameter changing signal aggregationFactor"); alg.setParameterAggregationFactor(para.getIntValue()); sendParameterChangeEvent("aggregationFactor", para.getIntValue(), signal.getCauseMessageId()); } catch (ValueFormatException e) { e.printStackTrace(); } break; case "delay" : try { System.out.println("Received parameter changing signal delay"); alg.setParameterDelay(para.getIntValue()); sendParameterChangeEvent("delay", para.getIntValue(), signal.getCauseMessageId()); } catch (ValueFormatException e) { e.printStackTrace(); } break; case "flag" : try { System.out.println("Received parameter changing signal flag"); alg.setParameterFlag(para.getBooleanValue()); sendParameterChangeEvent("flag", para.getBooleanValue(), signal.getCauseMessageId()); } catch (ValueFormatException e) { e.printStackTrace(); } break; case "windowSize" : try { System.out.println("Received parameter changing signal windowSize"); alg.setParameterWindowSize(para.getIntValue()); sendParameterChangeEvent("windowSize", para.getIntValue(), signal.getCauseMessageId()); } catch (ValueFormatException e) { e.printStackTrace(); } break; } } } catch (Throwable e) { if (e instanceof DefaultModeException) { logger.error("Throwable caught - turning to default mode"); e.printStackTrace(); sendDefaultModeMonitoringEvent((DefaultModeException) e); } } } @Override public void notifyAlgorithmChange(AlgorithmChangeSignal signal) { logger.info("Received algorithm switching signal " + signal.getAlgorithm()); try { switch (signal.getAlgorithm()) { case "SwitchProcessor1": if (!algChange || !(alg instanceof SwitchProcessor1)) { algChange = true; if(alg != null) { alg.switchState(State.PASSIVATE); //passivate the previous algorithm } try { Class cls = Class.forName("eu.qualimaster.algorithms.SwitchProcessor1"); alg = (ISwitchFamily) cls.newInstance(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } alg.setParameterAggregationFactor(0); alg.setParameterDelay(0); alg.setParameterFlag(true); alg.setParameterWindowSize(10); sendAlgorithmChangeEvent("SwitchProcessor1", signal.getCauseMessageId()); if(alg != null) { alg.switchState(State.ACTIVATE); //activate the current algorithm } } break; case "SwitchProcessor2": if (!algChange || !(alg instanceof SwitchProcessor2)) { algChange = true; if(alg != null) { alg.switchState(State.PASSIVATE); //passivate the previous algorithm } try { Class cls = Class.forName("eu.qualimaster.algorithms.SwitchProcessor2"); alg = (ISwitchFamily) cls.newInstance(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } alg.setParameterAggregationFactor(0); alg.setParameterDelay(0); alg.setParameterFlag(true); alg.setParameterWindowSize(10); sendAlgorithmChangeEvent("SwitchProcessor2", signal.getCauseMessageId()); if(alg != null) { alg.switchState(State.ACTIVATE); //activate the current algorithm } } break; } super.notifyAlgorithmChange(signal); } catch (Throwable e) { if (e instanceof DefaultModeException) { logger.error("Throwable caught - turning to default mode"); e.printStackTrace(); sendDefaultModeMonitoringEvent((DefaultModeException) e); } } } @Override public void cleanup() { super.cleanup(); if(alg != null) { alg.switchState(State.TERMINATING); } } public void declareOutputFields(OutputFieldsDeclarer declarer) { declarer.declareStream("PipelineVar_2_FamilyElement0RandomData", new Fields("PipelineVar_2_FamilyElement0RandomDataFields")); } @Override protected void prepareShutdown(ShutdownSignal signal) { super.prepareShutdown(signal); if(alg != null) { alg.switchState(State.TERMINATING); } } }
3e0d744875bd50630e17646b0f2d45cfc6de4e15
1,298
java
Java
toro-sample/src/main/java/im/ene/toro/sample/feature/extended/ExtendedNormalViewHolder.java
Sravani04/Albadiya
28177073179d2de81364c56bca4cb3aa29127a01
[ "Apache-2.0" ]
2
2019-11-13T11:08:19.000Z
2020-03-13T06:47:14.000Z
toro-sample/src/main/java/im/ene/toro/sample/feature/extended/ExtendedNormalViewHolder.java
Sravani04/Albadiya
28177073179d2de81364c56bca4cb3aa29127a01
[ "Apache-2.0" ]
null
null
null
toro-sample/src/main/java/im/ene/toro/sample/feature/extended/ExtendedNormalViewHolder.java
Sravani04/Albadiya
28177073179d2de81364c56bca4cb3aa29127a01
[ "Apache-2.0" ]
null
null
null
26.895833
83
0.739737
5,700
/* * Copyright 2016 eneim@Eneim Labs, dycjh@example.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package im.ene.toro.sample.feature.extended; import android.support.v7.widget.RecyclerView; import android.view.View; import im.ene.toro.sample.R; /** * Created by eneim on 6/29/16. * * Sample ViewHolder which holds no Video. Or it doesn't request support from Toro. */ public class ExtendedNormalViewHolder extends ExtendedViewHolder { public static final int LAYOUT_RES = R.layout.vh_normal_view; public ExtendedNormalViewHolder(View itemView) { super(itemView); } @Override public void bind(RecyclerView.Adapter adapter, Object item) { } @Override public void onAttachedToWindow() { } @Override public void onDetachedFromWindow() { } }
3e0d750fdb26aaa603ae62cdadbe46c8a39cc135
1,914
java
Java
src/main/java/org/yetiz/gae/validator/TokenValidator.java
yetisno/GAEService
659429b56fba996c249d2c866e8d6ba4c35b700b
[ "MIT" ]
1
2019-11-04T11:06:51.000Z
2019-11-04T11:06:51.000Z
src/main/java/org/yetiz/gae/validator/TokenValidator.java
yetisno/GAEService
659429b56fba996c249d2c866e8d6ba4c35b700b
[ "MIT" ]
null
null
null
src/main/java/org/yetiz/gae/validator/TokenValidator.java
yetisno/GAEService
659429b56fba996c249d2c866e8d6ba4c35b700b
[ "MIT" ]
null
null
null
26.957746
108
0.757053
5,701
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package org.yetiz.gae.validator; import java.util.Calendar; import java.util.Date; import org.yetiz.gae.GAEValidator; import org.yetiz.gae.ds.GAEToken; import org.yetiz.gae.ds.GAEUser; import org.yetiz.gae.exception.TokenArgumentException; import org.yetiz.gae.exception.TokenExpiredException; import org.yetiz.gae.exception.TokenNotFoundException; import org.yetiz.gae.exception.TokenUNAuthorizedException; /** * * @author yeti */ public class TokenValidator extends GAEValidator { public static final int EC_TOKEN_ARGUMENT = 11; public static final int EC_TOKEN_NOT_FOUND = 12; public static final int EC_TOKEN_UNAUTHORIZED = 13; public static final int EC_TOKEN_EXPIRED = 14; private GAEToken token = null; public TokenValidator(GAEToken token) { this.token = token; } public static TokenValidator exist(String tokenKey) throws TokenNotFoundException, TokenArgumentException { if (tokenKey == null) { throw new TokenNotFoundException(); } return new TokenValidator(GAEToken.get(tokenKey)); } public TokenValidator expire() throws TokenExpiredException { if (token.isExpire()) { throw new TokenExpiredException(); } return this; } public TokenValidator expireOneMonth() throws TokenExpiredException { Calendar cal = Calendar.getInstance(); cal.setTime(new Date(token.getExpire())); cal.add(Calendar.MONTH, 1); if (cal.getTime().getTime() < new Date().getTime()) { throw new TokenExpiredException(); } return this; } public TokenValidator authorize(GAEUser user) throws TokenUNAuthorizedException { if (!token.getUserID().equals(user.getUserID())) { throw new TokenUNAuthorizedException(); } return this; } public GAEToken fetch() { return token; } }
3e0d75f85369e1ec38b540b55fa7bfcb4da3c22d
70,396
java
Java
php/php.editor/test/unit/src/org/netbeans/modules/php/editor/csl/OccurrencesFinderImplTest.java
tusharvjoshi/incubator-netbeans
a61bd21f4324f7e73414633712522811cb20ac93
[ "Apache-2.0" ]
1,056
2019-04-25T20:00:35.000Z
2022-03-30T04:46:14.000Z
php/php.editor/test/unit/src/org/netbeans/modules/php/editor/csl/OccurrencesFinderImplTest.java
Marc382/netbeans
4bee741d24a3fdb05baf135de5e11a7cd95bd64e
[ "Apache-2.0" ]
1,846
2019-04-25T20:50:05.000Z
2022-03-31T23:40:41.000Z
php/php.editor/test/unit/src/org/netbeans/modules/php/editor/csl/OccurrencesFinderImplTest.java
Marc382/netbeans
4bee741d24a3fdb05baf135de5e11a7cd95bd64e
[ "Apache-2.0" ]
550
2019-04-25T20:04:33.000Z
2022-03-25T17:43:01.000Z
37.36518
143
0.667211
5,702
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.netbeans.modules.php.editor.csl; /** * @author Radek Matous */ public class OccurrencesFinderImplTest extends OccurrencesFinderImplTestBase { public OccurrencesFinderImplTest(String testName) { super(testName); } public void testGotoLabel() throws Exception { checkOccurrences(getTestPath(), "goto en^d;", true); } public void testOccurrencesInstanceMethod() throws Exception { checkOccurrences(getTestPath(), "$this->na^me();", true); } public void testOccurrencesDefines() throws Exception { checkOccurrences(getTestPath(), "echo \"fff\".t^est.\"ddddd\";", true); } public void testOccurrencesInstanceVarParam() throws Exception { checkOccurrences(getTestPath(), "$this->name = $na^me;", true); } public void testOccurrencesInstanceVarParam_1() throws Exception { checkOccurrences(getTestPath(), "$this->na^me = $name;", true); } public void testOccurrencesClassHeader() throws Exception { checkOccurrences(getTestPath(), "class fo^o", true); } public void testOccurrences1() throws Exception { checkOccurrences(getTestPath(), "function fo^o", true); } public void testOccurrences2() throws Exception { checkOccurrences(getTestPath(), "echo $na^me;", true); } public void testOccurrences3() throws Exception { checkOccurrences(getTestPath(), "echo $na^me;", true); } public void testOccurrences4() throws Exception { checkOccurrences(getTestPath(), "echo \"$na^me\";", true); } public void testGotoConstructTest() throws Exception { checkOccurrences(getTestPath(), "$a = new MyCla^ssConstr(", true); } public void testGotoConstructTest_2() throws Exception { checkOccurrences(getTestPath(), "$b = new MyClass^Constr2(", true); } public void testParamVarPropInPhpDocTest() throws Exception { checkOccurrences(getTestPath(), "* @param Book $he^llo", true); } public void testMarkReturnsOnConstructorTest() throws Exception { checkOccurrences(getTestPath(), "funct^ion __construct() {}//Auth", true); } public void testMarkReturnsOnConstructorTest_2() throws Exception { checkOccurrences(getTestPath(), "funct^ion __construct() {}//Bo", true); } public void testClsVarPropInPhpDocTest() throws Exception { checkOccurrences(getTestPath(), "* @return Aut^hor", true); } public void testIfaceTest() throws Exception { checkOccurrences(getTestPath(), "class mycls implements my^face", true); } public void testIfaceTest_2() throws Exception { checkOccurrences(getTestPath(), "const REC^OVER_ORIG = ", true); } public void testIfaceTest_3() throws Exception { checkOccurrences(getTestPath(), "class my^cls implements myface", true); } public void testIfaceTest_4() throws Exception { checkOccurrences(getTestPath(), "const RECOV^ER_ORIG = ", true); } public void testMarkClsIface() throws Exception { checkOccurrences(getTestPath(), "class clsDecla^ration implements ifaceDeclaration ", true); } public void testMarkClsIface_2() throws Exception { checkOccurrences(getTestPath(), "class clsDeclaration3 extends clsDec^laration ", true); } public void testMarkClsIface_3() throws Exception { checkOccurrences(getTestPath(), "interface ifaceDec^laration ", true); } public void testMarkClsIface_4() throws Exception { checkOccurrences(getTestPath(), "interface ifaceDeclaration2 extends ifaceDecl^aration ", true); } public void testMarkClsIface_5() throws Exception { checkOccurrences(getTestPath(), "class clsDeclaration implements ifaceDeclara^tion ", true); } public void testMarkClsIface_6() throws Exception { checkOccurrences(getTestPath(), "class clsDeclaration2 implements ifaceDecla^ration, ifaceDeclaration2 ", true); } public void testMarkClsIface_7() throws Exception { checkOccurrences(getTestPath(), "interface ifaceDecl^aration2 extends ifaceDeclaration ", true); } public void testMarkClsIface_8() throws Exception { checkOccurrences(getTestPath(), "class clsDeclaration2 implements ifaceDeclaration, ifaceDecl^aration2 ", true); } public void testMarkClsIface_9() throws Exception { checkOccurrences(getTestPath(), "$ifaceDec^laration = ", true); } public void testMarkClsIface_10() throws Exception { checkOccurrences(getTestPath(), "$ifaceDeclarati^on2 = ", true); } public void testMarkClsIface_11() throws Exception { checkOccurrences(getTestPath(), "$iface^Declaration4 = ", true); } public void testMarkClsIface_12() throws Exception { checkOccurrences(getTestPath(), "$clsDec^laration = ", true); } public void testMarkClsIface_13() throws Exception { checkOccurrences(getTestPath(), "$clsDec^laration2 = ", true); } public void testMarkClsIface_14() throws Exception { checkOccurrences(getTestPath(), "$clsDec^laration4 = ", true); } public void testMarkClsIface_15() throws Exception { checkOccurrences(getTestPath(), "$clsDeclar^ation3 = ", true); } public void testMarkClsIface_16() throws Exception { checkOccurrences(getTestPath(), "function ifaceDe^claration()", true); } public void testMarkClsIface_17() throws Exception { checkOccurrences(getTestPath(), "function ifaceDe^claration2() ", true); } public void testMarkClsIface_18() throws Exception { checkOccurrences(getTestPath(), "function ifaceDe^claration4() ", true); } public void testMarkClsIface_19() throws Exception { checkOccurrences(getTestPath(), "function clsDecla^ration() ", true); } public void testMarkClsIface_20() throws Exception { checkOccurrences(getTestPath(), "function clsDecla^ration2() ", true); } public void testMarkClsIface_21() throws Exception { checkOccurrences(getTestPath(), "function clsDecla^ration3() ", true); } public void testMarkClsIface_22() throws Exception { checkOccurrences(getTestPath(), "function clsDecla^ration4() ", true); } public void testMarkArray() throws Exception { checkOccurrences(getTestPath(), "private static $stat^ic_array = array('', 'thousand ', 'million ', 'billion '", true); } public void testMarkArray_2() throws Exception { checkOccurrences(getTestPath(), "$result .= self::$st^atic_array[$instance_array[$idx]", true); } public void testMarkArray_3() throws Exception { checkOccurrences(getTestPath(), "private $fi^eld_array = array('', 'thousand ', 'million ', 'billion '", true); } public void testMarkArray_4() throws Exception { checkOccurrences(getTestPath(), "$result .= $this->fiel^d_array[$instance_array[$idx]", true); } public void testMarkArray_5() throws Exception { checkOccurrences(getTestPath(), "$instance_a^rray = array('', 'thousand ', 'million ', 'billion '", true); } public void testMarkArray_6() throws Exception { checkOccurrences(getTestPath(), "$result .= self::$static_array[$instanc^e_array[$idx]", true); } public void testMarkArray_7() throws Exception { checkOccurrences(getTestPath(), "$i^dx = ", true); } public void testMarkArray_8() throws Exception { checkOccurrences(getTestPath(), "$instance_array[$i^dx", true); } public void testMarkArray_9() throws Exception { checkOccurrences(getTestPath(), "$i^dx2 = ", true); } public void testMarkArray_10() throws Exception { checkOccurrences(getTestPath(), "$instance_array2[$id^x2", true); } public void testMarkArray_11() throws Exception { checkOccurrences(getTestPath(), "$i^dx3 = ", true); } public void testMarkArray_12() throws Exception { checkOccurrences(getTestPath(), "$instance_array3[$id^x3", true); } public void testMarkArray_13() throws Exception { checkOccurrences(getTestPath(), "$instan^ce_array2 = array('', 'thousand ', 'million ', 'billion '", true); } public void testMarkArray_14() throws Exception { checkOccurrences(getTestPath(), "$instan^ce_array2[$idx2", true); } public void testMarkArray_15() throws Exception { checkOccurrences(getTestPath(), "$instan^ce_array3 = array('', 'thousand ', 'million ', 'billion '", true); } public void testVardoc166660() throws Exception { checkOccurrences(getTestPath(), "@var $testClass Test^Class", true); } public void testVardoc166660_1() throws Exception { checkOccurrences(getTestPath(), "@var $test^Class TestClass", true); } public void testMagicMethod171249() throws Exception { checkOccurrences(getTestPath(), "class OldC^lass {", true); } public void testInstanceof198909_01() throws Exception { checkOccurrences(getTestPath(), "$mExpectedE^xception = null", true); } public void testInstanceof198909_02() throws Exception { checkOccurrences(getTestPath(), "} catch (Exception $^e) {", true); } public void testInstanceof198909_03() throws Exception { checkOccurrences(getTestPath(), "$e instanceof $mExpect^edException", true); } public void testIssue198449_01() throws Exception { checkOccurrences(getTestPath(), "$cl^ass = 'StdClass';", true); } public void testIssue201429_01() throws Exception { checkOccurrences(getTestPath(), "protected static function test($keyC^losure)", true); } public void testIssue200399_01() throws Exception { checkOccurrences(getTestPath(), "function functionName(\\Character\\Ma^nager", true); } public void testIssue201671() throws Exception { checkOccurrences(getTestPath(), "$array as $my^Key", true); } public void testIssue133465_01() throws Exception { checkOccurrences(getTestPath(), "private $U^RL;", true); } public void testIssue133465_02() throws Exception { checkOccurrences(getTestPath(), "st $this->$U^RL", true); } public void testIssue133465_03() throws Exception { checkOccurrences(getTestPath(), "return $this->$U^RL;", true); } public void testIssue197283_01() throws Exception { checkOccurrences(getTestPath(), "$fu^nc = 'someFunc';", true); } public void testIssue197283_02() throws Exception { checkOccurrences(getTestPath(), "$fu^nc();", true); } public void testIssue197283_03() throws Exception { checkOccurrences(getTestPath(), "$o^bj = 'MyObj';", true); } public void testIssue197283_04() throws Exception { checkOccurrences(getTestPath(), "$x = new $o^bj;", true); } public void testIssue197283_05() throws Exception { checkOccurrences(getTestPath(), "$another^Obj = 'AnotherObj';", true); } public void testIssue197283_06() throws Exception { checkOccurrences(getTestPath(), "$y = new $another^Obj();", true); } public void testIssue203419_01() throws Exception { checkOccurrences(getTestPath(), "class MyClass20^3419", true); } public void testIssue203419_02() throws Exception { checkOccurrences(getTestPath(), "* @var \\test\\sub\\MyClass203^419", true); } public void testIssue203419_03() throws Exception { checkOccurrences(getTestPath(), "public function test2(MyClass^203419 $param) {", true); } public void testIssue203419_04() throws Exception { checkOccurrences(getTestPath(), "$v1 = new \\test\\sub\\MyClass20^3419();", true); } public void testIssue203419_05() throws Exception { checkOccurrences(getTestPath(), "$v2 = new MyClass203^419();", true); } public void testIssue203419_06() throws Exception { checkOccurrences(getTestPath(), "$v3 = new sub\\MyClass20^3419();", true); } public void testIssue203419_07() throws Exception { checkOccurrences(getTestPath(), "$v4 = new baf\\MyClass203^419();", true); } public void testIssue204433_01() throws Exception { checkOccurrences(getTestPath(), "$form = new Edit^Form();", true); } public void testIssue204433_02() throws Exception { checkOccurrences(getTestPath(), "$form = new E^F()", true); } public void testIssue204433_03() throws Exception { checkOccurrences(getTestPath(), "$fr = new Edit^Form();", true); } public void testArrayDereferencing_01() throws Exception { checkOccurrences(getTestPath(), "$myCl^ass->field[0]->getArray()[][]->foo();", true); } public void testArrayDereferencing_02() throws Exception { checkOccurrences(getTestPath(), "$myClass->fie^ld[0]->getArray()[][]->foo();", true); } public void testArrayDereferencing_03() throws Exception { checkOccurrences(getTestPath(), "$myClass->field[0]->getA^rray()[][]->foo();", true); } public void testArrayDereferencing_04() throws Exception { checkOccurrences(getTestPath(), "$myClass->field[0]->getArray()[][]->fo^o();", true); } public void testArrayDereferencing_05() throws Exception { checkOccurrences(getTestPath(), "$myC^lass->getArray()[0][]->foo();", true); } public void testArrayDereferencing_06() throws Exception { checkOccurrences(getTestPath(), "$myClass->getA^rray()[0][]->foo();", true); } public void testArrayDereferencing_07() throws Exception { checkOccurrences(getTestPath(), "$myClass->getArray()[0][]->fo^o();", true); } public void testArrayDereferencing_08() throws Exception { checkOccurrences(getTestPath(), "function^Name()[0]->foo();", true); } public void testArrayDereferencing_09() throws Exception { checkOccurrences(getTestPath(), "functionName()[0]->fo^o();", true); } public void testVariableAsAClassName() throws Exception { checkOccurrences(getTestPath(), "$static_clas^sname::$static_property;", true); } public void testStaticMethodCall() throws Exception { checkOccurrences(getTestPath(), "Presenter::staticFun^ctionName($param);", true); } public void testIssue209187_01() throws Exception { checkOccurrences(getTestPath(), "class Class^Name {", true); } public void testIssue209187_02() throws Exception { checkOccurrences(getTestPath(), "use \\Foo\\Bar\\Class^Name;", true); } public void testIssue209187_03() throws Exception { checkOccurrences(getTestPath(), "new Class^Name();", true); } public void testIssue208826_01() throws Exception { checkOccurrences(getTestPath(), "class Mo^del {}", true); } public void testIssue208826_02() throws Exception { checkOccurrences(getTestPath(), "* @var \\Mo^del", true); } public void testIssue208826_03() throws Exception { checkOccurrences(getTestPath(), "* @return \\Mo^del", true); } public void testIssue208826_04() throws Exception { checkOccurrences(getTestPath(), "class B^ag {}", true); } public void testIssue208826_05() throws Exception { checkOccurrences(getTestPath(), "* @param B\\B^ag $param", true); } public void testIssue208826_06() throws Exception { checkOccurrences(getTestPath(), "function functionName1(B\\B^ag $param) {", true); } public void testIssue200596_01() throws Exception { checkOccurrences(getTestPath(), "class Class^Name {", true); } public void testIssue200596_02() throws Exception { checkOccurrences(getTestPath(), "class Aliased^ClassName {", true); } public void testIssue200596_03() throws Exception { checkOccurrences(getTestPath(), "use \\Foo\\Bar as O^mg;", true); } public void testIssue200596_04() throws Exception { checkOccurrences(getTestPath(), "use \\Foo\\Bar\\Aliased^ClassName as Cls;", true); } public void testIssue200596_05() throws Exception { checkOccurrences(getTestPath(), "use \\Foo\\Bar\\AliasedClassName as C^ls;", true); } public void testIssue200596_06() throws Exception { checkOccurrences(getTestPath(), "use \\Foo\\Bar\\Class^Name;", true); } public void testIssue200596_07() throws Exception { checkOccurrences(getTestPath(), "(new O^mg\\AliasedClassName())->bar();", true); } public void testIssue200596_08() throws Exception { checkOccurrences(getTestPath(), "(new Omg\\Aliased^ClassName())->bar();", true); } public void testIssue200596_09() throws Exception { checkOccurrences(getTestPath(), "(new C^ls())->bar();", true); } public void testIssue200596_10() throws Exception { checkOccurrences(getTestPath(), "(new Class^Name())->bar();", true); } public void testIssue200596_11() throws Exception { checkOccurrences(getTestPath(), "new O^mg\\AliasedClassName();", true); } public void testIssue200596_12() throws Exception { checkOccurrences(getTestPath(), "new Omg\\Aliased^ClassName();", true); } public void testIssue200596_13() throws Exception { checkOccurrences(getTestPath(), "new C^ls();", true); } public void testIssue200596_14() throws Exception { checkOccurrences(getTestPath(), "new Class^Name();", true); } public void testIssue200596_15() throws Exception { checkOccurrences(getTestPath(), "O^mg\\AliasedClassName::foo();", true); } public void testIssue200596_16() throws Exception { checkOccurrences(getTestPath(), "Omg\\Aliased^ClassName::foo();", true); } public void testIssue200596_17() throws Exception { checkOccurrences(getTestPath(), "C^ls::foo();", true); } public void testIssue200596_18() throws Exception { checkOccurrences(getTestPath(), "Class^Name::bar();", true); } public void testIssue200596_19() throws Exception { checkOccurrences(getTestPath(), "O^mg\\AliasedClassName::FOO;", true); } public void testIssue200596_20() throws Exception { checkOccurrences(getTestPath(), "Omg\\Aliased^ClassName::FOO;", true); } public void testIssue200596_21() throws Exception { checkOccurrences(getTestPath(), "C^ls::FOO;", true); } public void testIssue200596_22() throws Exception { checkOccurrences(getTestPath(), "Class^Name::BAR;", true); } public void testIssue200596_23() throws Exception { checkOccurrences(getTestPath(), "O^mg\\AliasedClassName::$foo;", true); } public void testIssue200596_24() throws Exception { checkOccurrences(getTestPath(), "Omg\\Aliased^ClassName::$foo;", true); } public void testIssue200596_25() throws Exception { checkOccurrences(getTestPath(), "C^ls::$foo;", true); } public void testIssue200596_26() throws Exception { checkOccurrences(getTestPath(), "Class^Name::$bar;", true); } public void testIssue200596_27() throws Exception { checkOccurrences(getTestPath(), "if ($x instanceof O^mg\\AliasedClassName) {}", true); } public void testIssue200596_28() throws Exception { checkOccurrences(getTestPath(), "if ($x instanceof Omg\\Aliased^ClassName) {}", true); } public void testIssue200596_29() throws Exception { checkOccurrences(getTestPath(), "if ($x instanceof C^ls) {}", true); } public void testIssue200596_30() throws Exception { checkOccurrences(getTestPath(), "if ($x instanceof Class^Name) {}", true); } public void testFieldAccessInInstanceOf_01() throws Exception { checkOccurrences(getTestPath(), "if ($a instanceof $this->bb^bbb) {}", true); } public void testFieldAccessInInstanceOf_02() throws Exception { checkOccurrences(getTestPath(), "public $bb^bbb;", true); } public void testIssue209309_01() throws Exception { checkOccurrences(getTestPath(), "class Aliased^ClassName {}", true); } public void testIssue209309_02() throws Exception { checkOccurrences(getTestPath(), "use \\Foo\\Bar as O^mg;", true); } public void testIssue209309_03() throws Exception { checkOccurrences(getTestPath(), "use \\Foo\\Bar\\Aliased^ClassName as Cls;", true); } public void testIssue209309_04() throws Exception { checkOccurrences(getTestPath(), "use \\Foo\\Bar\\AliasedClassName as C^ls;", true); } public void testIssue209309_05() throws Exception { checkOccurrences(getTestPath(), "function bar(O^mg\\AliasedClassName $p, Cls $a) {}", true); } public void testIssue209309_06() throws Exception { checkOccurrences(getTestPath(), "function bar(Omg\\Aliased^ClassName $p, Cls $a) {}", true); } public void testIssue209309_07() throws Exception { checkOccurrences(getTestPath(), "function bar(Omg\\AliasedClassName $p, C^ls $a) {}", true); } public void testIssue209308_01() throws Exception { checkOccurrences(getTestPath(), "use \\Foo\\Bar as Om^g;", true); } public void testIssue209308_02() throws Exception { checkOccurrences(getTestPath(), "use \\Foo\\Bar\\AliasedClassName as Cl^s;", true); } public void testIssue209308_03() throws Exception { checkOccurrences(getTestPath(), "/** @var Cl^s */", true); } public void testIssue209308_04() throws Exception { checkOccurrences(getTestPath(), "/** @var Om^g\\AliasedClassName */", true); } public void testIssue209308_05() throws Exception { checkOccurrences(getTestPath(), "* @return Om^g\\AliasedClassName", true); } public void testIssue209308_08() throws Exception { checkOccurrences(getTestPath(), "* @param Om^g\\AliasedClassName $p", true); } public void testIssue209308_09() throws Exception { checkOccurrences(getTestPath(), "* @param Cl^s $a", true); } public void testIssue209308_010() throws Exception { checkOccurrences(getTestPath(), "* @return Cl^s", true); } public void testIssue209308_011() throws Exception { checkOccurrences(getTestPath(), "function bar(Om^g\\AliasedClassName $p, Cls $a, \\Foo\\Bar\\AliasedClassName $name) {}", true); } public void testIssue209308_012() throws Exception { checkOccurrences(getTestPath(), "function bar(Omg\\AliasedClassName $p, Cl^s $a, \\Foo\\Bar\\AliasedClassName $name) {}", true); } public void testIssue209308_013() throws Exception { checkOccurrences(getTestPath(), "class Aliased^ClassName {}", true); } public void testIssue209308_014() throws Exception { checkOccurrences(getTestPath(), "use \\Foo\\Bar\\Aliased^ClassName as Cls;", true); } public void testIssue209308_015() throws Exception { checkOccurrences(getTestPath(), "/** @var Omg\\Aliased^ClassName */", true); } public void testIssue209308_016() throws Exception { checkOccurrences(getTestPath(), "* @return Omg\\Aliased^ClassName", true); } public void testIssue209308_018() throws Exception { checkOccurrences(getTestPath(), "* @param Omg\\Aliased^ClassName $p", true); } public void testIssue209308_019() throws Exception { checkOccurrences(getTestPath(), "* @param \\Foo\\Bar\\Aliased^ClassName $name Description", true); } public void testIssue209308_020() throws Exception { checkOccurrences(getTestPath(), "function bar(Omg\\Aliased^ClassName $p, Cls $a, \\Foo\\Bar\\AliasedClassName $name) {}", true); } public void testIssue209308_021() throws Exception { checkOccurrences(getTestPath(), "function bar(Omg\\AliasedClassName $p, Cls $a, \\Foo\\Bar\\Aliased^ClassName $name) {}", true); } public void testStaticAccessWithNs_01() throws Exception { checkOccurrences(getTestPath(), "const B^AR = 2;", true); } public void testStaticAccessWithNs_02() throws Exception { checkOccurrences(getTestPath(), "public static $b^ar;", true); } public void testStaticAccessWithNs_03() throws Exception { checkOccurrences(getTestPath(), "static function b^ar() {}", true); } public void testStaticAccessWithNs_04() throws Exception { checkOccurrences(getTestPath(), "const F^OO = 1;", true); } public void testStaticAccessWithNs_05() throws Exception { checkOccurrences(getTestPath(), "public static $f^oo;", true); } public void testStaticAccessWithNs_06() throws Exception { checkOccurrences(getTestPath(), "static function f^oo() {}", true); } public void testStaticAccessWithNs_07() throws Exception { checkOccurrences(getTestPath(), "Omg\\AliasedClassName::f^oo();", true); } public void testStaticAccessWithNs_08() throws Exception { checkOccurrences(getTestPath(), "Cls::f^oo();", true); } public void testStaticAccessWithNs_09() throws Exception { checkOccurrences(getTestPath(), "ClassName::b^ar();", true); } public void testStaticAccessWithNs_10() throws Exception { checkOccurrences(getTestPath(), "Omg\\AliasedClassName::F^OO;", true); } public void testStaticAccessWithNs_11() throws Exception { checkOccurrences(getTestPath(), "Cls::F^OO;", true); } public void testStaticAccessWithNs_12() throws Exception { checkOccurrences(getTestPath(), "ClassName::B^AR;", true); } public void testStaticAccessWithNs_13() throws Exception { checkOccurrences(getTestPath(), "Omg\\AliasedClassName::$f^oo;", true); } public void testStaticAccessWithNs_14() throws Exception { checkOccurrences(getTestPath(), "Cls::$f^oo;", true); } public void testStaticAccessWithNs_15() throws Exception { checkOccurrences(getTestPath(), "ClassName::$b^ar;", true); } public void testStaticAccessWithNs_16() throws Exception { checkOccurrences(getTestPath(), "\\Foo\\Bar\\ClassName::$b^ar;", true); } public void testStaticAccessWithNs_17() throws Exception { checkOccurrences(getTestPath(), "\\Foo\\Bar\\ClassName::b^ar();", true); } public void testStaticAccessWithNs_18() throws Exception { checkOccurrences(getTestPath(), "\\Foo\\Bar\\ClassName::B^AR;", true); } public void testIssue207971_01() throws Exception { checkOccurrences(getTestPath(), "private $fie^ld1;", true); } public void testIssue207971_02() throws Exception { checkOccurrences(getTestPath(), "private $fie^ld3;", true); } public void testIssue207971_03() throws Exception { checkOccurrences(getTestPath(), "private $obj^ect2;", true); } public void testIssue207971_04() throws Exception { checkOccurrences(getTestPath(), "$sql = \" {$this->fie^ld1} {$this->object2->xxx} {$this->field3['array1']} \";", true); } public void testIssue207971_05() throws Exception { checkOccurrences(getTestPath(), "$sql = \" {$this->field1} {$this->obj^ect2->xxx} {$this->field3['array1']} \";", true); } public void testIssue207971_06() throws Exception { checkOccurrences(getTestPath(), "$sql = \" {$this->field1} {$this->object2->xxx} {$this->fie^ld3['array1']} \";", true); } public void testQualifiedUseStatement_01() throws Exception { checkOccurrences(getTestPath(), "class Kit^chen {", true); } public void testQualifiedUseStatement_02() throws Exception { checkOccurrences(getTestPath(), "use pl\\dagguh\\someproject\\rooms\\Kit^chen;", true); } public void testQualifiedUseStatement_03() throws Exception { checkOccurrences(getTestPath(), "Kit^chen::DEFAULT_SIZE;", true); } public void testQualifiedUseStatement_04() throws Exception { checkOccurrences(getTestPath(), "use pl\\dagguh\\someproject\\rooms\\Kit^chen as Alias;", true); } public void testIssue208245_01() throws Exception { checkOccurrences(getTestPath(), "$glob^Var = \"\";", true); } public void testIssue208245_02() throws Exception { checkOccurrences(getTestPath(), "function() use($glob^Var) {", true); } public void testIssue208245_03() throws Exception { checkOccurrences(getTestPath(), "echo $glob^Var;", true); } public void testIssue208245_04() throws Exception { checkOccurrences(getTestPath(), "$v^ar = \"\";", true); } public void testIssue208245_05() throws Exception { checkOccurrences(getTestPath(), "function() use($v^ar) {", true); } public void testIssue208245_06() throws Exception { checkOccurrences(getTestPath(), "echo $v^ar;", true); } public void testIssue203073_01() throws Exception { checkOccurrences(getTestPath(), "class First^Parent {", true); } public void testIssue203073_02() throws Exception { checkOccurrences(getTestPath(), "use Full\\Name\\Space\\First^Parent as SecondParent;", true); } public void testIssue203073_03() throws Exception { checkOccurrences(getTestPath(), "use Full\\Name\\Space\\First^Parent;", true); } public void testIssue203073_04() throws Exception { checkOccurrences(getTestPath(), "class Yours1 extends First^Parent {", true); } public void testIssue203073_05() throws Exception { checkOccurrences(getTestPath(), "use Full\\Name\\Space\\FirstParent as Second^Parent;", true); } public void testIssue203073_06() throws Exception { checkOccurrences(getTestPath(), "class Yours extends Second^Parent {", true); } public void testIssue203814_01() throws Exception { checkOccurrences(getTestPath(), "public function fMe^thod()", true); } public void testIssue203814_02() throws Exception { checkOccurrences(getTestPath(), "self::$first->fMe^thod();", true); } public void testIssue203814_03() throws Exception { checkOccurrences(getTestPath(), "static::$first->fMe^thod();", true); } public void testIssue203814_04() throws Exception { checkOccurrences(getTestPath(), "Second::$first->fMe^thod();", true); } public void testIssue207346_01() throws Exception { checkOccurrences(getTestPath(), "public $invalid^LinkMode;", true); } public void testIssue207346_02() throws Exception { checkOccurrences(getTestPath(), "$this->invalid^LinkMode = 10;", true); } public void testIssue207346_03() throws Exception { checkOccurrences(getTestPath(), "$this->invalid^LinkMode;", true); } public void testIssue207615_01() throws Exception { checkOccurrences(getTestPath(), "protected static $_v^ar = true;", true); } public void testIssue207615_02() throws Exception { checkOccurrences(getTestPath(), "self::$_v^ar;", true); } public void testIssue207615_03() throws Exception { checkOccurrences(getTestPath(), "return static::$_v^ar;", true); } public void testConstants_01() throws Exception { checkOccurrences(getTestPath(), "const C^ON = 1;", true); } public void testConstants_02() throws Exception { checkOccurrences(getTestPath(), "parent::C^ON;", true); } public void testConstants_03() throws Exception { checkOccurrences(getTestPath(), "self::C^ON;", true); } public void testConstants_04() throws Exception { checkOccurrences(getTestPath(), "static::C^ON;", true); } // #250579 public void testConstantArrayAccess_01() throws Exception { checkOccurrences(getTestPath(), "const GLOBAL_C^ONSTANT1 = [0, 1];", true); } public void testConstantArrayAccess_02() throws Exception { checkOccurrences(getTestPath(), "const GLOBAL_CONSTANT2 = GL^OBAL_CONSTANT1[0];", true); } public void testConstantArrayAccess_03() throws Exception { checkOccurrences(getTestPath(), "const GLOBAL_CONSTANT3 = GLOBAL_^CONSTANT1[GLOBAL_CONSTANT1[0] + GLOBAL_CONSTANT1[0]];", true); } public void testConstantArrayAccess_04() throws Exception { checkOccurrences(getTestPath(), "const GLOBAL_CONSTANT3 = GLOBAL_CONSTANT1[GL^OBAL_CONSTANT1[0] + GLOBAL_CONSTANT1[0]];", true); } public void testConstantArrayAccess_05() throws Exception { checkOccurrences(getTestPath(), "const GLOBAL_CONSTANT3 = GLOBAL_CONSTANT1[GLOBAL_CONSTANT1[0] + GL^OBAL_CONSTANT1[0]];", true); } public void testConstantArrayAccess_06() throws Exception { checkOccurrences(getTestPath(), "const G^LOBAL_CONSTANT4 = [\"a\" => [0, 1], \"b\" => [\"c\", \"d\"]];", true); } public void testConstantArrayAccess_07() throws Exception { checkOccurrences(getTestPath(), "const GLOBAL_CONSTANT5 = GLOBAL_CO^NSTANT4[\"b\"][GLOBAL_CONSTANT1[1]];", true); } public void testConstantArrayAccess_08() throws Exception { checkOccurrences(getTestPath(), "const GLOBAL_CONSTANT5 = GLOBAL_CONSTANT4[\"b\"][GLOBAL_CONS^TANT1[1]];", true); } public void testConstantArrayAccess_09() throws Exception { checkOccurrences(getTestPath(), "GLOBAL_CONST^ANT1[$index];", true); } public void testConstantArrayAccess_10() throws Exception { checkOccurrences(getTestPath(), "[1][GLOBAL_CO^NSTANT1[0]];", true); } public void testConstantArrayAccess_11() throws Exception { checkOccurrences(getTestPath(), "echo GLOBAL_C^ONSTANT4[\"a\"][GLOBAL_CONSTANT1[$index]];", true); } public void testConstantArrayAccess_12() throws Exception { checkOccurrences(getTestPath(), "echo GLOBAL_CONSTANT4[\"a\"][GLOB^AL_CONSTANT1[$index]];", true); } public void testConstantArrayAccess_13() throws Exception { checkOccurrences(getTestPath(), "const CLASS_CO^NSTANT1 = [\"a\", \"b\"];", true); } public void testConstantArrayAccess_14() throws Exception { checkOccurrences(getTestPath(), "const CLASS_CONSTANT2 = self::CL^ASS_CONSTANT1[0];", true); } public void testConstantArrayAccess_15() throws Exception { checkOccurrences(getTestPath(), "const CLASS_CONSTANT3 = GLOB^AL_CONSTANT1[0] + GLOBAL_CONSTANT1[1];", true); } public void testConstantArrayAccess_16() throws Exception { checkOccurrences(getTestPath(), "const CLASS_CONSTANT3 = GLOBAL_CONSTANT1[0] + GLOBAL_CON^STANT1[1];", true); } public void testConstantArrayAccess_17() throws Exception { checkOccurrences(getTestPath(), "const CLASS_C^ONSTANT4 = [0, 1];", true); } public void testConstantArrayAccess_18() throws Exception { checkOccurrences(getTestPath(), "self::CLASS_CON^STANT1[GLOBAL_CONSTANT1[1]];", true); } public void testConstantArrayAccess_19() throws Exception { checkOccurrences(getTestPath(), "self::CLASS_CONSTANT1[GL^OBAL_CONSTANT1[1]];", true); } public void testConstantArrayAccess_20() throws Exception { checkOccurrences(getTestPath(), "self::CLASS_CON^STANT1[ConstantClass::CLASS_CONSTANT4[self::CLASS_CONSTANT4[0]]];", true); } public void testConstantArrayAccess_21() throws Exception { checkOccurrences(getTestPath(), "self::CLASS_CONSTANT1[ConstantClass::CLASS_C^ONSTANT4[self::CLASS_CONSTANT4[0]]];", true); } public void testConstantArrayAccess_22() throws Exception { checkOccurrences(getTestPath(), "self::CLASS_CONSTANT1[ConstantClass::CLASS_CONSTANT4[self::CLASS_CONS^TANT4[0]]];", true); } public void testConstantArrayAccess_23() throws Exception { checkOccurrences(getTestPath(), "ConstantClass::CLASS_CO^NSTANT1[$index];", true); } public void testConstantArrayAccess_24() throws Exception { checkOccurrences(getTestPath(), "\"String\"[ConstantClass::CLASS_CON^STANT4[0]];", true); } public void testConstantArrayAccess_25() throws Exception { checkOccurrences(getTestPath(), "ConstantInterface::IN^TERFACE_CONSTANT1[GLOBAL_CONSTANT1[1]];", true); } public void testConstantArrayAccess_26() throws Exception { checkOccurrences(getTestPath(), "ConstantInterface::INTERFACE_CONSTANT1[GL^OBAL_CONSTANT1[1]];", true); } public void testConstantArrayAccess_27() throws Exception { checkOccurrences(getTestPath(), "const IN^TERFACE_CONSTANT1 = [\"a\", \"b\"];", true); } public void testConstantArrayAccess_28() throws Exception { checkOccurrences(getTestPath(), "const INTERFACE_CONSTANT2 = self::IN^TERFACE_CONSTANT1[0];", true); } public void testConstantArrayAccess_29() throws Exception { checkOccurrences(getTestPath(), "const INTERFACE_CONSTANT3 = ConstantInterface::INTERFACE_CON^STANT1[0] . GLOBAL_CONSTANT1[1];", true); } public void testConstantArrayAccess_30() throws Exception { checkOccurrences(getTestPath(), "const INTERFACE_CONSTANT3 = ConstantInterface::INTERFACE_CONSTANT1[0] . GLOBAL_CON^STANT1[1];", true); } public void testStaticAccessWithNsAlias_01() throws Exception { checkOccurrences(getTestPath(), "const O^MG = 1;", true); } public void testStaticAccessWithNsAlias_02() throws Exception { checkOccurrences(getTestPath(), "parent::O^MG;", true); } public void testStaticAccessWithNsAlias_03() throws Exception { checkOccurrences(getTestPath(), "self::O^MG;", true); } public void testStaticAccessWithNsAlias_04() throws Exception { checkOccurrences(getTestPath(), "static::O^MG;", true); } public void testStaticAccessWithNsAlias_05() throws Exception { checkOccurrences(getTestPath(), "public static $static^Field = 2;", true); } public void testStaticAccessWithNsAlias_06() throws Exception { checkOccurrences(getTestPath(), "parent::$static^Field;", true); } public void testStaticAccessWithNsAlias_07() throws Exception { checkOccurrences(getTestPath(), "self::$static^Field;", true); } public void testStaticAccessWithNsAlias_08() throws Exception { checkOccurrences(getTestPath(), "static::$static^Field;", true); } public void testStaticAccessWithNsAlias_09() throws Exception { checkOccurrences(getTestPath(), "static function some^Func() {", true); } public void testStaticAccessWithNsAlias_10() throws Exception { checkOccurrences(getTestPath(), "parent::some^Func();", true); } public void testIssue211230_01() throws Exception { checkOccurrences(getTestPath(), "class F^oo {", true); } public void testIssue211230_02() throws Exception { checkOccurrences(getTestPath(), " * @method F^oo|Bar method() This is my cool magic method description.", true); } public void testIssue211230_03() throws Exception { checkOccurrences(getTestPath(), " * @method Foo|B^ar method() This is my cool magic method description.", true); } public void testIssue211230_04() throws Exception { checkOccurrences(getTestPath(), "class B^ar {", true); } public void testIssue211230_05() throws Exception { checkOccurrences(getTestPath(), "$b = new B^ar();", true); } public void testMagicMethod_01() throws Exception { checkOccurrences(getTestPath(), " * @method Foo|Bar met^hod() This is my cool magic method description.", true); } public void testMagicMethod_02() throws Exception { checkOccurrences(getTestPath(), "$b->met^hod()->fooMethod();", true); } public void testIssue211015_01() throws Exception { checkOccurrences(getTestPath(), "$f^oo = \"omg\";", true); } public void testIssue211015_02() throws Exception { checkOccurrences(getTestPath(), "$this->$f^oo();", true); } public void testIssue211015_03() throws Exception { checkOccurrences(getTestPath(), "self::$f^oo();", true); } public void testIssue211015_04() throws Exception { checkOccurrences(getTestPath(), "static::$f^oo();", true); } public void testIssue211015_05() throws Exception { checkOccurrences(getTestPath(), "parent::$f^oo();", true); } public void testIssue186553_01() throws Exception { checkOccurrences(getTestPath(), "public function do^Something()", true); } public void testIssue186553_02() throws Exception { checkOccurrences(getTestPath(), "$object1->do^Something();", true); } public void testIssue186553_03() throws Exception { checkOccurrences(getTestPath(), "$this->do^Something();", true); } public void testIssue213133_01() throws Exception { checkOccurrences(getTestPath(), "class Te^st {", true); } public void testIssue213133_02() throws Exception { checkOccurrences(getTestPath(), "echo $test->{Te^st::$CHECK};", true); } public void testIssue213133_03() throws Exception { checkOccurrences(getTestPath(), "echo Te^st::$CHECK;", true); } public void testIssue213133_04() throws Exception { checkOccurrences(getTestPath(), "public static $CH^ECK = \"check\";", true); } public void testIssue213133_05() throws Exception { checkOccurrences(getTestPath(), "echo $test->{Test::$CH^ECK};", true); } public void testIssue213133_06() throws Exception { checkOccurrences(getTestPath(), "echo Test::$CH^ECK;", true); } public void testIssue213584_01() throws Exception { checkOccurrences(getTestPath(), "trait A^A {", true); } public void testIssue213584_02() throws Exception { checkOccurrences(getTestPath(), "trait B^B {", true); } public void testIssue213584_03() throws Exception { checkOccurrences(getTestPath(), "trait C^C {", true); } public void testIssue213584_04() throws Exception { checkOccurrences(getTestPath(), "trait D^D {", true); } public void testIssue213584_05() throws Exception { checkOccurrences(getTestPath(), "use A^A, BB, CC, DD {", true); } public void testIssue213584_06() throws Exception { checkOccurrences(getTestPath(), "use AA, B^B, CC, DD {", true); } public void testIssue213584_07() throws Exception { checkOccurrences(getTestPath(), "use AA, BB, C^C, DD {", true); } public void testIssue213584_08() throws Exception { checkOccurrences(getTestPath(), "use AA, BB, CC, D^D {", true); } public void testIssue213584_09() throws Exception { checkOccurrences(getTestPath(), "C^C::bar insteadof AA, BB;", true); } public void testIssue213584_10() throws Exception { checkOccurrences(getTestPath(), "CC::bar insteadof A^A, BB;", true); } public void testIssue213584_11() throws Exception { checkOccurrences(getTestPath(), "CC::bar insteadof AA, B^B;", true); } public void testIssue213584_12() throws Exception { checkOccurrences(getTestPath(), "D^D::bar as foo;", true); } public void testIssue217357_01() throws Exception { checkOccurrences(getTestPath(), "class Str^ing {", true); } public void testIssue217357_02() throws Exception { checkOccurrences(getTestPath(), "use Abc\\Str^ing;", true); } public void testIssue217357_03() throws Exception { checkOccurrences(getTestPath(), "$s = new Str^ing();", true); } public void testCatchWithAlias_01() throws Exception { checkOccurrences(getTestPath(), "use Blah\\Sec as B^S;", true); } public void testCatchWithAlias_02() throws Exception { checkOccurrences(getTestPath(), "new B^S\\MyException();", true); } public void testCatchWithAlias_03() throws Exception { checkOccurrences(getTestPath(), "} catch (B^S\\MyException $ex) {", true); } public void testIssue216876_01() throws Exception { checkOccurrences(getTestPath(), "class MyNewCl^ass123 {", true); } public void testIssue216876_02() throws Exception { checkOccurrences(getTestPath(), "public function MyNewCl^ass123($foo) {", true); } public void testIssue216876_03() throws Exception { checkOccurrences(getTestPath(), "$c = new \\Foo\\MyNewCl^ass123();", true); } public void testIssue218487_01() throws Exception { checkOccurrences(getTestPath(), "use Zend\\Stdlib2\\DispatchableInterface2 as Dispatch^able2;", true); } public void testIssue218487_02() throws Exception { checkOccurrences(getTestPath(), "class AbstractController implements Dispatch^able2 {", true); } public void testIssue223076_01() throws Exception { checkOccurrences(getTestPath(), "func^tion functionName($param) {", true); } public void testIssue223076_02() throws Exception { checkOccurrences(getTestPath(), "retur^n 5;", true); } public void testIssue223076_03() throws Exception { checkOccurrences(getTestPath(), "retur^n 10;", true); } public void testReflectionVariableInMethodInvocation_01() throws Exception { checkOccurrences(getTestPath(), "private $cont^ext;", true); } public void testReflectionVariableInMethodInvocation_02() throws Exception { checkOccurrences(getTestPath(), "$this->cont^ext[0]", true); } public void testIssue217360_01() throws Exception { checkOccurrences(getTestPath(), "private function get^Two()", true); } public void testIssue217360_02() throws Exception { checkOccurrences(getTestPath(), "$two = $this->get^Two();", true); } public void testIssue217360_03() throws Exception { checkOccurrences(getTestPath(), "return $two->get^Two();", true); } public void testIssue217360_04() throws Exception { checkOccurrences(getTestPath(), "(new Two)->get^Two();", true); } public void testUseFuncAndConst_01() throws Exception { checkOccurrences(getTestPath(), "use const Name\\Space\\F^OO;", true); } public void testUseFuncAndConst_02() throws Exception { checkOccurrences(getTestPath(), "use const Name\\Space\\F^OO as FOO2;", true); } public void testUseFuncAndConst_03() throws Exception { checkOccurrences(getTestPath(), "use const Name\\Space\\FOO as F^OO2;", true); } public void testUseFuncAndConst_04() throws Exception { checkOccurrences(getTestPath(), "use function Name\\Space\\f^nc;", true); } public void testUseFuncAndConst_05() throws Exception { checkOccurrences(getTestPath(), "use function Name\\Space\\f^nc as fnc2;", true); } public void testUseFuncAndConst_06() throws Exception { checkOccurrences(getTestPath(), "use function Name\\Space\\fnc as f^nc2;", true); } public void testUseFuncAndConst_07() throws Exception { checkOccurrences(getTestPath(), "echo F^OO;", true); } public void testUseFuncAndConst_08() throws Exception { checkOccurrences(getTestPath(), "echo F^OO2;", true); } public void testUseFuncAndConst_09() throws Exception { checkOccurrences(getTestPath(), "f^nc();", true); } public void testUseFuncAndConst_10() throws Exception { checkOccurrences(getTestPath(), "f^nc2();", true); } public void testIssue244317_01() throws Exception { checkOccurrences(getTestPath(), "const test^Constant = \"test\";", true); } public void testIssue244317_02() throws Exception { checkOccurrences(getTestPath(), "$variable = self::test^Constant;", true); } public void testIssue244317_03() throws Exception { checkOccurrences(getTestPath(), "echo self::test^Constant;", true); } public void testReturnTypes01_01() throws Exception { checkOccurrences(getTestPath(), "interface Ifac^eA {", true); } public void testReturnTypes01_02() throws Exception { checkOccurrences(getTestPath(), " static function make(): Ifa^ceA;", true); } public void testReturnTypes01_03() throws Exception { checkOccurrences(getTestPath(), "class ClsB implements Iface^A {", true); } public void testReturnTypes01_04() throws Exception { checkOccurrences(getTestPath(), " static function make(): If^aceA {", true); } public void testReturnTypes01_05() throws Exception { checkOccurrences(getTestPath(), "function create(Ifa^ceA $a): ClsB {", true); } public void testReturnTypes01_06() throws Exception { checkOccurrences(getTestPath(), "class Cls^B implements IfaceA {", true); } public void testReturnTypes01_07() throws Exception { checkOccurrences(getTestPath(), "function create(IfaceA $a): C^lsB {", true); } public void testReturnTypes01_08() throws Exception { checkOccurrences(getTestPath(), "function create2(Cl^sB $b): array {", true); } public void testReturnTypes01_09() throws Exception { // no occurences for 'array' checkOccurrences(getTestPath(), " function test(): a^rray {", true); } public void testReturnTypes01_10() throws Exception { // no occurences for 'array' checkOccurrences(getTestPath(), "function create2(ClsB $b): arr^ay {", true); } public void testGroupUses01_01() throws Exception { checkOccurrences(getTestPath(), "class C^lsA {", true); } public void testGroupUses01_02() throws Exception { checkOccurrences(getTestPath(), " Cl^sA,", true); } public void testGroupUses01_03() throws Exception { checkOccurrences(getTestPath(), "$a = new Cls^A();", true); } public void testGroupUses01_04() throws Exception { checkOccurrences(getTestPath(), "class Cls^AB {", true); } public void testGroupUses01_05() throws Exception { checkOccurrences(getTestPath(), " B\\ClsA^B,", true); } public void testGroupUses01_06() throws Exception { checkOccurrences(getTestPath(), "$ab = new C^lsAB();", true); } public void testGroupUses01_07() throws Exception { checkOccurrences(getTestPath(), "class C^lsABC {", true); } public void testGroupUses01_08() throws Exception { checkOccurrences(getTestPath(), " B\\C\\ClsAB^C,", true); } public void testGroupUses01_09() throws Exception { checkOccurrences(getTestPath(), "$abc = new ClsA^BC();", true); } public void testGroupUses01_10() throws Exception { checkOccurrences(getTestPath(), "class ClsAB^C2 {", true); } public void testGroupUses01_11() throws Exception { checkOccurrences(getTestPath(), " B\\C\\Cl^sABC2 AS MyCls", true); } public void testGroupUses01_12() throws Exception { checkOccurrences(getTestPath(), " B\\C\\ClsABC2 AS MyCl^s", true); } public void testGroupUses01_13() throws Exception { checkOccurrences(getTestPath(), "$mycls = new MyCl^s();", true); } public void testGroupUses01_14() throws Exception { checkOccurrences(getTestPath(), "class Cl^sAB implements Iface {", true); // unused } public void testGroupUses01_15() throws Exception { checkOccurrences(getTestPath(), "class MyC^ls implements Iface {", true); // unused } public void testGroupUses02_01() throws Exception { checkOccurrences(getTestPath(), "const CONSTA^NT = \"CONSTANT\";", true); } public void testGroupUses02_02() throws Exception { checkOccurrences(getTestPath(), " const CONST^ANT,", true); } public void testGroupUses02_03() throws Exception { checkOccurrences(getTestPath(), "echo CON^STANT; // CONSTANT", true); } public void testGroupUses02_04() throws Exception { checkOccurrences(getTestPath(), "function te^st() {", true); } public void testGroupUses02_05() throws Exception { checkOccurrences(getTestPath(), " function te^st,", true); } public void testGroupUses02_06() throws Exception { checkOccurrences(getTestPath(), " function tes^t AS mytest", true); } public void testGroupUses02_07() throws Exception { checkOccurrences(getTestPath(), "te^st(); // test", true); } public void testGroupUses02_08() throws Exception { checkOccurrences(getTestPath(), " function test AS myte^st", true); } public void testGroupUses02_09() throws Exception { checkOccurrences(getTestPath(), "my^test(); // test", true); } public void testGroupUses02_10() throws Exception { checkOccurrences(getTestPath(), "class My^A {}", true); } public void testGroupUses02_11() throws Exception { checkOccurrences(getTestPath(), " M^yA,", true); } public void testGroupUses02_12() throws Exception { checkOccurrences(getTestPath(), "new My^A();", true); } public void testAnonymousClasses01_01() throws Exception { checkOccurrences(getTestPath(), "interface Lo^gger {", true); } public void testAnonymousClasses01_02() throws Exception { checkOccurrences(getTestPath(), " public function lo^g(string $msg);", true); } public void testAnonymousClasses01_03() throws Exception { checkOccurrences(getTestPath(), "$anonCls = new class implements Log^ger {", true); } public void testAnonymousClasses01_04() throws Exception { checkOccurrences(getTestPath(), " public function lo^g(string $msg1) {", true); } public void testAnonymousClasses01_05() throws Exception { checkOccurrences(getTestPath(), " public function log(string $ms^g1) {", true); } public void testAnonymousClasses01_06() throws Exception { checkOccurrences(getTestPath(), " echo $ms^g1;", true); } public void testAnonymousClasses01_07() throws Exception { checkOccurrences(getTestPath(), " public function getLogger(): Log^ger {", true); } public void testAnonymousClasses01_08() throws Exception { checkOccurrences(getTestPath(), " public function setLogger(Lo^gger $logger) {", true); } public void testAnonymousClasses01_09() throws Exception { checkOccurrences(getTestPath(), "$app->setLogger(new class implements Lo^gger {", true); } public void testAnonymousClasses01_10() throws Exception { checkOccurrences(getTestPath(), " public function l^og(string $msg2) {", true); } public void testAnonymousClasses01_11() throws Exception { checkOccurrences(getTestPath(), " public function log(string $m^sg2) {", true); } public void testAnonymousClasses01_12() throws Exception { checkOccurrences(getTestPath(), " echo $ms^g2;", true); } public void testAnonymousClasses01_13() throws Exception { checkOccurrences(getTestPath(), "(new class implements Log^ger {", true); } public void testAnonymousClasses01_14() throws Exception { checkOccurrences(getTestPath(), " public function l^og(string $msg3) {", true); } public void testAnonymousClasses01_15() throws Exception { checkOccurrences(getTestPath(), " public function log(string $m^sg3) {", true); } public void testAnonymousClasses01_16() throws Exception { checkOccurrences(getTestPath(), " echo $ms^g3 . PHP_EOL;", true); } public void testAnonymousClasses01_17() throws Exception { checkOccurrences(getTestPath(), "})->lo^g('hello world');", true); } public void testAnonymousClasses02_01() throws Exception { checkOccurrences(getTestPath(), "class Some^Class {", true); } public void testAnonymousClasses02_02() throws Exception { checkOccurrences(getTestPath(), "interface Some^Interface {", true); } public void testAnonymousClasses02_03() throws Exception { checkOccurrences(getTestPath(), "trait Some^Trait {", true); } public void testAnonymousClasses02_04() throws Exception { checkOccurrences(getTestPath(), "var_dump(new class(10) extends Some^Class implements SomeInterface {", true); } public void testAnonymousClasses02_05() throws Exception { checkOccurrences(getTestPath(), "var_dump(new class(10) extends SomeClass implements Some^Interface {", true); } public void testAnonymousClasses02_06() throws Exception { checkOccurrences(getTestPath(), " private $n^um;", true); } public void testAnonymousClasses02_07() throws Exception { checkOccurrences(getTestPath(), " public function __construct($n^um) {", true); } public void testAnonymousClasses02_08() throws Exception { checkOccurrences(getTestPath(), " $this->n^um = $num;", true); } public void testAnonymousClasses02_09() throws Exception { checkOccurrences(getTestPath(), " $this->num = $nu^m;", true); } public void testAnonymousClasses02_10() throws Exception { checkOccurrences(getTestPath(), " use Some^Trait;", true); } public void testAnonymousClasses03_01() throws Exception { checkOccurrences(getTestPath(), "class Ou^ter {", true); } public void testAnonymousClasses03_02() throws Exception { checkOccurrences(getTestPath(), " private $pr^op = 1;", true); } public void testAnonymousClasses03_03() throws Exception { checkOccurrences(getTestPath(), " protected $pro^p2 = 2;", true); } public void testAnonymousClasses03_04() throws Exception { checkOccurrences(getTestPath(), " protected function fun^c1() {", true); } public void testAnonymousClasses03_05() throws Exception { checkOccurrences(getTestPath(), " public function fun^c2() {", true); } public void testAnonymousClasses03_06() throws Exception { checkOccurrences(getTestPath(), " return new class($this->pr^op) extends Outer {", true); } public void testAnonymousClasses03_07() throws Exception { checkOccurrences(getTestPath(), " return new class($this->prop) extends Out^er {", true); } public void testAnonymousClasses03_08() throws Exception { checkOccurrences(getTestPath(), " private $pro^p3;", true); } public void testAnonymousClasses03_09() throws Exception { checkOccurrences(getTestPath(), " $this->pro^p3 = $prop;", true); } public void testAnonymousClasses03_10() throws Exception { checkOccurrences(getTestPath(), " public function fun^c3() {", true); } public void testAnonymousClasses03_11() throws Exception { checkOccurrences(getTestPath(), " return $this->pr^op2 + $this->prop3 + $this->func1();", true); } public void testAnonymousClasses03_12() throws Exception { checkOccurrences(getTestPath(), " return $this->prop2 + $this->pr^op3 + $this->func1();", true); } public void testAnonymousClasses03_13() throws Exception { checkOccurrences(getTestPath(), " return $this->prop2 + $this->prop3 + $this->fun^c1();", true); } public void testAnonymousClasses03_14() throws Exception { checkOccurrences(getTestPath(), "echo (new Out^er)->func2()->func3() . PHP_EOL;", true); } public void testAnonymousClasses03_15() throws Exception { checkOccurrences(getTestPath(), "echo (new Outer)->fu^nc2()->func3() . PHP_EOL;", true); } public void testAnonymousClasses03_16() throws Exception { checkOccurrences(getTestPath(), "echo (new Outer)->func2()->fu^nc3() . PHP_EOL;", true); } public void testAnonymousClasses04_01() throws Exception { checkOccurrences(getTestPath(), " $this->tes^tB();", true); } public void testAnonymousClasses04_02() throws Exception { checkOccurrences(getTestPath(), " private function tes^tB() {", true); } public void testAnonymousClasses05_01() throws Exception { checkOccurrences(getTestPath(), "interface Log^ger {", true); } public void testAnonymousClasses05_02() throws Exception { checkOccurrences(getTestPath(), "use api\\Lo^gger as MyLogger;", true); } public void testAnonymousClasses05_03() throws Exception { checkOccurrences(getTestPath(), "use api\\Logger as MyLogg^er;", true); } public void testAnonymousClasses05_04() throws Exception { checkOccurrences(getTestPath(), "$x = new class implements MyLog^ger {", true); } public void testAnonymousClasses05_05() throws Exception { checkOccurrences(getTestPath(), " public function lo^g($msg2) {", true); } public void testAnonymousClasses05_06() throws Exception { checkOccurrences(getTestPath(), "$x->lo^g('');", true); } public void testUniformVariableSyntax01_01() throws Exception { checkOccurrences(getTestPath(), "UV^S3::myStatic3()::myStatic2()::myStatic1()::MAX;", true); } public void testUniformVariableSyntax01_02() throws Exception { checkOccurrences(getTestPath(), "UVS3::mySta^tic3()::myStatic2()::myStatic1()::MAX;", true); } public void testUniformVariableSyntax01_03() throws Exception { checkOccurrences(getTestPath(), "UVS3::myStatic3()::mySt^atic2()::myStatic1()::MAX;", true); } public void testUniformVariableSyntax01_04() throws Exception { checkOccurrences(getTestPath(), "UVS3::myStatic3()::myStatic2()::mySta^tic1()::MAX;", true); } public void testUniformVariableSyntax01_05() throws Exception { checkOccurrences(getTestPath(), "UVS3::myStatic3()::myStatic2()::myStatic1()::MA^X;", true); } public void testUniformVariableSyntax01_06() throws Exception { checkOccurrences(getTestPath(), "UVS3::myStatic3()::myStatic2()::myStatic1()::AV^G;", true); } public void testUniformVariableSyntax01_07() throws Exception { checkOccurrences(getTestPath(), "UVS3::myStatic3()::myStatic2()::myStatic1()::mySt^atic2();", true); } public void testUniformVariableSyntax01_08() throws Exception { checkOccurrences(getTestPath(), "UVS3::myStatic3()->myStat^ic2()::myStatic1()->myStatic2();", true); } public void testUniformVariableSyntax01_09() throws Exception { checkOccurrences(getTestPath(), "UVS3::myStatic3()->myStatic2()::my^Static1()->myStatic2();", true); } public void testUniformVariableSyntax01_10() throws Exception { checkOccurrences(getTestPath(), "UVS3::myStatic3()->myStatic2()::myStatic1()->myS^tatic2();", true); } public void testUniformVariableSyntax01_11() throws Exception { checkOccurrences(getTestPath(), "UVS3::myStatic3()::myStatic2()::myStatic1()::$M^IN;", true); } public void testUniformVariableSyntax01_12() throws Exception { checkOccurrences(getTestPath(), "UVS3::myStatic3()->myStatic2()::myStatic1()->te^st;", true); } public void testUniformVariableSyntax01_13() throws Exception { checkOccurrences(getTestPath(), "UVS3::myStatic3()::myStatic2()::myStatic1()::$INSTANCE::mySt^atic1();", true); } public void testUniformVariableSyntax02_01() throws Exception { checkOccurrences(getTestPath(), "UV^S3::myStatic3()->my2()::myStatic1()->my1();", true); } public void testUniformVariableSyntax02_02() throws Exception { checkOccurrences(getTestPath(), "UVS3::mySt^atic3()->my2()::myStatic1()->my1();", true); } public void testUniformVariableSyntax02_03() throws Exception { checkOccurrences(getTestPath(), "UVS3::myStatic3()->m^y2()::myStatic1()->my1();", true); } public void testUniformVariableSyntax02_04() throws Exception { checkOccurrences(getTestPath(), "UVS3::myStatic3()->my2()::myS^tatic1()->my1();", true); } public void testUniformVariableSyntax02_05() throws Exception { checkOccurrences(getTestPath(), "UVS3::myStatic3()->my2()::myStatic1()->my^1();", true); } public void testIssue247082_01() throws Exception { checkOccurrences(getTestPath(), " const PARE^NT_CONST = 'PARENT_CONST';", true); } public void testIssue247082_02() throws Exception { checkOccurrences(getTestPath(), " echo parent::PAR^ENT_CONST . PHP_EOL;", true); } public void testIssue247082_03() throws Exception { checkOccurrences(getTestPath(), " public static $parentF^ieldStatic = 'parentFieldStatic';", true); } public void testIssue247082_04() throws Exception { checkOccurrences(getTestPath(), " echo parent::$parentFi^eldStatic . PHP_EOL;", true); } public void testIssue247082_05() throws Exception { checkOccurrences(getTestPath(), " public function parentTe^stInstance() {", true); } public void testIssue247082_06() throws Exception { checkOccurrences(getTestPath(), " echo parent::parentTe^stInstance() . PHP_EOL;", true); } public void testIssue247082_07() throws Exception { checkOccurrences(getTestPath(), " public static function parentT^estStatic() {", true); } public void testIssue247082_08() throws Exception { checkOccurrences(getTestPath(), " echo parent::parentTes^tStatic() . PHP_EOL;", true); } public void testIssue247082_09() throws Exception { checkOccurrences(getTestPath(), " const MY_CO^NST = 'MY_CONST';", true); } public void testIssue247082_10() throws Exception { checkOccurrences(getTestPath(), " echo self::MY_C^ONST . PHP_EOL;", true); } public void testIssue247082_11() throws Exception { checkOccurrences(getTestPath(), " public static $myField^Static = 'myFieldStatic';", true); } public void testIssue247082_12() throws Exception { checkOccurrences(getTestPath(), " echo self::$myFiel^dStatic . PHP_EOL;", true); } public void testIssue247082_13() throws Exception { checkOccurrences(getTestPath(), " public $myFieldIn^stance = 'myFieldInstance';", true); } public void testIssue247082_14() throws Exception { checkOccurrences(getTestPath(), " echo $this->myFie^ldInstance . PHP_EOL;", true); } public void testIssue247082_15() throws Exception { checkOccurrences(getTestPath(), " public function myTestIns^tance() {", true); } public void testIssue247082_16() throws Exception { checkOccurrences(getTestPath(), " echo $this->myTest^Instance() . PHP_EOL;", true); } public void testIssue247082_17() throws Exception { checkOccurrences(getTestPath(), " public static function myTestSt^atic() {", true); } public void testIssue247082_18() throws Exception { checkOccurrences(getTestPath(), " echo self::myTest^Static() . PHP_EOL;", true); } public void testIssue262438_00() throws Exception { checkOccurrences(getTestPath(), "interface MyIf^ace {", true); } public void testIssue262438_01() throws Exception { checkOccurrences(getTestPath(), "use MyVendor\\PackageTwo\\MyT^rait;", true); } public void testIssue262438_02() throws Exception { checkOccurrences(getTestPath(), " use MyTr^ait;", true); } public void testIssue262438_03() throws Exception { checkOccurrences(getTestPath(), "trait MyTr^ait {", true); } public void testIssue268712_01() throws Exception { checkOccurrences(getTestPath(), "const TES^T1 = [0, 1];", true); } public void testIssue268712_02() throws Exception { checkOccurrences(getTestPath(), "const TE^ST2 = [[0, 1], 1];", true); } public void testIssue268712_03() throws Exception { checkOccurrences(getTestPath(), "const TEST^3 = \\TEST1[0];", true); } public void testIssue268712_04() throws Exception { checkOccurrences(getTestPath(), "const TEST4 = \\Issue268712_A\\TES^T3;", true); } public void testIssue268712_05() throws Exception { checkOccurrences(getTestPath(), "const TEST5 = \\Issue268712_A\\TES^T2[0][1];", true); } public void testIssue268712_06() throws Exception { checkOccurrences(getTestPath(), "const TES^T6 = [\"test\" => \"test\"];", true); } public void testIssue268712_07() throws Exception { checkOccurrences(getTestPath(), "$const1 = \\TEST^1[0];", true); } public void testIssue268712_08() throws Exception { checkOccurrences(getTestPath(), "$const2 = \\Issue268712_A\\TE^ST2[1];", true); } public void testIssue268712_09() throws Exception { checkOccurrences(getTestPath(), "echo \\Issue268712_B\\TES^T6[\"test\"] . PHP_EOL;", true); } public void testIssue268712_10() throws Exception { checkOccurrences(getTestPath(), "echo Sub\\S^UB[\"sub\"] . PHP_EOL;", true); } public void testIssue268712_11() throws Exception { checkOccurrences(getTestPath(), "echo namespace\\TEST^6[\"test\"] . PHP_EOL;", true); } public void testIssue268712_12() throws Exception { checkOccurrences(getTestPath(), "const S^UB = [\"sub\" => \"sub\"];", true); } }
3e0d76376629ce4bcba3f7b37c0a32c926058bce
8,501
java
Java
meta-utils/src/main/java/com/igormaznitsa/meta/common/utils/Deferrers.java
raydac/meta
0607320ecd0734d69e6496a2714255b64adae435
[ "Apache-2.0" ]
null
null
null
meta-utils/src/main/java/com/igormaznitsa/meta/common/utils/Deferrers.java
raydac/meta
0607320ecd0734d69e6496a2714255b64adae435
[ "Apache-2.0" ]
1
2016-03-20T10:21:53.000Z
2016-03-31T19:46:54.000Z
meta-utils/src/main/java/com/igormaznitsa/meta/common/utils/Deferrers.java
raydac/meta
0607320ecd0734d69e6496a2714255b64adae435
[ "Apache-2.0" ]
null
null
null
29.013652
177
0.673685
5,703
/* * Copyright 2015 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.meta.common.utils; import com.igormaznitsa.meta.annotation.Weight; import com.igormaznitsa.meta.common.exceptions.MetaErrorListeners; import static com.igormaznitsa.meta.common.utils.Assertions.assertNotNull; import java.io.Closeable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import com.igormaznitsa.meta.annotation.MustNotContainNull; import com.igormaznitsa.meta.common.interfaces.Disposable; import com.igormaznitsa.meta.annotation.Warning; import com.igormaznitsa.meta.common.exceptions.UnexpectedProcessingError; import java.io.Serializable; import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.annotation.concurrent.Immutable; import javax.annotation.concurrent.ThreadSafe; /** * Auxiliary tool to defer some actions and process them in some point in future. it check stack depth and executes only locally (for the stack level) defer actions. <b>It works * through ThreadLocal so that actions saved separately for every thread.</b> * * @since 1.0 * @see ThreadLocal */ @ThreadSafe public final class Deferrers { private Deferrers() { } /** * Class wrapping executeDeferred method and stack depth for action. * * @since 1.0 */ @Immutable @Weight(Weight.Unit.VARIABLE) public abstract static class Deferred implements Serializable { private static final long serialVersionUID = -1134788854676942497L; private final int stackDepth; /** * The Constructor. * * @since 1.0 */ @Weight(value = Weight.Unit.VARIABLE, comment = "Depends on the current call stack depth@") public Deferred() { this.stackDepth = ThreadUtils.stackDepth() - 1; } /** * Get the stack depth detected during object creation. * * @return the stack depth * @since 1.0 */ public int getStackDepth() { return this.stackDepth; } /** * Execute call. * * @throws Exception it will be thrown for error. * @since 1.0 */ public abstract void executeDeferred() throws Exception; } /** * Inside registry for defer actions. * * @since 1.0 */ @MustNotContainNull private static final ThreadLocal<List<Deferred>> REGISTRY = new ThreadLocal<List<Deferred>>() { @Override protected List<Deferred> initialValue() { return new ArrayList<Deferred>(); } }; /** * Defer some action. * * @param deferred action to be defer. * @return the same object from arguments * @since 1.0 */ @Weight(Weight.Unit.NORMAL) public static Deferred defer(@Nonnull final Deferred deferred) { REGISTRY.get().add(assertNotNull(deferred)); return deferred; } /** * Defer object containing public close() method. It catches all exceptions during closing and make notifications only for global error listeners. It finds a public 'close' * method of the object and call that through reflection. * * @param <T> type of the object to be processed * @param closeable an object with close() method. * @return the same object from arguments. * @since 1.0 */ @Warning("Using reflection") @Weight(Weight.Unit.NORMAL) public static <T> T deferredClose(@Nullable final T closeable) { if (closeable != null) { defer(new Deferred() { private static final long serialVersionUID = 2265124256013043847L; @Override public void executeDeferred() throws Exception { try { closeable.getClass().getMethod("close").invoke(closeable); } catch (Exception thr) { MetaErrorListeners.fireError("Error during deferred closing action", thr); } } }); } return closeable; } /** * Defer closing of an closeable object. * * @param <T> type of closeable object * @param closeable an object implements java.io.Closeable * @return the same closeable object from arguments * @since 1.0 */ @Weight(Weight.Unit.NORMAL) public static <T extends Closeable> T defer(@Nullable final T closeable) { if (closeable != null) { defer(new Deferred() { private static final long serialVersionUID = 2265124256013043847L; @Override public void executeDeferred() throws Exception { IOUtils.closeQuetly(closeable); } }); } return closeable; } /** * Defer execution of some runnable action. * * @param runnable some runnable action to be executed in future * @return the same runnable object from arguments. * @throws AssertionError if the runnable object is null */ @Weight(Weight.Unit.NORMAL) public static Runnable defer(@Nonnull final Runnable runnable) { assertNotNull(runnable); defer(new Deferred() { private static final long serialVersionUID = 2061489024868070733L; private final Runnable value = runnable; @Override public void executeDeferred() throws Exception { this.value.run(); } }); return runnable; } /** * Defer execution of some disposable object. * * @param disposable some disposable object to be processed. * @return the same object from arguments * @throws AssertionError if the disposable object is null * @see Disposable */ @Weight(Weight.Unit.NORMAL) public static Disposable defer(@Nonnull final Disposable disposable) { assertNotNull(disposable); defer(new Deferred() { private static final long serialVersionUID = 7940162959962038010L; private final Disposable value = disposable; @Override public void executeDeferred() throws Exception { this.value.dispose(); } }); return disposable; } /** * Cancel all defer actions globally. * * @since 1.0 */ @Weight(Weight.Unit.NORMAL) public static void cancelAllDeferredActionsGlobally() { final List<Deferred> list = REGISTRY.get(); list.clear(); REGISTRY.remove(); } /** * Cancel all defer actions for the current stack depth. * * @since 1.0 */ @Weight(value = Weight.Unit.VARIABLE, comment = "Depends on the current call stack depth") public static void cancelDeferredActions() { final int stackDepth = ThreadUtils.stackDepth(); final List<Deferred> list = REGISTRY.get(); final Iterator<Deferred> iterator = list.iterator(); while (iterator.hasNext()) { final Deferred deferred = iterator.next(); if (deferred.getStackDepth() >= stackDepth) { iterator.remove(); } } if (list.isEmpty()) { REGISTRY.remove(); } } /** * Process all defer actions for the current stack depth level. * * @since 1.0 */ @Weight(value = Weight.Unit.VARIABLE, comment = "Depends on the current call stack depth") public static void processDeferredActions() { final int stackDepth = ThreadUtils.stackDepth(); final List<Deferred> list = REGISTRY.get(); final Iterator<Deferred> iterator = list.iterator(); while (iterator.hasNext()) { final Deferred deferred = iterator.next(); if (deferred.getStackDepth() >= stackDepth) { try { deferred.executeDeferred(); } catch (Exception ex) { final UnexpectedProcessingError error = new UnexpectedProcessingError("Error during deferred action processing", ex); MetaErrorListeners.fireError(error.getMessage(), error); } finally { iterator.remove(); } } } if (list.isEmpty()) { REGISTRY.remove(); } } /** * Check that presented defer actions for the current thread. * * @return true if presented, false otherwise * @since 1.0 */ @Weight(Weight.Unit.NORMAL) public static boolean isEmpty() { final boolean result = REGISTRY.get().isEmpty(); if (result) { REGISTRY.remove(); } return result; } }
3e0d7653f05daae574b14070a4f5c86a90045f02
194
java
Java
design-pattern/decorator/BasePhone.java
avoidcloud/HelloJava
112903ba106dba1b4d539fa76856bf8e57ee6e1e
[ "MIT" ]
2
2018-12-03T22:14:58.000Z
2019-05-16T07:28:02.000Z
design-pattern/decorator/BasePhone.java
avoidcloud/HelloJava
112903ba106dba1b4d539fa76856bf8e57ee6e1e
[ "MIT" ]
null
null
null
design-pattern/decorator/BasePhone.java
avoidcloud/HelloJava
112903ba106dba1b4d539fa76856bf8e57ee6e1e
[ "MIT" ]
1
2019-02-24T09:54:14.000Z
2019-02-24T09:54:14.000Z
14.923077
46
0.628866
5,704
package sdp.decorator; /** * * @author rafiul islam */ public class BasePhone implements MobilePhone{ @Override public void call(){ System.out.println("calling..."); } }
3e0d76933aed71d5a4788e43427f7ac113de0de7
2,567
java
Java
src/main/java/jenkins/plugins/elastest/json/TestSupportServices.java
basil/elastest-plugin
686ecb086c791265411825d67b43af57eb4f1fc8
[ "MIT" ]
1
2018-08-21T10:50:39.000Z
2018-08-21T10:50:39.000Z
src/main/java/jenkins/plugins/elastest/json/TestSupportServices.java
elastest/elastest-jenkins
b2fe402cf0c790a598b2e3cde2403346583e7190
[ "MIT" ]
5
2020-03-04T22:08:51.000Z
2021-12-09T20:31:13.000Z
src/main/java/jenkins/plugins/elastest/json/TestSupportServices.java
basil/elastest-plugin
686ecb086c791265411825d67b43af57eb4f1fc8
[ "MIT" ]
1
2021-08-21T22:52:38.000Z
2021-08-21T22:52:38.000Z
29.505747
80
0.700429
5,705
/* * The MIT License * * (C) Copyright 2017-2019 ElasTest (http://elastest.io/) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package jenkins.plugins.elastest.json; import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; /** * * @author Francisco R Díaz * @since 0.0.1 */ public class TestSupportServices implements Serializable { private static final long serialVersionUID = 1; @JsonProperty("id") private String id; @JsonProperty("name") private String name; @JsonProperty("selected") private boolean selected; public TestSupportServices() { } public TestSupportServices(String id, String name, boolean selected) { super(); this.id = id; this.name = name; this.selected = selected; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public boolean isSelected() { return selected; } public void setSelected(boolean selected) { this.selected = selected; } public String toJsonString() throws JsonProcessingException { ObjectMapper mapper = new ObjectMapper(); String jsonInString = mapper.writeValueAsString(this); return jsonInString; } }
3e0d7928b6ee4137bebc0dc39e42c9eb30d35672
1,044
java
Java
tenorite-server/src/main/java/net/tenorite/clients/events/ClientRegistered.java
Kajvdh/tenorite
7761065723038c6bc99677e672d10510a0c4700c
[ "Apache-2.0" ]
3
2016-08-01T07:05:20.000Z
2016-09-24T09:56:15.000Z
tenorite-server/src/main/java/net/tenorite/clients/events/ClientRegistered.java
Kajvdh/tenorite
7761065723038c6bc99677e672d10510a0c4700c
[ "Apache-2.0" ]
1
2016-09-24T09:58:05.000Z
2016-09-27T10:21:49.000Z
tenorite-server/src/main/java/net/tenorite/clients/events/ClientRegistered.java
Kajvdh/tenorite
7761065723038c6bc99677e672d10510a0c4700c
[ "Apache-2.0" ]
3
2017-10-23T16:16:15.000Z
2020-10-16T15:35:18.000Z
29
75
0.745211
5,706
/* * Copyright 2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.tenorite.clients.events; import akka.actor.ActorRef; import net.tenorite.util.ImmutableStyle; import org.immutables.value.Value; /** * @author Johan Siebens */ @Value.Immutable @ImmutableStyle public abstract class ClientRegistered { public static ClientRegistered of(ActorRef client) { return new ClientRegisteredBuilder().client(client).build(); } public abstract ActorRef getClient(); }
3e0d7971b70612770d68ad716e4009ebdf8c2018
1,952
java
Java
camunda-workflow-starter/src/test/java/io/github/devbhuwan/microservices/nutshell/camunda/workflow/api/RESTWorkflowApiServiceTest.java
labcart/micro-services-nutshell
e8a8d0c91b16b5aa668fff6893752be3f12f989c
[ "Apache-2.0" ]
1
2017-08-13T10:59:33.000Z
2017-08-13T10:59:33.000Z
camunda-workflow-starter/src/test/java/io/github/devbhuwan/microservices/nutshell/camunda/workflow/api/RESTWorkflowApiServiceTest.java
labcart/micro-services-nutshell
e8a8d0c91b16b5aa668fff6893752be3f12f989c
[ "Apache-2.0" ]
null
null
null
camunda-workflow-starter/src/test/java/io/github/devbhuwan/microservices/nutshell/camunda/workflow/api/RESTWorkflowApiServiceTest.java
labcart/micro-services-nutshell
e8a8d0c91b16b5aa668fff6893752be3f12f989c
[ "Apache-2.0" ]
null
null
null
36.148148
110
0.736168
5,707
package io.github.devbhuwan.microservices.nutshell.camunda.workflow.api; import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.engine.TaskService; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.camunda.bpm.engine.task.Task; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.web.client.TestRestTemplate; import java.util.HashMap; import java.util.List; import java.util.Map; import static org.junit.Assert.assertNotNull; public class RESTWorkflowApiServiceTest extends AbstractTest { public static final String WF_REQUEST_APPROVAL = "wf-request-approval"; @Autowired private TestRestTemplate restTemplate; @Autowired private RuntimeService runtimeService; @Autowired private TaskService taskService; @Test public void requesterApporvalWorkflow() throws InterruptedException { Thread.sleep(5000); final ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(WF_REQUEST_APPROVAL); assertNotNull(processInstance); //-> A List<Task> ATasks = getTasks(processInstance); Map<String, Object> ATaskVariables = new HashMap<>(); ATaskVariables.put("approved", "false"); execute(ATasks.get(0), ATaskVariables); //-> B List<Task> BTasks = getTasks(processInstance); Map<String, Object> BTaskVariables = new HashMap<>(); BTaskVariables.put("approved", "true"); execute(ATasks.get(0), BTaskVariables); List<Task> FinalTasks = getTasks(processInstance); } private List<Task> getTasks(ProcessInstance processInstance) { return taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId()).list(); } private void execute(Task task, Map<String, Object> taskVariables) { taskService.complete(task.getId(), taskVariables); } }
3e0d7a67ea6081e792f63eec6b0dcb17f871d8cc
1,284
java
Java
java/src/main/java/com/google/crypto/tink/subtle/XSalsa20Poly1305.java
insightiotest/go
5add0f822bca1a6bfab41b880b0ced812e7eeeaa
[ "Apache-2.0" ]
2
2019-03-14T17:16:20.000Z
2022-03-22T10:33:58.000Z
java/src/main/java/com/google/crypto/tink/subtle/XSalsa20Poly1305.java
insightiotest/go
5add0f822bca1a6bfab41b880b0ced812e7eeeaa
[ "Apache-2.0" ]
null
null
null
java/src/main/java/com/google/crypto/tink/subtle/XSalsa20Poly1305.java
insightiotest/go
5add0f822bca1a6bfab41b880b0ced812e7eeeaa
[ "Apache-2.0" ]
null
null
null
34.702703
98
0.703271
5,708
// Copyright 2017 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package com.google.crypto.tink.subtle; import com.google.crypto.tink.annotations.Alpha; import java.security.InvalidKeyException; /** * XSalsa20-Poly1305 AEAD construction, compatible with <a * href="https://tools.ietf.org/html/rfc7539#section-2.8">RFC 7539, section 2.8</a>. */ @Alpha public final class XSalsa20Poly1305 extends SnufflePoly1305 { public XSalsa20Poly1305(final byte[] key) throws InvalidKeyException { super(key); } @Override Snuffle createSnuffleInstance(final byte[] key, int initialCounter) throws InvalidKeyException { return new XSalsa20(key, initialCounter); } }
3e0d7ac96d8928adad56e4845c6dcb7b05268768
1,849
java
Java
blueflood-core/src/main/java/com/rackspacecloud/blueflood/io/serializers/astyanax/StringMetadataSerializer.java
JLLeitschuh/blueflood
4722a3449b1a7f8e88889ea8c340c6f24396b5b0
[ "Apache-2.0" ]
390
2015-01-08T00:48:27.000Z
2022-01-21T09:48:33.000Z
blueflood-core/src/main/java/com/rackspacecloud/blueflood/io/serializers/astyanax/StringMetadataSerializer.java
JLLeitschuh/blueflood
4722a3449b1a7f8e88889ea8c340c6f24396b5b0
[ "Apache-2.0" ]
428
2015-01-07T18:12:56.000Z
2022-01-05T16:58:00.000Z
blueflood-core/src/main/java/com/rackspacecloud/blueflood/io/serializers/astyanax/StringMetadataSerializer.java
JLLeitschuh/blueflood
4722a3449b1a7f8e88889ea8c340c6f24396b5b0
[ "Apache-2.0" ]
91
2015-01-03T02:40:20.000Z
2022-01-16T08:03:15.000Z
37.734694
124
0.745268
5,709
/* * Copyright 2013 Rackspace * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.rackspacecloud.blueflood.io.serializers.astyanax; import com.netflix.astyanax.serializers.AbstractSerializer; import com.rackspacecloud.blueflood.io.serializers.metrics.StringMetadataSerDes; import java.nio.ByteBuffer; public class StringMetadataSerializer extends AbstractSerializer<String> { private static final StringMetadataSerDes deSer = new StringMetadataSerDes(); private static final StringMetadataSerializer INSTANCE = new StringMetadataSerializer(); // However, we never actually used that functionality, and it duplicated a lot of logic // as is contained in NumericSerializer, without actually being in a compatible [de]serialization format. // TODO: re-add non-str functionality in a way that does not involve as much code duplication and format incompatibility public static StringMetadataSerializer get() { return INSTANCE; } @Override public ByteBuffer toByteBuffer(String str) { return deSer.serialize(str); } @Override public String fromByteBuffer(ByteBuffer byteBuffer) { return deSer.deserialize(byteBuffer); } // prevent people from instantiating this class private StringMetadataSerializer() { } }
3e0d7b157d3694b628d10700312557aadcc734a1
1,251
java
Java
oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/user/TestOAuth2Users.java
cummiisa000/spring-security
0387723334d673a69565b973c45590bf4b694f5c
[ "Apache-2.0" ]
6
2019-06-19T17:56:07.000Z
2021-11-29T20:57:44.000Z
oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/user/TestOAuth2Users.java
cummiisa000/spring-security
0387723334d673a69565b973c45590bf4b694f5c
[ "Apache-2.0" ]
1
2019-01-25T00:44:16.000Z
2019-01-25T00:44:16.000Z
oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/user/TestOAuth2Users.java
cummiisa000/spring-security
0387723334d673a69565b973c45590bf4b694f5c
[ "Apache-2.0" ]
10
2019-04-08T12:01:28.000Z
2021-11-22T12:06:02.000Z
32.076923
81
0.756994
5,710
/* * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.security.oauth2.core.user; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.AuthorityUtils; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author Rob Winch */ public class TestOAuth2Users { public static DefaultOAuth2User create() { List<GrantedAuthority> roles = AuthorityUtils.createAuthorityList("ROLE_USER"); String attrName = "username"; Map<String, Object> attributes = new HashMap<>(); attributes.put(attrName, "user"); return new DefaultOAuth2User(roles, attributes, attrName); } }
3e0d7b16eee282ea811bfa9ced686e34209827ab
78
java
Java
project1/app/models/Area.java
firmanadiw/IoTBase
7d617899609202ce1454dcf80d62fa2576bcb595
[ "Apache-2.0" ]
1
2018-03-25T02:48:52.000Z
2018-03-25T02:48:52.000Z
project1/app/models/Area.java
firmanadiw/IoTBase
7d617899609202ce1454dcf80d62fa2576bcb595
[ "Apache-2.0" ]
null
null
null
project1/app/models/Area.java
firmanadiw/IoTBase
7d617899609202ce1454dcf80d62fa2576bcb595
[ "Apache-2.0" ]
null
null
null
9.75
23
0.653846
5,711
package models; public class Area { public int getArea() { return 0; } }
3e0d7c1a88d0b9bc0071103b95c7033c953a040f
464
java
Java
image-pipeline/src/main/java/software/amazon/imagebuilder/imagepipeline/ClientBuilder.java
aws-cloudformation/aws-cloudformation-resource-providers-imagebuilder
4f08d24b625c6c7683b49213661c5847a2d47b27
[ "Apache-2.0" ]
13
2020-04-27T05:30:26.000Z
2021-11-08T09:43:45.000Z
image-pipeline/src/main/java/software/amazon/imagebuilder/imagepipeline/ClientBuilder.java
aws-cloudformation/aws-cloudformation-resource-providers-imagebuilder
4f08d24b625c6c7683b49213661c5847a2d47b27
[ "Apache-2.0" ]
5
2020-09-07T09:46:22.000Z
2022-03-07T01:48:00.000Z
image-pipeline/src/main/java/software/amazon/imagebuilder/imagepipeline/ClientBuilder.java
aws-cloudformation/aws-cloudformation-resource-providers-imagebuilder
4f08d24b625c6c7683b49213661c5847a2d47b27
[ "Apache-2.0" ]
3
2021-02-11T22:07:37.000Z
2021-10-30T03:30:08.000Z
29
77
0.821121
5,712
package software.amazon.imagebuilder.imagepipeline; import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration; import software.amazon.awssdk.core.retry.RetryPolicy; import software.amazon.awssdk.services.imagebuilder.ImagebuilderClient; import software.amazon.cloudformation.LambdaWrapper; import java.net.URI; class ClientBuilder { static ImagebuilderClient getImageBuilderClient() { return ImagebuilderClient.create(); } }
3e0d7c64b6535886a4c4257d2b1033c6c8854e0e
674
java
Java
Application/src/main/java/com/example/android/domainview/TicketsView.java
estellerostan/tram-bus-CardEmulation
5473f8254f9bd115e8e59ba8e2e03bbfc042e36f
[ "Apache-2.0" ]
null
null
null
Application/src/main/java/com/example/android/domainview/TicketsView.java
estellerostan/tram-bus-CardEmulation
5473f8254f9bd115e8e59ba8e2e03bbfc042e36f
[ "Apache-2.0" ]
null
null
null
Application/src/main/java/com/example/android/domainview/TicketsView.java
estellerostan/tram-bus-CardEmulation
5473f8254f9bd115e8e59ba8e2e03bbfc042e36f
[ "Apache-2.0" ]
null
null
null
24.962963
56
0.743323
5,713
package com.example.android.domainview; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.ListView; import com.example.android.cardemulation.R; public class TicketsView extends AppCompatActivity { private ListView ticketsList; private TicketsListAdapter data; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tickets_view); ticketsList = findViewById(R.id.ticketsList); ticketsList.invalidateViews(); data = new TicketsListAdapter(); ticketsList.setAdapter(data); } }
3e0d7cfb826e4f8d7f00e74f90d0bf6ec4247a1b
1,331
java
Java
harahachibu/src/test/java/uk/co/flax/harahachibu/services/TestArgsDiskSpaceChecker.java
flaxsearch/harahachibu
887d53a23e6ac8c3af5699892c9d15f131c3f3ce
[ "Apache-2.0" ]
12
2016-04-21T09:50:59.000Z
2019-11-11T13:00:20.000Z
harahachibu/src/test/java/uk/co/flax/harahachibu/services/TestArgsDiskSpaceChecker.java
flaxsearch/harahachibu
887d53a23e6ac8c3af5699892c9d15f131c3f3ce
[ "Apache-2.0" ]
null
null
null
harahachibu/src/test/java/uk/co/flax/harahachibu/services/TestArgsDiskSpaceChecker.java
flaxsearch/harahachibu
887d53a23e6ac8c3af5699892c9d15f131c3f3ce
[ "Apache-2.0" ]
null
null
null
23.350877
92
0.74305
5,714
/** * Copyright (c) 2016 Lemur Consulting Ltd. * <p/> * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * <p/> * http://www.apache.org/licenses/LICENSE-2.0 * <p/> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package uk.co.flax.harahachibu.services; import javax.ws.rs.client.Client; import java.util.Map; /** * Test disk space checker. * * Created by mlp on 19/04/16. */ public class TestArgsDiskSpaceChecker implements DiskSpaceChecker { public TestArgsDiskSpaceChecker(String name) { } @Override public boolean isSpaceAvailable() throws DiskSpaceCheckerException { return false; } @Override public void configure(Map<String, Object> configuration) throws DiskSpaceCheckerException { } @Override public boolean requiresHttpClient() { return false; } @Override public void setHttpClient(Client httpClient) { } @Override public void setThreshold(DiskSpaceThreshold threshold) { } }
3e0d7d90ef77f58918b3601a43f77fd6aa87d100
589
java
Java
app/src/main/java/com/aotuweather/android/gson/Suggestion.java
aotuzhao/aotuweather
16bd79e79906c86179ad14c93f4b040e9fb8a71d
[ "Apache-2.0" ]
1
2017-02-02T14:08:58.000Z
2017-02-02T14:08:58.000Z
app/src/main/java/com/aotuweather/android/gson/Suggestion.java
aotuzhao/aotuweather
16bd79e79906c86179ad14c93f4b040e9fb8a71d
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/aotuweather/android/gson/Suggestion.java
aotuzhao/aotuweather
16bd79e79906c86179ad14c93f4b040e9fb8a71d
[ "Apache-2.0" ]
null
null
null
14.725
50
0.624788
5,715
package com.aotuweather.android.gson; import com.google.gson.annotations.SerializedName; /** * Created by Administrator on 2017/2/3. */ public class Suggestion { @SerializedName("comf") public Comfort comfort; @SerializedName("cw") public CarWash carWash; public Sport sport; public class Comfort { @SerializedName("txt") public String info; } public class CarWash { @SerializedName("txt") public String info; } public class Sport { @SerializedName("txt") public String info; } }
3e0d7e2d8ab1c26164af25efa4a037f019938b61
2,190
java
Java
ifs-resources/src/main/java/org/innovateuk/ifs/finance/resource/cost/FinanceRowItem.java
adambirse/innovation-funding-service
db1c2bc5a25d3143df02bef9019aefd5261caf6f
[ "MIT" ]
null
null
null
ifs-resources/src/main/java/org/innovateuk/ifs/finance/resource/cost/FinanceRowItem.java
adambirse/innovation-funding-service
db1c2bc5a25d3143df02bef9019aefd5261caf6f
[ "MIT" ]
null
null
null
ifs-resources/src/main/java/org/innovateuk/ifs/finance/resource/cost/FinanceRowItem.java
adambirse/innovation-funding-service
db1c2bc5a25d3143df02bef9019aefd5261caf6f
[ "MIT" ]
null
null
null
44.693878
108
0.715068
5,716
package org.innovateuk.ifs.finance.resource.cost; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import java.math.BigDecimal; /** * {@code FinanceRowItem} interface is used to handle the different type of costItems * for an application. */ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({ @JsonSubTypes.Type(value = AcademicCost.class, name = "academic"), @JsonSubTypes.Type(value = CapitalUsage.class, name = "capitalUsage"), @JsonSubTypes.Type(value = GrantClaim.class, name = "grantClaim"), @JsonSubTypes.Type(value = LabourCost.class, name = "labourCost"), @JsonSubTypes.Type(value = Materials.class, name = "materials"), @JsonSubTypes.Type(value = OtherCost.class, name = "otherCost"), @JsonSubTypes.Type(value = OtherFunding.class, name = "otherFunding"), @JsonSubTypes.Type(value = Overhead.class, name = "overhead"), @JsonSubTypes.Type(value = SubContractingCost.class, name = "subContractingCost"), @JsonSubTypes.Type(value = TravelCost.class, name = "travelCost") }) public interface FinanceRowItem { int MAX_DIGITS = 20; int MAX_DIGITS_INT = 10; int MAX_STRING_LENGTH = 255; // when to show the validation message and when to disable mark as complete int MAX_DB_STRING_LENGTH = 255; // max string length to send to the db. String MAX_LENGTH_MESSAGE = "{validation.field.too.many.characters}"; String NOT_BLANK_MESSAGE = "{validation.field.must.not.be.blank}"; String MAX_DIGITS_MESSAGE = "{validation.field.max.number.of.digits}"; String VALUE_MUST_BE_HIGHER_MESSAGE = "{validation.field.max.value.or.higher}"; String VALUE_MUST_BE_LOWER_MESSAGE = "{validation.field.max.value.or.lower}"; String NO_DECIMAL_VALUES = "{validation.field.non.decimal.format}"; Long getId(); BigDecimal getTotal(); FinanceRowType getCostType(); String getName(); boolean isEmpty(); default boolean excludeInRowCount(){ return isEmpty(); } int getMinRows(); BigDecimal totalDiff(FinanceRowItem other); }
3e0d7fcf23335af8caf65df85a5f5c02a2372481
6,874
java
Java
app/src/main/java/org/getcarebase/carebase/views/ShipmentDetailInputView.java
Carebase-Solutions/carebase-android
7075c480bd6e7da4b75528014e2242856fc17a92
[ "Apache-2.0" ]
4
2020-09-10T01:34:35.000Z
2021-02-01T19:40:07.000Z
app/src/main/java/org/getcarebase/carebase/views/ShipmentDetailInputView.java
Carebase-Solutions/carebase-android
7075c480bd6e7da4b75528014e2242856fc17a92
[ "Apache-2.0" ]
46
2020-09-17T01:37:57.000Z
2021-02-11T17:33:33.000Z
app/src/main/java/org/getcarebase/carebase/views/ShipmentDetailInputView.java
Carebase-Solutions/carebase-android
7075c480bd6e7da4b75528014e2242856fc17a92
[ "Apache-2.0" ]
1
2021-02-01T16:37:36.000Z
2021-02-01T16:37:36.000Z
43.783439
136
0.695374
5,717
package org.getcarebase.carebase.views; import android.content.Context; import android.text.Editable; import android.text.TextWatcher; import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.LinearLayout; import androidx.annotation.Nullable; import androidx.databinding.DataBindingUtil; import com.google.android.material.snackbar.Snackbar; import org.getcarebase.carebase.R; import org.getcarebase.carebase.databinding.ViewShipmentDetailBinding; import org.getcarebase.carebase.utils.Request; import org.getcarebase.carebase.utils.Resource; import java.util.ArrayList; import java.util.Collection; import java.util.Map; /** * A view that encapsulates the behavior between the tracking number input and the destination * input */ public class ShipmentDetailInputView extends LinearLayout { public static final String TAG = ShipmentDetailInputView.class.getSimpleName(); private ViewShipmentDetailBinding binding; private OnTrackingNumberSelection onTrackingNumberSelection; private OnDestinationSelection onDestinationSelection; private ArrayAdapter<String> trackingNumbersAdapter; private ArrayAdapter<String> destinationsAdapter; private Map<String,String> trackingNumbersToEntityIdMap; private Map<String,String> entityIdToEntityNameMap; public ShipmentDetailInputView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); binding = DataBindingUtil.inflate(LayoutInflater.from(getContext()),R.layout.view_shipment_detail,(ViewGroup) getParent(),true); trackingNumbersAdapter = new ArrayAdapter<>(getContext(), R.layout.dropdown_menu_popup_item, new ArrayList<>()); destinationsAdapter = new ArrayAdapter<>(getContext(), R.layout.dropdown_menu_popup_item, new ArrayList<>()); binding.trackingNumberTextView.setOnItemClickListener((parent, view, position, id) -> { String trackingNumber = trackingNumbersAdapter.getItem(position); onTrackingNumberSelection.update(trackingNumber); }); binding.destinationTextView.setOnItemClickListener((parent, view, position, id) -> { String destinationName = destinationsAdapter.getItem(position); String destinationId = null; // destination ID reverse lookup for (Map.Entry<String,String> entry : entityIdToEntityNameMap.entrySet()) { if (entry.getValue().equals(destinationName)) { destinationId = entry.getKey(); } } if (destinationId == null) { Log.e(TAG,"destination name is not recognized"); } onDestinationSelection.update(destinationId,destinationName); }); } public void setTrackingNumbersOptions(Resource<Map<String,String>> trackingNumbersResource) { if (trackingNumbersResource.getRequest().getStatus() == Request.Status.SUCCESS) { trackingNumbersToEntityIdMap = trackingNumbersResource.getData(); trackingNumbersAdapter.clear(); trackingNumbersAdapter.add("Get New Tracking Number"); trackingNumbersAdapter.addAll(trackingNumbersToEntityIdMap.keySet()); binding.trackingNumberLayout.setEnabled(true); binding.trackingNumberTextView.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {} @Override public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { if (charSequence.toString().contentEquals("Get New Tracking Number")) { binding.destinationLayout.setEnabled(true); } else { String entityId = trackingNumbersToEntityIdMap.get(charSequence.toString()); Log.d(TAG,"Matching Entity Id: " + entityId); String entityName = entityIdToEntityNameMap.get(entityId); Log.d(TAG, "Matching Entity Name: " + entityName); binding.destinationTextView.setText(entityName); binding.destinationLayout.setEnabled(false); onDestinationSelection.update(entityId,entityName); } binding.destinationLayout.setVisibility(View.VISIBLE); } @Override public void afterTextChanged(Editable editable) {} }); binding.trackingNumberTextView.setAdapter(trackingNumbersAdapter); } else if (trackingNumbersResource.getRequest().getStatus() == Request.Status.ERROR) { Log.d(TAG,"Unable to fetch shipment tracking numbers"); Snackbar.make(binding.getRoot(), R.string.error_something_wrong, Snackbar.LENGTH_LONG).show(); } } public void setOnTrackingNumberSelection(OnTrackingNumberSelection onTrackingNumberSelection) { this.onTrackingNumberSelection = onTrackingNumberSelection; } public void setTrackingNumberError(Integer errorStringId) { binding.trackingNumberLayout.setError(getContext().getText(errorStringId)); } public interface OnTrackingNumberSelection { void update(String trackingNumber); } public void setDestinationOptions(Resource<Map<String,String>> destinationsResource) { if (destinationsResource.getRequest().getStatus() == Request.Status.SUCCESS) { entityIdToEntityNameMap = destinationsResource.getData(); destinationsAdapter.clear(); Collection<String> siteOptions = entityIdToEntityNameMap.values(); destinationsAdapter.addAll(siteOptions); binding.destinationTextView.setAdapter(destinationsAdapter); binding.destinationLayout.setEnabled(true); } else if (destinationsResource.getRequest().getStatus() == Request.Status.ERROR) { Log.d(TAG,"Unable to fetch sites"); Snackbar.make(binding.getRoot(), R.string.error_something_wrong, Snackbar.LENGTH_LONG).show(); } } public void setOnDestinationSelection(OnDestinationSelection onDestinationSelection) { this.onDestinationSelection = onDestinationSelection; } public void setDestinationError(Integer errorStringId) { binding.destinationLayout.setError(getContext().getText(errorStringId)); } public interface OnDestinationSelection { void update(String destinationId, String destinationName); } }
3e0d83a44a5df4d7c880d172de28328f5582f809
1,331
java
Java
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/input/ProfileTaskCreationRequest.java
sunpwork/skywalking
b22d29afd9d76d825d19a6d5e7f0761b2436fa19
[ "Apache-2.0" ]
13,111
2017-12-13T01:09:29.000Z
2022-03-31T11:39:37.000Z
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/input/ProfileTaskCreationRequest.java
chenyi19851209/incubator-skywalking
94623f283139e31484979205ef7c14d73c91b0d0
[ "Apache-2.0" ]
5,145
2019-04-20T01:55:01.000Z
2022-03-31T08:07:26.000Z
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/input/ProfileTaskCreationRequest.java
chenyi19851209/incubator-skywalking
94623f283139e31484979205ef7c14d73c91b0d0
[ "Apache-2.0" ]
4,259
2019-04-20T12:02:37.000Z
2022-03-31T10:55:45.000Z
31.690476
75
0.757325
5,718
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package org.apache.skywalking.oap.server.core.query.input; import lombok.Getter; import lombok.Setter; import org.apache.skywalking.oap.server.core.query.enumeration.Step; /** * Profile task create need data */ @Setter @Getter public class ProfileTaskCreationRequest { private String serviceId; private String endpointName; private Long startTime; private int duration; private Step durationUnit; private int minDurationThreshold; private int dumpPeriod; private int maxSamplingCount; }
3e0d83f3e4f2696fbaf9ea3c64abd34a71805347
1,578
java
Java
src/main/java/pl/com/bottega/ecommerce/crm/application/commands/handlers/ChangeCustomerStatusCommandHandler.java
JLLeitschuh/ddd-leaven-v2
a1a0cf597e430cf58afe627cd5a724fa33665d2e
[ "Apache-2.0" ]
686
2015-01-08T16:14:53.000Z
2022-03-24T11:59:09.000Z
src/main/java/pl/com/bottega/ecommerce/crm/application/commands/handlers/ChangeCustomerStatusCommandHandler.java
SirKong/ddd-leaven-v2
a1a0cf597e430cf58afe627cd5a724fa33665d2e
[ "Apache-2.0" ]
2
2015-01-23T13:32:42.000Z
2019-01-07T05:50:01.000Z
src/main/java/pl/com/bottega/ecommerce/crm/application/commands/handlers/ChangeCustomerStatusCommandHandler.java
SirKong/ddd-leaven-v2
a1a0cf597e430cf58afe627cd5a724fa33665d2e
[ "Apache-2.0" ]
239
2015-01-18T06:27:57.000Z
2022-03-30T09:29:24.000Z
32.875
110
0.759189
5,719
/* * Copyright 2011-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * */ package pl.com.bottega.ecommerce.crm.application.commands.handlers; import javax.inject.Inject; import pl.com.bottega.cqrs.annotations.CommandHandlerAnnotation; import pl.com.bottega.cqrs.command.handler.CommandHandler; import pl.com.bottega.ecommerce.crm.application.commands.ChangeCustomerStatusCommand; import pl.com.bottega.ecommerce.crm.domain.Customer; import pl.com.bottega.ecommerce.crm.domain.CustomerRepository; /** * @author Slawek * */ @CommandHandlerAnnotation public class ChangeCustomerStatusCommandHandler implements CommandHandler<ChangeCustomerStatusCommand, Void>{ @Inject private CustomerRepository customerRepository; @Override public Void handle(ChangeCustomerStatusCommand command) { Customer customer = customerRepository.load(command.getCustomerId()); customer.changeStatus(command.getStatus()); customerRepository.save(customer); return null; } }
3e0d84e5fb2c89c78f2518d79ff5ab0f87c63960
1,186
java
Java
src/main/java/com/github/antkudruk/uniformfactory/base/exception/WrongTypeException.java
antkudruk/uniformfactory
57909ab8fbe7087b51c525946715f940adb8595f
[ "Apache-2.0" ]
1
2021-06-19T19:10:59.000Z
2021-06-19T19:10:59.000Z
src/main/java/com/github/antkudruk/uniformfactory/base/exception/WrongTypeException.java
antkudruk/uniformfactory
57909ab8fbe7087b51c525946715f940adb8595f
[ "Apache-2.0" ]
null
null
null
src/main/java/com/github/antkudruk/uniformfactory/base/exception/WrongTypeException.java
antkudruk/uniformfactory
57909ab8fbe7087b51c525946715f940adb8595f
[ "Apache-2.0" ]
null
null
null
38.258065
82
0.731029
5,720
/* Copyright 2020 - 2021 Anton Kudruk Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package com.github.antkudruk.uniformfactory.base.exception; import com.github.antkudruk.uniformfactory.singleton.descriptors.WrapperException; /** * Thrown when expected <b>wrapper method</b> return type does not correspond * to the actual <b>wrapper method</b> return type. */ public class WrongTypeException extends WrapperException { public WrongTypeException(Class<?> expectedType, Class<?> specifiedType) { super("Wrong specified type: expected type: " + expectedType.getName() + ", actual type: " + specifiedType.getName() + " is ", null); } }
3e0d851d0355a0521796e914e51d83508be13c6e
974
java
Java
projects/OG-Web/src/main/java/com/opengamma/web/analytics/formatting/MissingMarketDataSentinelFormatter.java
Incapture/OG-Platform
76be42671e692483125582d6dce1245b81de03a1
[ "Apache-2.0" ]
null
null
null
projects/OG-Web/src/main/java/com/opengamma/web/analytics/formatting/MissingMarketDataSentinelFormatter.java
Incapture/OG-Platform
76be42671e692483125582d6dce1245b81de03a1
[ "Apache-2.0" ]
null
null
null
projects/OG-Web/src/main/java/com/opengamma/web/analytics/formatting/MissingMarketDataSentinelFormatter.java
Incapture/OG-Platform
76be42671e692483125582d6dce1245b81de03a1
[ "Apache-2.0" ]
null
null
null
27.055556
109
0.74846
5,721
/** * Copyright (C) 2012 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.opengamma.web.analytics.formatting; import com.opengamma.engine.value.ValueSpecification; import com.opengamma.engine.view.cache.MissingMarketDataSentinel; /** * */ /* package */ class MissingMarketDataSentinelFormatter extends AbstractFormatter<MissingMarketDataSentinel> { /* package */ MissingMarketDataSentinelFormatter() { super(MissingMarketDataSentinel.class); addFormatter(new Formatter<MissingMarketDataSentinel>(Format.HISTORY) { @Override Object format(MissingMarketDataSentinel value, ValueSpecification valueSpec) { return null; } }); } @Override public Object formatCell(MissingMarketDataSentinel value, ValueSpecification valueSpec) { return "Missing market data"; } @Override public DataType getDataType() { return DataType.PRIMITIVE; } }
3e0d8607f77fc03d9c0ed034830e48b24cca3082
384
java
Java
src/test/java/starter/navigation/NavigateTo.java
roncproject/serenity-cucumber
a46045bdd2bf373b32abbb9a52213e19beaed667
[ "Apache-2.0" ]
null
null
null
src/test/java/starter/navigation/NavigateTo.java
roncproject/serenity-cucumber
a46045bdd2bf373b32abbb9a52213e19beaed667
[ "Apache-2.0" ]
null
null
null
src/test/java/starter/navigation/NavigateTo.java
roncproject/serenity-cucumber
a46045bdd2bf373b32abbb9a52213e19beaed667
[ "Apache-2.0" ]
null
null
null
24
63
0.736979
5,722
package starter.navigation; import net.serenitybdd.screenplay.Performable; import net.serenitybdd.screenplay.Task; import net.serenitybdd.screenplay.actions.Open; public class NavigateTo { public static Performable theSauceDemoHomePage() { return Task.where("{0} opens the SauceDemo home page", Open.browserOn().the(SauceDemoHomePage.class)); } }
3e0d8870b167a34a09df80b8a5ef7a71a27d5812
3,159
java
Java
exec/java-exec/src/test/java/org/apache/drill/TestAltSortQueries.java
idvp-project/drill
94e86d19407b0a66cfe432f45fb91a880eae4ea9
[ "Apache-2.0" ]
1,510
2015-01-04T01:35:19.000Z
2022-03-28T23:36:02.000Z
exec/java-exec/src/test/java/org/apache/drill/TestAltSortQueries.java
idvp-project/drill
94e86d19407b0a66cfe432f45fb91a880eae4ea9
[ "Apache-2.0" ]
1,979
2015-01-28T03:18:38.000Z
2022-03-31T13:49:32.000Z
exec/java-exec/src/test/java/org/apache/drill/TestAltSortQueries.java
zhangxiangyang/drill
97a321d8dc7430d8840fb4e0ee805b9fd2a0c329
[ "Apache-2.0" ]
940
2015-01-01T01:39:39.000Z
2022-03-25T08:46:59.000Z
37.607143
127
0.708452
5,723
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.drill; import org.apache.drill.categories.OperatorTest; import org.apache.drill.categories.SqlTest; import org.apache.drill.test.BaseTestQuery; import org.junit.BeforeClass; import org.junit.Test; import org.junit.experimental.categories.Category; import java.nio.file.Paths; @Category({SqlTest.class, OperatorTest.class}) public class TestAltSortQueries extends BaseTestQuery { @BeforeClass public static void setupTestFiles() { dirTestWatcher.copyFileToRoot(Paths.get("sample-data", "region.parquet")); dirTestWatcher.copyFileToRoot(Paths.get("sample-data", "regionsSF")); dirTestWatcher.copyFileToRoot(Paths.get("sample-data", "nation.parquet")); } @Test public void testOrderBy() throws Exception{ test("select R_REGIONKEY " + "from dfs.`sample-data/region.parquet` " + "order by R_REGIONKEY"); } @Test public void testOrderBySingleFile() throws Exception{ test("select R_REGIONKEY " + "from dfs.`sample-data/regionsSF/` " + "order by R_REGIONKEY"); } @Test public void testSelectWithLimit() throws Exception{ test("select employee_id, first_name, last_name from cp.`employee.json` order by employee_id limit 5 "); } // TODO - This is currently passing but I think that it is still in error, // the new verification for this test was written against the output that was previously not being checked // It looks like there is an off by one error in the results, see the baseline file for the current results @Test public void testSelectWithLimitOffset() throws Exception{ testBuilder() .sqlQuery("select employee_id, first_name, last_name from cp.`employee.json` order by employee_id limit 5 offset 10 ") .ordered() .csvBaselineFile("sort/testSelectWithLimitOffset.tsv") .baselineColumns("employee_id", "first_name", "last_name") .build().run(); } @Test public void testJoinWithLimit() throws Exception{ test("SELECT\n" + " nations.N_NAME,\n" + " regions.R_NAME\n" + "FROM\n" + " dfs.`sample-data/nation.parquet` nations\n" + "JOIN\n" + " dfs.`sample-data/region.parquet` regions\n" + " on nations.N_REGIONKEY = regions.R_REGIONKEY" + " order by regions.R_NAME, nations.N_NAME " + " limit 5"); } }
3e0d898afb038ac6684fd0dbec22d734a79be953
4,196
java
Java
main/plugins/org.talend.sdk.component.studio-integration/src/main/java/org/talend/sdk/component/studio/metadata/node/AbsTaCoKitRepositoryNode.java
vbogatyrov/tdi-studio-se
4c9128050d7ae23172aa17ea9da405dce9378cba
[ "Apache-2.0" ]
null
null
null
main/plugins/org.talend.sdk.component.studio-integration/src/main/java/org/talend/sdk/component/studio/metadata/node/AbsTaCoKitRepositoryNode.java
vbogatyrov/tdi-studio-se
4c9128050d7ae23172aa17ea9da405dce9378cba
[ "Apache-2.0" ]
null
null
null
main/plugins/org.talend.sdk.component.studio-integration/src/main/java/org/talend/sdk/component/studio/metadata/node/AbsTaCoKitRepositoryNode.java
vbogatyrov/tdi-studio-se
4c9128050d7ae23172aa17ea9da405dce9378cba
[ "Apache-2.0" ]
null
null
null
33.301587
123
0.707102
5,724
/** * Copyright (C) 2006-2018 Talend Inc. - www.talend.com * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ package org.talend.sdk.component.studio.metadata.node; import org.eclipse.swt.graphics.Image; import org.talend.core.model.repository.ERepositoryObjectType; import org.talend.core.model.repository.IRepositoryViewObject; import org.talend.repository.model.IRepositoryNode; import org.talend.repository.model.RepositoryNode; import org.talend.sdk.component.server.front.model.ConfigTypeNode; import org.talend.sdk.component.studio.util.TaCoKitUtil; /** * DOC cmeng class global comment. Detailled comment */ public abstract class AbsTaCoKitRepositoryNode extends RepositoryNode implements ITaCoKitRepositoryNode { private ITaCoKitRepositoryNode parentTaCoKitNode; private ConfigTypeNode configTypeNode; private Image image; public AbsTaCoKitRepositoryNode(final IRepositoryViewObject repViewObject, final RepositoryNode parent, final ITaCoKitRepositoryNode parentTaCoKitNode, final String label, final ConfigTypeNode configTypeNode) throws Exception { super(repViewObject, parent, IRepositoryNode.ENodeType.SYSTEM_FOLDER); this.parentTaCoKitNode = parentTaCoKitNode; this.configTypeNode = configTypeNode; this.setProperties(EProperties.LABEL, label); this.setProperties(EProperties.CONTENT_TYPE, TaCoKitUtil.getOrCreateERepositoryObjectType(configTypeNode)); } public void setContentType(final ERepositoryObjectType contentType) { this.setProperties(EProperties.CONTENT_TYPE, contentType); } @Override public boolean isLeafNode() { return false; } @Override public boolean isFolderNode() { return false; } @Override public boolean isFamilyNode() { return false; } @Override public boolean isConfigNode() { return false; } @Override public ITaCoKitRepositoryNode getParentTaCoKitNode() { return this.parentTaCoKitNode; } @Override public ConfigTypeNode getConfigTypeNode() { return this.configTypeNode; } @Override public Image getImage() { return this.image; } public void setParentTaCoKitNode(final ITaCoKitRepositoryNode parentTaCoKitNode) { this.parentTaCoKitNode = parentTaCoKitNode; } public void setConfigTypeNode(final ConfigTypeNode configTypeNode) { this.configTypeNode = configTypeNode; } public void setImage(final Image image) { this.image = image; } @Override public boolean equals(final Object o) { if (o == this) return true; if (!(o instanceof AbsTaCoKitRepositoryNode)) return false; final AbsTaCoKitRepositoryNode other = (AbsTaCoKitRepositoryNode) o; if (!other.canEqual(this)) return false; if (!super.equals(o)) return false; final Object this$configTypeNode = this.getConfigTypeNode(); final Object other$configTypeNode = other.getConfigTypeNode(); if (this$configTypeNode == null ? other$configTypeNode != null : !this$configTypeNode.equals(other$configTypeNode)) return false; return true; } protected boolean canEqual(final Object other) { return other instanceof AbsTaCoKitRepositoryNode; } @Override public int hashCode() { final int PRIME = 59; int result = super.hashCode(); final Object $configTypeNode = this.getConfigTypeNode(); result = result * PRIME + ($configTypeNode == null ? 43 : $configTypeNode.hashCode()); return result; } }
3e0d89a5f90d8ea2f21abb568a46e0a063b15a07
993
java
Java
friendly-id-jackson-datatype/src/main/java/com/devskiller/friendly_id/jackson/FriendlyIdDeserializer.java
wojcikt/friendly-id
1e6d0b4512619dad5e96576bc4d509f5bf8a1658
[ "Apache-2.0" ]
147
2017-10-02T21:28:32.000Z
2022-03-31T01:06:42.000Z
friendly-id-jackson-datatype/src/main/java/com/devskiller/friendly_id/jackson/FriendlyIdDeserializer.java
wojcikt/friendly-id
1e6d0b4512619dad5e96576bc4d509f5bf8a1658
[ "Apache-2.0" ]
8
2018-02-08T11:13:21.000Z
2021-12-12T11:52:44.000Z
friendly-id-jackson-datatype/src/main/java/com/devskiller/friendly_id/jackson/FriendlyIdDeserializer.java
wojcikt/friendly-id
1e6d0b4512619dad5e96576bc4d509f5bf8a1658
[ "Apache-2.0" ]
12
2018-02-21T11:10:46.000Z
2022-03-24T08:09:48.000Z
29.205882
111
0.784491
5,725
package com.devskiller.friendly_id.jackson; import java.io.IOException; import java.util.UUID; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.deser.std.UUIDDeserializer; import com.devskiller.friendly_id.FriendlyId; public class FriendlyIdDeserializer extends UUIDDeserializer { @Override public UUID deserialize(JsonParser parser, DeserializationContext deserializationContext) throws IOException { JsonToken token = parser.getCurrentToken(); if (token == JsonToken.VALUE_STRING) { String string = parser.getValueAsString().trim(); if (looksLikeUuid(string)) { return super.deserialize(parser, deserializationContext); } else { return FriendlyId.toUuid(string); } } throw new IllegalStateException("This is not friendly id"); } private boolean looksLikeUuid(String value) { return value.contains("-"); } }