blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
d80fd4e202dcd805e167279c1e9adf9488fd79a5
0bf9f67b530980161201c82d6bb50c3cc91e561e
/src/com/cognitiveclouds/socialite/interfaces/SocialSessionListener.java
4b86a7a5552a8a3882bd8e5bd40d322289f7ceda
[ "Apache-2.0" ]
permissive
Nikhil-Nandagopal/Socialite
cdaee48d7c92be579087e64cb4446adf973fc5d7
056dab46fde221d99cd0c4f3f6ca9753bdf52342
refs/heads/master
2021-01-10T19:47:13.364223
2014-01-02T09:13:37
2014-01-02T09:13:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
359
java
package com.cognitiveclouds.socialite.interfaces; import com.cognitiveclouds.socialite.utils.SessionListenerType; public interface SocialSessionListener { public void onAuthenticationSuccess(); public void onAuthenticationFailure(String error); public void onLogoutBegin(); public void onLogoutFinish(); public SessionListenerType getType(); }
[ "nikhil.nandagopal@gmail.com" ]
nikhil.nandagopal@gmail.com
448e7db65a290e9c3380779b66bb0a649e814318
220db0e6f66b9760980fa610e0efe64b478355cb
/archunit-junit/junit5/engine/src/test/java/com/tngtech/archunit/junit/testexamples/SimpleRuleLibrary.java
ba22524e10ea35e39d1bae94578c91848975f321
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
wolfs/ArchUnit
fa832ff6ae7b68748aa1ec724911a975273cc404
9316d617d0f31f9cf3c710a32e44f7cb81cd3b43
refs/heads/master
2023-03-10T23:41:40.282982
2021-11-08T06:25:58
2021-11-08T06:25:58
94,650,201
1
0
Apache-2.0
2023-03-02T16:01:36
2017-06-17T21:31:36
Java
UTF-8
Java
false
false
728
java
package com.tngtech.archunit.junit.testexamples; import com.tngtech.archunit.junit.AnalyzeClasses; import com.tngtech.archunit.junit.ArchTest; import com.tngtech.archunit.junit.ArchTests; import com.tngtech.archunit.junit.testexamples.subone.SimpleRuleField; import com.tngtech.archunit.junit.testexamples.subtwo.SimpleRules; @AnalyzeClasses(packages = "some.dummy.package") public class SimpleRuleLibrary { @ArchTest public static final ArchTests rules_one = ArchTests.in(SimpleRules.class); @ArchTest public static final ArchTests rules_two = ArchTests.in(SimpleRuleField.class); public static final String RULES_ONE_FIELD = "rules_one"; public static final String RULES_TWO_FIELD = "rules_two"; }
[ "peter.gafert@tngtech.com" ]
peter.gafert@tngtech.com
169072bf7d39df9c9aa6b4a644125a59dae50f56
cc287e85cd01154410395969c9823f879de8822d
/app/src/main/java/com/baronzhang/android/weather/base/BaseFragment.java
23c0cc0544c73d4a1dc5e6983db82200c2481f75
[ "Apache-2.0" ]
permissive
zhouddong/Android
11b996505e140e5fe901444606141d743856dcdd
fd3684297f7dc4e33314fdd92314082aa7b2f9f7
refs/heads/master
2020-05-15T21:21:48.305661
2019-04-21T06:13:39
2019-04-21T06:13:39
182,496,774
0
1
null
null
null
null
UTF-8
Java
false
false
1,067
java
package com.baronzhang.android.weather.base; import android.os.Bundle; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; /** * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com) */ public class BaseFragment extends Fragment { // private PublishSubject<FragmentLifecycleEvent> fragmentLifecycleSubject = PublishSubject.create(); @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return super.onCreateView(inflater, container, savedInstanceState); } @Override public void onDestroyView() { // fragmentLifecycleSubject.onNext(FragmentLifecycleEvent.DESTROY_VIEW); super.onDestroyView(); } @Override public void onDestroy() { super.onDestroy(); } }
[ "baron.zhanglei@gmail.com" ]
baron.zhanglei@gmail.com
5ceccf06a244e7a115fc5e784238cf65f78410c4
3a6d47785a91732add0cd4238147dcdc4918c2b2
/app/src/main/java/com/example/app_005/Tool/WindowView/WindowButtonView.java
8790cd7da80936b73a2742b046fe66990fa1f0b7
[]
no_license
EvMemo/APP_005B
1ec58d3fd71218b88ce52c3423b4808fb0da57f5
2e9731807d1d17ba636322528fa09c301b326f73
refs/heads/master
2022-11-13T08:12:38.933711
2020-04-16T14:08:09
2020-04-16T14:08:09
255,645,162
0
0
null
null
null
null
UTF-8
Java
false
false
2,994
java
package com.example.app_005.Tool.WindowView; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import com.example.app_005.Tool.MyWindowView; public class WindowButtonView extends View { private int width;//设置高 private int height;//设置高 Paint paintUI; MyWindowView myWindowView; public WindowButtonView(Context context) { super(context); } public WindowButtonView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); paintUI=new Paint(); paintUI.setColor(Color.BLUE); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); width = getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec); height = getDefaultSize(getSuggestedMinimumHeight(), heightMeasureSpec); setMeasuredDimension(width, height);//设置宽和高 } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.drawRoundRect(0,0,width,height,20,20,paintUI); } public void setMyWindowView(MyWindowView myWindowView_A){ myWindowView=myWindowView_A; } public void onTouch(MotionEvent event_A){ if(myWindowView!=null) { myWindowView.ccWindowButTouch(); } } float floatDownX; float floatDownY; float floatDownTime; @Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_MOVE: return true; case MotionEvent.ACTION_DOWN: floatDownX=event.getX(); floatDownY=event.getY(); floatDownTime=System.currentTimeMillis(); return true; case MotionEvent.ACTION_UP: float float_X=event.getX(); float float_Y=event.getY(); onTouch(event); return true; } return super.onTouchEvent(event); } @Override public boolean dispatchTouchEvent(MotionEvent event) { getParent().requestDisallowInterceptTouchEvent(true); //Log.w(this.toString(), "DOKDonTouchEventD1: "+"="+event.getAction() ); switch (event.getAction()){ case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_UP: getParent().requestDisallowInterceptTouchEvent(true); break; } return super.dispatchTouchEvent(event); } }
[ "pjmemo001@gmail.com" ]
pjmemo001@gmail.com
dea9599d0102487c24c3b9d90d39fb524a6eeeb0
26af0f0f93b7f3f66d2b0125c7e7dc2046c3a285
/hclibrary/src/main/java/com/hongchuang/hclibrary/rxbus/SubscriptionBean.java
2e4b7ca0063405b5a496ad926ae79b6c843abe6a
[]
no_license
timipaul/shijin3_android-dev
13d7bd3bb7fc5f93b9fac0e5ea4b57efbeed37a6
fd45639badd151e3f201a2295b6e490aa771c401
refs/heads/master
2021-01-04T08:31:22.363168
2020-02-20T03:36:13
2020-02-20T03:36:13
240,462,907
0
0
null
null
null
null
UTF-8
Java
false
false
506
java
package com.hongchuang.hclibrary.rxbus; /*** * 功能描述:RxBus消息订阅 * 作者:qiujialiu * 时间:2016/12/15 * 版本:1.0 ***/ public class SubscriptionBean { public static <T> RxBusSendBean createSendBean(int type, T t) { RxBusSendBean<T> busSendBean = new RxBusSendBean(); busSendBean.type = type; busSendBean.content = t; return busSendBean; } public static class RxBusSendBean<T> { public int type; public T content; } }
[ "1065997545@qq.com" ]
1065997545@qq.com
86cb53bf5a0e6c45e1ddf41cbc762d6467a015c8
606ee0795ef36f6d7eea03b2ca4e8655163c9fbe
/src/main/java/com/github/meowingtwurtle/tmsabot/PassthroughBotManager.java
92794169579149263f450cb958b7f954d89e2259
[]
no_license
TMSAProgrammers/TMSABot
1d1c2585834a9f15785c6733e5e1b9d036e89dbe
947c82223824bcc1598883bf0bce841e7f75d11d
refs/heads/master
2021-05-14T18:14:36.675120
2018-01-05T03:46:20
2018-01-06T02:24:31
116,065,959
0
0
null
null
null
null
UTF-8
Java
false
false
1,469
java
package com.github.meowingtwurtle.tmsabot; import com.srgood.reasons.BotManager; import com.srgood.reasons.commands.CommandManager; import com.srgood.reasons.config.BotConfigManager; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.logging.Logger; public class PassthroughBotManager implements BotManager { private Future<BotManager> botManagerFuture; private BotManager botManager; public PassthroughBotManager(Future<BotManager> botManagerFuture) { this.botManagerFuture = botManagerFuture; } private BotManager getBotManager() { if (botManager == null) { try { botManager = botManagerFuture.get(); botManagerFuture = null; } catch (InterruptedException | ExecutionException e) { throw new IllegalStateException(e); } } return botManager; } @Override public BotConfigManager getConfigManager() { return getBotManager().getConfigManager(); } @Override public CommandManager getCommandManager() { return getBotManager().getCommandManager(); } @Override public Logger getLogger() { return getBotManager().getLogger(); } @Override public void close() { try { getBotManager().close(); } catch (Exception e) { throw new IllegalStateException(e); } } }
[ "jason.e.cobb@gmail.com" ]
jason.e.cobb@gmail.com
53921bbde004baf1a0c6efd31479b1faab6b68b6
131011790810fca22e5a8df7bfc0a82733e7153e
/src/rs/com/game/player/actions/runecrafting/SiphonActionCreatures.java
7c93f1aee018d21584715ea34bfe7d197a87f684
[]
no_license
jens19963/Fractize
d4871025328df2c66e0c619ff5b0dd3e2b4b6481
03f1875a930254a11c974cd8ecd4e8deabd5a661
refs/heads/master
2020-04-05T01:38:42.511105
2018-11-07T10:11:57
2018-11-07T10:11:57
156,443,542
0
0
null
null
null
null
UTF-8
Java
false
false
7,155
java
package com.rs.game.player.actions.runecrafting; import com.rs.cache.loaders.ItemDefinitions; import com.rs.game.Animation; import com.rs.game.Graphics; import com.rs.game.World; import com.rs.game.npc.NPC; import com.rs.game.player.Player; import com.rs.game.player.Skills; import com.rs.game.player.actions.Action; import com.rs.game.player.content.Runecrafting; import com.rs.game.player.controllers.RunespanControler; import com.rs.game.tasks.WorldTask; import com.rs.game.tasks.WorldTasksManager; import com.rs.utils.Utils; public class SiphonActionCreatures extends Action { private static enum Creature { AIR_ESSLING(15403, 9.5, 24215, 16634, 1, 16571), MIND_ESSLING(15404, 10, 24217, 16634, 1, 16571), WATER_ESSLING(15405, 12.6, 24214, 16634, 5, 16571), EARTH_ESSLING(15406, 14.3, 24216, 16634, 9, 16571), FIRE_ESSLING(15407, 17.4, 24213, 16634, 14, 16571), BODY_ESSHOUND(15408, 23.1, 24218, 16650, 20, 16661), COSMIC_ESSHOUND(15409, 26.6, 24223, 16650, 27, 16661), CHOAS_ESSHOUND(15410, 30.8, 24221, 16650, 35, 16661), ASTRAL_ESSHOUND(15411, 35.7, 24224, 16650, 40, 16661), NATURE_ESSHOUND(15412, 43.4, 24220, 16650, 44, 16661), LAW_ESSHOUND(15413, 53.9, 24222, 16650, 54, 16661), DEATH_ESSWRAITH(15414, 60, 24219, 16644, 65, 16641), BLOOD_ESSWRAITH(15415, 73.1, 24225, 16644, 77, 16641), SOUL_ESSWRAITH(15416, 106.5, 24226, 16644, 90, 16641); private int npcId, runeId, npcEmoteId, levelRequired, deathEmote; private double xp; private Creature(int npcId, double xp, int runeId, int npcEmoteId, int levelRequired, int deathEmote) { this.npcId = npcId; this.xp = xp; this.runeId = runeId; this.npcEmoteId = npcEmoteId; this.levelRequired = levelRequired; this.deathEmote = deathEmote; } public int getDeathEmote() { return deathEmote; } public int getNpcEmoteId() { return npcEmoteId; } public int getRuneId() { return runeId; } public int getLevelRequired() { return levelRequired; } } private Creature creatures; private NPC creature; private boolean started; private int npcLife; private Animation EMOTE = new Animation(16596); public SiphonActionCreatures(Creature creatures, NPC creature) { this.creatures = creatures; this.creature = creature; } public static boolean siphon(Player player, NPC npc) { Creature creature = getCreature(npc.getId()); if (creature == null) return false; player.getActionManager().setAction(new SiphonActionCreatures(creature, npc)); return true; } private static Creature getCreature(int id) { for (Creature creature : Creature.values()) if (creature.npcId == id) return creature; return null; } @Override public boolean start(Player player) { if (checkAll(player)) { return true; } return false; } @Override public boolean process(Player player) { return checkAll(player); } public boolean checkAll(final Player player) { if (player.isLocked()) { return false; } if (creature.hasFinished()) return false; if (!started && (!player.withinDistance(creature, 6) || !player.clipedProjectile(creature, true, creature.getDefinitions().size))) { return true; } if (player.getSkills().getLevel(Skills.RUNECRAFTING) < creatures.getLevelRequired()) { player.getDialogueManager().startDialogue("SimpleMessage", "This creature requires level " + creatures.getLevelRequired() + " to siphon."); return false; } if (!player.getInventory().hasFreeSlots() && !player.getInventory().containsItem(creatures.getRuneId(), 1)) { player.getSocialManager().sendGameMessage("Not enough space in your inventory."); return false; } if (!player.getInventory().containsItem(24227, 1)) { player.getSocialManager().sendGameMessage("You don't have any rune essence to siphon from that creature.", true); return false; } if (!started) { creature.resetWalkSteps(); player.resetWalkSteps(); player.setNextAnimation(EMOTE); started = true; } return true; } @Override public int processWithDelay(final Player player) { if (started) { int level = player.getSkills().getLevel(Skills.RUNECRAFTING); if (level <= 50 ? Utils.getRandom(2) == 1 : Utils.getRandom(1) == 1) { if (player.getControlerManager().getControler() != null && player.getControlerManager().getControler() instanceof RunespanControler) ((RunespanControler) player.getControlerManager().getControler()).addRunespanPoints(creatures.getRuneId()); player.getInventory().addItem(creatures.getRuneId(), 1); player.getInventory().deleteItem(24227, 1); double totalXp = creatures.xp; if (Runecrafting.hasRcingSuit(player)) totalXp *= 1.025; player.getSkills().addXp(Skills.RUNECRAFTING, totalXp); player.getPackets().sendIComponentText(1274, 5, Integer.toString(player.getRuneSpanPoints())); player.setNextGraphics(new Graphics(3071)); if (npcLife++ == 10) return processEsslingDeath(player); } player.setNextAnimation(new Animation(16596)); creature.setNextAnimation(new Animation(creatures.getNpcEmoteId())); creature.setNextFaceWorldTile(player); creature.resetWalkSteps(); player.setNextFaceWorldTile(creature); World.sendProjectile(creature, creature, player, 3060, 31, 35, 35, 0, 2, 0); WorldTasksManager.schedule(new WorldTask() { @Override public void run() { player.setNextGraphics(new Graphics(3062)); } }, 1); } return 1; } public int processEsslingDeath(final Player player) { creature.setNextAnimation(new Animation(creatures.getDeathEmote())); WorldTasksManager.schedule(new WorldTask() { @Override public void run() { player.getSocialManager().sendGameMessage("The creature has been broken down."); player.getSocialManager().sendGameMessage("You pick up the essence left by the creature.", true); player.setNextAnimation(new Animation(16599)); creature.setRespawnTask(); player.getInventory().addItem(24227, 50); stop(); } }, 2); return -1; } @Override public void stop(Player player) { player.setNextAnimation(new Animation(16599)); setActionDelay(player, 3); } public static boolean chipCreature(Player player, NPC npc) { Creature creature = getCreature(npc.getId()); if (creature == null) return false; if (!player.getInventory().containsItem(creature.getRuneId(), 10)) { player.getSocialManager().sendGameMessage("You dont have enough " + ItemDefinitions.getItemDefinitions(creature.getRuneId()).getName() + "s to chip away at that creature."); return false; } else { player.getSocialManager().sendGameMessage("You use some runes to fire a blast of runic energy at the creature, chipping of some rune essense from its body."); player.getInventory().deleteItem(creature.getRuneId(), 10); player.getInventory().addItem(24227, 10); World.sendProjectile(player, npc, player, 3060, 31, 35, 35, 0, 2, 0); } return false; } }
[ "noreply@github.com" ]
jens19963.noreply@github.com
bef321863bf247a52077995f2e247a5e31bac73c
ab540d61b0d2c24d6827aa6af704283e1e0f766a
/src/chap06/BubbleSortV3.java
5f99f3dbb16b746e19415d0b3dfee2b9e9f80342
[]
no_license
MinjunShin/JAVA-Algorithm
176106b5813186c19b79a24988678358bf345bb3
66fab1271ba5a6a86137a93538d137e8aec1c253
refs/heads/master
2023-04-27T14:11:41.915606
2021-05-12T16:35:16
2021-05-12T16:35:16
354,859,378
1
0
null
null
null
null
UTF-8
Java
false
false
1,269
java
package chap06; import java.util.Scanner; public class BubbleSortV3 { static void swap(int[]a , int idx1, int idx2) { int t = a[idx1]; a[idx1] = a[idx2]; a[idx2] = t; } static void BubbleSort3(int[]a, int n) { int k = 0; // a[k]보다 앞쪽은 정렬을 마친 상태 while(k < n-1) { int last = n-1; // 마지막으로 요소를 교환한 위치 for(int j = n-1; j > k ; j--) if(a[j-1] > a[j]) { swap(a, j-1, j); last = j; } k = last; } } public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); System.out.print("배열 요소 갯수를 입력하세요. :"); int nx = stdIn.nextInt(); int[] x = new int [nx]; System.out.println("배열 요소를 입력하세요."); for(int i = 0; i < nx ; i++) { System.out.print("a[" + i + "] : "); x[i] = stdIn.nextInt(); } BubbleSort3(x, nx); System.out.println("버블 정렬 결과 : "); for(int i = 0 ; i < nx ; i++) System.out.println("x["+ i +"] : " + x[i]); } }
[ "pj0014@naver.com" ]
pj0014@naver.com
9f6ba8f8942d5cfad3657f0baa39e6bad2d59def
2f2073271bdb5c3a390dcc2c8ce9f94b14de234a
/architecture/src/main/java/com/zj/architecture/utils/NetworkUtils.java
45082c8fa440d9bd2d9326c435ccaae8f82e3c57
[]
no_license
zhang-zin/musicproject
ce7bb6876dfa842e08311ee3302a51259bb6826e
eaef1bc20847e98f012ae22551fcfa384174d3a3
refs/heads/master
2022-12-08T13:30:52.874005
2020-08-31T07:58:49
2020-08-31T07:58:49
290,987,951
0
0
null
null
null
null
UTF-8
Java
false
false
19,174
java
package com.zj.architecture.utils; import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.wifi.WifiManager; import android.os.Build; import android.telephony.TelephonyManager; import android.text.format.Formatter; import android.util.Log; import androidx.annotation.RequiresPermission; import java.lang.reflect.Method; import java.net.InetAddress; import java.net.InterfaceAddress; import java.net.NetworkInterface; import java.net.SocketException; import java.net.UnknownHostException; import java.util.Enumeration; import java.util.LinkedList; import java.util.List; import static android.Manifest.permission.ACCESS_NETWORK_STATE; import static android.Manifest.permission.ACCESS_WIFI_STATE; import static android.Manifest.permission.CHANGE_WIFI_STATE; import static android.Manifest.permission.INTERNET; import static android.Manifest.permission.MODIFY_PHONE_STATE; import static android.content.Context.WIFI_SERVICE; /** * <pre> * author: * blog : * time : * desc : utils derry * </pre> */ public final class NetworkUtils { private NetworkUtils() { throw new UnsupportedOperationException("u can't instantiate me..."); } /** * Open the settings of wireless. */ public static void openWirelessSettings() { Utils.getApp().startActivity( new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK) ); } /** * Return whether network is connected. * <p>Must hold {@code <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />}</p> * * @return {@code true}: connected<br>{@code false}: disconnected */ @RequiresPermission(ACCESS_NETWORK_STATE) public static boolean isConnected() { NetworkInfo info = getActiveNetworkInfo(); return info != null && info.isConnected(); } /** * Return whether network is available using ping. * <p>Must hold {@code <uses-permission android:name="android.permission.INTERNET" />}</p> * <p>The default ping ip: 223.5.5.5</p> * * @return {@code true}: yes<br>{@code false}: no */ @RequiresPermission(INTERNET) public static boolean isAvailableByPing() { return isAvailableByPing(null); } /** * Return whether network is available using ping. * <p>Must hold {@code <uses-permission android:name="android.permission.INTERNET" />}</p> * * @param ip The ip address. * @return {@code true}: yes<br>{@code false}: no */ @RequiresPermission(INTERNET) public static boolean isAvailableByPing(String ip) { if (ip == null || ip.length() <= 0) { // default ping ip ip = "223.5.5.5"; } ShellUtils.CommandResult result = ShellUtils.execCmd(String.format("ping -c 1 %s", ip), false); boolean ret = result.result == 0; if (result.errorMsg != null) { Log.d("NetworkUtils", "isAvailableByPing() called" + result.errorMsg); } if (result.successMsg != null) { Log.d("NetworkUtils", "isAvailableByPing() called" + result.successMsg); } return ret; } @RequiresPermission(INTERNET) public static void isAvailableByDns(String ip) { } /** * Return whether mobile data is enabled. * * @return {@code true}: enabled<br>{@code false}: disabled */ public static boolean getMobileDataEnabled() { try { TelephonyManager tm = (TelephonyManager) Utils.getApp().getSystemService(Context.TELEPHONY_SERVICE); if (tm == null) { return false; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { return tm.isDataEnabled(); } @SuppressLint("PrivateApi") Method getMobileDataEnabledMethod = tm.getClass().getDeclaredMethod("getDataEnabled"); if (null != getMobileDataEnabledMethod) { return (boolean) getMobileDataEnabledMethod.invoke(tm); } } catch (Exception e) { Log.e("NetworkUtils", "getMobileDataEnabled: ", e); } return false; } /** * Enable or disable mobile data. * <p>Must hold {@code android:sharedUserId="android.uid.system"}, * {@code <uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />}</p> * * @param enabled True to enabled, false otherwise. * @return {@code true}: success<br>{@code false}: fail */ @RequiresPermission(MODIFY_PHONE_STATE) public static boolean setMobileDataEnabled(final boolean enabled) { try { TelephonyManager tm = (TelephonyManager) Utils.getApp().getSystemService(Context.TELEPHONY_SERVICE); if (tm == null) { return false; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { tm.setDataEnabled(enabled); return false; } Method setDataEnabledMethod = tm.getClass().getDeclaredMethod("setDataEnabled", boolean.class); if (null != setDataEnabledMethod) { setDataEnabledMethod.invoke(tm, enabled); return true; } } catch (Exception e) { Log.e("NetworkUtils", "setMobileDataEnabled: ", e); } return false; } /** * Return whether using mobile data. * <p>Must hold {@code <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />}</p> * * @return {@code true}: yes<br>{@code false}: no */ @RequiresPermission(ACCESS_NETWORK_STATE) public static boolean isMobileData() { NetworkInfo info = getActiveNetworkInfo(); return null != info && info.isAvailable() && info.getType() == ConnectivityManager.TYPE_MOBILE; } /** * Return whether using 4G. * <p>Must hold {@code <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />}</p> * * @return {@code true}: yes<br>{@code false}: no */ @RequiresPermission(ACCESS_NETWORK_STATE) public static boolean is4G() { NetworkInfo info = getActiveNetworkInfo(); return info != null && info.isAvailable() && info.getSubtype() == TelephonyManager.NETWORK_TYPE_LTE; } /** * Return whether wifi is enabled. * <p>Must hold {@code <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />}</p> * * @return {@code true}: enabled<br>{@code false}: disabled */ @RequiresPermission(ACCESS_WIFI_STATE) public static boolean getWifiEnabled() { @SuppressLint("WifiManagerLeak") WifiManager manager = (WifiManager) Utils.getApp().getSystemService(WIFI_SERVICE); if (manager == null) { return false; } return manager.isWifiEnabled(); } /** * Enable or disable wifi. * <p>Must hold {@code <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />}</p> * * @param enabled True to enabled, false otherwise. */ @RequiresPermission(CHANGE_WIFI_STATE) public static void setWifiEnabled(final boolean enabled) { @SuppressLint("WifiManagerLeak") WifiManager manager = (WifiManager) Utils.getApp().getSystemService(WIFI_SERVICE); if (manager == null) { return; } if (enabled == manager.isWifiEnabled()) { return; } manager.setWifiEnabled(enabled); } /** * Return whether wifi is connected. * <p>Must hold {@code <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />}</p> * * @return {@code true}: connected<br>{@code false}: disconnected */ @RequiresPermission(ACCESS_NETWORK_STATE) public static boolean isWifiConnected() { ConnectivityManager cm = (ConnectivityManager) Utils.getApp().getSystemService(Context.CONNECTIVITY_SERVICE); if (cm == null) { return false; } NetworkInfo ni = cm.getActiveNetworkInfo(); return ni != null && ni.getType() == ConnectivityManager.TYPE_WIFI; } /** * Return whether wifi is available. * <p>Must hold {@code <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />}, * {@code <uses-permission android:name="android.permission.INTERNET" />}</p> * * @return {@code true}: available<br>{@code false}: unavailable */ @RequiresPermission(allOf = {ACCESS_WIFI_STATE, INTERNET}) public static boolean isWifiAvailable() { return getWifiEnabled() && isAvailableByPing(); } /** * Return the name of network operate. * * @return the name of network operate */ public static String getNetworkOperatorName() { TelephonyManager tm = (TelephonyManager) Utils.getApp().getSystemService(Context.TELEPHONY_SERVICE); if (tm == null) { return ""; } return tm.getNetworkOperatorName(); } /** * Return type of network. * <p>Must hold {@code <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />}</p> * * @return type of network * <ul> * <li>{@link NetworkType#NETWORK_ETHERNET} </li> * <li>{@link NetworkType#NETWORK_WIFI } </li> * <li>{@link NetworkType#NETWORK_4G } </li> * <li>{@link NetworkType#NETWORK_3G } </li> * <li>{@link NetworkType#NETWORK_2G } </li> * <li>{@link NetworkType#NETWORK_UNKNOWN } </li> * <li>{@link NetworkType#NETWORK_NO } </li> * </ul> */ @RequiresPermission(ACCESS_NETWORK_STATE) public static NetworkType getNetworkType() { if (isEthernet()) { return NetworkType.NETWORK_ETHERNET; } NetworkInfo info = getActiveNetworkInfo(); if (info != null && info.isAvailable()) { if (info.getType() == ConnectivityManager.TYPE_WIFI) { return NetworkType.NETWORK_WIFI; } else if (info.getType() == ConnectivityManager.TYPE_MOBILE) { switch (info.getSubtype()) { case TelephonyManager.NETWORK_TYPE_GSM: case TelephonyManager.NETWORK_TYPE_GPRS: case TelephonyManager.NETWORK_TYPE_CDMA: case TelephonyManager.NETWORK_TYPE_EDGE: case TelephonyManager.NETWORK_TYPE_1xRTT: case TelephonyManager.NETWORK_TYPE_IDEN: return NetworkType.NETWORK_2G; case TelephonyManager.NETWORK_TYPE_TD_SCDMA: case TelephonyManager.NETWORK_TYPE_EVDO_A: case TelephonyManager.NETWORK_TYPE_UMTS: case TelephonyManager.NETWORK_TYPE_EVDO_0: case TelephonyManager.NETWORK_TYPE_HSDPA: case TelephonyManager.NETWORK_TYPE_HSUPA: case TelephonyManager.NETWORK_TYPE_HSPA: case TelephonyManager.NETWORK_TYPE_EVDO_B: case TelephonyManager.NETWORK_TYPE_EHRPD: case TelephonyManager.NETWORK_TYPE_HSPAP: return NetworkType.NETWORK_3G; case TelephonyManager.NETWORK_TYPE_IWLAN: case TelephonyManager.NETWORK_TYPE_LTE: return NetworkType.NETWORK_4G; default: String subtypeName = info.getSubtypeName(); if ("TD-SCDMA".equalsIgnoreCase(subtypeName) || "WCDMA".equalsIgnoreCase(subtypeName) || "CDMA2000".equalsIgnoreCase(subtypeName)) { return NetworkType.NETWORK_3G; } } } } return NetworkType.NETWORK_UNKNOWN; } /** * Return whether using ethernet. * <p>Must hold * {@code <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />}</p> * * @return {@code true}: yes<br>{@code false}: no */ @RequiresPermission(ACCESS_NETWORK_STATE) private static boolean isEthernet() { final ConnectivityManager cm = (ConnectivityManager) Utils.getApp().getSystemService(Context.CONNECTIVITY_SERVICE); if (cm == null) { return false; } final NetworkInfo info = cm.getNetworkInfo(ConnectivityManager.TYPE_ETHERNET); if (info == null) { return false; } NetworkInfo.State state = info.getState(); if (null == state) { return false; } return state == NetworkInfo.State.CONNECTED || state == NetworkInfo.State.CONNECTING; } @RequiresPermission(ACCESS_NETWORK_STATE) private static NetworkInfo getActiveNetworkInfo() { ConnectivityManager cm = (ConnectivityManager) Utils.getApp().getSystemService(Context.CONNECTIVITY_SERVICE); if (cm == null) { return null; } return cm.getActiveNetworkInfo(); } /** * Return the ip address. * <p>Must hold {@code <uses-permission android:name="android.permission.INTERNET" />}</p> * * @param useIPv4 True to use ipv4, false otherwise. * @return the ip address */ @RequiresPermission(INTERNET) public static String getIPAddress(final boolean useIPv4) { try { Enumeration<NetworkInterface> nis = NetworkInterface.getNetworkInterfaces(); LinkedList<InetAddress> adds = new LinkedList<>(); while (nis.hasMoreElements()) { NetworkInterface ni = nis.nextElement(); // To prevent phone of xiaomi return "10.0.2.15" if (!ni.isUp() || ni.isLoopback()) { continue; } Enumeration<InetAddress> addresses = ni.getInetAddresses(); while (addresses.hasMoreElements()) { adds.addFirst(addresses.nextElement()); } } for (InetAddress add : adds) { if (!add.isLoopbackAddress()) { String hostAddress = add.getHostAddress(); boolean isIPv4 = hostAddress.indexOf(':') < 0; if (useIPv4) { if (isIPv4) { return hostAddress; } } else { if (!isIPv4) { int index = hostAddress.indexOf('%'); return index < 0 ? hostAddress.toUpperCase() : hostAddress.substring(0, index).toUpperCase(); } } } } } catch (SocketException e) { e.printStackTrace(); } return ""; } /** * Return the ip address of broadcast. * * @return the ip address of broadcast */ public static String getBroadcastIpAddress() { try { Enumeration<NetworkInterface> nis = NetworkInterface.getNetworkInterfaces(); LinkedList<InetAddress> adds = new LinkedList<>(); while (nis.hasMoreElements()) { NetworkInterface ni = nis.nextElement(); if (!ni.isUp() || ni.isLoopback()) { continue; } List<InterfaceAddress> ias = ni.getInterfaceAddresses(); for (int i = 0, size = ias.size(); i < size; i++) { InterfaceAddress ia = ias.get(i); InetAddress broadcast = ia.getBroadcast(); if (broadcast != null) { return broadcast.getHostAddress(); } } } } catch (SocketException e) { e.printStackTrace(); } return ""; } /** * Return the domain address. * <p>Must hold {@code <uses-permission android:name="android.permission.INTERNET" />}</p> * * @param domain The name of domain. * @return the domain address */ @RequiresPermission(INTERNET) public static String getDomainAddress(final String domain) { InetAddress inetAddress; try { inetAddress = InetAddress.getByName(domain); return inetAddress.getHostAddress(); } catch (UnknownHostException e) { e.printStackTrace(); return ""; } } /** * Return the ip address by wifi. * * @return the ip address by wifi */ @RequiresPermission(ACCESS_WIFI_STATE) public static String getIpAddressByWifi() { @SuppressLint("WifiManagerLeak") WifiManager wm = (WifiManager) Utils.getApp().getSystemService(Context.WIFI_SERVICE); if (wm == null) { return ""; } return Formatter.formatIpAddress(wm.getDhcpInfo().ipAddress); } /** * Return the gate way by wifi. * * @return the gate way by wifi */ @RequiresPermission(ACCESS_WIFI_STATE) public static String getGatewayByWifi() { @SuppressLint("WifiManagerLeak") WifiManager wm = (WifiManager) Utils.getApp().getSystemService(Context.WIFI_SERVICE); if (wm == null) { return ""; } return Formatter.formatIpAddress(wm.getDhcpInfo().gateway); } /** * Return the net mask by wifi. * * @return the net mask by wifi */ @RequiresPermission(ACCESS_WIFI_STATE) public static String getNetMaskByWifi() { @SuppressLint("WifiManagerLeak") WifiManager wm = (WifiManager) Utils.getApp().getSystemService(Context.WIFI_SERVICE); if (wm == null) { return ""; } return Formatter.formatIpAddress(wm.getDhcpInfo().netmask); } /** * Return the server address by wifi. * * @return the server address by wifi */ @RequiresPermission(ACCESS_WIFI_STATE) public static String getServerAddressByWifi() { @SuppressLint("WifiManagerLeak") WifiManager wm = (WifiManager) Utils.getApp().getSystemService(Context.WIFI_SERVICE); if (wm == null) { return ""; } return Formatter.formatIpAddress(wm.getDhcpInfo().serverAddress); } public enum NetworkType { NETWORK_ETHERNET, NETWORK_WIFI, NETWORK_4G, NETWORK_3G, NETWORK_2G, NETWORK_UNKNOWN, NETWORK_NO } public interface Callback { void call(boolean isSuccess); } }
[ "15659515613@163.com" ]
15659515613@163.com
09e19c7d89037139b2e1152014cd2af4c754e3d1
9e5139fa2386cbe835e3d06aaf9b2b65d1e64bc9
/src/main/java/com/app/dao/impl/CustomerDaoImpl.java
46affc2f8794b0175193c0ad221f7a09cae0aad3
[]
no_license
RameshBabuC/Warehouse
ae5ab8cf1ccf76b04fbb1b66edf1dd1cfc58945c
daa8720a3e3913e6bdd3a0d69839e1a6770d8c6f
refs/heads/master
2020-04-08T05:22:32.115459
2018-11-25T17:43:38
2018-11-25T17:43:38
159,057,872
0
0
null
null
null
null
UTF-8
Java
false
false
1,113
java
package com.app.dao.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.orm.hibernate5.HibernateTemplate; import org.springframework.stereotype.Repository; import com.app.dao.ICustomerDao; import com.app.model.Customer; @Repository public class CustomerDaoImpl implements ICustomerDao { @Autowired private HibernateTemplate ht; @Override public Integer saveCustomer(Customer cust) { // TODO Auto-generated method stub return (Integer)ht.save(cust); } @Override public void updateCustomer(Customer cust) { // TODO Auto-generated method stub ht.update(cust); } @Override public void deleteCustomer(int custId) { // TODO Auto-generated method stub Customer cust=new Customer(); cust.setCustId(custId); ht.delete(cust); } @Override public Customer getOneCustomer(int custId) { // TODO Auto-generated method stub return ht.get(Customer.class, custId); } @Override public List<Customer> getAllCustomers() { // TODO Auto-generated method stub return ht.loadAll(Customer.class); } }
[ "home@venkateshwarreddy" ]
home@venkateshwarreddy
473574a584119a4ad1921302a9e63fadb97c53f9
a6f052dac1a1f1a4eac86c522d9cc1d9cf182592
/Exam/src/M5_AccumulatedAmountCalculation.java
25ff211905372b7f4e89823103ce2c70c40d8158
[ "MIT" ]
permissive
stu01509/NKUST_MIS
67b3e8f1cf3d11505ea62514fd8063d37a7469a4
aa51c3bd8e0fa59435c3725b4130ca874c3d792c
refs/heads/master
2021-06-04T10:24:22.247641
2020-06-25T14:23:48
2020-06-25T14:23:48
147,346,866
4
0
MIT
2020-06-25T14:23:50
2018-09-04T13:01:32
Java
UTF-8
Java
false
false
606
java
import java.util.Scanner; public class M5_AccumulatedAmountCalculation { public static void main(String[] args) { System.out.println("M5. 本利和計算"); Scanner scanner = new Scanner(System.in); // 本金 System.out.print("請輸入本金:"); double p = scanner.nextDouble(); // 月利率 System.out.print("請輸入月利率: "); double r = scanner.nextDouble(); // 存款期數 System.out.print("請輸入存款期數:"); int n = scanner.nextInt(); // 本利和 double t = p * Math.pow((1 + r), n); System.out.println("本利和為 : " + t); } }
[ "stu01509@yahoo.com.tw" ]
stu01509@yahoo.com.tw
dd4f0bc3e6473ba0fec64eab090b9d572bc50cbd
730d2e136b97b671aa0da434d2bd43d29fffb32e
/app/src/main/java/com/live/tv/mvp/view/live/IFamousdoctorLiveListView.java
aedd98a6d572b132e7dcee728f238140a18f0ece
[]
no_license
Sekei/aymk
f7cc2e85ca727e395740bf9404d5e6501d82268a
a188a171f04b4b7bb301dc6b0f3d7ea32feed780
refs/heads/master
2020-04-30T22:38:53.035186
2019-05-23T07:39:56
2019-05-23T07:39:56
177,124,575
0
0
null
null
null
null
UTF-8
Java
false
false
396
java
package com.live.tv.mvp.view.live; import com.live.tv.bean.DepartmentLevelOneBean; import com.live.tv.bean.LiveBean; import com.live.tv.mvp.base.BaseView; import java.util.List; /** * Created by taoh on 2017/7/20. */ public interface IFamousdoctorLiveListView extends BaseView { void onLiveList(List<LiveBean> data); void onGetDepartments(List<DepartmentLevelOneBean> data); }
[ "juanjuan19941019" ]
juanjuan19941019
c37dd17c94b06c061eb0e5100a06f226a37b46ae
c812a1ef22b08eb770ad58ddba8052ec919591a6
/app/src/main/java/com/example/zhengdong/base/Section/Five/Controller/OfferDetailAC.java
75383e4c2b8c3c940441bef6b0c037b3b80bdd19
[]
no_license
Catfeeds/JBX-Android
00dee52ab7c11dfefd37c27af6712f3b30f74862
0cca367b43068fd22f59eab56b6e551ece27b7b0
refs/heads/master
2021-05-01T06:17:23.318736
2018-02-09T20:02:52
2018-02-09T20:02:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,078
java
/* * Copyright (c) create by ki1lt0 . */ package com.example.zhengdong.base.Section.Five.Controller; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import com.example.zhengdong.base.APIManager.HttpInterFace; import com.example.zhengdong.base.APIManager.HttpRequest; import com.example.zhengdong.base.APIManager.UrlUtils; import com.example.zhengdong.base.Macro.XToast; import com.example.zhengdong.base.Section.Five.Adapter.OfferDetailListAdapter; import com.example.zhengdong.base.Section.Login.Model.RequireOrderListModel; import com.example.zhengdong.jbx.R; import com.google.gson.Gson; import java.util.HashMap; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; public class OfferDetailAC extends AppCompatActivity { @BindView(R.id.navi_title_txt) TextView naviTitleTxt; @BindView(R.id.navi_title_lay) LinearLayout naviTitleLay; @BindView(R.id.navi_right_txt) TextView naviRightTxt; @BindView(R.id.navi_right_lay) LinearLayout naviRightLay; @BindView(R.id.right_pic) ImageView rightPic; @BindView(R.id.navi_right_pic_lay) LinearLayout naviRightPicLay; @BindView(R.id.title_bg) RelativeLayout titleBg; @BindView(R.id.offer_detail_rv) RecyclerView offerDetailRv; @BindView(R.id.navi_back_lay) LinearLayout naviBackLay; @BindView(R.id.offer_detail_lay) LinearLayout offerDetailLay; private int offerType = -1; private String match_enqu_id=""; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_offer_detail_ac); ButterKnife.bind(this); offerType = getIntent().getIntExtra("offertype", -1); naviBackLay.setVisibility(View.VISIBLE); naviTitleTxt.setText("询价单详情"); match_enqu_id = getIntent().getStringExtra("Match_enqu_id"); initRequireDetailData(match_enqu_id); if(offerType == 1){ offerDetailLay.setVisibility(View.VISIBLE); } } /** * 询价单详情列表 * * @param match_enqu_id*/ private void initRequireDetailData(String match_enqu_id) { HashMap<String,String> map = new HashMap<>(); map.put("enquiry_id",match_enqu_id); if (offerType == 1){ map.put("sort","1"); }else { map.put("sort","0"); } HttpRequest.URL_GET_REQUEST(this, UrlUtils.MINE_REQUIRE_DETAIL_LIST_URL, map, "加载中...", true, new HttpInterFace() { @Override public void URL_REQUEST(String response) { RequireOrderListModel requireOrderListModel = new Gson().fromJson(response,RequireOrderListModel.class); if (requireOrderListModel.getCode() == 200){ initRecycleView(requireOrderListModel); }else { XToast.show(getBaseContext(),""+requireOrderListModel.getMsg()); } } @Override public void BEFORE() { } @Override public void AFTER() { } @Override public void NOCONNECTION() { } }); } private void initRecycleView(RequireOrderListModel requireOrderListModel) { LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); offerDetailRv.setLayoutManager(linearLayoutManager); OfferDetailListAdapter offerDetailListAdapter = new OfferDetailListAdapter(this,requireOrderListModel); offerDetailRv.setAdapter(offerDetailListAdapter); offerDetailListAdapter.setOnItemClickListener(new OfferDetailListAdapter.OnItemClickListener() { @Override public void OnItemClick(View view, String name) { Intent intent = new Intent(OfferDetailAC.this,MineOfferSecondAC.class); intent.putExtra("offerType",6); intent.putExtra("orderDetailID",name); startActivity(intent); } }); } @OnClick({R.id.navi_back_lay, R.id.offer_detail_lay}) public void onViewClicked(View view) { switch (view.getId()) { case R.id.navi_back_lay: finish(); break; case R.id.offer_detail_lay: Intent intent = new Intent(OfferDetailAC.this,MineOfferSecondAC.class); intent.putExtra("offerType",5); intent.putExtra("enquireID",match_enqu_id); startActivity(intent); break; default: break; } } }
[ "zheng.dong@zhengdeMacBook-Pro.local" ]
zheng.dong@zhengdeMacBook-Pro.local
d0a61ad37d91ea43da47b175e6ea6bf3cb82f080
acde5640ecd4488bc2173e755c17e6268fb24d0f
/IFIS/src/com/example/ifis/Receiver.java
4e760843af813032eb73173dfd144ae160c1ffcc
[]
no_license
ifis-tradeportal/Android
5a2571e7d46ee3effb597b8cade9e87e401569cc
9b24bb3771b9f25b17539e939e5a701dd389bb55
refs/heads/master
2020-05-27T02:37:11.990123
2015-01-29T10:17:41
2015-01-29T10:17:41
30,015,179
0
0
null
null
null
null
UTF-8
Java
false
false
2,673
java
package com.example.ifis; import java.util.List; import org.json.JSONException; import org.json.JSONObject; import com.parse.ParseAnalytics; import com.parse.ParsePushBroadcastReceiver; import android.app.ActivityManager; import android.app.ActivityManager.RunningTaskInfo; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.util.Log; import android.widget.Toast; public class Receiver extends ParsePushBroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { String pushdt=null; String uriString = null; ParseAnalytics.trackAppOpened(intent); try { JSONObject pushData = new JSONObject(intent.getStringExtra("com.parse.Data")); pushdt=pushData.toString(); uriString = pushData.optString("alert"); } catch (JSONException e) { Log.v("com.parse.ParsePushReceiver", "Unexpected JSONException when receiving push data: ", e); } Log.e("context is", context.getPackageName()); Log.e("intent", intent.getPackage()); Toast.makeText(context, uriString, 700).show(); updateMyActivity(context,uriString); super.onReceive(context, intent); } static void updateMyActivity(Context context, String message) { Intent intent = new Intent("unique_name"); //put whatever data you want to send, if any intent.putExtra("message", message); //send broadcast context.sendBroadcast(intent); } @Override public void onPushOpen(Context context, Intent intent) { Log.e("Push", "Clicked"); getNotification(context, intent); ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); List<RunningTaskInfo> tasks = am.getRunningTasks(1); if (!tasks.isEmpty()) { ComponentName topActivity = tasks.get(0).topActivity; if (!topActivity.getPackageName().equals(context.getPackageName())) { //return true; Log.i("push 2", "bolngs here"); Intent i = new Intent(context, LoginActivity.class); i.putExtras(intent.getExtras()); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); } } else{ Log.i("push 2", "not bolngs here"); } Log.e("context", context.getPackageResourcePath().toString()); Log.e("context", intent.getPackage().toString()); } }
[ "nagarajan.sathish@ifis.com.sg" ]
nagarajan.sathish@ifis.com.sg
c49fc95bce338c6eff23294f5804d360d9cb340c
dbd4a7ba684ef1a4d6f7a50289b7e2344fe81010
/src/bento/parser/ParsedFloatingPointLiteral.java
f392f2ff6dafaca48e799aa3ca383a609f4ecc01
[ "MIT" ]
permissive
bentodev/bentolang
37409aa7428db98c3ccc376e49855cf7588b28d1
8290c69eb3413831d6c1e8073b70facee4cdb687
refs/heads/master
2021-01-24T07:56:15.486575
2017-08-05T01:58:48
2017-08-05T01:58:48
39,535,891
0
0
null
2015-09-14T01:12:18
2015-07-22T23:53:01
Java
UTF-8
Java
false
false
1,361
java
/* Bento * * $Id: ParsedFloatingPointLiteral.java,v 1.4 2005/06/30 04:20:55 sthippo Exp $ * * Copyright (c) 2002-2005 by bentodev.org * * Use of this code in source or compiled form is subject to the * Bento Poetic License at http://www.bentodev.org/poetic-license.html */ package bento.parser; import bento.lang.*; /** * Based on code generated by jjtree. * * @author Michael St. Hippolyte * @version $Revision: 1.4 $ */ public class ParsedFloatingPointLiteral extends PrimitiveValue { public ParsedFloatingPointLiteral(int id) { super(null, Double.class); } public void setValue(String val) { char lastChar = val.charAt(val.length() - 1); if (lastChar == 'f' || lastChar == 'F') { try { setValueAndClass(Float.valueOf(val), Float.TYPE); } catch (NumberFormatException nfe) { setValueAndClass(new Float(Float.NaN), Float.TYPE); } } else { try { setValueAndClass(Double.valueOf(val), Double.TYPE); } catch (NumberFormatException nfe) { setValueAndClass(new Double(Double.NaN), Double.TYPE); } } } /** Accept the visitor. **/ public Object jjtAccept(BentoParserVisitor visitor, Object data) { return visitor.visit(this, data); } }
[ "mash@brooklyndigital.net" ]
mash@brooklyndigital.net
310a84c330bd5afa6779ee93d22e5c614f8365eb
73f4caf4e2192eaca3c66a8b7f63be65e680884a
/xml_zqs/src/org/zqs/xml/MyDefaultHander.java
abebc4a4f105ba86e681006b953c1cf9fbb11b2c
[]
no_license
Mr-class-zhan/.github.com
02a623dc80ea0044f01d85d15312ca04fc1f7cab
0f34d08b0151d33db715de988c3093daa86f059d
refs/heads/master
2021-01-25T09:32:38.420399
2017-06-09T13:52:41
2017-06-09T13:52:41
93,849,868
0
0
null
null
null
null
UTF-8
Java
false
false
1,710
java
package org.zqs.xml; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; public class MyDefaultHander extends DefaultHandler { @Override public void startDocument() throws SAXException { System.out.println("MyDefaultHander.startDocument()"); } /* (non-Javadoc) * @see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes) */ @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { // TODO Auto-generated method stub System.out.println("MyDefaultHander.startElement()-->"+qName); } /* (non-Javadoc) * @see org.xml.sax.helpers.DefaultHandler#endElement(java.lang.String, java.lang.String, java.lang.String) */ @Override public void endElement(String uri, String localName, String qName) throws SAXException { // TODO Auto-generated method stub System.out.println("MyDefaultHander.endElement()-->"+qName); } /* (non-Javadoc) * @see org.xml.sax.helpers.DefaultHandler#characters(char[], int, int) */ @Override public void characters(char[] ch, int start, int length) throws SAXException { // TODO Auto-generated method stub String str = (new String(ch,start,length)).trim(); if(str.length()!=0){ System.out.println("MyDefaultHander.characters()-->"+str); }} @Override public void endDocument() throws SAXException { System.out.println("MyDefaultHander.endDocument()"); } }
[ "874431856@qq.com" ]
874431856@qq.com
8ca15e1980ff2c6af1d8a2a251f60d0c31f5ddfe
bdb2240042590568eb070180e2b1013410673c35
/Pong Prototype 2/src/Powerup.java
3d739a2b65519112c74c63fe2feebb3977b2a7a3
[]
no_license
NicholasSalazar/Nicholas-Salazar-AdvanceJava
2c1e06bc7c70e106610a33c7b0b8412fc2fe9979
e8ce26ef22a78b2c07cde443a71f691619bcb1a3
refs/heads/master
2021-09-12T21:40:46.929665
2018-04-21T03:55:43
2018-04-21T03:55:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
728
java
import java.awt.Color; import java.awt.Graphics; public abstract class Powerup { protected int x,y; protected Color color; protected HumanPaddle p1,p2; public Powerup(HumanPaddle p1, HumanPaddle p2) { // player = p; x= randomX(); y = randomY(); this.p1 = p1; this.p2 = p2; } public abstract void draw(Graphics g); public abstract void effect(HumanPaddle p); private int randomX() { int range = (500-200) + 1; return (int) (Math.random()*range) + 200; } private int randomY() { int range = (480-10)+1; return (int) (Math.random()*range)+10; } public int getX() { return x; } public int getY() { return y; } protected Color getColor() { return color; } }
[ "33555344+Ghostrite@users.noreply.github.com" ]
33555344+Ghostrite@users.noreply.github.com
606c068650e1a6990fd51736acb17bc7610054ce
558c0aa1b9316cb5b1a7aefa35db4dd153700d34
/src/main/java/com/web/carpool/CarpoolApplication.java
ea6dd655e0799bac78d15ff35b1e4613672b1bfd
[]
no_license
sophiayang123/carpool
bf7b5e23ac878ffd215ad9a03b8a519b670c5862
b40fd9035a7aa713c5ba4f216019e1d40b4b884a
refs/heads/master
2020-04-27T04:04:32.588386
2019-03-02T21:52:47
2019-03-02T21:52:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
312
java
package com.web.carpool; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class CarpoolApplication { public static void main(String[] args) { SpringApplication.run(CarpoolApplication.class, args); } }
[ "gu000031@algonquinlive.com" ]
gu000031@algonquinlive.com
975ff2b001f4c8028a3766c3343ff07d26a85ece
011bf2adde6ea659ff326ebfe118e30f0d6652bb
/app/src/main/java/com/example/venson/soho/Case/Caseapply/PostFragment.java
cf73b9c774d235dd21de4246f632b880d21a6475
[]
no_license
HuangYiLun/editmember
a27e1a4e8d196333c0c26593b34b858a5bba7890
0a428c67bb1a9c4a2bd8baa8d2f6ded8dc217f5d
refs/heads/master
2020-03-17T09:22:52.540472
2018-05-15T07:03:08
2018-05-15T07:03:08
133,472,466
0
0
null
null
null
null
UTF-8
Java
false
false
2,023
java
package com.example.venson.soho.Case.Caseapply; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.example.venson.soho.R; import java.util.ArrayList; import java.util.List; /** * Created by ricky on 2018/4/30. */ public class PostFragment extends Fragment { @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.postcase_caseoverview_layout, container, false); ViewPager viewPager = view.findViewById(R.id.viewPager_caseOverViewRight); viewPager.setAdapter(new MyPagerAdapter(getFragmentManager())); TabLayout tabLayout = view.findViewById(R.id.tabLayout); tabLayout.setupWithViewPager(viewPager); return view; } private class MyPagerAdapter extends FragmentPagerAdapter { List<Page> pageList; public MyPagerAdapter(FragmentManager fragmentManager) { super(fragmentManager); pageList = new ArrayList<>(); pageList.add(new Page(new PostRecruitFragment(), "招募中")); pageList.add(new Page(new PostProcessFragment(), "進行中")); pageList.add(new Page(new PostEndFragment(), "已結案")); } @Override public Fragment getItem(int position) { return pageList.get(position).getFragment(); } @Override public int getCount() { return pageList.size(); } @Override public CharSequence getPageTitle(int position) { return pageList.get(position).getTitle(); } } }//end
[ "twvsad98@gmail.com" ]
twvsad98@gmail.com
7a76b7e01090e286bcd542ae2f7d9e82bd1ddda0
e619fda5538630224c8d7526949449d6091e0d9c
/src/test/java/me/liang/rediscache/throughput/ThroughputTest.java
7f69ac59c6c671a913838ec7be4e0c1bd25916ec
[]
no_license
LiangShang/redis-cache
f9700571dfa9cfa42a55c939a97b2214379ae92d
f141463562ec8c19862034ab01c824fdf5cff572
refs/heads/master
2021-01-17T14:41:07.707752
2016-06-14T13:20:12
2016-06-14T13:20:12
52,503,782
0
0
null
null
null
null
UTF-8
Java
false
false
244
java
package me.liang.rediscache.throughput; /** * this class tests the throughput for the cache * * the basic idea is that put a large and fixed number of data to redis via this lib and write the cost time */ public class ThroughputTest { }
[ "liang1990.shang@gmail.com" ]
liang1990.shang@gmail.com
c95e5b5725cbb5189d654b069a45800bb48648e2
8fb547c1cc41b5b5fccdeeaa0c77bfde80633eaa
/src/bottls.java
5200e68dd8a0e8a2108a2fe6f0d82cca13eeed77
[]
no_license
League-Level0-Student/level-0-module-3-GavinPennock
e8c83f50cc97a2ee6f78fa65291fca21693e5d44
7126d564cb105440df375ba09a68adb048dea43d
refs/heads/master
2020-08-19T09:02:16.646364
2019-11-22T00:20:06
2019-11-22T00:20:06
215,902,072
0
0
null
null
null
null
UTF-8
Java
false
false
618
java
import javax.swing.JOptionPane; public class bottls { public static void main(String[] args) { for(int i=99; i>1; i--) { System.out.println(i+ " bottles of beer on the wall " +i+ " bottles of beer take one down pass it around "+(i-1)+ " bottles of beer on the wall"); } System.out.println("1 bottle of beer on the wall, 1 bottle of beer" + " Take one down and pass it around, no more bottles of beer on the wall. \n " + "No more bottles of beer on the wall, no more bottles of beer" + " Go to the store and buy some more, 99 bottles of beer on the wall."); } }
[ "league@iMac-16.attlocal.net" ]
league@iMac-16.attlocal.net
9c88849aedb32625c20a77daf0100d8a273146b1
2faec76f1b8de8630e03fc87f22f2bab140bdf34
/src/com/sunny/service/vo/config/AdConfig_ProducrtPage.java
b3b7e6359817eafafd26bbbdc0b6034795e13ef2
[]
no_license
shmily8023/webservice
dcc2715c5fbcd162b96381ef430246e7bee248be
c788234051800a4fc2d907ab76a460447ad38a2d
refs/heads/master
2020-09-12T23:00:03.354510
2019-11-19T02:01:58
2019-11-19T02:01:58
222,586,130
0
0
null
null
null
null
GB18030
Java
false
false
359
java
package com.sunny.service.vo.config; public class AdConfig_ProducrtPage { //产品页 public int ids;//编号 public int productId;//产品 public int adType;//广告类型[纯html|轮播] public String adContent; //广告内容 public String[] urlTips;//悬浮图片提示 public String[] imgUrl; //轮播图片url 加载url显示 |点击 url加载 }
[ "lj101127@163.com" ]
lj101127@163.com
27cd1321470bd7dccf603ffcd3917e9b2644aa68
9499dfa2dbd1deaf2f800aae2714aefeca807f82
/Java Term Project/Part 3 (Networking and Threading added)/src/DataModel/Country.java
3a3a4e7723e7594b33b4bf6ff984206610fd697d
[]
no_license
Sadat-Hossain-01/CSE108-OOP
acbb50d4ecf8ac45543d3f8723e2820889636228
b3af106c642a38697124522cf2b46ac7d33399ef
refs/heads/main
2023-06-25T10:50:47.467229
2021-07-29T13:57:48
2021-07-29T13:57:48
347,022,291
1
0
null
null
null
null
UTF-8
Java
false
false
699
java
package DataModel; public class Country { private String name; private int count; public Country(String name) { setName(name); } public Country(String name, int count) { this.name = name; this.count = count; } public String getName() { return name; } public void setName(String name) { this.name = FormatCountryName(name); } public int getCount() { return count; } public void incrementCount() { count++; } @Override public String toString() { return name; } public String FormatCountryName(String name) { return League.FormatName(name); } }
[ "sadatho2014@gmail.com" ]
sadatho2014@gmail.com
bbf86d8aca43b31f32eccd44001eb60955c1e8fe
df985ad690456e2f7fcde521a38709c0611db7e3
/zeidon-joe/src/main/java/com/quinsoft/zeidon/domains/DateDomain.java
8244509e72dcdc5bf6add926655ee48655198fb6
[]
no_license
jdmr/zeidon-joe
77fea253cc8d3e8ae3de3a1059be0d89624ef682
18fc83de22694f28d54e1a1372a379a827253006
refs/heads/master
2020-12-26T02:59:18.883256
2014-04-26T20:03:30
2014-04-26T20:03:30
25,006,894
0
0
null
null
null
null
UTF-8
Java
false
false
8,732
java
/** This file is part of the Zeidon Java Object Engine (Zeidon JOE). Zeidon JOE is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Zeidon JOE 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Zeidon JOE. If not, see <http://www.gnu.org/licenses/>. Copyright 2009-2012 QuinSoft */ package com.quinsoft.zeidon.domains; import java.util.Date; import java.util.Map; import org.apache.commons.lang3.StringUtils; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; import com.quinsoft.zeidon.Application; import com.quinsoft.zeidon.InvalidAttributeValueException; import com.quinsoft.zeidon.ObjectEngine; import com.quinsoft.zeidon.Task; import com.quinsoft.zeidon.ZeidonException; import com.quinsoft.zeidon.objectdefinition.ViewAttribute; import com.quinsoft.zeidon.utils.JoeUtils; import com.quinsoft.zeidon.utils.PortableFileReader; /** * @author DG * */ public class DateDomain extends AbstractDomain { protected DateTimeFormatter defaultDateFormatter = DateTimeFormat.forPattern( ObjectEngine.INTERNAL_DATE_STRING_FORMAT ); public DateDomain(Application application, Map<String, Object> domainProperties, Task task) { super( application, domainProperties, task ); } @Override public Object convertExternalValue(Task task, ViewAttribute viewAttribute, String contextName, Object externalValue) { // KJS - Added 01/27/11 because of line 2836 in lTrnscpt_Object.java // OrderEntityForView( lTrnscpt, "StudentMajorDegreeTrack", "wPrimarySortOrder A GraduationDate A" ); // value = null so we are getting to the exception. Will try returning null, see what happens. if ( externalValue == null ) return null; if ( externalValue instanceof DateTime ) return externalValue; if ( externalValue instanceof Date ) return new DateTime( externalValue ); // VML operations use "" as synonymous with null. if ( externalValue instanceof String && StringUtils.isBlank( (String) externalValue ) ) return null; if ( externalValue instanceof CharSequence ) { // If string is "NOW" then we'll use current datetime. if ( externalValue.toString().equals( "NOW" ) ) return new DateTime(); DomainContext context = getContext( task, contextName ); return context.convertExternalValue( task, viewAttribute, externalValue.toString() ); } throw new InvalidAttributeValueException( viewAttribute, externalValue, "Invalid object: Domain %s cannot convert value for context %s.", this.getClass().getName(), contextName ); } /** * Attempt to get the context. This differs from the normal getContext() by attempting to create * a SimpleDateFormatter using the contextName as the format if a context is not found by name. */ @Override public DomainContext getContext(Task task, String contextName) { DomainContext context = getContext( contextName ); if ( context != null ) return context; // We found one by name. if ( StringUtils.isBlank( contextName ) ) throw new ZeidonException("Domain '%s' does not have a default context defined.", getName() ); // Create a temporary new one and set its edit string to the context name. DateContext dateContext = new DateContext( this ); dateContext.setName( contextName ); dateContext.setEditString( contextName ); return dateContext; } @Override public void validateInternalValue( Task task, ViewAttribute viewAttribute, Object internalValue ) throws InvalidAttributeValueException { if ( internalValue instanceof DateTime ) return; throw new InvalidAttributeValueException( viewAttribute, internalValue, "Internal value must be Joda DateTime, not %s", internalValue.getClass().getName() ); } @Override public String convertToString(Task task, ViewAttribute viewAttribute, Object internalValue) { if ( internalValue == null ) return StringDomain.checkNullString( viewAttribute.getDomain().getApplication(), null ); if ( internalValue.toString().isEmpty()) return internalValue.toString(); return defaultDateFormatter.print( (DateTime) internalValue ); } /** * Adds milliseconds to the datetime value. */ @Override public Object addToAttribute( Task task, ViewAttribute viewAttribute, Object currentValue, Object addValue ) { DateTime date1 = (DateTime) convertExternalValue( task, viewAttribute, null, currentValue ); if ( addValue == null ) return date1; if ( addValue instanceof Number ) { int millis = ((Number) addValue).intValue(); return date1.plusMillis( millis ); } throw new ZeidonException( "Value type of %s not supported for add to DateDomain", addValue.getClass().getName() ); } @Override public DomainContext newContext(Task task) { return new DateContext( this ); } private class DateContext extends BaseDomainContext { /** * URL for Java SimpleDateFormat help. */ private static final String JAVA_DATE_FORMATTING_URL = "http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html"; public DateContext(Domain domain) { super( domain ); } private String editString; private DateTimeFormatter formatter; @Override public String convertToString(Task task, ViewAttribute viewAttribute, Object internalValue) { if ( internalValue == null ) return StringDomain.checkNullString(task.getApplication(), null); if ( internalValue.toString().isEmpty()) return internalValue.toString(); return formatter.print( (DateTime) internalValue ); } /** * Assumes a string. */ @Override public Object convertExternalValue(Task task, ViewAttribute viewAttribute, Object value) throws InvalidAttributeValueException { if ( value == null ) return null; String s = (String) value; // VML operations use "" as synonymous with null. if ( StringUtils.isBlank( s ) ) return null; // A common internal date/time format is the DefaultTimeFormat. Let's try // a quick check to see if 's' is the same length and only digits. if ( s.length() >= ObjectEngine.INTERNAL_DATE_STRING_FORMAT.length() && JoeUtils.onlyDigits( s ) ) return JoeUtils.parseStandardDateString( s ); if ( formatter == null ) throw new ZeidonException( "JaveEditString is not set for context %s", this.toString() ); try { return formatter.parseDateTime( s ); } catch ( Exception e ) { throw new InvalidAttributeValueException( viewAttribute, s, e.getMessage() ) .appendMessage( "Format string = %s", editString ) .appendMessage( "See %s for help on Java Date formatting", JAVA_DATE_FORMATTING_URL ) .setCause( e ); } } private void setEditString( String editString ) { this.editString = editString; formatter = DateTimeFormat.forPattern( editString ); } @Override public void setAttribute(PortableFileReader reader) { if ( reader.getAttributeName().equals( "JavaEditString" ) ) setEditString( reader.getAttributeValue() ); else super.setAttribute( reader ); } } }
[ "dgc@dgcmac.(none)" ]
dgc@dgcmac.(none)
e4b6523595424d3b6ff1513a2f28bd86a86e719d
0af8b92686a58eb0b64e319b22411432aca7a8f3
/large-multiproject/project7/src/main/java/org/gradle/test/performance7_5/Production7_490.java
71a5cdfd335531e1e2ae5b500c386f6c1be7167b
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
300
java
package org.gradle.test.performance7_5; public class Production7_490 extends org.gradle.test.performance4_5.Production4_490 { private final String property; public Production7_490() { this.property = "foo"; } public String getProperty() { return property; } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
0400a19560eccdbd00c951075f7cce37df4eb81e
c535547283cb7bfd42f2f428c330cf73e2fea600
/cb-core/src/main/java/com/yunxin/cb/mall/service/ISpecFilterService.java
588a9def459055cda6674b7c8d86371d4c53752e
[]
no_license
yue18679307314/mall
00b63c9fff08423ebb436cb563fed4a3cbfe06aa
e1ba001cb43a9e1761e2f7fc9e959abf8d73f924
refs/heads/master
2020-03-28T13:56:15.919489
2018-08-31T07:39:33
2018-08-31T07:39:33
148,443,368
0
1
null
null
null
null
UTF-8
Java
false
false
615
java
package com.yunxin.cb.mall.service; import com.yunxin.cb.mall.entity.SpecFilter; import com.yunxin.cb.mall.entity.SpecFilterItem; import com.yunxin.core.persistence.PageSpecification; import org.springframework.data.domain.Page; import java.util.List; /** * Created by chenpeng 2018年8月20日 */ public interface ISpecFilterService { SpecFilter addSpecFilter(SpecFilter filter); SpecFilter updateSpecFilter(SpecFilter filter); SpecFilter getSpecFilterById(Integer id); void removeSpecFilterById(Integer id); Page<SpecFilter> pageSpecFilters(PageSpecification<SpecFilter> prQuery); }
[ "523606455@qq.com" ]
523606455@qq.com
7e2c64be62f157c4317ede21d3853dbd9028aa96
ca56cb55e0913706ad7cb793393aff5ab5b954ad
/bipolar_preprocessing/src/main/java/bipolar_preprocessing/bipolar_preprocessing/App.java
6f480878506cd349be08dc07d4321dee86758751
[]
no_license
aascode/bipolar-disorder-recognition
9237fa36a9f9b7afe52f524e4425daa7e4da8cff
90b356e36e8775e3a98ea24a2f7eac812c30bf17
refs/heads/master
2022-11-18T07:21:52.023439
2020-07-07T10:49:32
2020-07-07T10:49:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,384
java
package bipolar_preprocessing.bipolar_preprocessing; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.nio.charset.Charset; import java.util.List; import java.util.StringTokenizer; import org.antlr.v4.runtime.Token; import zemberek.morphology.TurkishMorphology; import zemberek.morphology.analysis.WordAnalysis; import zemberek.tokenization.TurkishSentenceExtractor; import zemberek.tokenization.TurkishTokenizer; import zemberek.tokenization.antlr.TurkishLexer; public class App { public static void main( String[] args ) throws IOException { TurkishTokenizer tokenizer = TurkishTokenizer .builder() .ignoreTypes(TurkishLexer.NewLine, TurkishLexer.SpaceTab, TurkishLexer.Time, TurkishLexer.Punctuation) .build(); TurkishMorphology morphology = TurkishMorphology.createWithDefaults(); BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("transcripts.csv"))); PrintWriter writer = new PrintWriter(new File("transcripts_preprocessed.csv")); String strLine = ""; StringTokenizer st = null; int lineNumber = 0, tokenNumber = 0;; StringBuilder sb = new StringBuilder(); while ((strLine = reader.readLine()) != null) { System.out.println(strLine.replaceAll("\"", "")); System.out.println("aaaaaa"); if(lineNumber == 0) { sb.append("file_name,transcript,num_verb,num_noun,num_adj,num_adv,num_neg,num_narr,num_past,num_prog,num_fut,num_pres,a1sg,a2sg,a3sg,a1pl,a2pl,a3pl"); sb.append("\n"); lineNumber+=1; } strLine = strLine.replaceAll("\"", ""); //break comma separated line using "," st = new StringTokenizer(strLine, ","); int narr = 0, past = 0, prog = 0, fut = 0, pres = 0; int neg = 0; int verb = 0, noun = 0, adj = 0, adv = 0; int a1sg = 0, a2sg = 0, a3sg = 0, a1pl = 0, a2pl = 0, a3pl = 0; while (st.hasMoreTokens()) { sb.append(st.nextToken()); sb.append(','); String str = st.nextToken(); //System.out.println(str); List<Token> tokens = tokenizer.tokenize(str); String sent = ""; for(Token tok : tokens) { WordAnalysis results = morphology.analyze(tok); if(results.getAnalysisResults().isEmpty()) { sent += tok.getText() + " "; continue; } sent += results.getAnalysisResults().get(0).getLemmas().get(0)+ " "; if(results.getAnalysisResults().get(0).getMorphemes().toString().contains("Verb") && !results.getAnalysisResults().get(0).getMorphemes().toString().contains("Noun") && !results.getAnalysisResults().get(0).getMorphemes().toString().contains("Adj") && !results.getAnalysisResults().get(0).getMorphemes().toString().contains("Adv") && !tok.getText().equalsIgnoreCase("bana") && !tok.getText().equalsIgnoreCase("onun")) { if(results.getAnalysisResults().get(0).getMorphemes().toString().contains("A1sg")) a1sg+=1; if(results.getAnalysisResults().get(0).getMorphemes().toString().contains("A2sg")) a2sg+=1; if(results.getAnalysisResults().get(0).getMorphemes().toString().contains("A3sg")) a3sg+=1; if(results.getAnalysisResults().get(0).getMorphemes().toString().contains("A1pl")) a1pl+=1; if(results.getAnalysisResults().get(0).getMorphemes().toString().contains("A2pl")) a2pl+=1; if(results.getAnalysisResults().get(0).getMorphemes().toString().contains("A3pl")) a3pl+=1; } if(results.getAnalysisResults().get(0).getMorphemes().toString().contains("Verb")) verb+=1; if(results.getAnalysisResults().get(0).getMorphemes().toString().contains("Noun")) noun+=1; if(results.getAnalysisResults().get(0).getMorphemes().toString().contains("Adj")) adj+=1; if(results.getAnalysisResults().get(0).getMorphemes().toString().contains("Adv")) adv+=1; if(results.getAnalysisResults().get(0).getMorphemes().toString().contains("Neg")) neg+=1; if(results.getAnalysisResults().get(0).getMorphemes().toString().contains("Narr")) narr+=1; if(results.getAnalysisResults().get(0).getMorphemes().toString().contains("Past")) past+=1; if(results.getAnalysisResults().get(0).getMorphemes().toString().contains("Prog1")) prog+=1; if(results.getAnalysisResults().get(0).getMorphemes().toString().contains("Fut")) fut+=1; if(results.getAnalysisResults().get(0).getMorphemes().toString().contains("Pres")) pres+=1; } sb.append(sent); sb.append(','); sb.append(verb); sb.append(','); sb.append(noun); sb.append(','); sb.append(adv); sb.append(','); sb.append(adj); sb.append(','); sb.append(neg); sb.append(','); sb.append(narr); sb.append(','); sb.append(past); sb.append(','); sb.append(prog); sb.append(','); sb.append(fut); sb.append(','); sb.append(pres); sb.append(','); sb.append(a1sg); sb.append(','); sb.append(a2sg); sb.append(','); sb.append(a3sg); sb.append(','); sb.append(a1pl); sb.append(','); sb.append(a2pl); sb.append(','); sb.append(a3pl); sb.append(System.getProperty("line.separator")); } //reset token number tokenNumber = 0; System.out.println("----------------------------------------------"); } writer.write(sb.toString()); writer.close(); } }
[ "noreply@github.com" ]
aascode.noreply@github.com
c399a32b2ad7cf0434bca62de3ea90be21805da9
b1f95c8536d32eaf0d96e1ba80472325078b48e0
/ProTrsutee/src/test/java/TestRunner/Runner.java
7e25f37dc3f9426196d75481a2e13513c47cfafe
[]
no_license
pavan6454/QProCucumber
1ede6d1ebc81a1a2452426b59583bf2e38e5d691
29fdd95c2dc5bf443deeeebf7137e09f1c56cd9e
refs/heads/master
2023-06-02T16:02:56.913200
2021-06-17T14:33:20
2021-06-17T14:33:20
375,589,959
0
0
null
2021-06-17T14:32:18
2021-06-10T06:12:00
HTML
UTF-8
Java
false
false
585
java
package TestRunner; import org.junit.runner.RunWith; import io.cucumber.junit.Cucumber; import io.cucumber.junit.CucumberOptions; @RunWith(Cucumber.class) @CucumberOptions( features = {"src/test/resources/AppFeatures/openAccount.feature"},//path of feature file glue = {"StepDefinition","AppHooks"},//To execute pre defined steps plugin = {"pretty", "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:" },//Reporting monochrome=true//Clear console output //tags = "@smokeTest"//Differentiate test suit ) public class Runner { }
[ "Pavans@DESKTOP-I3EVCHO" ]
Pavans@DESKTOP-I3EVCHO
c343dd36ba100304add6deee47b910fa557867f2
470abdfc8b37c679a43428262ce0ae6ca2a2c80e
/Code/misc/original_java/WeigtedCS/WeigtedCS/src/Parser.java
9401726f88c7d8522e5529a21720bd3dd283a3e0
[]
no_license
mynew3/CS591-Social-Networks
ede6b8ca0e712fe6219bae4919e2800865a5e72c
ef73e75abb250cfcaa2f97a3ac1ceeb45735ab9d
refs/heads/master
2021-01-12T05:54:38.777127
2016-12-21T05:05:58
2016-12-21T05:05:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,812
java
import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.HashSet; import java.util.Scanner; //import org.jgraph.graph.DefaultEdge; import org.jgrapht.UndirectedGraph; import org.jgrapht.graph.DefaultWeightedEdge; import org.jgrapht.graph.SimpleGraph; import org.jgrapht.graph.SimpleWeightedGraph; import entity.Edge; import entity.Network; import entity.Node; public class Parser { public static Network getGraph(String filepath){ File file = new File(filepath); Scanner scaner = null; try { scaner = new Scanner(file); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } Network g = new Network(Edge.class); //UndirectedGraph<Node, Integer> g = new SimpleGraph<Node, Integer>(Integer.class); //ArrayList<Node> allNods = new ArrayList<Node>(); //for(int i = 1; i <= numberOfNodes; i++){ //allNods.add(new Node(i)); // g.addVertex(i); //} //g.vertexSet().addAll(allNods); String line =""; String[] data; Integer v1, v2;double w; DefaultWeightedEdge e; Integer edgeId = 0; while(scaner.hasNext()){ line = scaner.nextLine().trim(); if(line.startsWith("#") || line.startsWith("*")) continue; data = line.split(" "); v1 = Integer.parseInt(data[0]); v2 = Integer.parseInt(data[1]); w = Double.parseDouble(data[2]); if(!g.containsVertex(v1)){ g.addVertex(v1); if(v1 > g.maxNodeId) g.maxNodeId = v1; } if(!g.containsVertex(v2)){ g.addVertex(v2); if(v2 > g.maxNodeId) g.maxNodeId = v2; } if(v1.equals(v2)) continue; e = new Edge(edgeId); boolean add = g.addEdge(v1, v2, (Edge)e); g.setEdgeWeight((Edge)e, w); if(add) edgeId++; } return g; } }
[ "mikhail.andreev@pemicro.com" ]
mikhail.andreev@pemicro.com
099a22422a3d42f140c08e63358f9483145357b8
e5431a10d8a82b382fa586724be9f804041fa0fe
/gaia-core/src/main/java/gaia/api/ACLFilteringResource.java
8910d26feb70d3829963608933ec90cbf3ca136d
[]
no_license
whlee21/gaia
65ca1a45e3c85ac0a368a94827e53cf73834d48b
9abcb86b7c2ffc33c39ec1cf66a25e9d2144aae0
refs/heads/master
2022-12-26T14:06:44.067143
2014-05-19T16:15:47
2014-05-19T16:15:47
14,943,649
2
0
null
2022-12-14T20:22:44
2013-12-05T04:16:26
Java
UTF-8
Java
false
false
1,054
java
package gaia.api; import java.io.IOException; import java.util.Map; import javax.xml.parsers.ParserConfigurationException; import javax.xml.xpath.XPathExpressionException; import org.quartz.SchedulerException; import org.restlet.resource.Delete; import org.restlet.resource.Get; import org.restlet.resource.Post; import org.restlet.resource.Put; import org.w3c.dom.DOMException; import org.xml.sax.SAXException; public interface ACLFilteringResource { @Get("json") public Map<String, Object> retrieve(); @Delete public void remove() throws DOMException, XPathExpressionException, IOException, ParserConfigurationException, SAXException, SchedulerException; @Post("json") public void create(Map<String, Object> paramMap) throws DOMException, XPathExpressionException, IOException, ParserConfigurationException, SAXException, SchedulerException; @Put("json") public void update(Map<String, Object> paramMap) throws DOMException, XPathExpressionException, IOException, ParserConfigurationException, SAXException, SchedulerException; }
[ "whlee21@gmail.com" ]
whlee21@gmail.com
7e5e8c49e673ee08165d8ead534fc4651557c866
420623cf22e43935322e6e81d4aeadba4cde4ba2
/src/main/java/com/BootcampFirstChallenge/BootcampFirstChallenge/Exception/Client/ClientException.java
382bcca16fa519a87f6ee1f73f4a5d51aeac888d
[]
no_license
csantoyoMeli/Desafio01
d4254fce70a82b3ec609afd3c10100ee13c50f7e
1e2978648c2cd53dd2fbac4866d4b92a60055d0c
refs/heads/main
2023-04-05T01:08:59.879477
2021-04-14T23:54:08
2021-04-14T23:54:08
355,238,515
0
0
null
2021-04-14T23:54:12
2021-04-06T15:26:07
Java
UTF-8
Java
false
false
1,033
java
package com.BootcampFirstChallenge.BootcampFirstChallenge.Exception.Client; import lombok.Data; import java.io.IOException; @Data public class ClientException extends IOException { public static final String INVALID_INPUT = "INVALID_INPUT"; public static final String INVALID_INPUT_MSG = "No es posible procesar alguno de los parametros"; public static final String CLIENT_COULD_NOT_BE_FOUND = "CLIENT_COULD_NOT_BE_FOUND"; public static final String CLIENT_COULD_NOT_BE_FOUND_MSG = "No se pudo encontrar el cliente"; public static final String VALUES_REQUIRED = "VALUES_REQUIRED"; public static final String VALUES_REQUIRED_MSG = "Hacen faltan valores necesarios para la operación"; public static final String CLIENT_ALREADY_EXISTS = "CLIENT_ALREADY_EXISTS"; public static final String CLIENT_ALREADY_EXISTS_MSG = "El ID que se ha ingresado ya existe"; private String code; public ClientException(String code, String message) { super(message); this.code = code; } }
[ "cristian.santoyo@mercadolibre.com.co" ]
cristian.santoyo@mercadolibre.com.co
6425d816ac40d840f9835752d8799030b5a8013b
5b7b43aa387a9d4a4a4850bf187012ac3b18f7f8
/src/test/java/com/lizhehui/common/test/RandomTest.java
29e1f9db5590d2589e4eb57f9f7a093f2639222d
[]
no_license
lizhehuiX/lizhehui-common-6.17
dd25056cb8eb766beec4df7275bad6eb6d110864
43c063d7e405262f9395d4cb1fb4da3feda6490a
refs/heads/master
2022-12-23T10:28:56.057103
2019-09-09T06:25:01
2019-09-09T06:25:01
192,257,984
0
0
null
2022-12-16T09:10:39
2019-06-17T01:58:01
Java
UTF-8
Java
false
false
1,891
java
package com.lizhehui.common.test; import org.junit.Test; import com.lizhehui.common.utils.RandomUtil; /** * <br> * Title:TODO 类标题 <br> * Description:测试 类功能描述 <br> * Author:李哲辉(1989773396@qq.com) <br> * Date:2019年6月17日 */ //@ContextConfiguration(locations = "classpath:spring-beans.xml") //@RunWith(SpringJUnit4ClassRunner.class) public class RandomTest { /** * <br> * Description:获取随机数 方法功能描述 <br> * Author:李哲辉(1989773396@qq.com) <br> * Date:2019年6月17日 */ @Test public void random() { for (int i = 0; i < 5; i++) { System.out.println(RandomUtil.random(1, 6)); } } /** * <br> * Description:获取N个不重复的随机数 方法功能描述 <br> * Author:李哲辉(1989773396@qq.com) <br> * Date:2019年6月17日 */ @Test public void subRandom() { for (int i = 0; i < 5; i++) { System.out.println(RandomUtil.subRandom(1, 10, 9)); } } /** * <br> * Description:返回1个1-9,a-Z之间的随机字符<br> * Author:李哲辉(1989773396@qq.com) <br> * Date:2019年6月17日 */ @Test public void randomCharacter() { for (int i = 0; i < 5; i++) { System.out.println(RandomUtil.randomCharacter()); } } /** * <br> * Description:返回长度为N的随机字符串<br> * Author:李哲辉(1989773396@qq.com) <br> * Date:2019年6月17日 */ @Test public void randomString() { for (int i = 0; i < 5; i++) { System.out.println(RandomUtil.randomString(4)); } } /* * @Test public void aa() { * * String str = "123456789qazwsxedcrfvtgbyhnujmikolpQAZWSXEDCRFVTGBYHNUJMIKOLP"; * System.out.println(str.length()); * * SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); * System.out.println(new Date() + s.format(new Date())); } */ }
[ "1989773396@qq.com" ]
1989773396@qq.com
5b363a87201946ac0dc99cb1e9734c8850e872ba
a4619d491ad92965cd87cf9781e8625dbbc9f60d
/app/src/main/java/com/veloeye/model/data/AddBikeResponse.java
ae8296e07cd32513cffef955a562cd214f111bf6
[]
no_license
anchu-jossy/VeloeyeProject
a866fe14a762c936978941277b05555e98673b5b
9ea36dc5fe8893d989144473ebf4e4b0d9031b48
refs/heads/master
2020-05-31T09:04:20.844526
2019-06-04T13:05:34
2019-06-04T13:05:34
190,203,015
0
0
null
null
null
null
UTF-8
Java
false
false
1,807
java
package com.veloeye.model.data; import android.os.Parcel; import android.os.Parcelable; /** * Created by Florin Mihalache on 17.09.2015. */ public class AddBikeResponse implements Parcelable { private String response; private String bikeid; private String status; private String userid; protected AddBikeResponse(Parcel in) { response = in.readString(); bikeid = in.readString(); status = in.readString(); userid = in.readString(); } public static final Creator<AddBikeResponse> CREATOR = new Creator<AddBikeResponse>() { @Override public AddBikeResponse createFromParcel(Parcel in) { return new AddBikeResponse(in); } @Override public AddBikeResponse[] newArray(int size) { return new AddBikeResponse[size]; } }; public String getResponse() { return response; } public void setResponse(String response) { this.response = response; } public String getBikeid() { return bikeid; } public void setBikeid(String bikeid) { this.bikeid = bikeid; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getUserid() { return userid; } public void setUserid(String userid) { this.userid = userid; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(response); dest.writeString(bikeid); dest.writeString(status); dest.writeString(userid); } }
[ "manu@numeroeins.com" ]
manu@numeroeins.com
55f07342b165006b5fde80731eea99bcca7c2e3c
cdc764b57e8e8df532d123c6b1d966d625a65bcd
/Tps/p1/p1e4/Main.java
ee1df3888cc0cf9553a07420df9787c5ec54773a
[]
no_license
mmoauro/Programacion2-2020
5f43b13e900fdada2b3a1c7f1d143559e99948a8
8007b97ce0350f093f5020202efd61dc3701270a
refs/heads/master
2023-01-04T11:18:47.803860
2020-11-05T18:45:04
2020-11-05T18:45:04
289,585,324
0
0
null
null
null
null
UTF-8
Java
false
false
341
java
package p1e4; public class Main { public static void main(String[] args) { Jugador baru = new Jugador("Manuel"); EstablecimientoDeportivo nahuel = new EstablecimientoDeportivo(); for (int i = 0; i < 6; i++) { nahuel.reservarPaddle(baru); nahuel.reservarFutbol(baru); } } }
[ "manuelmoauro1@gmail.com" ]
manuelmoauro1@gmail.com
50d0b2236c309b8f85b33050789782adf612a36d
974c1d0a142c43bda71fd6ae77dc3009a4d3e126
/src/main/java/com/example/lesson17/HomeController.java
53e3ec386ebf4246fe572191672d18aa95d003d2
[]
no_license
josmyJJ/SpringBoot_22AutoloadData
ebc384d0a09de862ccbd9c929188f7241e649047
e686139ccc83b04ec83cfff9282b6ce1d5193739
refs/heads/master
2020-03-23T08:36:47.596916
2019-02-11T18:51:36
2019-02-11T18:51:36
141,336,597
1
1
null
null
null
null
UTF-8
Java
false
false
1,630
java
package com.example.lesson17; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import javax.validation.Valid; @Controller public class HomeController { @Autowired private UserService userService; @RequestMapping("/") public String index(){ return "index"; } @RequestMapping("/login") public String login(){ return "login"; } // @RequestMapping("/admin") // public String admin(){ // return "admin"; // } @RequestMapping("/secure") public String secure(){ return "secure"; } @RequestMapping(value = "/register", method = RequestMethod.GET) public String showRegistrationPage(Model model){ model.addAttribute("user", new User()); return "registration"; } @RequestMapping(value = "/register", method = RequestMethod.POST) public String processRegistrationPage( @Valid @ModelAttribute("user") User user, BindingResult result, Model model){ model.addAttribute("user", user); if(result.hasErrors()){ return "registration"; }else{ userService.saveUser(user); model.addAttribute("message", "User Account Successfully Created"); } return "index"; } }
[ "josemyjoseph@gmail.com" ]
josemyjoseph@gmail.com
2346f3191cd5a06f6914b46c18d198db16a87cb2
331b37887ffdbb32e2ddb54d66ee04481efa7da7
/AbstractFactory/listfactory/ListTray.java
5420453addc4b47392b45f67feaece785bf15b56
[]
no_license
neodes-h/DesignPatternTest
32041fd6966b1a55532650e5e13544d55906e65b
97c4b53e35737c0208f27f7d6cd0d347a0a5dca3
refs/heads/master
2021-11-25T21:35:50.341622
2018-09-20T17:55:07
2018-09-20T17:55:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
504
java
package listfactory; import factory.Item; import factory.Tray; public class ListTray extends Tray { public ListTray(String caption) { super(caption); } @Override public String makeHTML() { StringBuffer buffer = new StringBuffer(); buffer.append("<li>\n"); buffer.append(this.caption + "\n"); buffer.append("<ul>\n"); for(Item item : this.tray) { buffer.append(item.makeHTML()); } buffer.append("</ul>\n</li>\n"); return buffer.toString(); } }
[ "haoyixian1994@hotmail.com" ]
haoyixian1994@hotmail.com
56029b9b7ef3c46ac077b7710b91cbd759201dfb
3c8797e1ccc694648600162424044e7686f949e2
/core/src/main/java/cn/seclover/zyf/base/tips/Tip.java
a0919cc81a8c497ee5c19624b9c2fabb3777127d
[]
no_license
huangjiyong/seclover
bb0dceaaa758313a1e37c2d7f888c76a1e5ec119
309c425975d504a6dc4a03ad0cf16914d2a59b4a
refs/heads/master
2020-08-03T16:20:05.145108
2018-07-26T10:56:26
2018-07-26T10:56:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
460
java
package cn.seclover.zyf.base.tips; /** * 返回给前台的提示(最终转化为json形式) */ public abstract class Tip { protected int code; protected String message; public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
[ "844255243@qq.com" ]
844255243@qq.com
477a78fd68a6f99f4773ed278e5aa02b6e575a7a
bebfdd1bd5691ddf635b8f3e46be6b095b8d3f43
/android/app/src/main/java/net/droidlabs/audio/ogg/OggStreamPlayer.java
5644da26bc11c0076b9ed9ca73187cb8efb1990d
[]
no_license
jankobarjan/Feather-radio
cbf2a74fe323ff119cc0cc54de8752c43a55b461
51ab19c6150fd2d489c4d63a94c71933c603fce4
refs/heads/master
2021-08-31T06:05:47.350818
2017-12-20T13:46:36
2017-12-20T13:46:36
112,489,820
0
0
null
null
null
null
UTF-8
Java
false
false
26,687
java
package net.droidlabs.audio.ogg; /* * Based on Jon Kristensen JOrbis tutorial * * 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. */ import android.media.AudioFormat; import android.media.AudioManager; import android.media.AudioTrack; import android.util.Log; import com.jcraft.jogg.Packet; import com.jcraft.jogg.Page; import com.jcraft.jogg.StreamState; import com.jcraft.jogg.SyncState; import com.jcraft.jorbis.Block; import com.jcraft.jorbis.Comment; import com.jcraft.jorbis.DspState; import com.jcraft.jorbis.Info; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.net.UnknownServiceException; import static pl.kobarjan.featherradio.RadioController.radioRun; /** * The <code>OggStreamPlayer</code> thread class will simply download and play * OGG media. All you need to do is supply a valid URL as the first argument. */ public class OggStreamPlayer { public boolean shutdown = false; public static final String TAG = OggStreamPlayer.class.getSimpleName(); // If you wish to debug this source, please set the variable below to true. private final boolean debugMode = true; /* * URLConnection and InputStream objects so that we can open a connection to * the media file. */ private URLConnection urlConnection = null; private InputStream inputStream = null; /* * We need a buffer, it's size, a count to know how many bytes we have read * and an index to keep track of where we are. This is standard networking * stuff used with read(). */ byte[] buffer = null; int bufferSize = 2048; int count = 0; int index = 0; /* * JOgg and JOrbis require fields for the converted buffer. This is a buffer * that is modified in regards to the number of audio channels. Naturally, * it will also need a size. */ byte[] convertedBuffer; int convertedBufferSize; // A three-dimensional an array with PCM information. private float[][][] pcmInfo; // The index for the PCM information. private int[] pcmIndex; // Here are the four required JOgg objects... private Packet joggPacket; private Page joggPage; private StreamState joggStreamState; private SyncState joggSyncState; // ... followed by the four required JOrbis objects. private DspState jorbisDspState; private Block jorbisBlock; private Comment jorbisComment; private Info jorbisInfo; private AudioTrack track; private boolean isStopped = false; private OggStreamPlayerCallback playerCallback; public OggStreamPlayer(OggStreamPlayerCallback playerCallback) { this.playerCallback = playerCallback; } public OggStreamPlayer() { this(null); } /** * Given a string, <code>getUrl()</code> will return an URL object. * * @param url the URL to be opened * @return the URL object */ public void play(String url) { play(getUrl(url)); } public void play(URL url) { isStopped = false; if (playerCallback != null) { playerCallback.playerStarted(); } joggStreamState = new StreamState(); joggSyncState = new SyncState(); // ... followed by the four required JOrbis objects. jorbisDspState = new DspState(); jorbisBlock = new Block(jorbisDspState); jorbisComment = new Comment(); jorbisInfo = new Info(); joggPacket = new Packet(); joggPage = new Page(); configureInputStream(url); playImpl(); } public void playAsync(String url) { playAsync(getUrl(url)); } public void playAsync(final URL url) { new Thread(new Runnable() { public void run() { try { play(url); if(shutdown == false){ radioRun(); } } catch (Exception e) { Log.e(TAG, "playAsync():", e); if (playerCallback != null) { playerCallback.playerException( e ); } } } }).start(); } public void stop() { isStopped = true; } private URL getUrl(String pUrl) { URL url = null; try { url = new URL(pUrl); } catch (MalformedURLException exception) { Log.e(TAG, "Malformed \"url\" parameter: \"" + pUrl + "\""); } return url; } /** * Sets the <code>inputStream</code> object by taking an URL, opens a * connection to it and get the <code>InputStream</code>. * * @param pUrl the url to the media file */ private void configureInputStream(URL pUrl) { // Try to open a connection to the URL. try { urlConnection = pUrl.openConnection(); } catch (UnknownServiceException exception) { Log.e(TAG, "The protocol does not support input."); } catch (IOException exception) { Log.e(TAG, "An I/O error occoured while trying create the " + "URL connection."); } // If we have a connection, try to create an input stream. if (urlConnection != null) { try { inputStream = urlConnection.getInputStream(); } catch (IOException exception) { Log.e(TAG, "An I/O error occoured while trying to get an " + "input stream from the URL."); //Log.e(TAG, exception); } } } /** * This method is probably easiest understood by looking at the body. * However, it will - if no problems occur - call methods to initialize the * JOgg JOrbis libraries, read the header, initialize the sound system, read * the body of the stream and clean up. */ private void playImpl() { // Check that we got an InputStream. if (inputStream == null) { Log.e(TAG, "We don't have an input stream and therefor cannot continue."); return; } // Initialize JOrbis. initializeJOrbis(); /* * If we can read the header, we try to inialize the sound system. If we * could initialize the sound system, we try to read the body. */ if (readHeader()) { if (initializeSound()) { readBody(); } } // Afterwards, we clean up. cleanUp(); if (playerCallback != null) { playerCallback.playerStopped(); } } /** * Initializes JOrbis. First, we initialize the <code>SyncState</code> * object. After that, we prepare the <code>SyncState</code> buffer. Then * we "initialize" our buffer, taking the data in <code>SyncState</code>. */ private void initializeJOrbis() { debugOutput("Initializing JOrbis."); // Initialize SyncState joggSyncState.init(); // Prepare the to SyncState internal buffer joggSyncState.buffer(bufferSize); /* * Fill the buffer with the data from SyncState's internal buffer. Note * how the size of this new buffer is different from bufferSize. */ buffer = joggSyncState.data; debugOutput("Done initializing JOrbis."); } /** * This method reads the header of the stream, which consists of three * packets. * * @return true if the header was successfully read, false otherwise */ private boolean readHeader() { debugOutput("Starting to read the header."); /* * Variable used in loops below. While we need more data, we will * continue to read from the InputStream. */ boolean needMoreData = true; /* * We will read the first three packets of the header. We start off by * defining packet = 1 and increment that value whenever we have * successfully read another packet. */ int packet = 1; /* * While we need more data (which we do until we have read the three * header packets), this loop reads from the stream and has a big * <code>switch</code> statement which does what it's supposed to do in * regards to the current packet. */ while (needMoreData) { // Read from the InputStream. try { count = inputStream.read(buffer, index, bufferSize); } catch (IOException exception) { Log.e(TAG, "Could not read from the input stream."); } // We let SyncState know how many bytes we read. joggSyncState.wrote(count); /* * We want to read the first three packets. For the first packet, we * need to initialize the StreamState object and a couple of other * things. For packet two and three, the procedure is the same: we * take out a page, and then we take out the packet. */ switch (packet) { // The first packet. case 1: { // We take out a page. switch (joggSyncState.pageout(joggPage)) { // If there is a hole in the data, we must exit. case -1: { Log.e(TAG, "There is a hole in the first packet data."); return false; } // If we need more data, we break to get it. case 0: { break; } /* * We got where we wanted. We have successfully read the * first packet, and we will now initialize and reset * StreamState, and initialize the Info and Comment * objects. Afterwards we will check that the page * doesn't contain any errors, that the packet doesn't * contain any errors and that it's Vorbis data. */ case 1: { // Initializes and resets StreamState. joggStreamState.init(joggPage.serialno()); joggStreamState.reset(); // Initializes the Info and Comment objects. jorbisInfo.init(); jorbisComment.init(); // Check the page (serial number and stuff). if (joggStreamState.pagein(joggPage) == -1) { Log.e(TAG, "We got an error while reading the first header page."); return false; } /* * Try to extract a packet. All other return values * than "1" indicates there's something wrong. */ if (joggStreamState.packetout(joggPacket) != 1) { Log.e(TAG, "We got an error while reading the first header packet."); return false; } /* * We give the packet to the Info object, so that it * can extract the Comment-related information, * among other things. If this fails, it's not * Vorbis data. */ if (jorbisInfo.synthesis_headerin(jorbisComment, joggPacket) < 0) { Log.e(TAG, "We got an error while interpreting the first packet. Apparantly, it's not Vorbis data."); return false; } // We're done here, let's increment "packet". packet++; break; } } /* * Note how we are NOT breaking here if we have proceeded to * the second packet. We don't want to read from the input * stream again if it's not necessary. */ if (packet == 1) break; } // The code for the second and third packets follow. case 2: case 3: { // Try to get a new page again. switch (joggSyncState.pageout(joggPage)) { // If there is a hole in the data, we must exit. case -1: { Log.e(TAG, "There is a hole in the second or third packet data."); return false; } // If we need more data, we break to get it. case 0: { break; } /* * Here is where we take the page, extract a packet and * and (if everything goes well) give the information to * the Info and Comment objects like we did above. */ case 1: { // Share the page with the StreamState object. joggStreamState.pagein(joggPage); /* * Just like the switch(...packetout...) lines * above. */ switch (joggStreamState.packetout(joggPacket)) { // If there is a hole in the data, we must exit. case -1: { Log.e(TAG, "There is a hole in the first packet data."); return false; } // If we need more data, we break to get it. case 0: { break; } // We got a packet, let's process it. case 1: { /* * Like above, we give the packet to the * Info and Comment objects. */ jorbisInfo.synthesis_headerin(jorbisComment, joggPacket); // Increment packet. packet++; if (packet == 4) { /* * There is no fourth packet, so we will * just end the loop here. */ needMoreData = false; } break; } } break; } } break; } } // We get the new index and an updated buffer. index = joggSyncState.buffer(bufferSize); buffer = joggSyncState.data; /* * If we need more data but can't get it, the stream doesn't contain * enough information. */ if (count == 0 && needMoreData) { Log.e(TAG, "Not enough header data was supplied."); return false; } } debugOutput("Finished reading the header."); return true; } /** * This method starts the sound system. It starts with initializing the * <code>DspState</code> object, after which it sets up the * <code>Block</code> object. Last but not least, it opens a line to the * source data line. * * @return true if the sound system was successfully started, false * otherwise */ private boolean initializeSound() { debugOutput("Initializing the sound system."); // This buffer is used by the decoding method. convertedBufferSize = bufferSize * 2; convertedBuffer = new byte[convertedBufferSize]; // Initializes the DSP synthesis. jorbisDspState.synthesis_init(jorbisInfo); // Make the Block object aware of the DSP. jorbisBlock.init(jorbisDspState); // Wee need to know the channels and rate. int channels = jorbisInfo.channels; int rate = jorbisInfo.rate; int minimumBufferSize; if (channels == 1) { minimumBufferSize = AudioTrack.getMinBufferSize(rate, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT); track = new AudioTrack(AudioManager.STREAM_MUSIC, rate, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT, bufferSize < minimumBufferSize ? minimumBufferSize : bufferSize , AudioTrack.MODE_STREAM); } else { minimumBufferSize = AudioTrack.getMinBufferSize(rate, AudioFormat.CHANNEL_OUT_STEREO, AudioFormat.ENCODING_PCM_16BIT); track = new AudioTrack(AudioManager.STREAM_MUSIC, rate, AudioFormat.CHANNEL_OUT_STEREO, AudioFormat.ENCODING_PCM_16BIT, bufferSize < minimumBufferSize ? minimumBufferSize : bufferSize, AudioTrack.MODE_STREAM); } track.play(); /* * We create the PCM variables. The index is an array with the same * length as the number of audio channels. */ pcmInfo = new float[1][][]; pcmIndex = new int[jorbisInfo.channels]; debugOutput("Done initializing the sound system."); return true; } /** * This method reads the entire stream body. Whenever it extracts a packet, * it will decode it by calling <code>decodeCurrentPacket()</code>. */ private void readBody() { debugOutput("Reading the body."); /* * Variable used in loops below, like in readHeader(). While we need * more data, we will continue to read from the InputStream. */ boolean needMoreData = true; while (needMoreData && isStopped == false) { switch (joggSyncState.pageout(joggPage)) { // If there is a hole in the data, we just proceed. case -1: { debugOutput("There is a hole in the data. We proceed."); } // If we need more data, we break to get it. case 0: { break; } // If we have successfully checked out a page, we continue. case 1: { // Give the page to the StreamState object. joggStreamState.pagein(joggPage); // If granulepos() returns "0", we don't need more data. if (joggPage.granulepos() == 0) { needMoreData = false; break; } // Here is where we process the packets. processPackets: while (true) { switch (joggStreamState.packetout(joggPacket)) { // Is it a hole in the data? case -1: { debugOutput("There is a hole in the data, we continue though."); } // If we need more data, we break to get it. case 0: { break processPackets; } /* * If we have the data we need, we decode the * packet. */ case 1: { decodeCurrentPacket(); } } } /* * If the page is the end-of-stream, we don't need more * data. */ if (joggPage.eos() != 0) needMoreData = false; } } // If we need more data... if (needMoreData) { // We get the new index and an updated buffer. index = joggSyncState.buffer(bufferSize); buffer = joggSyncState.data; // Read from the InputStream. try { count = inputStream.read(buffer, index, bufferSize); } catch (Exception e) { return; } // We let SyncState know how many bytes we read. joggSyncState.wrote(count); // There's no more data in the stream. if (count == 0) needMoreData = false; } } debugOutput("Done reading the body."); } /** * A clean-up method, called when everything is finished. Clears the * JOgg/JOrbis objects and closes the <code>InputStream</code>. */ private void cleanUp() { debugOutput("Cleaning up."); // Clear the necessary JOgg/JOrbis objects. joggStreamState.clear(); jorbisBlock.clear(); jorbisDspState.clear(); jorbisInfo.clear(); joggSyncState.clear(); track.stop(); urlConnection = null; // Closes the stream. try { if (inputStream != null) inputStream.close(); inputStream = null; } catch (Exception e) { } buffer = null; bufferSize = 2048; count = 0; index = 0; convertedBuffer = null; convertedBufferSize = 0; pcmInfo = null; pcmIndex = null; debugOutput("Done cleaning up."); } /** * Decodes the current packet and sends it to the audio output line. */ private void decodeCurrentPacket() { int samples; // Check that the packet is a audio data packet etc. if (jorbisBlock.synthesis(joggPacket) == 0) { // Give the block to the DspState object. jorbisDspState.synthesis_blockin(jorbisBlock); } // We need to know how many samples to process. int range; /* * Get the PCM information and count the samples. And while these * samples are more than zero... */ while ((samples = jorbisDspState.synthesis_pcmout(pcmInfo, pcmIndex)) > 0) { // We need to know for how many samples we are going to process. if (samples < convertedBufferSize) { range = samples; } else { range = convertedBufferSize; } // For each channel... for (int i = 0; i < jorbisInfo.channels; i++) { int sampleIndex = i * 2; // For every sample in our range... for (int j = 0; j < range; j++) { /* * Get the PCM value for the channel at the correct * position. */ int value = (int) (pcmInfo[0][i][pcmIndex[i] + j] * 32767); /* * We make sure our value doesn't exceed or falls below * +-32767. */ if (value > 32767) { value = 32767; } if (value < -32768) { value = -32768; } /* * It the value is less than zero, we bitwise-or it with * 32768 (which is 1000000000000000 = 10^15). */ if (value < 0) value = value | 32768; /* * Take our value and split it into two, one with the last * byte and one with the first byte. */ convertedBuffer[sampleIndex] = (byte) (value); convertedBuffer[sampleIndex + 1] = (byte) (value >>> 8); /* * Move the sample index forward by two (since that's how * many values we get at once) times the number of channels. */ sampleIndex += 2 * (jorbisInfo.channels); } } // Write the buffer to the audio output line. track.write(convertedBuffer, 0, 2 * jorbisInfo.channels * range); jorbisDspState.synthesis_read(range); } } /** * This method is being called internally to output debug information * whenever that is wanted. * * @param output the debug output information */ private void debugOutput(String output) { if (debugMode) { Log.d(TAG, "Debug: " + output); } } public void setPlayerCallback(OggStreamPlayerCallback playerCallback) { this.playerCallback = playerCallback; } }
[ "kobarjan@onet.pl" ]
kobarjan@onet.pl
0a4d5dc8e85f4c0a932bc9d0802b50f0eeda1408
d81f7b20029d0bc72a61e9a6d5b429a054c5832f
/src/test/java/lastminute/FlightsSearch/AppModelTest.java
19e09802e3301a187337c8dc92ae07ee1a43b3ea
[]
no_license
vanessaCantalapiedra/LastMinuteAssignment
ecf01b70ba5597b8bb42986f879de31bfdba9a27
c6132fe57fca83f8ab81b0c4acc72cdeeae9dac2
refs/heads/master
2020-12-24T11:36:39.598244
2016-08-05T18:05:56
2016-08-05T18:05:56
65,036,735
0
0
null
null
null
null
UTF-8
Java
false
false
1,209
java
package lastminute.FlightsSearch; import static org.junit.Assert.*; import java.io.File; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.ArrayList; import org.junit.Before; import org.junit.Test; import lastminute.FlightsSearch.data.FlightInfo; public class AppModelTest { private AppModel myAppModel = new AppModel(); private String filePath = "flights.txt"; @Before public void setUp() throws Exception { assertTrue(myAppModel.fillData(filePath)); } @Test public void testGetAvailableFlights() { ArrayList<FlightInfo> list = myAppModel.getAvailableFlights("CPH", "FCO"); FlightInfo [] resultExpected = new FlightInfo[2]; resultExpected[0] = new FlightInfo("FCO","TK4667","137"); boolean ok = false; if ( resultExpected[0].getDestAirport().equals(list.get(0).getDestAirport()) && resultExpected[0].getFlightCode().equals(list.get(0).getFlightCode()) && resultExpected[0].getPrice()== list.get(0).getPrice() ) { ok = true; } assertTrue(ok); } @Test public void testFillData() { File file = new File(this.getClass().getClassLoader().getResource("flights.txt").getPath()); assertTrue(file.exists()); } }
[ "vanessa.cantalapiedra@gmail.com" ]
vanessa.cantalapiedra@gmail.com
9b476a8d7b3cf71611cb1b9e1c9d17b2387db4fa
c2ede43a279259fbe24874c338f6e486b0549f7a
/packages/internal/distributedWekaBase/src/main/java/weka/distributed/CorrelationMatrixRowReduceTask.java
dd8462013897189e429c0ea93c98451e8b00f66d
[]
no_license
TheSengers/Weka
d9835b820a5c2c13a44d964f597dfa28a148ceac
7343ff0fb79abc66ede700e13084ce49c3d2a535
refs/heads/master
2016-09-05T19:56:45.859905
2014-03-25T15:08:44
2014-03-25T15:08:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,903
java
/* * This program 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/>. */ /* * CorrelationMatrixMapTask.java * Copyright (C) 2013 University of Waikato, Hamilton, New Zealand * */ package weka.distributed; import java.io.Serializable; import java.util.List; import weka.core.Attribute; import weka.core.Instances; import weka.core.Utils; import weka.distributed.CSVToARFFHeaderMapTask.ArffSummaryNumericMetric; import weka.filters.Filter; import weka.filters.unsupervised.attribute.Remove; /** * A reduce task that sums the incoming partial covariance sums for a given row * of the matrix and then computes the final correlation/ covariance values. * * @author Mark Hall (mhall{[at]}pentaho{[dot]}com) * @version $Revision: 10510 $ */ public class CorrelationMatrixRowReduceTask implements Serializable { /** For serialization */ private static final long serialVersionUID = -2314677791571204717L; /** * Aggregate a list of partial rows of the matrix. * * @param matrixRowNumber the index of the row in the matrix to be aggregated * @param toAggregate a list rows to be aggregated * @param coOccurrencesToAgg a list of co-occurrence counts to aggregate (will * be null if missings have been replaced with means) * @param headerWithSummaryAtts the header of the data (including summary * attributes) * @param missingsWereReplacedWithMeans true if missing values were replaced * by means in the map tasks * @param covarianceInsteadOfCorrelation final matrix is to be a covariance * one rather than correlation * @param deleteClassIfSet true if the class attribute is to be deleted (if * set) * @return the aggregated row * @throws DistributedWekaException if a problem occurs */ public double[] aggregate(int matrixRowNumber, List<double[]> toAggregate, List<int[]> coOccurrencesToAgg, Instances headerWithSummaryAtts, boolean missingsWereReplacedWithMeans, boolean covarianceInsteadOfCorrelation, boolean deleteClassIfSet) throws DistributedWekaException { StringBuilder rem = new StringBuilder(); Instances trainingHeader = CSVToARFFHeaderReduceTask .stripSummaryAtts(headerWithSummaryAtts); if (trainingHeader.classIndex() >= 0 && deleteClassIfSet) { rem.append("" + (trainingHeader.classIndex() + 1)).append(","); } // remove all nominal attributes for (int i = 0; i < trainingHeader.numAttributes(); i++) { if (!trainingHeader.attribute(i).isNumeric()) { rem.append("" + (i + 1)).append(","); } } if (rem.length() > 0) { Remove remove = new Remove(); rem.deleteCharAt(rem.length() - 1); // remove the trailing , String attIndices = rem.toString(); remove.setAttributeIndices(attIndices); remove.setInvertSelection(false); try { remove.setInputFormat(trainingHeader); trainingHeader = Filter.useFilter(trainingHeader, remove); } catch (Exception ex) { throw new DistributedWekaException(ex); } } Attribute origCorrespondingToRow = trainingHeader .attribute(matrixRowNumber); Attribute correspondingSummaryAtt = headerWithSummaryAtts .attribute(CSVToARFFHeaderMapTask.ARFF_SUMMARY_ATTRIBUTE_PREFIX + origCorrespondingToRow.name()); if (correspondingSummaryAtt == null) { throw new DistributedWekaException( "Was unable to find the summary stats attribute for " + "original attribute '" + origCorrespondingToRow.name() + "' corresponding to matrix row number: " + matrixRowNumber); } if (toAggregate.size() == 0) { throw new DistributedWekaException("Nothing to aggregate!"); } double[] aggregated = toAggregate.get(0).clone(); for (int i = 1; i < toAggregate.size(); i++) { double[] toAgg = toAggregate.get(i); for (int j = 0; j < toAgg.length; j++) { aggregated[j] += toAgg[j]; } } int[] coOccAgg = null; if (!missingsWereReplacedWithMeans) { coOccAgg = coOccurrencesToAgg.get(0).clone(); for (int i = 1; i < coOccurrencesToAgg.size(); i++) { int[] toAgg = coOccurrencesToAgg.get(i); for (int j = 0; j < toAgg.length; j++) { coOccAgg[j] += toAgg[j]; } } } // correlation or covariance? double[] statsForRowAtt = CSVToARFFHeaderReduceTask .attributeToStatsArray(correspondingSummaryAtt); for (int i = 0; i < aggregated.length; i++) { Attribute attI = trainingHeader.attribute(i); Attribute currespondingSummaryI = headerWithSummaryAtts .attribute(CSVToARFFHeaderMapTask.ARFF_SUMMARY_ATTRIBUTE_PREFIX + attI.name()); double[] statsForI = CSVToARFFHeaderReduceTask .attributeToStatsArray(currespondingSummaryI); // if missings were replaced then sum is divided by the total count (i.e. // count + #missing); otherwise use the co-occurrence count for rowAtt, // col i double denom = missingsWereReplacedWithMeans ? statsForRowAtt[ArffSummaryNumericMetric.COUNT .ordinal()] + statsForRowAtt[ArffSummaryNumericMetric.MISSING.ordinal()] : coOccAgg[i]; // Math // .min(statsForRowAtt[ArffSummaryNumericMetric.COUNT.ordinal()], // statsForI[ArffSummaryNumericMetric.COUNT.ordinal()]); if (covarianceInsteadOfCorrelation) { if (denom > 1) { aggregated[i] /= (denom - 1); } else { if (denom == 1) { aggregated[i] = Double.POSITIVE_INFINITY; } else { aggregated[i] = Utils.missingValue(); // never co-occurred } } } else { if (matrixRowNumber == i || denom <= 1) { if (missingsWereReplacedWithMeans) { aggregated[i] = 1.0; } else { aggregated[i] = Utils.missingValue(); // never co-occurred } } else { double sR = statsForRowAtt[ArffSummaryNumericMetric.STDDEV.ordinal()]; double sI = statsForI[ArffSummaryNumericMetric.STDDEV.ordinal()]; if (sR * sI > 0.0) { aggregated[i] = aggregated[i] / ((denom - 1) * sR * sI); } } } } return aggregated; } }
[ "bradm6@gmail.com" ]
bradm6@gmail.com
001d062217495971248aa261e7d3e7753c12e388
4a607c18a1bcbaa8adf865f0097716d02661f1b2
/shining-sys/src/main/java/com/sjy/shining/service/impl/SysLogServiceImpl.java
028261c4dc034dfb3b46488f01e2b773addf42a5
[]
no_license
sunjiyongtc0/ShiningMall
660472024a8d2e7a4bd801691020613b6998fea6
b161eb2a61f2e3dace5cfb5b7c4a0413f690bd53
refs/heads/master
2023-02-21T03:00:24.100779
2021-01-20T01:33:03
2021-01-20T01:33:03
329,852,700
0
1
null
null
null
null
UTF-8
Java
false
false
955
java
package com.sjy.shining.service.impl; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.sjy.shining.dao.SysLogDao; import com.sjy.shining.entity.SysLogEntity; import com.sjy.shining.service.SysLogService; import com.sjy.shining.utils.PageUtilsPlus; import com.sjy.shining.utils.QueryPlus; import org.springframework.stereotype.Service; import java.util.Map; /** * */ @Service("sysLogService") public class SysLogServiceImpl extends ServiceImpl<SysLogDao, SysLogEntity> implements SysLogService { @Override public PageUtilsPlus queryPage(Map<String, Object> params) { //排序 params.put("sidx", "create_date"); params.put("asc", false); Page<SysLogEntity> page = new QueryPlus<SysLogEntity>(params).getPage(); return new PageUtilsPlus(page.setRecords(baseMapper.selectSysLogPage(page, params))); } }
[ "315541219@qq.com" ]
315541219@qq.com
6b639b086f48dcca109298ab41013df7c700b6fb
bae89ec0779f5ffeffbbea16a4a8baa171c7f0e7
/ps-mdm/src/com/orchestranetworks/ps/googlemaps/addressstandardization/GoogleMapsConstant.java
b641adf4737ee9351b966d035111bd033ae7d055
[]
no_license
static-x03/compensarEBX
25eec424e24ee1bc32e6944f6e57f9658fa7e684
82bc89d7f64d666b8a8b78d4c4c3f11894a97ce7
refs/heads/main
2023-08-13T02:22:17.735874
2021-10-14T02:10:48
2021-10-14T02:10:48
416,941,464
0
0
null
null
null
null
UTF-8
Java
false
false
7,548
java
package com.orchestranetworks.ps.googlemaps.addressstandardization; public final class GoogleMapsConstant { public final class AddressComponents { public final class Type { public final static String LONG_NAME = "long_name"; public final static String SHORT_NAME = "short_name"; private Type() { } } public final static String STREET_NUMBER = "street_number";// street number public final static String ROUTE = "route"; public final static String LOCALITY = "locality";// city or town public final static String ADMINISTRATIVE_AREA_1 = "administrative_area_level_1";// state ISO 3166-2 public final static String COUNTRY = "country";// country ISO 3166-1 public final static String POSTAL_CODE = "postal_code";// zip code public final static String LAT = "lat"; public final static String LONG = "long"; public final static String FORMATTED_ADDRESS = "formatted_address"; public final static String PREMISE = "premise";// building name public final static String ADMINISTRATIVE_AREA_2 = "administrative_area_level_2";// county public final static String POSTAL_TOWN = "postal_town";// city/town of UK public final static String PLUS_CODE = "plus_code"; public final static String ROOM = "room"; public final static String INTERSECTION = "intersection"; public final static String COLLOQUIAL_AREA = "colloquial_area"; public final static String NEIGHBORHOOD = "neighborhood"; public final static String ADMINISTRATIVE_AREA_3 = "administrative_area_level_3"; public final static String ADMINISTRATIVE_AREA_4 = "administrative_area_level_4"; public final static String ADMINISTRATIVE_AREA_5 = "administrative_area_level_5"; public final static String POSTAL_CODE_SUFFIX = "postal_code_suffix"; public final static String POST_BOX = "post_box"; public final static String SUB_PREMISE = "subpremise"; public final static String POI = "point_of_interest"; public final static String SUBLOCALITY_LEVEL = "sublocality"; public final static String SUBLOCALITY_LEVEL_1 = "sublocality_level_1"; public final static String SUBLOCALITY_LEVEL_2 = "sublocality_level_2"; public final static String SUBLOCALITY_LEVEL_3 = "sublocality_level_3"; public final static String SUBLOCALITY_LEVEL_4 = "sublocality_level_4"; public final static String SUBLOCALITY_LEVEL_5 = "sublocality_level_5"; private AddressComponents() { } } public final class ControlPosition { public final static String BOTTOM_CENTER = "google.maps.ControlPosition.BOTTOM_CENTER"; public final static String BOTTOM_LEFT = "google.maps.ControlPosition.BOTTOM_LEFT"; public final static String BOTTOM_RIGHT = "google.maps.ControlPosition.BOTTOM_RIGHT"; public final static String LEFT_BOTTOM = "google.maps.ControlPosition.LEFT_BOTTOM"; public final static String LEFT_CENTER = "google.maps.ControlPosition.LEFT_CENTER"; public final static String LEFT_TOP = "google.maps.ControlPosition.LEFT_TOP"; public final static String RIGHT_BOTTOM = "google.maps.ControlPosition.RIGHT_BOTTOM"; public final static String RIGHT_CENTER = "google.maps.ControlPosition.RIGHT_CENTER"; public final static String RIGHT_TOP = "google.maps.ControlPosition.RIGHT_TOP"; public final static String TOP_CENTER = "google.maps.ControlPosition.TOP_CENTER"; public final static String TOP_LEFT = "google.maps.ControlPosition.TOP_LEFT"; public final static String TOP_RIGHT = "google.maps.ControlPosition.TOP_RIGHT"; private ControlPosition() { } } public final class Events { public final static String PLACE_CHANGED = "place_changed"; public final static String CLICK = "click"; public final static String DRAG_END = "dragend"; private Events() { } } public final class Icons { public final static String RED = "http://maps.google.com/mapfiles/ms/icons/red-dot.png"; public final static String BLUE = "http://maps.google.com/mapfiles/ms/icons/blue-dot.png"; public final static String GREEN = "http://maps.google.com/mapfiles/ms/icons/green-dot.png"; public final static String ORANGE = "http://maps.google.com/mapfiles/ms/icons/orange-dot.png"; public final static String PURPLE = "http://maps.google.com/mapfiles/ms/icons/purple-dot.png"; public final static String PINK = "http://maps.google.com/mapfiles/ms/icons/pink-dot.png"; public final static String YELLOW = "http://maps.google.com/mapfiles/ms/icons/yellow-dot.png"; private Icons() { } } public final class MapType { public final static String HYBRID = "google.maps.MapTypeId.HYBRID"; public final static String ROADMAP = "google.maps.MapTypeId.ROADMAP"; public final static String SATELLITE = "google.maps.MapTypeId.SATELLITE"; public final static String TERRAIN = "google.maps.MapTypeId.TERRAIN"; private MapType() { } } public final class Zoom { public final static String LEVEL_1 = "1"; public final static String LEVEL_2 = "2"; public final static String LEVEL_3 = "3"; public final static String LEVEL_4 = "4"; public final static String LEVEL_5 = "5"; public final static String LEVEL_6 = "6"; public final static String LEVEL_7 = "7"; public final static String LEVEL_8 = "8"; public final static String LEVEL_9 = "9"; public final static String LEVEL_10 = "10"; public final static String LEVEL_11 = "11"; public final static String LEVEL_12 = "12"; public final static String LEVEL_13 = "13"; public final static String LEVEL_14 = "14"; public final static String LEVEL_15 = "15"; public final static String LEVEL_16 = "16"; public final static String LEVEL_17 = "17"; public final static String LEVEL_18 = "18"; public final static String LEVEL_19 = "19"; public final static String LEVEL_20 = "20"; public final static String LEVEL_21 = "21"; public final static String MIN = Zoom.LEVEL_1; public final static String MAX = Zoom.LEVEL_21; public final static String DEFAULT = Zoom.LEVEL_2; public final static String DEFAULT_SINGLE_MARKER = Zoom.LEVEL_17; private Zoom() { } } public final class ZoomControlStyle { /** The Constant DEFAULT with value google.maps.ZoomControlStyle.DEFAULT. */ public final static String DEFAULT = "google.maps.ZoomControlStyle.DEFAULT"; /** The Constant LARGE with value google.maps.ZoomControlStyle.LARGE. */ public final static String LARGE = "google.maps.ZoomControlStyle.LARGE"; /** The Constant SMALL with value google.maps.ZoomControlStyle.SMALL. */ public final static String SMALL = "google.maps.ZoomControlStyle.SMALL"; private ZoomControlStyle() { } } public final static String JS_FUNCNAME_STANDARDIZE = JSPrefix.PREFIX + "standardize"; public final static String JS_FUNCNAME_FILL_IN_ADDRESS = JSPrefix.PREFIX + "fillInAddress"; public final static String JS_FUNCNAME_SET_EBX_VALUE = JSPrefix.PREFIX + "setEBXValue"; public final static String JS_FUNCNAME_GET_EBX_VALUE = JSPrefix.PREFIX + "getEBXValue"; public final static String JS_FUNCNAME_GEOLOCATE = JSPrefix.PREFIX + "geolocate"; public final static String JS_FUNCNAME_UPDATE_MAP = JSPrefix.PREFIX + "updateMap"; public final static String JS_FUNCNAME_REPLACE_MARKER = JSPrefix.PREFIX + "replaceMarker"; public final static String JS_FUNCNAME_CREATE_MARKER = JSPrefix.PREFIX + "createMarker"; public final static String JS_FUNCNAME_CREATE_GOOGLE_MAPS_ITEM = JSPrefix.PREFIX + "createGoogleMapsItem"; public final static String JS_FUNCNAME_GET_GEOCODE = JSPrefix.PREFIX + "getGeoCode"; public final static String JS_FUNCNAME_ADD_MARKERS_FROM_ITEMS = JSPrefix.PREFIX + "addMarkersFromItems"; }
[ "static-x03@hotmail.com" ]
static-x03@hotmail.com
ee61353e9d720f57c0f98c20aae0234b8d774290
7696aae71bcb7a20ace8fc3cfeac57b1098899fd
/LAB/src/Lab5/XuLi.java
37e4e412c39ace052741bdc0ee4523bd3f1fdad3
[]
no_license
PaulNguyen1998/Nguyen-Dinh-Tru-en
ab901cc546e9c8a212314e3cfdc57300e2ce30ca
90ba84a52ce01f3a50aab2ae71d7a92ab8165a7f
refs/heads/master
2021-01-07T01:41:00.146859
2020-03-10T00:51:22
2020-03-10T00:51:22
241,541,922
0
0
null
null
null
null
UTF-8
Java
false
false
2,233
java
package Lab5; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Scanner; public class XuLi { public static void main(String[] args) { // TODO Auto-generated method stub Scanner s = new Scanner(System.in); ArrayList<SanPham> SP = new ArrayList<SanPham>(); int option = 0; do { option = ShowMenu(s); switch (option) { case 1: ThemSanPham(s,SP); break; case 2: SapXepVaXuatDanhSach(SP); break; case 3: System.out.println(XoaSanPham(s, SP)); break; default: break; } } while (option != 4); } public static int ShowMenu(Scanner s) { System.out.println("1. Nhap danh sach san pham"); System.out.println("2. Sap xep giam dan theo theo gia"); System.out.println("3. Xoa san pham"); System.out.println("4. Ket thuc"); System.out.println(">."); return Integer.parseInt(s.nextLine()); } public static void ThemSanPham(Scanner s, ArrayList<SanPham> SP) { while (true) { System.out.println("Nhap ten san pham"); String tenSP = s.nextLine(); System.out.println("Nhap gia san pham"); int giaSP = Integer.parseInt(s.nextLine()); SP.add(new SanPham(tenSP,giaSP)); System.out.println("Nhap them Y/N"); if(s.nextLine().equals("N")) { break; } } } public static void SapXepVaXuatDanhSach(ArrayList<SanPham> listSP) { Collections.sort(listSP, (SanPham sp1, SanPham sp2) -> { return sp1.getGiaSP() > sp2.getGiaSP() ? -1 : 1; }); for (int i = 0; i < listSP.size(); i++) { System.out.println("----------------"); System.out.println("Ten san pham :" + listSP.get(i).getTenSP()); System.out.println("Gia san pham :" + listSP.get(i).getGiaSP()); } System.out.println("----------------"); } public static String XoaSanPham(Scanner sc, ArrayList<SanPham> listSP) { System.out.println("Nhap ten san pham can xoa: "); String name = sc.nextLine(); for (int i = 0; i < listSP.size(); i++) { if(name.equals(listSP.get(i).getTenSP())) { listSP.remove(i); return "Xoa thanh cong"; } } return "Xoa khong thanh cong"; } }
[ "noreply@github.com" ]
PaulNguyen1998.noreply@github.com
9334d3f7dd4dfe1c8c506d9531ce139ddf6b0b4a
bbae8b1a31cf67fa5109c98bd5f1f777642f2b0d
/src/AbstractMap.java
576a4f66ec78f8f2a809b04dfea90ad0253acd84
[]
no_license
dragos99/Data-Structures-in-Java
458c79ed1046509ba13549970fb542c89396565b
bbcffc65eb90fc56d19c9abcc9cb486e5542c749
refs/heads/master
2022-11-14T13:48:25.326556
2020-07-03T21:41:35
2020-07-03T21:41:35
276,991,707
0
0
null
null
null
null
UTF-8
Java
false
false
3,959
java
import java.util.Iterator; /** * An abstract base class to ease the implementation of the Map interface. * * The base class provides three means of support: 1) It provides an isEmpty * implementation based upon the abstract size() method. 2) It defines a * protected MapEntry class as a concrete implementation of the entry interface * 3) It provides implemenations of the keySet and values methods, based upon * use of a presumed implementation of the entrySet method. * */ public abstract class AbstractMap<K, V> implements Map<K, V> { /** * Tests whether the map is empty. * * @return true if the map is empty, false otherwise */ @Override public boolean isEmpty() { return size() == 0; } // ---------------- nested MapEntry class ---------------- /** * A concrete implementation of the Entry interface to be used within a Map * implementation. */ protected static class MapEntry<K, V> implements Entry<K, V> { private K k; // key private V v; // value public MapEntry(K key, V value) { k = key; v = value; } // public methods of the Entry interface public K getKey() { return k; } public V getValue() { return v; } // utilities not exposed as part of the Entry interface protected void setKey(K key) { k = key; } protected V setValue(V value) { V old = v; v = value; return old; } /** Returns string representation (for debugging only) */ public String toString() { return "<" + k + ", " + v + ">"; } } // ----------- end of nested MapEntry class ----------- // Provides support for keySet() and values() methods, based upon // the entrySet() method that must be provided by subclasses // ---------------- nested KeyIterator class ---------------- private class KeyIterator implements Iterator<K> { private Iterator<Entry<K, V>> entries = entrySet().iterator(); // reuse entrySet public boolean hasNext() { return entries.hasNext(); } public K next() { return entries.next().getKey(); } // return key! public void remove() { throw new UnsupportedOperationException("remove not supported"); } } // ----------- end of nested KeyIterator class ----------- // ---------------- nested KeyIterable class ---------------- private class KeyIterable implements Iterable<K> { public Iterator<K> iterator() { return new KeyIterator(); } public String toString() { String s = "["; for (Iterator<K> iter = iterator(); iter.hasNext();) { K k = iter.next(); s += k.toString(); if (iter.hasNext()) s += ", "; } s += "]"; return s; } } // ----------- end of nested KeyIterable class ----------- /** * Returns an iterable collection of the keys contained in the map. * * @return iterable collection of the map's keys */ @Override public Iterable<K> keySet() { return new KeyIterable(); } // ---------------- nested ValueIterator class ---------------- private class ValueIterator implements Iterator<V> { private Iterator<Entry<K, V>> entries = entrySet().iterator(); // reuse entrySet public boolean hasNext() { return entries.hasNext(); } public V next() { return entries.next().getValue(); } // return value! public void remove() { throw new UnsupportedOperationException("remove not supported"); } } // ----------- end of nested ValueIterator class ----------- // ---------------- nested ValueIterable class ---------------- private class ValueIterable implements Iterable<V> { public Iterator<V> iterator() { return new ValueIterator(); } } // ----------- end of nested ValueIterable class ----------- /** * Returns an iterable collection of the values contained in the map. Note that * the same value will be given multiple times in the result if it is associated * with multiple keys. * * @return iterable collection of the map's values */ @Override public Iterable<V> values() { return new ValueIterable(); } }
[ "georgedragos99@gmail.com" ]
georgedragos99@gmail.com
57274b1c888a0d532c6f257bd8bcc2286fb3eb18
54f352a242a8ad6ff5516703e91da61e08d9a9e6
/Source Codes/AtCoder/abc038/C/4803603.java
0e28aa2cc327e3bb3978e9e041ed8899fcdc3681
[]
no_license
Kawser-nerd/CLCDSA
5cbd8a4c3f65173e4e8e0d7ed845574c4770c3eb
aee32551795763b54acb26856ab239370cac4e75
refs/heads/master
2022-02-09T11:08:56.588303
2022-01-26T18:53:40
2022-01-26T18:53:40
211,783,197
23
9
null
null
null
null
UTF-8
Java
false
false
809
java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); } long ans = syakutori(a, n); System.out.println(ans); } public static long syakutori(int[] a, int n) { int right = 1; int res = 0; long ans = 0; for (int left = 0; left < n; left++) { while (right < n && (left >= right || a[right - 1] < a[right])) { right++; } ans += Math.max(0, right - left); if (left >= right) { right++; } } return ans; } }
[ "kwnafi@yahoo.com" ]
kwnafi@yahoo.com
6eb71f38e52ab2bd04819c4ef7be1f58605e7d5e
5a0bfac7ad00c079fe8e0bdf1482f4271c46eeab
/app/src/main/wechat6.5.3/oicq/wlogin_sdk/request/g.java
c9e3af61d5d6ad75852f68705511d8d4a5e562eb
[]
no_license
newtonker/wechat6.5.3
8af53a870a752bb9e3c92ec92a63c1252cb81c10
637a69732afa3a936afc9f4679994b79a9222680
refs/heads/master
2020-04-16T03:32:32.230996
2017-06-15T09:54:10
2017-06-15T09:54:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,177
java
package oicq.wlogin_sdk.request; import oicq.wlogin_sdk.a.ao; import oicq.wlogin_sdk.a.f; public final class g extends d { public g(i iVar) { this.pMT = 2064; this.pMU = 2; this.pMW = iVar; } public final byte[] bG(byte[] bArr) { int length; int i; int i2 = this.pMW.pNg; byte[] bQW = this.pMW.pNb.bQW(); oicq.wlogin_sdk.a.g gVar = this.pMW.pNc; Object obj = new byte[gVar.pNO]; if (gVar.pNO > 0) { System.arraycopy(gVar.pMN, gVar.pNQ, obj, 0, gVar.pNO); } f fVar = new f(); ao aoVar = new ao(); Object bH = fVar.bH(bQW); Object o = aoVar.o(bArr, obj); Object obj2 = new byte[(bH.length + o.length)]; if (bQW.length > 0) { System.arraycopy(bH, 0, obj2, 0, bH.length); length = bH.length + 0; i = 1; } else { length = 0; i = 0; } System.arraycopy(o, 0, obj2, length, o.length); a(this.pMO, this.pMT, pMP, this.pMW._uin, this.pMQ, this.pMR, i2, this.pMS, super.h(obj2, this.pMU, i + 1)); return super.bQT(); } }
[ "zhangxhbeta@gmail.com" ]
zhangxhbeta@gmail.com
33c5ae8fed3508b9e49e8b90de51a838b9d7f5d9
db78dcc8ab03b3c357411cfd582c1985a5b9e17a
/src/main/java/com/leckbrito/cursomc/domain/PagamentoComBoleto.java
522488ff8faed56188d76be138272af178ab9f9a
[]
no_license
LeckBrito/spring-boot-ionic-backend
61526a9e1984d66700b31d2c0bd2392a3360c506
31c8bb7c5785ce3da8c82ba890a5f1fbd6f1e9e9
refs/heads/master
2020-04-02T11:58:06.785670
2018-12-29T16:35:21
2018-12-29T16:35:21
154,414,235
0
0
null
null
null
null
UTF-8
Java
false
false
1,136
java
package com.leckbrito.cursomc.domain; import java.util.Date; import javax.persistence.Entity; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonTypeName; import com.leckbrito.cursomc.domain.enums.EstadoPagamento; @Entity @JsonTypeName("pagamentoComBoleto") public class PagamentoComBoleto extends Pagamento { private static final long serialVersionUID = 1L; @JsonFormat(pattern="dd/MM/yyyy") private Date dataVencimento; @JsonFormat(pattern="dd/MM/yyyy") private Date dataPagamento; public PagamentoComBoleto() { } public PagamentoComBoleto(Integer id, EstadoPagamento estado, Pedido pedido, Date dataVencimento, Date dataPagamento) { super(id, estado, pedido); this.dataVencimento = dataVencimento; this.dataPagamento = dataPagamento; } public Date getDataVencimento() { return dataVencimento; } public void setDataVencimento(Date dataVencimento) { this.dataVencimento = dataVencimento; } public Date getDataPagamento() { return dataPagamento; } public void setDataPagamento(Date dataPagamento) { this.dataPagamento = dataPagamento; } }
[ "alexander.diasbrito@gmail.com" ]
alexander.diasbrito@gmail.com
dd81cf9e4a30964cafcec252631896bd9a45f43b
2a915ab3eb1593c81497775b2a2c8131d290c13f
/cassandra-migration/src/test/java/org/cognitor/cassandra/migration/collector/FailOnDuplicatesCollectorTest.java
1ffc8f86bc29255c260a9f0b0fdf0179ef19f782
[ "LGPL-3.0-only", "MIT" ]
permissive
thelastpickle/cassandra-migration
4b42bc1bd6ff41034c951bc20806962a02f1947c
f47f37067019eefd562be9219e0ef32af5167909
refs/heads/master
2023-05-31T19:21:43.813043
2019-07-16T14:50:20
2019-07-16T15:10:32
202,141,333
1
0
MIT
2019-08-13T12:38:10
2019-08-13T12:38:10
null
UTF-8
Java
false
false
1,526
java
package org.cognitor.cassandra.migration.collector; import org.cognitor.cassandra.migration.MigrationException; import org.junit.Before; import org.junit.Test; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.Matchers.empty; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsNot.not; import static org.junit.Assert.*; /** * @author Patrick Kranz */ public class FailOnDuplicatesCollectorTest { private ScriptCollector scriptCollector; @Before public void before() { this.scriptCollector = new FailOnDuplicatesCollector(); } @Test public void shouldReturnAllScriptsWhenNoDuplicateScriptFileGiven() { scriptCollector.collect(new ScriptFile(0, "/0_init.cql", "init.cql")); scriptCollector.collect(new ScriptFile(1, "/1_add-table.cql", "add_table.cql")); assertThat(scriptCollector.getScriptFiles().size(), is(equalTo(2))); } @Test(expected = MigrationException.class) public void shouldThrowExceptionWhenDuplicateScriptFileVersionsGiven() { scriptCollector.collect(new ScriptFile(0, "/0_init.cql", "init.cql")); scriptCollector.collect(new ScriptFile(0, "/0_another-init.cql", "another-init.cql")); } @Test public void shouldReturnEmptyCollectionWhenNoScriptFileGiven() { assertThat(scriptCollector.getScriptFiles(), is(not(nullValue()))); assertThat(scriptCollector.getScriptFiles(), is(empty())); } }
[ "patrick@got-email.de" ]
patrick@got-email.de
41f5a8af044041b9069a2870611f8ab568d4bf98
9cd45a02087dac52ea4d39a0c17e525c11a8ed97
/src/java/com/integralads/avid/library/adcolony/session/AvidVideoAdSession.java
584adce78bfd8c1a56abac53341f9ac077828c80
[]
no_license
abhijeetvaidya24/INFO-NDVaidya
fffb90b8cb4478399753e3c13c4813e7e67aea19
64d69250163e2d8d165e8541aec75b818c2d21c5
refs/heads/master
2022-11-29T16:03:21.503079
2020-08-12T06:00:59
2020-08-12T06:00:59
286,928,296
0
0
null
null
null
null
UTF-8
Java
false
false
347
java
/* * Decompiled with CFR 0.0. * * Could not load the following classes: * android.webkit.WebView */ package com.integralads.avid.library.adcolony.session; import android.webkit.WebView; import com.integralads.avid.library.adcolony.session.AbstractAvidAdSession; public class AvidVideoAdSession extends AbstractAvidAdSession<WebView> { }
[ "abhijeetvaidya24@gmail.com" ]
abhijeetvaidya24@gmail.com
125f14f37610815ec3a81194d723a11f4e9a228e
387f4b94bc0cb5ae91a62d44d5813fac1693ae6b
/born-gui/src/main/java/de/tudresden/inf/lat/born/gui/BornModelImpl.java
a753cd884d78cf97aeda1d87e463af318adab9d5
[ "Apache-2.0" ]
permissive
josectoledo/born
6d6a181e54495a5db4753aa90f31c1e80805e380
e896763163d4b2f116e4c221336890bf5c071a3e
refs/heads/master
2021-01-17T21:30:56.871212
2016-02-15T19:37:33
2016-02-15T19:37:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,398
java
package de.tudresden.inf.lat.born.gui; import java.util.Date; import java.util.Objects; import de.tudresden.inf.lat.born.owlapi.annotator.AnnotatorConfiguration; import de.tudresden.inf.lat.born.owlapi.annotator.AnnotatorConfigurationImpl; import de.tudresden.inf.lat.born.owlapi.multiprocessor.MultiProcessorConfiguration; import de.tudresden.inf.lat.born.owlapi.multiprocessor.MultiProcessorConfigurationImpl; import de.tudresden.inf.lat.born.owlapi.processor.ProblogProcessor; import de.tudresden.inf.lat.born.owlapi.processor.ProcessorConfiguration; import de.tudresden.inf.lat.born.owlapi.processor.ProcessorConfigurationImpl; /** * This is the model of the graphical user interface. * * @author Julian Mendez * */ public class BornModelImpl implements BornModel { private ProcessorConfiguration processorConfiguration = new ProcessorConfigurationImpl(); private AnnotatorConfiguration annotatorConfiguration = new AnnotatorConfigurationImpl(); private MultiProcessorConfiguration multiProcessorConfiguration = new MultiProcessorConfigurationImpl(); /** * Constructs a new BORN model. */ public BornModelImpl() { ProblogProcessor queryProcessor = new ProblogProcessor(); this.processorConfiguration.setQueryProcessor(queryProcessor); this.multiProcessorConfiguration.setQueryProcessor(queryProcessor); queryProcessor.startInstallation((new Date().getTime())); } @Override public AnnotatorConfiguration getAnnotatorConfiguration() { return annotatorConfiguration; } @Override public void setAnnotatorConfiguration(AnnotatorConfiguration annotatorConfiguration) { Objects.requireNonNull(annotatorConfiguration); this.annotatorConfiguration = annotatorConfiguration; } @Override public ProcessorConfiguration getProcessorConfiguration() { return processorConfiguration; } @Override public void setProcessorConfiguration(ProcessorConfiguration processorConfiguration) { Objects.requireNonNull(processorConfiguration); this.processorConfiguration = processorConfiguration; } @Override public MultiProcessorConfiguration getMultiProcessorConfiguration() { return multiProcessorConfiguration; } @Override public void setMultiProcessorConfiguration(MultiProcessorConfiguration multiProcessorConfiguration) { Objects.requireNonNull(multiProcessorConfiguration); this.multiProcessorConfiguration = multiProcessorConfiguration; } }
[ "julian.mendez@tu-dresden.de" ]
julian.mendez@tu-dresden.de
16e83e58fd2c430bf1b4ca82ab2cd9eb2ea1e341
80a4f5fd6c5bcc01509aa16fafc7f7df7a04e7ac
/SpringBoot-MyBatis/src/test/java/com/mybatis/serviceimpl/UserServiceImplTest.java
374fd49b10ae495aebea281c4d0ac6e9a14ca6f0
[]
no_license
lemon525/lemon-SpringBoot
fd88dce0509188119fc0cbe55cedf1a884102d43
5d4731e015810b336b7fb0ee850b006a2fa8894a
refs/heads/master
2022-02-18T13:43:07.533699
2020-04-20T05:54:45
2020-04-20T05:54:45
227,377,785
0
0
null
2022-02-09T22:22:00
2019-12-11T13:54:39
Java
UTF-8
Java
false
false
1,101
java
package com.mybatis.serviceimpl; import com.mybatis.entity.Role; import com.mybatis.entity.User; import com.mybatis.service.RoleService; import com.mybatis.service.UserService; import lombok.var; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import javax.annotation.Resource; import java.util.HashMap; import java.util.List; import java.util.Map; import static org.junit.Assert.*; @SpringBootTest @RunWith(SpringRunner.class) public class UserServiceImplTest { @Resource private UserService userService; @Resource private RoleService roleService; @Test public void findAll() { List<User> users = userService.findAll(); users.forEach(user->{ System.out.println(user.toString()); }); } @Test public void RoleTestAll(){ List<Role> roles = roleService.findAll(); roles.forEach(role -> System.out.println(role.toString())); } @Test public void tessMap(){ } }
[ "wx534289894@163.com" ]
wx534289894@163.com
eb1e0d7e504c7c55f4b26b87a5dd0e513b373dae
1e0b88d61241874e98f6a9fa7c365c8cd924baba
/LC032_Longest_Valid_Parentheses.java
36eba55571bd7545acf4fe87562424d8d6159a9b
[]
no_license
YunqiuXu/LeeeeeeetCode
1cae23ad11a6da029cddf68dd822b8fe041f9cf5
410cf58f4e1588fe1c6d0214417f3e33b7f3de0c
refs/heads/master
2021-01-12T06:34:48.751819
2017-03-14T09:53:02
2017-03-14T09:53:02
77,388,308
0
0
null
null
null
null
UTF-8
Java
false
false
2,245
java
public class Solution { /** Yunqiu Xu*/ /** Method 1: AC by DP*/ public int longestValidParentheses(String s) { if (s == null || s.length() == 0){ return 0; } int maxLen = 0; int start = 0; Stack<Integer> stack=new Stack<Integer>(); int[] a = new int[s.length()]; char[] c = s.toCharArray(); for(int i = 0; i < c.length; i++){ if(c[i] == '('){ stack.push(i); } else if(!stack.empty()){ //当前为')'且栈中还有未被匹配的'(' start = stack.pop(); a[i] = i - start + 1; if(start > 1){ a[i] += a[start-1]; } maxLen = Math.max(maxLen, a[i]); } } return maxLen; } /** Method 2: Stack, but I face time limit */ public int longestValidParentheses(String s) { if (s == null || s.length() == 0){ return 0; } int maxLen = 0; int last = -1; //最后一个无法匹配的'('的位置 --> 所有无法匹配的')'”的index其实都是各个group的分界点 Stack<Integer> lefts = new Stack<Integer>(); for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == '(') { lefts.push(i); } else { if (lefts.isEmpty()) { // this ')' can not be matched last = i; } else{ lefts.pop(); // find a matching pair if (lefts.isEmpty()) { //()() //当前刚好完全匹配, 计算该group的长度i-last并对结果进行更新 maxLen = Math.max(maxLen, i-last); } else { //(().. //栈内还有‘(', 通过查询栈中下一个即将被匹配的"("的index来更新maxLen maxLen = Math.max(maxLen, i-lefts.peek()); } } } } return maxLen; } }
[ "yunqiu_xu@163.com" ]
yunqiu_xu@163.com
89811825733293f3b19e777d39509c6099cddf84
0fdea16d95c76ada1364a3be06cdda2194290789
/GameServer/src/gameserver/jsonprotocol/GDL_C2G_BJLResignBanker.java
3fb36d4f3682604e28e02c6e337a3b4adc6bcbc0
[]
no_license
ringofthec/server95
bbffc006ac4d4d26a9e58c92a326fc79154902d1
a550e11b4bdbd48d2a4d0bbff1c04e0a3e786012
refs/heads/master
2021-08-08T09:01:45.740206
2017-11-10T01:55:26
2017-11-10T01:55:26
110,184,989
2
3
null
null
null
null
UTF-8
Java
false
false
479
java
package gameserver.jsonprotocol; import java.util.List; import java.util.ArrayList; import com.commons.util.JsonUtil; import com.commons.network.websock.JsonPacket; public final class GDL_C2G_BJLResignBanker extends JsonPacket { public int getProtocolId() { return 367; } public static GDL_C2G_BJLResignBanker parse(String data) { return JsonUtil.JsonToObject(data, GDL_C2G_BJLResignBanker.class); } public String json() { return JsonUtil.ObjectToJson(this); } }
[ "308876850@qq.com" ]
308876850@qq.com
729e08e7f478e69d8a29843f812c713cb236dbb4
c285c5451f3395b8beb52975c0d7d82f85847296
/src/main/java/com/yanhuo/sign/service/CourseService.java
f420dc43b252c10bdea5e53fd16159fc04f1b93b
[]
no_license
zhm-sky/newWXsign
2be30ba76d956fd525747bdcfd2935b5dc7abadd
ccee85015d3fd0099648557ca0e3b0f9154ec511
refs/heads/master
2021-09-15T04:42:32.736530
2018-04-14T10:16:40
2018-04-14T10:16:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
190
java
package com.yanhuo.sign.service; /** * @author 烟火(yanhuo@maihaoche.com) * @version V1.0 * @Description: TODO * @date 2018/3/20 下午4:27 */ public interface CourseService { }
[ "yfzhouhuimiao@gmail.com" ]
yfzhouhuimiao@gmail.com
2363e9a7ac1137d6825c75215f3d73f644a3fb88
1c03e0e669d6c071fed9a8028c1c00bde6031f20
/MedicineDetect/app/src/androidTest/java/com/example/medicinedetect/ExampleInstrumentedTest.java
dda456430816594e652d18b5995b86ff8f312fe9
[]
no_license
trungduyen0220/shecodes-hackathon-medisha
83812e68f9b74e22c6a539faeca4a1eb10822e04
426fcfadf434a4bf15fa393b3ed76f75c56739d4
refs/heads/master
2022-11-30T01:42:22.388702
2020-08-12T11:14:47
2020-08-12T11:14:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
766
java
package com.example.medicinedetect; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.example.medicinedetect", appContext.getPackageName()); } }
[ "trungduyen0220@gmail.com" ]
trungduyen0220@gmail.com
f9fced53edb16e92f4a85cf4c168f2fc8144d0cb
566c43a60376d22b89d81ce2c7f1a82404c0d395
/app/src/main/java/com/yisingle/map/move/demo/MainActivity.java
cdf2e192a13ff82f60206ddd98c5cf41e4c18e55
[]
no_license
jikun2008/MarkerMoveUtils
ac8d10ad95f5311230c3a14fff407da5c09705a2
3776ce761eccf9d497286ae935699a3637fab702
refs/heads/master
2020-06-17T03:26:25.490010
2019-07-29T10:07:45
2019-07-29T10:07:45
195,780,166
6
0
null
null
null
null
UTF-8
Java
false
false
1,996
java
package com.yisingle.map.move.demo; import android.os.Bundle; import android.view.View; import com.amap.api.maps.CameraUpdateFactory; import com.amap.api.maps.TextureMapView; import com.amap.api.maps.model.BitmapDescriptorFactory; import com.amap.api.maps.model.LatLng; import com.amap.api.maps.model.Marker; import com.amap.api.maps.model.MarkerOptions; import com.yisingle.map.move.demo.base.BaseMapActivity; import com.yisingle.map.move.library.MoveUtils; public class MainActivity extends BaseMapActivity { protected MoveUtils moveUtils; protected Marker marker; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextureMapView textureMapView = findViewById(R.id.textureMapView); initMapView(savedInstanceState, textureMapView); MarkerOptions markerOptions = new MarkerOptions() .icon(BitmapDescriptorFactory.fromResource(R.mipmap.move_car)) .anchor(0.5f, 0.5f); marker = getAmap().addMarker(markerOptions); moveUtils = new MoveUtils(); moveUtils.setCallBack(new MoveUtils.OnCallBack() { @Override public void onSetLatLng(LatLng latLng, float rotate) { marker.setPosition(latLng); //车辆方向 float carDirection = 360.0F - rotate + getAmap().getCameraPosition().bearing; marker.setRotateAngle(carDirection); } }); testMove(null); } public void testMove(View view) { LatLng center = new LatLng(30.546284, 104.06934); moveUtils.startMove(TestRandomUtils.getRandomMoveList(center), 5000, false); moveCamre(center); } public void testStop(View view) { moveUtils.stop(); } private void moveCamre(LatLng center) { getAmap().animateCamera(CameraUpdateFactory.newLatLngZoom(center, 14)); } }
[ "j314815101@qq.com" ]
j314815101@qq.com
cc4ca208e6ab6450b8f8f96bda76d2312116d42b
4041ac6ce0f49f7b39bff7d0febaa98205a5d9e5
/ph-tree/src/main/java/com/helger/tree/singleton/AbstractGlobalSingletonTreeWithUniqueID.java
c3be7669ed07b5ede1857bbafaf36c139c59d3c8
[ "Apache-2.0" ]
permissive
johnpoth/ph-commons
78733ea8dcd4f60618f05a32996fb9a41dc4da99
023d381536867ce36a649add81aaf63389aa3888
refs/heads/master
2020-03-16T02:30:27.948133
2018-04-25T16:48:13
2018-04-25T16:48:13
132,466,341
0
0
null
2018-05-07T13:42:24
2018-05-07T13:42:23
null
UTF-8
Java
false
false
1,697
java
/** * Copyright (C) 2014-2018 Philip Helger (www.helger.com) * philip[at]helger[dot]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 com.helger.tree.singleton; import javax.annotation.Nonnull; import com.helger.scope.singleton.AbstractGlobalSingleton; import com.helger.tree.withid.unique.DefaultTreeWithGlobalUniqueID; /** * Represents a global singleton tree with a unique ID. It basically is a * {@link AbstractGlobalSingleton} wrapping a * {@link DefaultTreeWithGlobalUniqueID} with the same API. * * @author Philip Helger * @param <KEYTYPE> * Tree key type * @param <VALUETYPE> * Tree value type */ public abstract class AbstractGlobalSingletonTreeWithUniqueID <KEYTYPE, VALUETYPE> extends AbstractGlobalSingleton implements ITreeWithUniqueIDProxy <KEYTYPE, VALUETYPE> { protected final DefaultTreeWithGlobalUniqueID <KEYTYPE, VALUETYPE> m_aTree = new DefaultTreeWithGlobalUniqueID<> (); public AbstractGlobalSingletonTreeWithUniqueID () {} @Nonnull public final DefaultTreeWithGlobalUniqueID <KEYTYPE, VALUETYPE> getProxyTree () { return m_aTree; } }
[ "philip@helger.com" ]
philip@helger.com
17e3d652ae78cb96d8adf006e3481ce7e66bcfc3
97d14108b6beb51074344550f40674e2bff6f362
/src/com/class2/VariablesDeclare.java
d2e03f9b59f24a92f956cdc33acfdce4bcf88dae
[]
no_license
ntxm/Java
cabf1ee5c910f327b54517a0bdb28ca241d31161
d6fa4cbd071e990c437b141d1b8dc5f2054781df
refs/heads/master
2020-09-04T21:02:01.755902
2019-12-24T16:11:02
2019-12-24T16:11:02
219,890,430
1
0
null
null
null
null
UTF-8
Java
false
false
577
java
package com.class2; public class VariablesDeclare { public static void main(String[] args) { //Declaring variable and assign int num1 = 1; int num2 = 5; int num3 = 600; //declare var first and then assign the value int num4; int num5; int num6; num4 = 10; num5 = 20; num6 = 40; //declare all together, then assign the value int num7, num8, num9; num7 = 50; num8 = 90; num9 = 200; num7 = num8; System.out.println(num7); boolean isRain=false; boolean isSnow; isSnow=isRain; System.out.println(isSnow); } }
[ "51963319+ntxm@users.noreply.github.com" ]
51963319+ntxm@users.noreply.github.com
c0a82f8802700ffdd8fac57add773d6e343ac974
683223a3be4c89d70119326166905a99fbd4c7ea
/src/main/java/HmrsProje/Hmrs/busines/abstracts/JobAdvertisementService.java
1e97381c0cef0503b6966c0ac315f38f21139eea
[]
no_license
HakanSenturkBen/Hmrs
777310e2ea3b9b862b310545168d7e67cb6f0c79
f8b02aeb2c9f9924da6a227d721af12dc63a8ca9
refs/heads/main
2023-05-08T21:07:32.184780
2021-06-06T21:14:03
2021-06-06T21:14:03
366,099,020
4
0
null
null
null
null
UTF-8
Java
false
false
611
java
package HmrsProje.Hmrs.busines.abstracts; import java.util.List; import HmrsProje.Hmrs.core.utilities.results.DataResult; import HmrsProje.Hmrs.core.utilities.results.Result; import HmrsProje.Hmrs.entity.concretes.JobAdvertisement; import HmrsProje.Hmrs.entity.dtos.JobAdvertisementDto; public interface JobAdvertisementService { DataResult<List<JobAdvertisement>>getAll(); DataResult<List<JobAdvertisement>>getAllOrderByEndDate(); DataResult<List<JobAdvertisement>>getByNameAndActivity(String companyName, boolean activity ); Result add(JobAdvertisementDto jobAdvertisementDto); }
[ "noreply@github.com" ]
HakanSenturkBen.noreply@github.com
55783bdf1d182f3228d948c1587df8f0c62e1e6d
692a7b9325014682d72bd41ad0af2921a86cf12e
/iWiFi/src/com/umeng/socialize/common/SocialResHelper$LoadMode.java
cb1dff262eb673e4107063fe6b3c9980f20a37b8
[]
no_license
syanle/WiFi
f76fbd9086236f8a005762c1c65001951affefb6
d58fb3d9ae4143cbe92f6f893248e7ad788d3856
refs/heads/master
2021-01-20T18:39:13.181843
2015-10-29T12:38:57
2015-10-29T12:38:57
45,156,955
0
0
null
null
null
null
UTF-8
Java
false
false
1,414
java
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.umeng.socialize.common; // Referenced classes of package com.umeng.socialize.common: // SocialResHelper public static final class _cls9 extends Enum { public static final LOAD_NETWORK_ELSE_CACHE LOAD_CACHE_ELSE_NETWORK; public static final LOAD_NETWORK_ELSE_CACHE LOAD_CACHE_ONLY; public static final LOAD_NETWORK_ELSE_CACHE LOAD_NETWORK_ELSE_CACHE; private static final LOAD_NETWORK_ELSE_CACHE a[]; public static _cls9 valueOf(String s) { return (_cls9)Enum.valueOf(com/umeng/socialize/common/SocialResHelper$LoadMode, s); } public static _cls9[] values() { _cls9 a_lcls9[] = a; int i = a_lcls9.length; _cls9 a_lcls9_1[] = new a[i]; System.arraycopy(a_lcls9, 0, a_lcls9_1, 0, i); return a_lcls9_1; } static { LOAD_CACHE_ELSE_NETWORK = new <init>("LOAD_CACHE_ELSE_NETWORK", 0); LOAD_CACHE_ONLY = new <init>("LOAD_CACHE_ONLY", 1); LOAD_NETWORK_ELSE_CACHE = new <init>("LOAD_NETWORK_ELSE_CACHE", 2); a = (new a[] { LOAD_CACHE_ELSE_NETWORK, LOAD_CACHE_ONLY, LOAD_NETWORK_ELSE_CACHE }); } private _cls9(String s, int i) { super(s, i); } }
[ "arehigh@gmail.com" ]
arehigh@gmail.com
c74390cea195d977e34a34475ec395adf4332689
518017a73d63ea162e12063f2ce456d7f47a7d6d
/03-tag/rel-v1.0.0beta/03-tag/tag-v0.9.1beta/01-core/src/sys/spvisor/core/entity/file/FileInfo.java
51def8d4396f763f8a82171ce15025847e93f250
[]
no_license
wzc99/MaurerlabSupervision
7a1a9f21feb032cfc5d2085730dfc37f96177e4c
105cd643795fd15c2f6d5ca856c51a460169189d
refs/heads/master
2020-03-19T11:53:45.364437
2018-06-07T15:09:26
2018-06-07T15:09:26
136,483,463
0
0
null
2018-06-07T13:44:16
2018-06-07T13:44:16
null
UTF-8
Java
false
false
2,155
java
package sys.spvisor.core.entity.file; import java.util.Date; public class FileInfo { private Integer fileId; private String fileName; private String fileContentIntroduction; private String releaseOrganization; private Date releaseDate; private Date validDate; private Integer postUserId; private String userName; private Date postDate; private String postPath; private Integer type; public Integer getFileId() { return fileId; } public void setFileId(Integer fileId) { this.fileId = fileId; } public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } public String getFileContentIntroduction() { return fileContentIntroduction; } public void setFileContentIntroduction(String fileContentIntroduction) { this.fileContentIntroduction = fileContentIntroduction; } public String getReleaseOrganization() { return releaseOrganization; } public void setReleaseOrganization(String releaseOrganization) { this.releaseOrganization = releaseOrganization; } public Date getReleaseDate() { return releaseDate; } public void setReleaseDate(Date releaseDate) { this.releaseDate = releaseDate; } public Date getValidDate() { return validDate; } public void setValidDate(Date validDate) { this.validDate = validDate; } public Integer getPostUserId() { return postUserId; } public void setPostUserId(Integer postUserId) { this.postUserId = postUserId; } public String getUserName() { return userName; } public void setUserName(String UserName) { userName = UserName; } public Date getPostDate() { return postDate; } public void setPostDate(Date postDate) { this.postDate = postDate; } public String getPostPath() { return postPath; } public void setPostPath(String postPath) { this.postPath = postPath; } public Integer getType() { return type; } public void setType(Integer type) { this.type = type; } }
[ "sake@eb47c38b-02f9-4f13-a855-7db6f9b7017d" ]
sake@eb47c38b-02f9-4f13-a855-7db6f9b7017d
33b6c405c70ab9328da23d723da39ede9510d739
cb3ecbbe8f3b50042e06582c2b4f811bd0aa1998
/svj/manualAnalysis/a2a87229d354f3404023c0aac71b340d78c2387a/InsertBase/InsertBase_right.java
bf25599f35806e32b93e4e9e5fb82caae857f787
[]
no_license
leusonmario/s3m
2ed78229a14296691353d743ce63f7423f3fc8c8
ba751ebca7bf432aad9420ae850fe179a818df85
refs/heads/master
2022-04-09T20:28:45.262607
2020-02-14T23:43:15
2020-02-14T23:43:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,356
java
/* * Copyright 2011, Mysema Ltd * * 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.mysema.query; import java.sql.ResultSet; import java.sql.SQLException; import com.mysema.query.QueryFlag.Position; import com.mysema.query.sql.SQLSubQuery; import com.mysema.query.sql.dml.DefaultMapper; import com.mysema.query.sql.dml.Mapper; import com.mysema.query.sql.dml.SQLInsertClause; import com.mysema.query.sql.domain.Employee; import com.mysema.query.sql.domain.QDateTest; import com.mysema.query.sql.domain.QEmployee; import com.mysema.query.sql.domain.QSurvey; import com.mysema.query.support.Expressions; import com.mysema.query.types.Path; import com.mysema.query.types.PathImpl; import com.mysema.query.types.expr.Param; import com.mysema.testutil.ExcludeIn; import com.mysema.testutil.IncludeIn; import org.joda.time.DateTime; import org.joda.time.LocalDate; import org.junit.After; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import static com.mysema.query.Constants.survey; import static com.mysema.query.Constants.survey2; import static com.mysema.query.Target.*; import static org.junit.Assert.*; public class InsertBase extends AbstractBaseTest { private void reset() throws SQLException{ delete(survey).execute(); insert(survey).values(1, "Hello World", "Hello").execute(); delete(QDateTest.qDateTest).execute(); } @Before public void setUp() throws SQLException{ reset(); } @After public void tearDown() throws SQLException{ reset(); } @Test @ExcludeIn(SQLITE) // https://bitbucket.org/xerial/sqlite-jdbc/issue/133/prepstmtsetdate-int-date-calendar-seems public void Insert_Dates() { QDateTest dateTest = QDateTest.qDateTest; LocalDate localDate = new LocalDate(1978, 1, 2); Path<LocalDate> localDateProperty = new PathImpl<LocalDate>(LocalDate.class, "DATE_TEST"); Path<DateTime> dateTimeProperty = new PathImpl<DateTime>(DateTime.class, "DATE_TEST"); SQLInsertClause insert = insert(dateTest); insert.set(localDateProperty, localDate); insert.execute(); Tuple result = query().from(dateTest).singleResult( dateTest.dateTest.year(), dateTest.dateTest.month(), dateTest.dateTest.dayOfMonth(), dateTimeProperty); assertEquals(Integer.valueOf(1978), result.get(0, Integer.class)); assertEquals(Integer.valueOf(1), result.get(1, Integer.class)); assertEquals(Integer.valueOf(2), result.get(2, Integer.class)); DateTime dateTime = result.get(dateTimeProperty); if (target == CUBRID) { // XXX Cubrid adds random milliseconds for some reason dateTime = dateTime.withMillisOfSecond(0); } assertEquals(localDate.toDateTimeAtStartOfDay(), dateTime); } @Test public void Complex1() { // related to #584795 QSurvey survey = new QSurvey("survey"); QEmployee emp1 = new QEmployee("emp1"); QEmployee emp2 = new QEmployee("emp2"); SQLInsertClause insert = insert(survey); insert.columns(survey.id, survey.name); insert.select(new SQLSubQuery().from(survey) .innerJoin(emp1) .on(survey.id.eq(emp1.id)) .innerJoin(emp2) .on(emp1.superiorId.eq(emp2.superiorId), emp1.firstname.eq(emp2.firstname)) .list(survey.id, emp2.firstname)); insert.execute(); } @Test public void Insert_Alternative_Syntax() { // with columns assertEquals(1, insert(survey) .set(survey.id, 3) .set(survey.name, "Hello") .execute()); } @Test public void Insert_Batch() { SQLInsertClause insert = insert(survey) .set(survey.id, 5) .set(survey.name, "55") .addBatch(); insert.set(survey.id, 6) .set(survey.name, "66") .addBatch(); assertEquals(2, insert.execute()); assertEquals(1l, query().from(survey).where(survey.name.eq("55")).count()); assertEquals(1l, query().from(survey).where(survey.name.eq("66")).count()); } @Test public void Insert_Batch2() { SQLInsertClause insert = insert(survey) .set(survey.id, 5) .set(survey.name, "55") .addBatch(); insert.set(survey.id, 6) .setNull(survey.name) .addBatch(); assertEquals(2, insert.execute()); } @Test public void Insert_Null_With_Columns() { assertEquals(1, insert(survey) .columns(survey.id, survey.name) .values(3, null).execute()); } @Test @ExcludeIn(DERBY) public void Insert_Null_Without_Columns() { assertEquals(1, insert(survey) .values(4, null, null).execute()); } @Test @ExcludeIn({HSQLDB, DERBY, ORACLE}) public void Insert_Without_Values() { assertEquals(1, insert(survey).execute()); } @Test @ExcludeIn(ORACLE) public void Insert_Nulls_In_Batch() { // QFoo f= QFoo.foo; // SQLInsertClause sic = new SQLInsertClause(c, new H2Templates(), f); // sic.columns(f.c1,f.c2).values(null,null).addBatch(); // sic.columns(f.c1,f.c2).values(null,1).addBatch(); // sic.execute(); SQLInsertClause sic = insert(survey); sic.columns(survey.name, survey.name2).values(null, null).addBatch(); sic.columns(survey.name, survey.name2).values(null, "X").addBatch(); sic.execute(); } @Test @Ignore @ExcludeIn({DERBY}) public void Insert_Nulls_In_Batch2() { Mapper<Object> mapper = DefaultMapper.WITH_NULL_BINDINGS; // QFoo f= QFoo.foo; // SQLInsertClause sic = new SQLInsertClause(c, new H2Templates(), f); // Foo f1=new Foo(); // sic.populate(f1).addBatch(); // f1=new Foo(); // f1.setC1(1); // sic.populate(f1).addBatch(); // sic.execute(); QEmployee employee = QEmployee.employee; SQLInsertClause sic = insert(employee); Employee e = new Employee(); sic.populate(e, mapper).addBatch(); e = new Employee(); e.setFirstname("X"); sic.populate(e, mapper).addBatch(); sic.execute(); } @Test public void Insert_With_Columns() { assertEquals(1, insert(survey) .columns(survey.id, survey.name) .values(3, "Hello").execute()); } @Test @ExcludeIn({CUBRID, SQLSERVER}) public void Insert_With_Keys() throws SQLException{ ResultSet rs = insert(survey).set(survey.name, "Hello World").executeWithKeys(); assertTrue(rs.next()); assertTrue(rs.getObject(1) != null); rs.close(); } @Test @ExcludeIn({CUBRID, SQLSERVER}) public void Insert_With_Keys_Projected() throws SQLException{ assertNotNull(insert(survey).set(survey.name, "Hello you").executeWithKey(survey.id)); } @Test @ExcludeIn({CUBRID, SQLSERVER}) public void Insert_With_Keys_Projected2() throws SQLException{ Path<Object> idPath = new PathImpl<Object>(Object.class, "id"); Object id = insert(survey).set(survey.name, "Hello you").executeWithKey(idPath); assertNotNull(id); } // http://sourceforge.net/tracker/index.php?func=detail&aid=3513432&group_id=280608&atid=2377440 @Test public void Insert_With_Set() { assertEquals(1, insert(survey) .set(survey.id, 5) .set(survey.name, (String)null) .execute()); } @Test @IncludeIn(MYSQL) @SkipForQuoted public void Insert_with_Special_Options() { SQLInsertClause clause = insert(survey) .columns(survey.id, survey.name) .values(3, "Hello"); clause.addFlag(Position.START_OVERRIDE, "insert ignore into "); assertEquals("insert ignore into SURVEY (ID, NAME) values (?, ?)", clause.toString()); clause.execute(); } @Test public void Insert_With_SubQuery() { int count = (int)query().from(survey).count(); assertEquals(count, insert(survey) .columns(survey.id, survey.name) .select(sq().from(survey2).list(survey2.id.add(20), survey2.name)) .execute()); } @Test @ExcludeIn({HSQLDB, CUBRID, DERBY}) public void Insert_With_SubQuery2() { // insert into modules(name) // select 'MyModule' // where not exists // (select 1 from modules where modules.name = 'MyModule') assertEquals(1, insert(survey).set(survey.name, sq().where(sq().from(survey2) .where(survey2.name.eq("MyModule")).notExists()) .unique(Expressions.constant("MyModule"))) .execute()); assertEquals(1l , query().from(survey).where(survey.name.eq("MyModule")).count()); } @Test @ExcludeIn({HSQLDB, CUBRID, DERBY}) public void Insert_With_SubQuery3() { // insert into modules(name) // select 'MyModule' // where not exists // (select 1 from modules where modules.name = 'MyModule') assertEquals(1, insert(survey).columns(survey.name).select( sq().where(sq().from(survey2) .where(survey2.name.eq("MyModule2")).notExists()) .unique(Expressions.constant("MyModule2"))) .execute()); assertEquals(1l , query().from(survey).where(survey.name.eq("MyModule2")).count()); } @Test public void Insert_With_SubQuery_Params() { Param<Integer> param = new Param<Integer>(Integer.class, "param"); SQLSubQuery sq = sq().from(survey2); sq.set(param, 20); int count = (int)query().from(survey).count(); assertEquals(count, insert(survey) .columns(survey.id, survey.name) .select(sq.list(survey2.id.add(param), survey2.name)) .execute()); } @Test public void Insert_With_SubQuery_Via_Constructor() { int count = (int)query().from(survey).count(); SQLInsertClause insert = insert(survey, sq().from(survey2)); insert.set(survey.id, survey2.id.add(20)); insert.set(survey.name, survey2.name); assertEquals(count, insert.execute()); } @Test public void Insert_With_SubQuery_Without_Columns() { int count = (int)query().from(survey).count(); assertEquals(count, insert(survey) .select(sq().from(survey2).list(survey2.id.add(10), survey2.name, survey2.name2)) .execute()); } @Test public void Insert_Without_Columns() { assertEquals(1, insert(survey).values(4, "Hello", "World").execute()); } @Test public void InsertBatch_with_Subquery() { SQLInsertClause insert = insert(survey) .columns(survey.id, survey.name) .select(sq().from(survey2).list(survey2.id.add(20), survey2.name)) .addBatch(); insert(survey) .columns(survey.id, survey.name) .select(sq().from(survey2).list(survey2.id.add(40), survey2.name)) .addBatch(); insert.execute(); // assertEquals(1, insert.execute()); } @Test public void Like() { insert(survey).values(11, "Hello World", "a\\b").execute(); assertEquals(1l, query().from(survey).where(survey.name2.contains("a\\b")).count()); } @Test public void Like_with_Escape() { SQLInsertClause insert = insert(survey); insert.set(survey.id, 5).set(survey.name, "aaa").addBatch(); insert.set(survey.id, 6).set(survey.name, "a_").addBatch(); insert.set(survey.id, 7).set(survey.name, "a%").addBatch(); assertEquals(3, insert.execute()); assertEquals(1l, query().from(survey).where(survey.name.like("a|%", '|')).count()); assertEquals(1l, query().from(survey).where(survey.name.like("a|_", '|')).count()); assertEquals(3l, query().from(survey).where(survey.name.like("a%")).count()); assertEquals(2l, query().from(survey).where(survey.name.like("a_")).count()); assertEquals(1l, query().from(survey).where(survey.name.startsWith("a_")).count()); assertEquals(1l, query().from(survey).where(survey.name.startsWith("a%")).count()); } @Test @IncludeIn(MYSQL) @SkipForQuoted public void Replace() { SQLInsertClause clause = mysqlReplace(survey); clause.columns(survey.id, survey.name) .values(3, "Hello"); assertEquals("replace into SURVEY (ID, NAME) values (?, ?)", clause.toString()); clause.execute(); } }
[ "gjcc@cin.ufpe.br" ]
gjcc@cin.ufpe.br
bf141d5ff454d609a663775d241351e98837e112
93f6188146577776827b7e2770d17842fa27fd04
/neuro4j-core/src/main/java/org/neuro4j/core/Constants.java
3536e5ee7f510e8a8e449e6d707cf562d452e82d
[]
no_license
nagyistge/neuro4j.nms
20b17e89d4c9f5083d0115a0efe4c5e4ca60c70d
3ed7173ef6f71a9e10c917f9743c6397d24f4050
refs/heads/master
2020-06-11T15:17:08.120351
2014-04-01T17:44:46
2014-04-01T17:44:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
126
java
package org.neuro4j.core; public interface Constants { public static final long SERIALIZATION_VERSION_UID = 1L; }
[ "pavlikovskiy@gmail.com" ]
pavlikovskiy@gmail.com
038f1d37e90593dd3b6b8cdd325a7002df91541c
471a1d9598d792c18392ca1485bbb3b29d1165c5
/jadx-MFP/src/main/java/com/google/api/AuthenticationRuleOrBuilder.java
70baebbb720c7b93e24f0e27ae58b52be4be4295
[]
no_license
reed07/MyPreferencePal
84db3a93c114868dd3691217cc175a8675e5544f
365b42fcc5670844187ae61b8cbc02c542aa348e
refs/heads/master
2020-03-10T23:10:43.112303
2019-07-08T00:39:32
2019-07-08T00:39:32
129,635,379
2
0
null
null
null
null
UTF-8
Java
false
false
693
java
package com.google.api; import com.google.protobuf.ByteString; import com.google.protobuf.MessageOrBuilder; import java.util.List; public interface AuthenticationRuleOrBuilder extends MessageOrBuilder { boolean getAllowWithoutCredential(); OAuthRequirements getOauth(); OAuthRequirementsOrBuilder getOauthOrBuilder(); AuthRequirement getRequirements(int i); int getRequirementsCount(); List<AuthRequirement> getRequirementsList(); AuthRequirementOrBuilder getRequirementsOrBuilder(int i); List<? extends AuthRequirementOrBuilder> getRequirementsOrBuilderList(); String getSelector(); ByteString getSelectorBytes(); boolean hasOauth(); }
[ "anon@ymous.email" ]
anon@ymous.email
76df723167b4e2465db0b019ea238649b84b3073
352ff71698151385eac548f3076c62b1e911edcf
/Java/spring-demo-one/src/com/luv2code/springdemo/BeanLifeCycleDemoApp.java
c6f6894e67290356708a9e9c778b90c77df3c7de
[]
no_license
danior10/CoursesProjects
a061b49bd266ef8e580abc5d9c5cf5a6b37c7bad
91f56d19eee61cf458c34706f3961569a606789a
refs/heads/main
2023-04-02T03:45:18.154874
2021-04-15T19:09:37
2021-04-15T19:09:37
358,347,676
0
0
null
null
null
null
UTF-8
Java
false
false
557
java
package com.luv2code.springdemo; import org.springframework.context.support.ClassPathXmlApplicationContext; public class BeanLifeCycleDemoApp { public static void main(String[] args) { //load the spring configuration file ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("beanScope-applicationContext.xml"); //retrieve bean from spring container Coach theCoach = context.getBean("myCoach",Coach.class); //print out the result System.out.println(theCoach.getDailyWorkout()); context.close(); } }
[ "74651979+danior10@users.noreply.github.com" ]
74651979+danior10@users.noreply.github.com
9943a0d6e43afd8564080166f43b476b0f4b284d
f630d086e1f96ff8c7b39dd011f72b52059ba17c
/DSA-Beginner/1.Basics-of-Programming/4.2D-Arrays/exit-point-of-matrix.java
de22ea1f3b1aaca2d398fba248c9085d5401d70f
[]
no_license
iamrnkk/pepcoding-solutions
a22d89f0b0b58979e0e6e505caef608e53c71d6f
6dcfad873e02bb93227bac75acff16d72da15d2e
refs/heads/master
2023-05-27T21:59:25.086549
2021-06-16T20:24:26
2021-06-16T20:24:26
351,218,486
0
0
null
null
null
null
UTF-8
Java
false
false
1,128
java
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { // write your code here BufferedReader br= new BufferedReader(new InputStreamReader(System.in)); int n= Integer.parseInt(br.readLine()); int m= Integer.parseInt(br.readLine()); int a[][]= new int[n][m]; for(int i=0; i< n; i++) { for(int j=0; j<m; j++) a[i][j]= Integer.parseInt(br.readLine()); } int dir=0; int i=0,j=0; while(i>=0 && j>=0 && i<n && j< m) { dir= dir+a[i][j]; if(dir==4) dir=0; if(dir==0) j++; else if(dir==1) i++; else if(dir==2) j--; else i--; } if(i<0) i++; else if(j<0) j++; else if(i==n) i--; else j--; System.out.println(i); System.out.println(j); } }
[ "iamrnkk@gmail.com" ]
iamrnkk@gmail.com
876b61478cfbbceeea8b38714c86bc405660076c
ff9c71c6d9fce618f28864861c22e777d0a79a42
/App/app/src/main/java/mc/usi/org/mobilecomputingproject/Utils/DateUtils.java
9a23c03a53006043c376d2f719db9768309063d4
[]
no_license
pennal/MobileComputing
a855cf4ec2bc8b8687df72438701083a94528e5c
34c13c2b133d3e56494b40a07ed95aead75caef1
refs/heads/master
2021-09-01T11:34:00.950737
2017-12-26T17:33:04
2017-12-26T17:33:04
111,858,590
0
0
null
null
null
null
UTF-8
Java
false
false
398
java
package mc.usi.org.mobilecomputingproject.Utils; import java.text.SimpleDateFormat; import java.util.Date; /** * Created by Lucas on 20.12.17. */ public class DateUtils { public static String getFormattedDate(Date d) { if (d == null) { return ""; } SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy"); return format.format(d); } }
[ "pennal@usi.ch" ]
pennal@usi.ch
bc2756f1c50dd30574f6e6e597d3d05db8ccd57f
44c9c408398f1ec3969749e44da4d39315293351
/app/src/main/java/com/example/doo37/seoulpeople/DetectNoise.java
c140ef4eea4418dd9455bed6e002d5afb17ec100
[ "CC-BY-4.0", "Apache-2.0" ]
permissive
Leeheejin/seoulpeople
2f860541fb2ef219be8c2c65dca2b753b8657cd3
bd377d5b7a9a87ccddb90b37bb4fe7c584738d38
refs/heads/master
2020-04-09T03:40:27.833449
2018-12-01T22:11:25
2018-12-01T22:11:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,476
java
package com.example.doo37.seoulpeople; import android.media.MediaRecorder; import java.io.IOException; public class DetectNoise { // This file is used to record voice private MediaRecorder mRecorder = null; public void start() { if (mRecorder == null) { mRecorder = new MediaRecorder(); mRecorder.setAudioSource(MediaRecorder.AudioSource.VOICE_RECOGNITION); //mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); mRecorder.setOutputFile("/dev/null"); try { mRecorder.prepare(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } mRecorder.start(); } } public void stop() { if (mRecorder != null) { mRecorder.stop(); mRecorder.release(); mRecorder = null; } } public double getAmplitude() { if (mRecorder != null) //return (mRecorder.getMaxAmplitude()/2700.0); return 20 * Math.log10(mRecorder.getMaxAmplitude() / 2700.0); else return 0; } }
[ "37955272+doh01@users.noreply.github.com" ]
37955272+doh01@users.noreply.github.com
d92742ae3efe47a5f4517984d5e762bb1cdc0d79
d85c52ab9cff49cce8c8d03c9c044df541820bc8
/app/src/main/java/com/nerv/pricepoint/DBRequest.java
45c61cbb948b91a1638a2330a434c10edf174644
[]
no_license
FazliMolaJan/PricePointMobile
b82afb3dbeb2b758c49d572bdd6495ee86c692de
8f0c03b72bb08ce652686da95068bdcc5aaa7351
refs/heads/master
2021-01-16T01:56:55.421658
2017-10-27T01:41:41
2017-10-27T01:41:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,193
java
package com.nerv.pricepoint; import android.app.Activity; import android.content.Context; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; /** * Created by NERV on 11.10.2017. */ public class DBRequest { public interface RequestCallback { void onResponse(JSONObject response); void onErrorResponse(VolleyError error); } private final static String BASE_URL = "https://graph.microsoft.com/v1.0/sites/"; private Context context; private String siteId; private String accessToken; private String listId; private boolean getItems; private boolean filter; private boolean expandFields; private boolean select; private String filterCondition; private String selectFields; private int requestMethod; private RequestCallback callback; public DBRequest(Context context, String siteId, String accessToken) { this.context = context; this.siteId = siteId; this.accessToken = accessToken; } public void retrieveLists(RequestCallback callback) { getItems = false; requestMethod = Request.Method.GET; this.callback = callback; } public void retrieveListItems(String listId, RequestCallback callback) { this.listId = listId; this.callback = callback; expandFields = false; filter = false; getItems = true; requestMethod = Request.Method.GET; } public void expandFields(String fields) { expandFields = true; if (fields == null || fields.isEmpty()) { select = false; } else { select = true; selectFields = fields; } } public void filter(String condition) { if (condition == null || condition.isEmpty()) { return; } filter = true; filterCondition = condition; } private String buildUrl() { String url = BASE_URL + siteId + "/lists"; if (getItems) { url += "/" + listId + "/items"; if (filter) { url += "?$filter=" + filterCondition; } if (expandFields) { url += (filter ? "&" : "?") + "$expand=fields"; if (select) { url += "($select=" + selectFields + ")"; } } } return url; } public void request() { String url = buildUrl(); Utils.requestJSONObject(context, accessToken, requestMethod , url , new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { callback.onResponse(response); } } , new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { callback.onErrorResponse(error); } }); } }
[ "vkalit@gmail.com" ]
vkalit@gmail.com
b0d36f91dc1606f71b33e41fdcaeda5f3ce35beb
96840cda529c56f183a7c9bf90d8539987ef7d1c
/src/main/java/cn/chenwx/dto/StatisticsDto.java
0e52c7af9d8570f2226a7d9271326ae911e31f09
[ "Apache-2.0" ]
permissive
create-sw/Personal-Blog
129b31445f1c15dc80df95eea2c40c0bd05dd4ec
90f81de3b081b45ce8b4ed90e8292cc4cd5ca6f8
refs/heads/master
2022-07-14T13:36:30.099937
2020-03-24T07:01:15
2020-03-24T07:01:15
247,832,660
2
0
Apache-2.0
2022-06-21T03:00:09
2020-03-16T22:58:30
Java
UTF-8
Java
false
false
939
java
package cn.chenwx.dto; /** * 后台统计对象 * Created by Donghua.Chen on 2018/4/30. */ public class StatisticsDto { /** * 文章数 */ private Long articles; /** * 评论数 */ private Long comments; /** * 连接数 */ private Long links; /** * 附件数 */ private Long attachs; public Long getArticles() { return articles; } public void setArticles(Long articles) { this.articles = articles; } public Long getComments() { return comments; } public void setComments(Long comments) { this.comments = comments; } public Long getLinks() { return links; } public void setLinks(Long links) { this.links = links; } public Long getAttachs() { return attachs; } public void setAttachs(Long attachs) { this.attachs = attachs; } }
[ "42410334@qq.com" ]
42410334@qq.com
c2c24edbdd2adaa6a85d7c7729efd98d81884341
205a90ffef1e9b9f363d915dff9cd56318109e02
/src/main/java/com/sxl/ssm/service/impl/UserServiceImpl.java
372eea326e6f7604ed1cf9e3ec214a5c8cccbc3b
[]
no_license
shuaixl/ssm
235e2697f3578b117766b0c017353204e6e90363
d22c52a204b788aa8d439511879b27e7d47102f9
refs/heads/master
2021-01-20T13:03:40.744509
2017-05-05T10:00:32
2017-05-05T10:00:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
658
java
package com.sxl.ssm.service.impl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.sxl.ssm.dao.UserDao; import com.sxl.ssm.entity.User; import com.sxl.ssm.service.UserService; @Service("userService") public class UserServiceImpl implements UserService { @Autowired private UserDao userDao; public boolean doUserLogin(User user) { System.out.println(111); User user1 = userDao.selectId(user.getUsername()); if (user1 == null) { return false; } else { if (user1.getPassword().equals(user.getPassword())) { return true; } else { return false; } } } }
[ "894153062@qq.com" ]
894153062@qq.com
769f48e1d80017d26d32d2cf1135c2b983c37a05
ed6191681cb29117f3240b763d31f5e3e559c3cc
/oo/encapsulamento/Pessoa.java
945994cb8b6f334cf21162b0ee40a7ba846b1533
[ "MIT" ]
permissive
heltonricardo/estudo-java
756c85c0869ff4f195dbf24b4039a662e4faeca2
edaa8f968a75c4336e2646eb36c08ceda622cc36
refs/heads/master
2022-12-27T21:05:03.528948
2020-10-14T14:58:32
2020-10-14T14:58:32
284,755,962
0
0
null
null
null
null
UTF-8
Java
false
false
298
java
package oo.encapsulamento; public class Pessoa { private int idade; Pessoa(int idade) { this.setIdade(idade); } public int getIdate() { return this.idade; } public void setIdade(int idade) { idade = Math.abs(idade); if (0 <= idade && idade <= 120) this.idade = idade; } }
[ "50843386+heltonr13@users.noreply.github.com" ]
50843386+heltonr13@users.noreply.github.com
3d00fc2e288813cd6412522076a698a337152b49
c3445da9eff3501684f1e22dd8709d01ff414a15
/LIS/sinosoft-parents/lis-business/src/main/java/com/sinosoft/lis/bank/RNProxyInvoiceSendToBankBL.java
ee604652a5027efcf2943ad1fd2667e28d4cc3ce
[]
no_license
zhanght86/HSBC20171018
954403d25d24854dd426fa9224dfb578567ac212
c1095c58c0bdfa9d79668db9be4a250dd3f418c5
refs/heads/master
2021-05-07T03:30:31.905582
2017-11-08T08:54:46
2017-11-08T08:54:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,783
java
package com.sinosoft.lis.bank; import org.apache.log4j.Logger; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import com.sinosoft.lis.pubfun.GlobalInput; import com.sinosoft.lis.pubfun.PubFun; import com.sinosoft.lis.schema.LDSysVarSchema; import com.sinosoft.lis.vschema.LYBankBillSet; import com.sinosoft.utility.CError; import com.sinosoft.utility.CErrors; import com.sinosoft.utility.RSWrapper; import com.sinosoft.utility.SQLwithBindVariables; import com.sinosoft.utility.TransferData; import com.sinosoft.utility.VData; /** * <p> * Title: 银行代打发票 * </p> * * <p> * Description: 银行代打发票生成数据库文件模块 * </p> * * <p> * Copyright: Copyright (c) 2006 * </p> * * <p> * Company: sinosoft * </p> * * @author : guanwei * * @version 1.0 */ public class RNProxyInvoiceSendToBankBL { private static Logger logger = Logger.getLogger(RNProxyInvoiceSendToBankBL.class); /** 传入数据的容器 */ private VData mInputData = new VData(); /** 传出数据的容器 */ private VData mResult = new VData(); /** 数据操作字符串 */ private String mOperate; /** 错误处理类 */ public CErrors mErrors = new CErrors(); int ErrCount = 0; /** 业务处理相关变量 */ private String mStartDate = ""; private String mEndDate = ""; private String mBankCode = ""; /** 直接与数据库进行连接的变量 */ private Connection conn = null; private Statement st = null; private ResultSet rs = null; String FileName = ""; String FilePath = ""; String TempFileName = ""; private RNProxyInvoiceSendToBankBLF mRNProxyInvoiceSendToBankBLF = new RNProxyInvoiceSendToBankBLF(); int temp = 0; private GlobalInput mGlobalInput = new GlobalInput(); private TransferData mTransferData = new TransferData(); private boolean tFlag = false; private Object text; public RNProxyInvoiceSendToBankBL() { try { jbInit(); } catch (Exception ex) { ex.printStackTrace(); } } /** * 传输数据的公共方法 */ public boolean submitData(VData cInputData, String cOperate) throws SQLException { this.mInputData = (VData) cInputData.clone(); this.mOperate = cOperate; if (!cOperate.equals("INVOICE")) { buildError("submitData", "不支持的操作字符串"); return false; } // 得到外部传入的数据,将数据备份到本类中 if (!getInputData(cInputData)) { return false; } logger.debug("---End getInputData---"); mResult.clear(); // 准备所有要生成的数据 if (!dealData()) { return false; } logger.debug("---End dealData---"); mResult.add(TempFileName); logger.debug("---FileName:" + FileName + "---"); return true; } /** * 测试函数 * * @param args * String[] */ public static void main(String[] args) { } /** * 从输入数据中得到所有对象 输出:如果没有得到足够的业务数据对象,则返回false,否则返回true * * @param cInputData * VData * @return boolean */ private boolean getInputData(VData cInputData) { // 全局变量 mGlobalInput.setSchema((GlobalInput) cInputData.getObjectByObjectName( "GlobalInput", 0)); if (mGlobalInput == null) { buildError("getInputData", "没有得到足够的信息!"); return false; } mTransferData = (TransferData) cInputData.getObjectByObjectName( "TransferData", 0); mStartDate = (String) mTransferData.getValueByName("StartDate"); // 起始日期 logger.debug("|||||||||StartDate||||||||" + mStartDate); mEndDate = (String) mTransferData.getValueByName("EndDate"); // 终止日期 logger.debug("|||||||||mEndDate||||||||" + mEndDate); mBankCode = (String) mTransferData.getValueByName("BankCode"); // 银行代码 logger.debug("|||||||||mBankCode||||||||" + mBankCode); return true; } /** * 获取返回信息 * * @return VData */ public VData getResult() { return this.mResult; } /** * 错误构建 * * @param szFunc * String * @param szErrMsg * String */ private void buildError(String szFunc, String szErrMsg) { CError cError = new CError(); cError.moduleName = "RNProxyInvoiceSendToBankBL"; cError.functionName = szFunc; cError.errorMessage = szErrMsg; this.mErrors.addOneError(cError); } private String getFilePath() { LDSysVarSchema tLDSysVarSchema = new LDSysVarSchema(); tLDSysVarSchema.setSysVar("SendToBankFilePath"); logger.debug("SendToBankFilePath"); tLDSysVarSchema = tLDSysVarSchema.getDB().query().get(1); return tLDSysVarSchema.getSysVarValue(); } /** * 查询得到要发送银行的数据 * * @return boolean */ private boolean dealData() throws SQLException { // 构建文件名,未加后缀名 // ExeSQL exeSql = new ExeSQL(); // String bSql = "select BankName from LDBank where BankCode = '" + // mBankCode + "'"; // SSRS tSSRS = exeSql.execSQL(bSql); // String tBankName = tSSRS.GetText(1,1); FileName = "xh_inv_" + // tBankName + "_" + PubFun.getCurrentDate().substring(0, 4) + PubFun.getCurrentDate().substring(5, 7); // 构建文件名,添加后缀名 TempFileName = FileName + ".z"; logger.debug("FileName return:" + TempFileName); FileName = getFilePath() + FileName; logger.debug("FileName:" + FileName); mTransferData.setNameAndValue("FileName", FileName); String tSql = "select * from LYBankBill where BankCode = '" + "?a1?" + "' and BankSuccDate between '" + "?a2?" + "'and '" + "?a3?" + "' " + " and BankPrintCount is null or BankPrintCount < '1'"; SQLwithBindVariables sqlbv1=new SQLwithBindVariables(); sqlbv1.sql(tSql); sqlbv1.put("a1", mBankCode); sqlbv1.put("a2", mStartDate); sqlbv1.put("a3", mEndDate); logger.debug("tSql=" + tSql); // LYBankBillDB tLYBankBillDB = new LYBankBillDB(); LYBankBillSet tLYBankBillSet = new LYBankBillSet(); // tLYBankBillSet = tLYBankBillDB.executeQuery(tSql); RSWrapper rsWrapper = new RSWrapper(); if (!rsWrapper.prepareData(tLYBankBillSet, sqlbv1)) { this.mErrors.copyAllErrors(rsWrapper.mErrors); logger.debug(rsWrapper.mErrors.getFirstError()); return false; } /** ********初始化调用生成BLF的类,传入一些基本值,并生成文件头********** */ mRNProxyInvoiceSendToBankBLF.getInputData(mTransferData, mGlobalInput); mRNProxyInvoiceSendToBankBLF.WriterFileHead(); do { logger.debug("Start getData...."); rsWrapper.getData(); logger.debug("5000的数据取数"); dealOneBantchData(tLYBankBillSet); } while (tLYBankBillSet.size() > 0); rsWrapper.close(); /** *再次调用BLF中的方法 关闭输出流,并开始生成解析xml,生成文本文件 ** */ mRNProxyInvoiceSendToBankBLF.WriterFileEnd(); // 转换xml if (!mRNProxyInvoiceSendToBankBLF.xmlTransform()) { return false; } if (ErrCount > 0) { CError tError = new CError(); tError.moduleName = "RNProxyInvoiceSendToBankBL"; tError.functionName = "saveData"; tError.errorMessage = "以上错误导致部分数据添加失败!"; this.mErrors.addOneError(tError); return false; } return true; } /** * 准备往后层输出所需要的数据 * * @return 如果准备数据时发生错误则返回false,否则返回true */ private boolean dealOneBantchData(LYBankBillSet tLYBankBillSet) throws SQLException { // 给BLF输入需要生成xml的值 return void mRNProxyInvoiceSendToBankBLF.setLYBankBillSet(tLYBankBillSet); // 生成本次输入数据xml的文件 return boolean if (!mRNProxyInvoiceSendToBankBLF.WriterFileBody()) { this.mErrors.copyAllErrors(mRNProxyInvoiceSendToBankBLF.mErrors); return false; } return true; } private void jbInit() throws Exception { } }
[ "dingzansh@sinosoft.com.cn" ]
dingzansh@sinosoft.com.cn
a2b3359c3e9aef66bafbb5c742c728bc45c8d0cd
756c2b4f3c8c9bccde4f6ada339f5ce25ed2e136
/AlexaAssistant/src/test/java/supermarket/example/SuperMarketHandlerTest.java
d9be15acd20ea5aecb998dc3d6154c3efa858e0c
[]
no_license
kmuppara/AWSVoiceAssistant
5baff46b7a0a01564d892951fbebd00b74ed4aa0
5183f2869c63893f167f35362334ccabf7530f9e
refs/heads/master
2020-03-18T13:01:26.855397
2018-06-07T12:09:13
2018-06-07T12:09:13
134,756,455
0
2
null
null
null
null
UTF-8
Java
false
false
1,064
java
package supermarket.example; import java.io.IOException; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import com.amazonaws.services.lambda.runtime.Context; /** * A simple test harness for locally invoking your Lambda function handler. */ public class SuperMarketHandlerTest { private static Object input; @BeforeClass public static void createInput() throws IOException { // TODO: set up your sample input object here. input = null; } private Context createContext() { TestContext ctx = new TestContext(); // TODO: customize your context here if needed. ctx.setFunctionName("Your Function Name"); return ctx; } @Test public void testSuperMarketHandler() { SuperMarketHandler handler = new SuperMarketHandler(); Context ctx = createContext(); // String output = handler.handleRequest(input, ctx); // TODO: validate output here if needed. //Assert.assertEquals("Hello from Lambda!", output); } }
[ "noreply@github.com" ]
kmuppara.noreply@github.com
3a21fd014b64d2895ef29cdcdf4550e86c00f6d2
f376698ea71ca3d96c8080a16d0a267892b9543e
/src/com/brightsconsulting/conoha4j/json/common/Link.java
f84070823688b891d62ac8a4cae042e30db4ae82
[]
no_license
kotobuki76/conoha4j
b7be1ecde225da660c9dfed94f538d9c9202e6d1
f3026a1526cf1d263cb23eb2e05982b279f05d18
refs/heads/master
2021-05-08T06:28:48.093146
2017-10-12T05:56:05
2017-10-12T05:56:05
106,622,186
0
0
null
null
null
null
UTF-8
Java
false
false
360
java
package com.brightsconsulting.conoha4j.json.common; import com.fasterxml.jackson.annotation.JsonInclude; /** * JSONオブジェクト リンク情報 * * @author kotobuki76 * */ @JsonInclude(JsonInclude.Include.NON_NULL) public class Link { /** * */ public String href; /** * */ public String rel; /** * */ public String type; }
[ "kotobuki76@gmail.com" ]
kotobuki76@gmail.com
13269218bbcbc6e28f369bd48cd205b5e8e925ea
6564c31555a4ff1fb419da2597fa63527935d68b
/java basic/src/basic/IfElse.java
50c14bf0e0ade2d0515740236050e5337d975f56
[]
no_license
sanjay221998/Sample
6b6049ff0584d35b721db5036672424c67dd04b0
8e91febb682d987ef53b98b893f8e4d786e69915
refs/heads/master
2020-07-17T09:31:29.330939
2019-10-20T10:43:22
2019-10-20T10:43:22
205,995,002
0
0
null
null
null
null
UTF-8
Java
false
false
234
java
package basic; public class IfElse { public static void main(String[] args) { int age=15; if(age>=18) { System.out.println("major"); }//true block else { System.out.println("minor"); }//false block } }
[ "SANMUGAM@192.168.2.167" ]
SANMUGAM@192.168.2.167
8427103c13000f68282f4e34685f9b061ee1dcb5
119a5321a9f113d2960fb78d9feabddb5efb2a7b
/src/main/java/cn/itcast/travel/service/impl/CategoryServiceImpl.java
b312ed29efc8e1887076b50dc5a281be5031a0eb
[]
no_license
flyation/travel
253078d8929526843dca0dc1231efe986b9e1315
37302b52babfdf0c9b715afbb6ef2c0cd3f3ea3e
refs/heads/master
2022-12-24T02:59:28.892503
2019-10-07T15:29:01
2019-10-07T15:29:01
206,221,607
0
0
null
2022-12-16T01:24:55
2019-09-04T03:18:26
TSQL
UTF-8
Java
false
false
1,945
java
package cn.itcast.travel.service.impl; import cn.itcast.travel.dao.CategoryDao; import cn.itcast.travel.dao.impl.CategoryDaoImpl; import cn.itcast.travel.domain.Category; import cn.itcast.travel.service.CategoryService; import cn.itcast.travel.util.JedisUtil; import redis.clients.jedis.Jedis; import redis.clients.jedis.Tuple; import java.util.ArrayList; import java.util.List; import java.util.Set; /** * @author fly * @date 2019/9/26 */ public class CategoryServiceImpl implements CategoryService { private CategoryDao categoryDao = new CategoryDaoImpl(); @Override public List<Category> findAll() { //1.从redis查询 //获取jedis Jedis jedis = JedisUtil.getJedis(); //使用sortedSet排序查询 Set<Tuple> category_set = jedis.zrangeWithScores("category", 0, -1); //2.判断redis查询结果是否为空 List<Category> category_list = null; if (category_set == null || category_set.size() == 0) { //2.1若为空(无缓存),则查询数据库,并存入redis System.out.println("从数据库查询category..."); //从数据库查询 category_list = categoryDao.findAll(); //存入redis for (int i = 0; i < category_list.size(); i++) { jedis.zadd("category", category_list.get(i).getCid(), category_list.get(i).getCname()); } } else { //2.2若不为空(有缓存),则将category_set的数据存入category_list System.out.println("从redis查询category..."); category_list = new ArrayList<>(); for (Tuple tuple : category_set) { Category category = new Category(); category.setCname(tuple.getElement()); category.setCid((int) tuple.getScore()); category_list.add(category); } } return category_list; } }
[ "my@example.com" ]
my@example.com
5f375da61ae029390dad06f1d50993a6f7956043
09dafabdf16e95ef05cca841f43cd2cfe5d33b23
/src/main/java/cn/edu/buaa/bstar/exception/SemanticsException.java
b5a765f316a61b9e756996a61b33608d4e7617da
[]
no_license
buaaonion/liucong
db134bf5d63098a938f8acddd7cd1615360a5952
da20fbb6b4bf07b183e42cb5d3a47ddfa650fb44
refs/heads/master
2021-01-17T19:23:28.309002
2020-11-23T07:43:24
2020-11-23T07:43:24
62,896,635
0
0
null
null
null
null
UTF-8
Java
false
false
1,615
java
/** * @author LiuCong * @file SemanticsException.java * @date Date:2016年1月7日 下午8:37:07 * @version 1.0 */ package cn.edu.buaa.bstar.exception; import static cn.edu.buaa.bstar.exception.Error.REDEFINE; import static cn.edu.buaa.bstar.exception.Error.MISMATCH; import static cn.edu.buaa.bstar.exception.Error.UNDEFINE; import static cn.edu.buaa.bstar.exception.Error.UNDEFINEDCHILD; public class SemanticsException extends BstarException { /* * -1表示是include进来的 */ public SemanticsException(String fileName, int line, Error error, String message){ super(fileName+" "+error.toString()+":At line "+ line+";"+message); } public static SemanticsException mismatchException(String fileName, int line, String message) { return new SemanticsException(fileName, line, MISMATCH, message); } public static SemanticsException undefineException(String fileName, int line, String message) { return new SemanticsException(fileName, line, UNDEFINE, message); } public static SemanticsException undefinedChildException(String fileName, int line, String message) { return new SemanticsException(fileName, line, UNDEFINEDCHILD, message); } public static SemanticsException redefineException(String fileName, int line, String message) { return new SemanticsException(fileName, line, REDEFINE, message); } public static SemanticsException parameterErorException(String fileName, int line, String message) { return new SemanticsException(fileName, line, Error.PARAMETERERROR, message); } public String getMessage() { return super.getMessage(); } }
[ "buaaonion@163.com" ]
buaaonion@163.com
f7ec100b1bce7e6b4cbdbe4fe390689981920d2c
e478c682a4ef6cb454d45718299cd7433b8700f7
/java/com/aming/sso/model/DwzCallBackModel.java
2e591882e82ff62eb6ad1817ac395d5150ccf5e6
[]
no_license
beming/pure-sso
7415b26b4b9c3ecec0d86c431b0c6dc890fa103b
44496f718b5a75b989de3d5bc83cbc98a3481f68
refs/heads/master
2021-01-01T18:23:20.540602
2014-08-20T23:19:23
2014-08-20T23:19:23
16,660,234
0
1
null
null
null
null
UTF-8
Java
false
false
1,278
java
package com.aming.sso.model; import java.io.Serializable; public class DwzCallBackModel implements Serializable { /** * */ public final static String callbackType_FORWARD = "forward"; public final static String callbackType_CLOSECURRENT = "closeCurrent"; private static final long serialVersionUID = -7819750993889901227L; private String statusCode; private String message; private String navTabId; private String rel; private String callbackType; private String forwardUrl; public String getStatusCode() { return statusCode; } public void setStatusCode(String statusCode) { this.statusCode = statusCode; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getNavTabId() { return navTabId; } public void setNavTabId(String navTabId) { this.navTabId = navTabId; } public String getRel() { return rel; } public void setRel(String rel) { this.rel = rel; } public String getCallbackType() { return callbackType; } public void setCallbackType(String callbackType) { this.callbackType = callbackType; } public String getForwardUrl() { return forwardUrl; } public void setForwardUrl(String forwardUrl) { this.forwardUrl = forwardUrl; } }
[ "beming@21cn.com" ]
beming@21cn.com
c907996e0ef6b3cd3989ae641d47775f9f2bfe3e
16b46aaa5142fac2191786bf4bb680faaee428e0
/src/dao/OrderItemDAO.java
3760a9cd1742c5f152a54987a28669f3f6b9a68d
[]
no_license
jp-0603/midtownComics
e7ab77d8210bb0976788f867fe58251fcd4bb504
3fd15a2cfd224a0f5ba1b0f376ef931596b19d8e
refs/heads/master
2023-02-25T21:22:26.154352
2021-02-04T05:42:57
2021-02-04T05:42:57
315,136,372
0
0
null
null
null
null
UTF-8
Java
false
false
8,002
java
package dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import model.Customer; import model.Order; import model.OrderItem; import model.Product; public class OrderItemDAO { public int orderId; /** * Retrieves a Product from the database. * * @param productId the productId of the product to retrieve * @return the product retrieved from the database * @throws SQLException */ public static OrderItem getOrderItem(long itemId) throws SQLException { OrderItem orderItem = null; // first, we need to establish a connection to the database. we // call getConnection, which will return a new connection object. Connection conn = DAO.getConnection(); // a statement is a query we'll execute on the database. this // includes select, insert, update, and delete statements. a // prepared statement is a parameterized statement that allows // us to pass in values to predefined placeholders. PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM orderitems WHERE orderId = ?"); // we need to provide an actual value for our placeholder. pstmt.setLong(1, itemId); // when we execute our query (a select statement), it's going to // return zero or more rows. we'll store that result in what is // called a result set. ResultSet rs = pstmt.executeQuery(); // a result set has something called a cursor that points at the // current row. initially, this cursor is positioned before the // first row (i.e., it points at nothing). we need to call next // to tell the cursor to advance to the first row. // // next returns a boolean value. if it returns true, that means // the cursor successfully advanced to the next row (which, in this // case, is the first row). // // our query is designed to return a single row. if next returns // true, that means we've got a row. we'll use that row to build // a product object. if (rs.next()) { orderItem = new OrderItem((Product) (rs.getRef(4)).getObject()); orderItem.setItemId(rs.getLong(1)); orderItem.setQuantity(rs.getInt(2)); } // we're done with the result set, prepared statement, and connection // objects, so we should close them. this is a form of memory management. rs.close(); pstmt.close(); conn.close(); return orderItem; } /** * Retrieves all Products from the database. * * @return a list of products retrieved from the database * @throws SQLException */ public static List<OrderItem> getOrderItems(long itemId, List<Product> products) throws SQLException { List<OrderItem> orderItems = new ArrayList<>(); Connection conn = DAO.getConnection(); PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM orderitems WHERE orderid = ?"); pstmt.setLong(1, itemId); ResultSet rs = pstmt.executeQuery(); // earlier, we created a prepared statement (i.e., a parameterized // statement). this is just a regular statement, which is used for // simpler queries that don't require additional values. // statements are executed the same way prepared statements are. their // results are stored in a result set, too. the only difference is we // pass the SQL directly into the executeQuery method. // remember, next returns true if the cursor is advanced to the next // row. last time, we called next in an if statement to advance the // cursor to the first and only row. // // this query is designed to return more than one row, so we call next // in the condition of a while loop instead. this allows us to repeatedly // build products from every row in the result set. the while loop will // exist after the last row is processed and next returns false. while (rs.next()) { pstmt.setLong(1, rs.getLong(1)); for (int i = 0; i < products.size(); i++) { if (rs.getLong(1) == products.get(i).getProductId()) { OrderItem orderItem = new OrderItem(products.get(i)); orderItem.setItemId(rs.getLong(1)); orderItem.setQuantity(rs.getInt(2)); orderItems.add(orderItem); } } } rs.close(); pstmt.close(); conn.close(); return orderItems; } /** * Inserts a Product into the database. * * @param product the product to insert into the database * @throws SQLException */ public static void insertOrderItem(OrderItem orderItem, Order order) throws SQLException { Connection conn = DAO.getConnection(); PreparedStatement pstmt = conn.prepareStatement( "INSERT INTO orderitems (" + " quantity, " + " orderid, " + " productid " + ") VALUES (?, ?, ?)" ); // we've got quite a few more placeholders to fill in this time. they // are numbered in the order in which they appear in the SQL statement. // pstmt.setString(1, product.getTitle()); // pstmt.setString(2, product.getAuthor()); // pstmt.setLong(3, product.getReleaseDate()); // pstmt.setInt(4, product.getIssue()); // pstmt.setDouble(5, product.getUnitPrice()); // pstmt.setInt(6, product.getCopies()); pstmt.setInt(1, orderItem.getQuantity()); pstmt.setLong(2, order.getOrderId()); pstmt.setLong(3, orderItem.getProduct().getProductId()); pstmt.executeUpdate(); pstmt.close(); conn.close(); } /** * Updates an existing Product in the database * * @param product the new product used to update the old one * @throws SQLException */ public static void updateOrder(OrderItem orderItem, Order order) throws SQLException { Connection conn = DAO.getConnection(); PreparedStatement pstmt = conn.prepareStatement( "UPDATE orders SET " + " quantity = ?, " + " orderid = ?, " + " productid = ?, " + "WHERE id = ?" ); pstmt.setInt(1, orderItem.getQuantity()); pstmt.setLong(2, order.getOrderId()); pstmt.setLong(3, orderItem.getProduct().getProductId()); pstmt.executeUpdate(); pstmt.close(); conn.close(); } /** * Deletes an existing Product from the database. * * @param product the product to delete * @throws SQLException */ public static void deleteOrderItem(OrderItem orderItem) throws SQLException { Connection conn = DAO.getConnection(); PreparedStatement pstmt = conn.prepareStatement("DELETE FROM orderItems WHERE id = ?"); // we're deleting a product from the table, so we only need the primary key // (in this case, the id column). a primary key, which can be a combination // of columns (called a composite key) is the value that is guaranteed to // uniquely identify a row in the table. pstmt.setLong(1, orderItem.getItemId()); pstmt.executeUpdate(); pstmt.close(); conn.close(); } }
[ "jparedes0303@gmail.com" ]
jparedes0303@gmail.com
9da8298f25bfbbb093a0915528c924674c6693ff
05f2a8fc3fe1e6b081c1fe09ec7d28e9cbd4c02e
/machine-geek-system/src/main/java/cn/machine/geek/websocket/constant/WebSocketConstant.java
0fdc44ffff72a724be02d747e2c8bd7f9a1f9711
[]
no_license
AlgoYu/machine-geek
b780f272f82176bab200bca79b00af7674ed5639
1d554d7c2aff6485579495d440281b47f35ea207
refs/heads/master
2023-02-25T02:35:37.434001
2021-02-03T02:05:41
2021-02-03T02:05:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
443
java
package cn.machine.geek.websocket.constant; import org.springframework.data.redis.listener.ChannelTopic; /** * @Author: MachineGeek * @Description: WebSocket常量 * @Email: 794763733@qq.com * @Date: 2020/11/12 */ public class WebSocketConstant { public static final String URI = "websocket"; public static final String TOKEN = "token"; public static ChannelTopic WEB_SOCKET_CHANNEL_TOPIC = new ChannelTopic("WebSocket"); }
[ "794763733@qq.com" ]
794763733@qq.com
ca0b0aec868466bd990d0d422701b960a71544d6
b15712f0ce6ed2f11cd46139b979fc86ffe39014
/src/dao/MemberDAOImpl.java
e403ede8401060475d6b731a845ffa01024799c6
[]
no_license
wldms0828/GMS-Model1
39e2c288f19b749b8073dde26d8481943503b78d
0a4eba6e4865ae3c86640141fb55fde57e1f1a3c
refs/heads/master
2020-03-22T21:36:43.961318
2018-09-03T01:41:02
2018-09-03T01:41:02
140,700,498
0
0
null
null
null
null
UTF-8
Java
false
false
6,242
java
package dao; import java.sql.*; import java.util.*; import domain.MemberBean; import enums.MemberQuery; import enums.Vendor; import factory.*; import pool.*; public class MemberDAOImpl implements MemberDAO { private static MemberDAO instance = new MemberDAOImpl(); public static MemberDAO getInstance() {return instance;} private MemberDAOImpl() {} @Override public void insertMemberBean(MemberBean member) { try { DatabaseFactory.createDatabase(Vendor.ORACLE, DBConstant.USER_NAME, DBConstant.PASSWORD) .getConnection().createStatement().executeUpdate(String.format(MemberQuery.INSERT_MEMBER.toString(),member.getUserId(),member.getName(),member.getSsn(),member.getPassword())); } catch (Exception e) { e.printStackTrace(); } } @Override public List<MemberBean> selectAllMember() { List<MemberBean> list= new ArrayList<>(); try { ResultSet rs = DatabaseFactory.createDatabase(Vendor.ORACLE, DBConstant.USER_NAME, DBConstant.PASSWORD) .getConnection() .createStatement() .executeQuery( MemberQuery.SELECT_ALL.toString()); MemberBean mem = null; while(rs.next()) { mem = new MemberBean(); mem.setUserId(rs.getString("USERID")); mem.setTeamId(rs.getString("TEAMID")); mem.setName(rs.getString("NAME")); mem.setSsn(rs.getString("SSN")); mem.setRoll(rs.getString("ROLL")); mem.setPassword(rs.getString("PASSWORD")); list.add(mem); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return list; } @Override public List<MemberBean> selectByName(String name) { List<MemberBean> list = new ArrayList<>(); try { ResultSet rs = DatabaseFactory.createDatabase(Vendor.ORACLE, DBConstant.USER_NAME, DBConstant.PASSWORD) .getConnection() .createStatement() .executeQuery(String.format(MemberQuery.SELECT_BY_NAME.toString(), name)); MemberBean mem = null; while(rs.next()) { mem = new MemberBean(); mem.setName(rs.getString("NAME")); mem.setSsn(rs.getString("SSN")); mem.setUserId(rs.getString("USERID")); mem.setTeamId(rs.getString("TEAMID")); mem.setPassword(rs.getString("PASSWORD")); mem.setRoll(rs.getString("ROLL")); list.add(mem); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return list; } @Override public MemberBean selectById(String id) { MemberBean mem = null; try { ResultSet rs = DatabaseFactory.createDatabase(Vendor.ORACLE, DBConstant.USER_NAME, DBConstant.PASSWORD) .getConnection() .createStatement() .executeQuery(String.format(MemberQuery.SEARCH_BY_ID.toString(), id )); while(rs.next()) { mem = new MemberBean(); mem.setName(rs.getString("NAME")); mem.setSsn(rs.getString("SSN")); mem.setUserId(rs.getString("USERID")); mem.setTeamId(rs.getString("TEAMID")); mem.setPassword(rs.getString("PASSWORD")); mem.setRoll(rs.getString("ROLL")); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return mem; } @Override public int countMember() { int count = 0; try { ResultSet rs = DatabaseFactory.createDatabase(Vendor.ORACLE, DBConstant.USER_NAME, DBConstant.PASSWORD) .getConnection() .createStatement() .executeQuery(MemberQuery.COUNT_MEMBER.toString()); while(rs.next()) { count = rs.getInt("count"); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return count; } @Override public void updateMember(MemberBean member) { try { DatabaseFactory .createDatabase(Vendor.ORACLE, DBConstant.USER_NAME,DBConstant.PASSWORD) .getConnection() .createStatement() .executeUpdate( String.format(MemberQuery.UPDATE_MEMBER.toString(), member.getPassword().split("/")[1], member.getUserId(), member.getPassword().split("/")[0]) ); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override public void deleteMember(MemberBean member) { try { DatabaseFactory.createDatabase(Vendor.ORACLE,DBConstant.USER_NAME , DBConstant.PASSWORD) .getConnection().createStatement().executeQuery(String.format(MemberQuery.DELETE_MEMBER.toString(), member.getUserId(),member.getPassword())); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } // <!-- "oracle.jdbc.driver.OracleDriver" --> // <!-- "jdbc:oracle:thin:@localhost:1521:xe" --> // <!-- "wldms" --> // <!-- "wldms0828" --> @Override public MemberBean login(MemberBean member) { MemberBean mem = null; try { System.out.println("멤버 파라미터" + member.getUserId()); System.out.println("멤버 파라미터" + member.getPassword()); ResultSet rs = DatabaseFactory .createDatabase(Vendor.ORACLE , DBConstant.USER_NAME , DBConstant.PASSWORD) .getConnection() .createStatement() .executeQuery( String.format(MemberQuery.LOGIN.toString() , member.getUserId(), member.getPassword())); while (rs.next()) { mem = new MemberBean(); mem.setUserId(rs.getString("MEM_ID")); mem.setTeamId(rs.getString("TEAM_ID")); mem.setPassword(rs.getString("PASSWORD")); mem.setName(rs.getString("NAME")); mem.setSsn(rs.getString("SSN")); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return mem; } @Override public MemberBean join(MemberBean member) { MemberBean mem2 = null; try { ResultSet rs = DatabaseFactory.createDatabase(Vendor.ORACLE, DBConstant.USER_NAME, DBConstant.PASSWORD) .getConnection() .createStatement() .executeQuery(String.format(MemberQuery.JOIN.toString() ,member.getUserId(), member.getPassword() ,member.getSsn(), member.getName())); if (rs.next()) { mem2 = new MemberBean(); mem2.setUserId(rs.getString("USERID")); mem2.setPassword(rs.getString("PASSWORD")); mem2.setSsn(rs.getString("SSN")); mem2.setName(rs.getString("NAME")); } } catch (Exception e) { e.printStackTrace(); } return mem2; } }
[ "whatsportskim@gmail.com" ]
whatsportskim@gmail.com
52862a19f1565bc964599991ebebb76fca9fcc04
3e216449f4ec6afec2343c9be067763fd00cdbbf
/app/src/main/java/com/example/tbprojet32/presentation/model/RestPokemonResponse.java
d38ad7953a6e408ce5de6b5b025da1286b7cfbbf
[]
no_license
BenkemounTom/Tombenkemounprojet32
a10f66fab3c64ac89d5879feffd3799612bc2914
fa9c26aaaa6e948fdc4b69a645f42fc6a2039fe4
refs/heads/master
2023-02-13T06:35:16.733270
2020-12-29T22:44:09
2020-12-29T22:44:09
265,550,762
0
0
null
null
null
null
UTF-8
Java
false
false
450
java
package com.example.tbprojet32.presentation.model; import com.example.tbprojet32.presentation.model.Pokemon; import java.util.List; public class RestPokemonResponse { private Integer count; private String next; private List<Pokemon> results; public Integer getCount() { return count; } public String getNext() { return next; } public List<Pokemon> getResults() { return results; } }
[ "tombenkemoun@free.fr" ]
tombenkemoun@free.fr
3e54939b3e6c69a39095bd433ddd16848422fe12
3293449352795a0f4033e00bf36d1460615a5ec0
/app/src/main/java/com/miniproj/rushi/analytics/DatabaseOperations.java
b2545574a409142c3060695f8c2cfa09cda2d12e
[]
no_license
RushilBasappa/Analytics
bcdb1ccc3c54b421174a52fa0e6751903dabe7f4
f72d632008791bafc4c01c8bcdfdd0eb10c06017
refs/heads/master
2016-08-12T13:40:03.447116
2016-02-14T16:32:37
2016-02-14T16:32:37
51,702,498
0
0
null
null
null
null
UTF-8
Java
false
false
5,491
java
package com.miniproj.rushi.analytics; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; /** * Created by Rushil on 28-Jun-15. */ public class DatabaseOperations extends SQLiteOpenHelper { String CREATE_TABLE_Line = "CREATE TABLE " + TableInfo.Line_data_Table + "(" + TableInfo.Line_KEY_ID + " integer primary key autoincrement," + TableInfo.Line_xaxis + " TEXT," + TableInfo.Line_yaxis + " TEXT);"; String CREATE_TABLE_LineCount = "CREATE TABLE " + TableInfo.Line_Count_Table + "(" + TableInfo.Line_KEY_ID + " integer primary key autoincrement," + TableInfo.Line_ser_name + " TEXT," + TableInfo.Line_PointsPerSeries + " INTEGER);"; String CREATE_TABLE_Bar = "CREATE TABLE " + TableInfo.Bar_data_Table + "(" + TableInfo.Bar_KEY_ID + " integer primary key autoincrement," + TableInfo.Bar_xaxis + " INTEGER," + TableInfo.Bar_yaxis + " INTEGER);"; String CREATE_TABLE_BarCount = "CREATE TABLE " + TableInfo.Bar_Count_Table + "(" + TableInfo.Bar_KEY_ID + " integer primary key autoincrement," + TableInfo.Bar_ser_name + " TEXT," + TableInfo.Bar_PointsPerSeries + " INTEGER);"; String CREATE_TABLE_PIE = "CREATE TABLE " + TableInfo.Pie_table + "(" + TableInfo.Pie_ser_name + " TEXT," + TableInfo.Pie_ser_value + " INTEGER);"; public DatabaseOperations(Context context) { super(context, TableInfo.Database_name, null, 1); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL(CREATE_TABLE_Line); db.execSQL(CREATE_TABLE_LineCount); db.execSQL(CREATE_TABLE_Bar); db.execSQL(CREATE_TABLE_BarCount); db.execSQL(CREATE_TABLE_PIE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { } public void putLinePoints(DatabaseOperations db, String xdata, String ydata) { SQLiteDatabase SQ = db.getWritableDatabase(); ContentValues CV = new ContentValues(); CV.put(TableInfo.Line_xaxis, xdata); CV.put(TableInfo.Line_yaxis, ydata); SQ.insert(TableInfo.Line_data_Table, null, CV); } public void putLineCount(DatabaseOperations db, String SerName, Integer count) { SQLiteDatabase SQ = db.getWritableDatabase(); ContentValues CV = new ContentValues(); CV.put(TableInfo.Line_ser_name, SerName); CV.put(TableInfo.Line_PointsPerSeries, count); SQ.insert(TableInfo.Line_Count_Table, null, CV); } public Cursor getLinePoints(DatabaseOperations db) { SQLiteDatabase SQ = db.getReadableDatabase(); String[] Columns = {TableInfo.Line_xaxis, TableInfo.Line_yaxis}; Cursor CR = SQ.query(TableInfo.Line_data_Table, Columns, null, null, null, null, null); return CR; } public Cursor getLineCount(DatabaseOperations db) { SQLiteDatabase SQ = db.getReadableDatabase(); String[] Columns = {TableInfo.Line_KEY_ID, TableInfo.Line_ser_name, TableInfo.Line_PointsPerSeries}; Cursor CR = SQ.query(TableInfo.Line_Count_Table, Columns, null, null, null, null, null); return CR; } public void putBarPoints(DatabaseOperations db, double xdata, double ydata) { SQLiteDatabase SQ = db.getWritableDatabase(); ContentValues CV = new ContentValues(); CV.put(TableInfo.Bar_xaxis, xdata); CV.put(TableInfo.Bar_yaxis, ydata); SQ.insert(TableInfo.Bar_data_Table, null, CV); } public void putBarCount(DatabaseOperations db, String SerName, Integer count) { SQLiteDatabase SQ = db.getWritableDatabase(); ContentValues CV = new ContentValues(); CV.put(TableInfo.Bar_ser_name, SerName); CV.put(TableInfo.Bar_PointsPerSeries, count); SQ.insert(TableInfo.Bar_Count_Table, null, CV); } public Cursor getBarPoints(DatabaseOperations db) { SQLiteDatabase SQ = db.getReadableDatabase(); String[] Columns = {TableInfo.Bar_xaxis, TableInfo.Bar_yaxis}; Cursor CR = SQ.query(TableInfo.Bar_data_Table, Columns, null, null, null, null, null); return CR; } public Cursor getBarCount(DatabaseOperations db) { SQLiteDatabase SQ = db.getReadableDatabase(); String[] Columns = {TableInfo.Bar_KEY_ID, TableInfo.Bar_ser_name, TableInfo.Bar_PointsPerSeries}; Cursor CR = SQ.query(TableInfo.Bar_Count_Table, Columns, null, null, null, null, null); return CR; } public void putPiePoints(DatabaseOperations db, String SerName, Integer count) { SQLiteDatabase SQ = db.getWritableDatabase(); ContentValues CV = new ContentValues(); CV.put(TableInfo.Pie_ser_name, SerName); CV.put(TableInfo.Pie_ser_value, count); SQ.insert(TableInfo.Pie_table, null, CV); } public Cursor getPiePoints(DatabaseOperations db) { SQLiteDatabase SQ = db.getReadableDatabase(); String[] Columns = {TableInfo.Pie_ser_name, TableInfo.Pie_ser_value}; Cursor CR = SQ.query(TableInfo.Pie_table, Columns, null, null, null, null, null); return CR; } }
[ "rushil.oucse37@gmail.com" ]
rushil.oucse37@gmail.com
9f330ac7334da82975be47da5992fc519c6d2fbf
397893fbcbbc870dd7f309a9a4d8eae208661572
/src/modelo/TipoContas.java
f860a6741c48687f1873f7df21441cc6a23e8bf8
[]
no_license
AlissonBreno/reppy
c2db01e02917b72908c40c0529e13ae5f9999ed8
dc31c5dd3a2b591ea8c8db1bccebd5ebe72e75ec
refs/heads/main
2023-01-24T20:17:51.958890
2020-12-12T00:28:25
2020-12-12T00:28:25
310,930,933
0
0
null
null
null
null
UTF-8
Java
false
false
547
java
package modelo; public class TipoContas { private Integer id; private String TipodeConta; private String Credor; public TipoContas() { } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getTipodeConta() { return TipodeConta; } public void setTipodeConta(String tipodeConta) { this.TipodeConta = tipodeConta; } public String getCredor() { return Credor; } public void setCredor(String credor) { this.Credor = credor; } }
[ "jeffersonmarinho97@gmail.com" ]
jeffersonmarinho97@gmail.com
5fe9a1fc4582727970a3aabf523ed0d5a8ccf014
a5b39df8c447620f996073c4dbde3fe8db5c8bb3
/day14_Socket网络编程、NIO,AIO/src/com/itheima/demo8_线程优化并发操作/Server.java
f48a5e021b213c172d40b7435b93cf6354c4e9f9
[]
no_license
xiaozhi1218/javaee
b6a72fee7e7145f577732c85b167fe65bc4dc6e4
b12496c77f450e20d6b75454c991c8106589269c
refs/heads/main
2021-12-03T12:13:08.620324
2021-12-01T06:59:57
2021-12-01T06:59:57
198,920,540
1
0
null
2021-04-22T18:29:28
2019-07-26T00:49:52
TSQL
UTF-8
Java
false
false
2,367
java
package com.itheima.demo8_线程优化并发操作; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.net.ServerSocket; import java.net.Socket; /** * @Author:pengzhilin * @Date: 2020/9/23 11:02 */ public class Server { public static void main(String[] args) throws Exception{ // 服务器: // 1.创建ServerSocket对象,指定端口号(6666) ServerSocket ss = new ServerSocket(6666); // 循环接收请求 while (true){ // 2.调用accept()方法接收客户端请求,得到Socket对象 Socket socket = ss.accept(); // 只要建立连接,就开辟线程上传文件 new Thread(new Runnable() { @Override public void run() { try{ // 3.通过返回的Socket对象获得输入流 InputStream is = socket.getInputStream(); // 4.创建字节输出流对象,关联目的地文件路径 FileOutputStream fos = new FileOutputStream("day14\\aaa\\"+System.currentTimeMillis()+".jpg"); // 5.定义一个字节数组,用来存储读取到的字节数据 byte[] bys = new byte[8192]; // 5.定义一个int变量,用来存储读取到的字节个数 int len; // 6.循环读取数据 while ((len = is.read(bys)) != -1) {// 卡死 // 7.在循环中,写出数据 fos.write(bys, 0, len); } System.out.println("============开始回写数据给客户端=========="); // 8.通过返回的Socket对象获得输出流 OutputStream os = socket.getOutputStream(); // 9.写出字符串数据给客户端 os.write("文件上传成功!".getBytes()); // 10.关闭流,释放资源 fos.close(); socket.close(); //ss.close(); }catch (Exception e){ } } }).start(); } } }
[ "chenyongzhijjk@163.com" ]
chenyongzhijjk@163.com
ee6132c0f6e90c7767db23897463657964ec3d68
fb693b3e47e043694067cfa3216839e940e3c203
/pc/src/com/rp25/routePlanning/RouteAction.java
1af643313e5af205bee880b107d0fdb2b5cc74a0
[]
no_license
MMJ744/Warehouse
bade7f2edb6deaa106f8d7d44c76103aac908abb
e408891388a1ecce31a9dc152e681c4a51486643
refs/heads/master
2022-11-23T15:42:49.400859
2018-03-23T11:52:37
2018-03-23T11:52:37
281,202,896
1
0
null
null
null
null
UTF-8
Java
false
false
1,270
java
package com.rp25.routePlanning; import java.awt.Point; public class RouteAction { public enum ACTION { MOVE, WAIT, PICKUP, DROPOFF } ACTION action; Point point; int robotID; String itemID; int itemCount; public RouteAction(ACTION action, Point point) { this(action, point, -1); } public RouteAction(ACTION action, Point point, int robotID) { this(action, point, robotID, null, 0); } public RouteAction(ACTION action, Point point, int robotID, String itemID, int itemCount) { this.action = action; this.point = point; this.robotID = robotID; this.itemID = itemID; this.itemCount = itemCount; } public Point getPoint() { return point; } public ACTION getAction() { return action; } public String getItemID() { return itemID; } public int getItemCount() { return itemCount; } @Override public String toString() { return robotID + " -> ACTION: " + enumToString(action) + " x: " + point.x + ", y: " + point.y; } public String enumToString(ACTION action) { switch (action) { case MOVE: return "MOVE to"; case WAIT: return "WAIT at"; case PICKUP: return "PICKUP at"; case DROPOFF: return "DROPOFF at"; } return ""; } }
[ "mmj744@cs.bham.ac.uk" ]
mmj744@cs.bham.ac.uk
13044fbcd6c618ca63371df23d74c2983ba1e78e
c608b5eb8d75146256195be21369364125d5e06b
/src/poke/model/Bulbasaur.java
1462b4f01d565e5500457847bb4164e284a9153e
[]
no_license
Asmi0816/Pokemon
2384ba1c253fc9ff35ae2b4585aefc7b5f2860ad
feec073e3fc58a8f118236552abafb1f4cbf5682
refs/heads/master
2020-06-16T08:45:17.478739
2017-01-27T19:10:17
2017-01-27T19:10:17
75,120,472
0
0
null
null
null
null
UTF-8
Java
false
false
379
java
package poke.model; public class Bulbasaur extends Pokemon implements Grass { public Bulbasaur() { super("Bulbasaur", 001); } public Bulbasaur(String name) { super(name, 001); } public Bulbasaur(String name, int number) { super(name, number); } public int vineWhip() { return 2; } public int leechSeed() { return this.getAttackPoints() * 2; } }
[ "kidwriter2020@gmail.com" ]
kidwriter2020@gmail.com
569bc2d0f751878422dcfd1bc6cd284d85ed5381
be7255eeb02b1a4426d9526180269d87d949664e
/app/src/main/java/com/uranus/economy/util/ToastUtils.java
0c22d41275f5d5026b5f8658db86f8b603013b5a
[]
no_license
uranusTian/economy
65776dc30a252ea4669b9ce0434be3915c169cf3
a7abf642053abe48aac0a50e7fbba82d20749805
refs/heads/master
2023-03-12T00:17:50.687110
2020-11-04T13:20:23
2020-11-04T13:20:23
249,207,246
0
0
null
null
null
null
UTF-8
Java
false
false
18,177
java
package com.uranus.economy.util; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Color; import android.graphics.PixelFormat; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.WindowManager; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.ColorInt; import androidx.annotation.DrawableRes; import androidx.annotation.LayoutRes; import androidx.annotation.StringRes; import androidx.core.app.NotificationManagerCompat; import com.uranus.economy.base.App; import com.uranus.economy.views.FontManager; import com.uranus.economy.views.FontType; import java.lang.reflect.Field; public class ToastUtils { private static final int COLOR_DEFAULT = 0xFEFFFFFF; private static final Handler HANDLER = new Handler(Looper.getMainLooper()); private static final String NULL = "null"; private static IToast iToast; private static int sGravity = -1; private static int sXOffset = -1; private static int sYOffset = -1; private static int sBgColor = COLOR_DEFAULT; private static int sBgResource = -1; private static int sMsgColor = COLOR_DEFAULT; private static int sMsgTextSize = -1; private ToastUtils() { throw new UnsupportedOperationException("u can't instantiate me..."); } /** * Set the gravity. * * @param gravity The gravity. * @param xOffset X-axis offset, in pixel. * @param yOffset Y-axis offset, in pixel. */ public static void setGravity(final int gravity, final int xOffset, final int yOffset) { sGravity = gravity; sXOffset = xOffset; sYOffset = yOffset; } /** * Set the color of background. * * @param backgroundColor The color of background. */ public static void setBgColor(@ColorInt final int backgroundColor) { sBgColor = backgroundColor; } /** * Set the resource of background. * * @param bgResource The resource of background. */ public static void setBgResource(@DrawableRes final int bgResource) { sBgResource = bgResource; } /** * Set the color of message. * * @param msgColor The color of message. */ public static void setMsgColor(@ColorInt final int msgColor) { sMsgColor = msgColor; } /** * Set the text size of message. * * @param textSize The text size of message. */ public static void setMsgTextSize(final int textSize) { sMsgTextSize = textSize; } /** * Show the toast for a short period of time. * * @param text The text. */ public static void showShort(final CharSequence text) { show(text == null ? NULL : text, Toast.LENGTH_SHORT); } /** * Show the toast for a short period of time. * * @param resId The resource id for text. */ public static void showShort(@StringRes final int resId) { show(resId, Toast.LENGTH_SHORT); } /** * Show the toast for a short period of time. * * @param resId The resource id for text. * @param args The args. */ public static void showShort(@StringRes final int resId, final Object... args) { show(resId, Toast.LENGTH_SHORT, args); } /** * Show the toast for a short period of time. * * @param format The format. * @param args The args. */ public static void showShort(final String format, final Object... args) { show(format, Toast.LENGTH_SHORT, args); } /** * Show the toast for a long period of time. * * @param text The text. */ public static void showLong(final CharSequence text) { show(text == null ? NULL : text, Toast.LENGTH_LONG); } /** * Show the toast for a long period of time. * * @param resId The resource id for text. */ public static void showLong(@StringRes final int resId) { show(resId, Toast.LENGTH_LONG); } /** * Show the toast for a long period of time. * * @param resId The resource id for text. * @param args The args. */ public static void showLong(@StringRes final int resId, final Object... args) { show(resId, Toast.LENGTH_LONG, args); } /** * Show the toast for a long period of time. * * @param format The format. * @param args The args. */ public static void showLong(final String format, final Object... args) { show(format, Toast.LENGTH_LONG, args); } /** * Show custom toast for a short period of time. * * @param layoutId ID for an XML layout resource to load. */ public static View showCustomShort(@LayoutRes final int layoutId) { final View view = getView(layoutId); show(view, Toast.LENGTH_SHORT); return view; } /** * Show custom toast for a long period of time. * * @param layoutId ID for an XML layout resource to load. */ public static View showCustomLong(@LayoutRes final int layoutId) { final View view = getView(layoutId); show(view, Toast.LENGTH_LONG); return view; } /** * Cancel the toast. */ public static void cancel() { if (iToast != null) { iToast.cancel(); } } private static void show(final int resId, final int duration) { try { CharSequence text = App.context.getResources().getText(resId); show(text, duration); } catch (Exception ignore) { show(String.valueOf(resId), duration); } } private static void show(final int resId, final int duration, final Object... args) { try { CharSequence text = App.context.getResources().getText(resId); String format = String.format(text.toString(), args); show(format, duration); } catch (Exception ignore) { show(String.valueOf(resId), duration); } } private static void show(final String format, final int duration, final Object... args) { String text; if (format == null) { text = NULL; } else { text = String.format(format, args); if (text == null) { text = NULL; } } show(text, duration); } private static void show(final CharSequence text, final int duration) { HANDLER.post(new Runnable() { @SuppressLint("ShowToast") @Override public void run() { cancel(); iToast = ToastFactory.makeToast(App.context, text, duration); final TextView tvMessage = iToast.getView().findViewById(android.R.id.message); if (sMsgColor != COLOR_DEFAULT) { tvMessage.setTextColor(sMsgColor); } if (sMsgTextSize != -1) { tvMessage.setTextSize(sMsgTextSize); } //修改字体 FontManager.setFontType(tvMessage, FontType.No); //字体居中 tvMessage.setGravity(Gravity.CENTER); if (sGravity != -1 || sXOffset != -1 || sYOffset != -1) { iToast.setGravity(sGravity, sXOffset, sYOffset); } setBg(tvMessage); iToast.show(); } }); } private static void show(final View view, final int duration) { HANDLER.post(new Runnable() { @Override public void run() { cancel(); iToast = ToastFactory.newToast(App.context); iToast.setView(view); iToast.setDuration(duration); if (sGravity != -1 || sXOffset != -1 || sYOffset != -1) { iToast.setGravity(sGravity, sXOffset, sYOffset); } setBg(); iToast.show(); } }); } private static void setBg() { if (sBgResource != -1) { final View toastView = iToast.getView(); toastView.setBackgroundResource(sBgResource); } else if (sBgColor != COLOR_DEFAULT) { final View toastView = iToast.getView(); Drawable background = toastView.getBackground(); if (background != null) { background.setColorFilter( new PorterDuffColorFilter(sBgColor, PorterDuff.Mode.SRC_IN) ); } else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { toastView.setBackground(new ColorDrawable(sBgColor)); } else { toastView.setBackgroundDrawable(new ColorDrawable(sBgColor)); } } } } private static void setBg(final TextView tvMsg) { if (sBgResource != -1) { final View toastView = iToast.getView(); toastView.setBackgroundResource(sBgResource); tvMsg.setBackgroundColor(Color.TRANSPARENT); } else if (sBgColor != COLOR_DEFAULT) { final View toastView = iToast.getView(); Drawable tvBg = toastView.getBackground(); Drawable msgBg = tvMsg.getBackground(); if (tvBg != null && msgBg != null) { tvBg.setColorFilter(new PorterDuffColorFilter(sBgColor, PorterDuff.Mode.SRC_IN)); tvMsg.setBackgroundColor(Color.TRANSPARENT); } else if (tvBg != null) { tvBg.setColorFilter(new PorterDuffColorFilter(sBgColor, PorterDuff.Mode.SRC_IN)); } else if (msgBg != null) { msgBg.setColorFilter(new PorterDuffColorFilter(sBgColor, PorterDuff.Mode.SRC_IN)); } else { toastView.setBackgroundColor(sBgColor); } } } private static View getView(@LayoutRes final int layoutId) { LayoutInflater inflate = (LayoutInflater) App.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); //noinspection ConstantConditions return inflate.inflate(layoutId, null); } static class ToastFactory { static IToast makeToast(Context context, CharSequence text, int duration) { if (NotificationManagerCompat.from(context).areNotificationsEnabled()) { return new SystemToast(makeNormalToast(context, text, duration)); } return new ToastWithoutNotification(makeNormalToast(context, text, duration)); } static IToast newToast(Context context) { if (NotificationManagerCompat.from(context).areNotificationsEnabled()) { return new SystemToast(new Toast(context)); } return new ToastWithoutNotification(new Toast(context)); } private static Toast makeNormalToast(Context context, CharSequence text, int duration) { @SuppressLint("ShowToast") Toast toast = Toast.makeText(context, "", duration); toast.setText(text); return toast; } } static class SystemToast extends AbsToast { private static Field sField_mTN; private static Field sField_TN_Handler; SystemToast(Toast toast) { super(toast); if (Build.VERSION.SDK_INT == Build.VERSION_CODES.N_MR1) { try { //noinspection JavaReflectionMemberAccess sField_mTN = Toast.class.getDeclaredField("mTN"); sField_mTN.setAccessible(true); Object mTN = sField_mTN.get(toast); sField_TN_Handler = sField_mTN.getType().getDeclaredField("mHandler"); sField_TN_Handler.setAccessible(true); Handler tnHandler = (Handler) sField_TN_Handler.get(mTN); sField_TN_Handler.set(mTN, new SafeHandler(tnHandler)); } catch (Exception ignored) { /**/ } } } @Override public void show() { mToast.show(); } @Override public void cancel() { mToast.cancel(); } static class SafeHandler extends Handler { private Handler impl; SafeHandler(Handler impl) { this.impl = impl; } @Override public void handleMessage(Message msg) { try { impl.handleMessage(msg); } catch (Exception e) { Log.e("ToastUtils", e.toString()); } } @Override public void dispatchMessage(Message msg) { impl.dispatchMessage(msg); } } } static class ToastWithoutNotification extends AbsToast { private WindowManager mWM; private View mView; private WindowManager.LayoutParams mParams = new WindowManager.LayoutParams(); ToastWithoutNotification(Toast toast) { super(toast); } @Override public void show() { mView = mToast.getView(); if (mView == null) return; Context context = mToast.getView().getContext(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) { mWM = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); mParams.type = WindowManager.LayoutParams.TYPE_TOAST; mParams.y = mToast.getYOffset(); } else { Context topActivityOrApp = App.context; if (topActivityOrApp instanceof Activity) { mWM = ((Activity) topActivityOrApp).getWindowManager(); } mParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL; mParams.y = mToast.getYOffset() + getNavBarHeight(); } final Configuration config = context.getResources().getConfiguration(); final int gravity; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { gravity = Gravity.getAbsoluteGravity(mToast.getGravity(), config.getLayoutDirection()); } else { gravity = mToast.getGravity(); } mParams.height = WindowManager.LayoutParams.WRAP_CONTENT; mParams.width = WindowManager.LayoutParams.WRAP_CONTENT; mParams.format = PixelFormat.TRANSLUCENT; mParams.windowAnimations = android.R.style.Animation_Toast; mParams.setTitle("ToastWithoutNotification"); mParams.flags = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE; mParams.gravity = gravity; if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) == Gravity.FILL_HORIZONTAL) { mParams.horizontalWeight = 1.0f; } if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.FILL_VERTICAL) { mParams.verticalWeight = 1.0f; } mParams.x = mToast.getXOffset(); mParams.packageName = App.context.getPackageName(); try { mWM.addView(mView, mParams); } catch (Exception ignored) { /**/ } HANDLER.postDelayed(new Runnable() { @Override public void run() { cancel(); } }, mToast.getDuration() == Toast.LENGTH_SHORT ? 2000 : 3500); } @Override public void cancel() { try { if (mWM != null) { mWM.removeView(mView); } } catch (Exception ignored) { /**/ } mView = null; mWM = null; mToast = null; } private int getNavBarHeight() { Resources res = Resources.getSystem(); int resourceId = res.getIdentifier("navigation_bar_height", "dimen", "android"); if (resourceId != 0) { return res.getDimensionPixelSize(resourceId); } else { return 0; } } } static abstract class AbsToast implements IToast { Toast mToast; AbsToast(Toast toast) { mToast = toast; } @Override public void setView(View view) { mToast.setView(view); } @Override public View getView() { return mToast.getView(); } @Override public void setDuration(int duration) { mToast.setDuration(duration); } @Override public void setGravity(int gravity, int xOffset, int yOffset) { mToast.setGravity(gravity, xOffset, yOffset); } @Override public void setText(int resId) { mToast.setText(resId); } @Override public void setText(CharSequence s) { mToast.setText(s); } } interface IToast { void show(); void cancel(); void setView(View view); View getView(); void setDuration(int duration); void setGravity(int gravity, int xOffset, int yOffset); void setText(@StringRes int resId); void setText(CharSequence s); } }
[ "1657513085@qq.com" ]
1657513085@qq.com
c71f00cc4e18168e88b5bd8c24c251e56a6f8b79
5690d40de69fcffddac7b8c598ced789560977ae
/src/main/java/com/hejie/springboot/ServletInitializer.java
5caf3336ff409dec9a87a6a13ee5ecef9e89de58
[]
no_license
hejie61677/springboot
29950ead89df86193278e03c109daad88e38cba6
900139b85b2b4930c854605a370012a820c4ec1d
refs/heads/master
2020-05-16T10:04:25.793949
2019-05-09T07:21:21
2019-05-09T07:21:21
182,967,339
0
0
null
null
null
null
UTF-8
Java
false
false
429
java
package com.hejie.springboot; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; public class ServletInitializer extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(SpringbootApplication.class); } }
[ "hejie@qq.com" ]
hejie@qq.com
45fea837b25712e41f3265197bfb21f2cc09163a
2afe1f34cdc302d669ccf3103baec90e311cb7c6
/src/com/lesikapk/openradiobrony/Utils.java
c4226b9c241f6109c056103b71b91bd8dfbf92ad
[ "Apache-2.0" ]
permissive
Lesik/open-radiobrony
9e5a8172027fd10e3a17b8508884238295b229ff
4dce083164531fcc36b278c293e21ebf1a18034d
refs/heads/master
2016-09-09T18:17:18.213970
2014-02-02T19:30:11
2014-02-02T19:30:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
532
java
package com.lesikapk.openradiobrony; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; public class Utils { public static final boolean internetAvailable(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); return activeNetworkInfo != null && activeNetworkInfo.isConnectedOrConnecting(); } }
[ "amborsdorfer@gmail.com" ]
amborsdorfer@gmail.com
fd239cd2ab647bd4046dba76ef168502974d6cf8
a0a892b52699ebd8ea85b0ffff326d6bb2cfab6d
/app/src/main/java/com/example/wilso/gympad/ThursdayDelete.java
c09d79747a6efa997350ba0c7c0db49512d4cb49
[]
no_license
wilsonmchiu/GymPad
db3910ca13033d75805a08318fa8630d0c486b9b
80d8484f7950077fb359df121df3feb6efa74122
refs/heads/master
2020-04-15T08:29:44.425701
2019-09-09T08:41:45
2019-09-09T08:41:45
162,859,085
0
0
null
null
null
null
UTF-8
Java
false
false
2,551
java
package com.example.wilso.gympad; import android.content.Intent; import android.database.Cursor; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class ThursdayDelete extends AppCompatActivity { DatabaseHelper MONWORKOUT; EditText editName,editSets,editReps, editWeight, editID; Button btnAddData, btnUpdateData, btnDeleteData, botBar; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_thursday_delete); MONWORKOUT = new DatabaseHelper(this); editName = (EditText)findViewById(R.id.mondayInput1); editSets = (EditText)findViewById(R.id.mondayInput2); editReps = (EditText)findViewById(R.id.mondayInput3); editWeight = (EditText)findViewById(R.id.mondayInput4); editID = (EditText)findViewById(R.id.mondayInput5); botBar = (Button)findViewById(R.id.mondayAddBotBar); botBar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openHome(); } }); btnAddData = (Button)findViewById(R.id.mondayAdd2Data); btnUpdateData = (Button)findViewById(R.id.updateMonBtn); btnDeleteData = (Button)findViewById(R.id.deleteBtn); deleteData(); //viewData(); } public void openHome(){ Intent intent = new Intent(this, MainActivity.class); startActivity(intent); } public void deleteData(){ btnDeleteData.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int temp = editID.getText().toString().length(); if(temp > 0){ int deleteRow = MONWORKOUT.deleteThursData(editID.getText().toString()); if(deleteRow > 0){ Toast.makeText(ThursdayDelete.this, "Successfully Deleted The Data!", Toast.LENGTH_LONG).show(); }else{ Toast.makeText(ThursdayDelete.this, "Something went wrong :(.", Toast.LENGTH_LONG).show(); } }else{ Toast.makeText(ThursdayDelete.this, "You Must Enter An ID to Delete :(.", Toast.LENGTH_LONG).show(); } } }); } }
[ "wilsonmchiu@gmail.com" ]
wilsonmchiu@gmail.com
343b71556d7f02b9315b37d9e5683f3a05cf3121
3aeb3f7c4ae53b6661f30cba1ad96f2348e9aa94
/SuperArray.java
c315c1f804eb4b13216c9cfe352de43600d3abdd
[]
no_license
MatthewSo/ComeTogether
3d1a50357837cfeff923845adfe7a3a64b096447
9837f80c62166843254704557cdc09e274da2c1f
refs/heads/master
2021-01-18T16:47:22.300750
2015-12-10T04:31:19
2015-12-10T04:31:19
47,737,793
0
0
null
null
null
null
UTF-8
Java
false
false
5,054
java
// A Lonely Little Triangle - Matthew So // APCS1 pd10 // HW45 -- Come Together // 2015-12-9 public class SuperArray implements ListInt { //~~~~~INSTANCE VARS~~~~~ //underlying container, or "core" of this data structure: private Comparable[] _data; //position of last meaningful value private int _lastPos; //size of this instance of SuperArray private int _size; //~~~~~METHODS~~~~~ //default constructor – initializes 10-item array public SuperArray() { _data = new Comparable[10]; _lastPos = -1; _size = 0; } //output array in [a,b,c] format, eg // {1,2,3}.toString() -> "[1,2,3]" public String toString() { String storage = "["; // Keeps track of non-zeros. String stack = ""; // Keeps track of zeros. for (int i = 0; i < _size; i++) { storage += _data[i] + ","; } if (storage.equals("[")) {return "[]";} return storage.substring(0,storage.length()-1) + "]"; } //swap - switches two indices of the array //precond: int i1, i2 - two indices to be swapped public void swap(int i1, int i2) { _data[i1] = set(i2, _data[i1]); } //add - adds an item to the end of the array and gives the index meaning //precond: int value - value to be added at the end public void add(Comparable value) { if (_size+1 >= _data.length) {expand();} // Increases size if no space _data[_lastPos+1] = value; _lastPos += 1; // Afterwards, in case there is an error. _size += 1; } //add - adds an item to an index of the array and shifts array to the right //precond: int value - value to be added // int index - index to add to public void add(int index, Comparable value) { if (_size+1 >= _data.length) {expand();} add(value); for (int i = _lastPos; i > index; i--) { // "bubble swap" backwards. swap(i,i-1); } } //remove - removes an item at a specified index and shifts everything left //precond: int index - index to be removed; public void remove(int index) { for (int i = index; i < _lastPos; i++) { swap(i,i+1); } _lastPos -= 1; _size -= 1; } //remove - removes last meaningful element public void remove() { remove(_lastPos); } //double capacity of this SuperArray private void expand() { int len = _data.length * 2; Comparable[] copy = new Comparable[len]; for (int i = 0; i < len / 2; i++) { copy[i] = _data[i]; } _data = copy; } //accessor -- return value at specified index public Comparable get( int index ) { return _data[index]; } public int size() { return _size; } public int linSearch(Comparable input){ for (int i = 0; i < _size; i++){ if (_data[i].compareTo(input) == 0){ return i;}} return -1;} //returns true if sorted, otherwise false public boolean isSorted(){ boolean ret = true; Comparable prev = _data[0]; for (int i =0 ; i < _size;i++){ if (!((_data[i].compareTo(prev) >= 0))){ ret = false;} prev = _data[i];} return ret;} //mutator -- set value at index to newVal, // return old value at index public Comparable set( int index, Comparable value ) { Comparable storage = _data[index]; _data[index] = value; return storage; } //main method for testing public static void main( String[] args ) { // // ------PHASE I------ // SuperArray oof = new SuperArray(); // System.out.println("Phase I Testing:\n" + oof); // oof.expand(); // System.out.println(oof); // for (int i = 0; i < 20; i++) { // oof.set(i, i*i); // } // System.out.println(oof); // System.out.println(oof.get(3) + oof.get(4)); // 25 // oof.expand(); // // ------PHASE II------ // System.out.println(oof + "\n\n" + // "Phase II Testing:"); // SuperArray rab = new SuperArray(); // for (int i = 0; i < 10; i++) { // rab.add(i); // } // System.out.println(rab); // rab.add(5,101); // System.out.println(rab); // for (int i = 11; i < 16; i++) { // rab.add(i, i*10); // } // System.out.println(rab); // rab.remove(0); // System.out.println(rab); // rab.remove(4); // System.out.println(rab); // rab.remove(); // rab.remove(); // System.out.println(rab); // // ------PHASE III------ // System.out.println(oof + "\n\n" + // "Phase III Testing:"); // ListInt foo = new SuperArray(); // for (int i = 0; i < 10; i++) { // foo.add(i*i*i); // } // foo.add(0,-10); // System.out.println(foo); // foo.add(100); // System.out.println(foo); // foo.remove(5); // System.out.println(foo); // System.out.println(foo.size()); // System.out.println(foo.get(5)); // foo.set(5,1000); // System.out.println(foo.get(5)); //Come Together SuperArray Compare = new SuperArray(); Rational rat = new Rational(50,4); Binary bin = new Binary(10); Hexadecimal hex = new Hexadecimal(15); Compare.add(rat); Compare.add(bin); Compare.add(hex); System.out.println(Compare); System.out.println(Compare.linSearch(bin)); System.out.println(Compare.isSorted()); }//end main }//end class
[ "mso@stuy.edu" ]
mso@stuy.edu
34dd39d79fa168fd1b2872736833889b30d54c2e
e8603ffded06a8f12c3f219c1347793ecf7d235c
/test/GraphTest.java
98cda01ea05b36fd8d6c35a0f0c3914c3410e6d9
[]
no_license
guthriematthew/Beyond-gOOD
b329bf69c7ab02556c0ab260f81acd91a1caa0d7
097584100d925e82874f34777702727396ef05f2
refs/heads/master
2021-01-03T05:24:17.031357
2020-02-12T06:15:03
2020-02-12T06:15:03
239,940,696
0
0
null
null
null
null
UTF-8
Java
false
false
4,029
java
import org.jfree.data.general.DefaultPieDataset; import org.junit.Before; import org.junit.Test; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.HashSet; import java.util.Scanner; import edu.cs3500.spreadsheets.BeyondGood; import edu.cs3500.spreadsheets.model.Chart; import edu.cs3500.spreadsheets.model.Coord; import edu.cs3500.spreadsheets.model.Worksheet; import edu.cs3500.spreadsheets.model.WorksheetModel; import edu.cs3500.spreadsheets.view.EditableGUIView; import edu.cs3500.spreadsheets.view.GraphingEditableGUIView; import static junit.framework.TestCase.assertEquals; /** * A class to test the behaviors of charts and their properties including saving and opening. */ public class GraphTest { private Chart chart; private DefaultPieDataset data; private Coord s1; private Coord s2; private HashSet<Coord> dep; private int len; private WorksheetModel model; private GraphingEditableGUIView graphView; @Before public void setup() { s1 = new Coord(1, 1); s2 = new Coord(2, 1); len = 3; dep = new HashSet<>(); data = new DefaultPieDataset(); model = new Worksheet(); EditableGUIView view = new EditableGUIView("Basic View", model); graphView = new GraphingEditableGUIView(view, model); } @Test public void testGetTitle() { chart = new Chart(s1, s2, len, data, dep, "testTitle", 0); assertEquals("testTitle", chart.getTitle()); } @Test public void testGetData() { chart = new Chart(s1, s2, len, data, dep, "testTitle", 0); assertEquals(new DefaultPieDataset(), chart.getData()); } @Test public void testGetPosition() { chart = new Chart(s1, s2, len, data, dep, "testTitle", 0); assertEquals(0, chart.getPosition()); } @Test public void testGetPositionAfterUpdate() { chart = new Chart(s1, s2, len, data, dep, "testTitle", 2); assertEquals(2, chart.getPosition()); chart.shiftPosition(); assertEquals(1, chart.getPosition()); } @Test public void testToString() { chart = new Chart(s1, s2, len, data, dep, "testTitle", 0); assertEquals("A1 B1 3 testTitle", chart.toString()); } @Test public void testModelStoresGraphs() { assertEquals(new ArrayList<Chart>(), model.getCharts()); } @Test public void testModelAddsGraphs() { chart = new Chart(s1, s2, len, data, dep, "testTitle", 2); ArrayList<Chart> list = new ArrayList<>(); list.add(chart); model.addChart(chart); assertEquals(list, model.getCharts()); } @Test public void testModelUpdatesDynamically() { dep = new HashSet<>(); dep.add(new Coord(1, 1)); chart = new Chart(s1, s2, 1, data, dep, "testTitle", 2); ArrayList<Chart> list = new ArrayList<>(); list.add(chart); model.addChart(chart); model.setCell(new Coord(1, 1), "hi"); model.setCell(new Coord(2, 1), "=3"); assertEquals(list, model.getCharts()); model.setCell(new Coord(2, 1), "=5"); try { graphView.render(); } catch (IOException e) { //there should be no error here } assertEquals(list, model.getCharts()); } @Test public void testGetFileExtension() { String fileName = "file.txt"; assertEquals("file.ch", BeyondGood.fileExtension(fileName)); } // the working directory must be "Homework" 9 for this test to run @Test public void TestFileSavedCanBeOpened() { FileReader f; try { f = new FileReader("resources\\testGraphing.ch"); } catch (FileNotFoundException e) { throw new IllegalArgumentException("Given file was not found."); } Scanner scanner = new Scanner(f); assertEquals(scanner.next(), "F2"); assertEquals(scanner.next(), "G2"); assertEquals(scanner.next(), "3"); assertEquals(scanner.next(), "FruitPopularity"); assertEquals(scanner.next(), "A1"); assertEquals(scanner.next(), "B1"); assertEquals(scanner.next(), "1"); assertEquals(scanner.next(), "Other"); } }
[ "matthewrguthrie12@gmail.com" ]
matthewrguthrie12@gmail.com
8e7f356625df4c0777dfc196bf111a61a84a7f42
2e9df94485e0d8c46aea45a696bedc5f36d38b72
/GMSQ/src/Array_SumOfAllPairs.java
78ed10ec392e67966c6fb495076dbd2c74f84045
[]
no_license
aseemshrestha/CodingQuestions
154741f321b926fcebb872b03999b6833212cc1f
4cf4395f923e477c84f3f50f91157bd4899fc97a
refs/heads/master
2020-04-29T17:38:05.963321
2019-03-22T16:43:26
2019-03-22T16:43:26
176,301,902
1
0
null
null
null
null
UTF-8
Java
false
false
560
java
public class Array_SumOfAllPairs { public void sumOfAllPairs(int[] arr) { int sum = 0; for (int i = 0; i < arr.length; i++) { for(int j=i+1;j < arr.length;j++) { // System.out.println("Pairs:{"+ arr[i]+","+arr[j]+"}"); sum = sum + (arr[i] * arr[j]); } } System.out.println(sum); } public static void main(String[] args) { int[] arr = new int[]{1, 3, 4}; Array_SumOfAllPairs s = new Array_SumOfAllPairs(); s.sumOfAllPairs(arr); } }
[ "aseshres@wkmus0643470.global.publicisgroupe.net" ]
aseshres@wkmus0643470.global.publicisgroupe.net
cf588ff44ee7fa8c69b397c76576e672ec11515d
9bd500e9cd0c498fd6005be04b6edb6a29f39bec
/src/main/java/com/promineotech/jeep/entity/JeepModel.java
56a25fd81076d7d201fffb788561c060508ad0cd
[]
no_license
JohnKSmith2005/SpringBootWeek4
265bf61daac4c4208609b93446922d84c54f253d
3ce72f0bb988128faae89c7ed0288199ecfd88b2
refs/heads/main
2023-08-18T12:45:25.943078
2021-10-09T20:56:48
2021-10-09T20:56:48
415,419,543
0
0
null
null
null
null
UTF-8
Java
false
false
145
java
package com.promineotech.jeep.entity; public enum JeepModel { WRANGLER, GRAND_CHEROKEE, CHEROKEE, COMPASS, RENEGADE, GLADIATOR, WRANGLER_4XE }
[ "noreply@github.com" ]
JohnKSmith2005.noreply@github.com
185fd047896e7c84f0c99dfb04810d6fdb3bbc8c
95b40068350134b5e62a3c28716931d1e7c2a8eb
/library/src/main/java/com/developer/kalert/KAlertDialog.java
bceba94e5bbbb51127c7f8c30b55b24ea65f13a2
[ "Apache-2.0" ]
permissive
erotundo/KAlertDialog
0e5666f9641ae1d980694c380d88cfd3faaa26c0
22aab23d7fc6438d1de19762ce3a6f4f723acd8e
refs/heads/main
2023-03-10T02:20:39.933380
2021-02-20T15:05:23
2021-02-20T15:05:23
340,650,845
0
0
null
null
null
null
UTF-8
Java
false
false
16,911
java
package com.developer.kalert; import android.content.Context; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; import android.text.Html; import android.text.util.Linkify; import android.util.TypedValue; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.Transformation; import android.widget.Button; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import androidx.appcompat.app.AlertDialog; import java.util.Objects; @SuppressWarnings("ALL") public class KAlertDialog extends AlertDialog implements View.OnClickListener { private final AnimationSet mModalInAnim, mModalOutAnim, mErrorXInAnim; private final Animation mOverlayOutAnim, mImageAnim; private TextView mTitleTextView, mContentTextView; private ImageView mErrorX, mSuccessTick, mCustomImage; private Drawable mCustomImgDrawable; private Button mConfirmButton, mCancelButton; private Drawable mColor, mCancelColor; private int mConfirmHeight,mCancelHeight = 0; private View mDialogView; private View mCustomView; private FrameLayout mCustomViewContainer; private String mTitleText, mContentText, mCancelText, mConfirmText; private boolean mShowCancel, mShowContent, mShowTitleText, mCloseFromCancel, mShowConfirm; private int contentTextSize = 0; private int titleTextSize = 0; private FrameLayout mErrorFrame, mSuccessFrame, mProgressFrame, mWarningFrame; private final ProgressHelper mProgressHelper; private KAlertDialog.KAlertClickListener mCancelClickListener; private KAlertDialog.KAlertClickListener mConfirmClickListener; private int mAlertType; public static final int NORMAL_TYPE = 0; public static final int ERROR_TYPE = 1; public static final int SUCCESS_TYPE = 2; public static final int WARNING_TYPE = 3; public static final int CUSTOM_IMAGE_TYPE = 4; public static final int PROGRESS_TYPE = 5; public static boolean DARK_STYLE = false; public interface KAlertClickListener { void onClick(KAlertDialog kAlertDialog); } public static final int INPUT_TYPE = 6; private EditText mEditText; public KAlertDialog(Context context) { this(context, NORMAL_TYPE); } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.alert_dialog); mDialogView = Objects.requireNonNull(getWindow()).getDecorView().findViewById(android.R.id.content); mTitleTextView = findViewById(R.id.title_text); mContentTextView = findViewById(R.id.content_text); mErrorFrame = findViewById(R.id.error_frame); assert mErrorFrame != null; mErrorX = mErrorFrame.findViewById(R.id.error_x); mEditText = findViewById(R.id.edit_text); mSuccessFrame = findViewById(R.id.success_frame); mProgressFrame = findViewById(R.id.progress_dialog); mSuccessTick = mSuccessFrame.findViewById(R.id.success_x); mCustomImage = findViewById(R.id.custom_image); mWarningFrame = findViewById(R.id.warning_frame); mCustomViewContainer = findViewById(R.id.custom_view_container); mProgressHelper.setProgressWheel(findViewById(R.id.progressWheel)); mConfirmButton = findViewById(R.id.custom_confirm_button); mCancelButton = findViewById(R.id.cancel_button); mConfirmButton.setOnClickListener(this); mCancelButton.setOnClickListener(this); setCustomView(mCustomView); setTitleText(mTitleText); setContentText(mContentText); setCancelText(mCancelText); setConfirmText(mConfirmText); setConfirmButtonColor(mColor); setCancelButtonColor(mCancelColor); changeAlertType(mAlertType, true); } public KAlertDialog(Context context, int alertType) { super(context, DARK_STYLE ? R.style.alert_dialog_dark : R.style.alert_dialog_light); setCancelable(true); setCanceledOnTouchOutside(false); mProgressHelper = new ProgressHelper(context); mAlertType = alertType; mImageAnim = AnimationLoader.loadAnimation(getContext(), R.anim.error_frame_in); mErrorXInAnim = (AnimationSet) AnimationLoader.loadAnimation(getContext(), R.anim.error_x_in); mModalInAnim = (AnimationSet) AnimationLoader.loadAnimation(getContext(), R.anim.modal_in); mModalOutAnim = (AnimationSet) AnimationLoader.loadAnimation(getContext(), R.anim.modal_out); Objects.requireNonNull(mModalOutAnim).setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { mDialogView.setVisibility(View.GONE); mDialogView.post(() -> { if (mCloseFromCancel) { KAlertDialog.super.cancel(); } else { KAlertDialog.super.dismiss(); } }); } @Override public void onAnimationRepeat(Animation animation) { } }); mOverlayOutAnim = new Animation() { @Override protected void applyTransformation(float interpolatedTime, Transformation t) { WindowManager.LayoutParams wlp = Objects.requireNonNull(getWindow()).getAttributes(); wlp.alpha = 1 - interpolatedTime; getWindow().setAttributes(wlp); } }; mOverlayOutAnim.setDuration(120); Objects.requireNonNull(this.getWindow()).setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); } private void restore() { mCustomImage.setVisibility(View.GONE); mErrorFrame.setVisibility(View.GONE); mSuccessFrame.setVisibility(View.GONE); mWarningFrame.setVisibility(View.GONE); mProgressFrame.setVisibility(View.GONE); mConfirmButton.setVisibility(View.VISIBLE); mConfirmButton.setBackgroundResource(R.drawable.button_background); mErrorFrame.clearAnimation(); mErrorX.clearAnimation(); mSuccessTick.clearAnimation(); } private void playAnimation() { if (mAlertType == ERROR_TYPE) { mErrorFrame.startAnimation(mImageAnim); mErrorX.startAnimation(mErrorXInAnim); } else if (mAlertType == SUCCESS_TYPE) { mSuccessTick.startAnimation(mImageAnim); mSuccessFrame.startAnimation(mImageAnim); } } private void changeAlertType(int alertType, boolean fromCreate) { mAlertType = alertType; if (mDialogView != null) { if (!fromCreate) { restore(); } switch (mAlertType) { case ERROR_TYPE: mErrorFrame.setVisibility(View.VISIBLE); setConfirmButtonColor(mColor); break; case SUCCESS_TYPE: mSuccessFrame.setVisibility(View.VISIBLE); setConfirmButtonColor(mColor); break; case WARNING_TYPE: mWarningFrame.setVisibility(View.VISIBLE); setConfirmButtonColor(mColor); break; case CUSTOM_IMAGE_TYPE: setCustomImage1(mCustomImgDrawable); setConfirmButtonColor(mColor); break; case PROGRESS_TYPE: mProgressFrame.setVisibility(View.VISIBLE); mConfirmButton.setVisibility(View.GONE); setConfirmButtonColor(mColor); break; case INPUT_TYPE: mEditText.requestFocus(); setConfirmButtonColor(mColor); break; } if (!fromCreate) { playAnimation(); } } } public void changeAlertType(int alertType) { changeAlertType(alertType, false); } public KAlertDialog setTitleText(String text) { mTitleText = text; if (mTitleTextView != null && mTitleText != null) { showTitleText(); if (titleTextSize != 0) { mTitleTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, spToPx(titleTextSize, getContext())); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { mTitleTextView.setText(Html.fromHtml(mTitleText,1)); }else { mTitleTextView.setText(Html.fromHtml(mTitleText)); } } return this; } private void showTitleText() { mShowTitleText = true; if (mTitleTextView != null) { mTitleTextView.setVisibility(View.VISIBLE); mContentTextView.setAutoLinkMask(Linkify.ALL); } } public KAlertDialog setCustomImage(int resourceId, Context context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return setCustomImage1(getContext().getResources().getDrawable(resourceId,context.getTheme())); } else { return setCustomImage1(getContext().getResources().getDrawable(resourceId)); } } private KAlertDialog setCustomImage1(Drawable drawable) { mCustomImgDrawable = drawable; if (mCustomImage != null && mCustomImgDrawable != null) { mCustomImage.setVisibility(View.VISIBLE); mCustomImage.setImageDrawable(mCustomImgDrawable); } return this; } public KAlertDialog setContentText(String text) { mContentText = text; if (mContentTextView != null && mContentText != null) { showContentText(); if (contentTextSize != 0) { mContentTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, spToPx(contentTextSize, getContext())); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { mContentTextView.setText(Html.fromHtml(mContentText,0)); }else { mContentTextView.setText(Html.fromHtml(mContentText)); } mCustomViewContainer.setVisibility(View.GONE); } return this; } public KAlertDialog showCancelButton ( boolean isShow){ mShowCancel = isShow; if (mCancelButton != null) { mCancelButton.setVisibility(mShowCancel ? View.VISIBLE : View.GONE); } return this; } public KAlertDialog showConfirmButton (boolean isShow){ mShowConfirm = isShow; if (mConfirmButton != null) { mConfirmButton.setVisibility(mShowConfirm ? View.VISIBLE : View.GONE); } return this; } private void showContentText () { mShowContent = true; if (mContentTextView != null) { mContentTextView.setVisibility(View.VISIBLE); mContentTextView.setAutoLinkMask(Linkify.ALL); } } public KAlertDialog setCancelClickListener (KAlertClickListener listener){ mCancelClickListener = listener; return this; } public KAlertDialog setConfirmClickListener (KAlertClickListener listener){ mConfirmClickListener = listener; return this; } protected void onStart () { mDialogView.startAnimation(mModalInAnim); playAnimation(); } @Override public void cancel () { dismissWithAnimation(true); } public KAlertDialog setConfirmButtonHeight (int height){ mConfirmHeight = height; if(mConfirmButton != null && mConfirmHeight != 0){ mConfirmButton.setLayoutParams(new LinearLayout.LayoutParams(mConfirmHeight,mConfirmHeight)); } return this; } public KAlertDialog setCancelButtonHeight (int height){ mCancelHeight = height; if(mConfirmButton != null && mCancelHeight != 0){ mConfirmButton.setHeight(mCancelHeight); } return this; } private KAlertDialog setConfirmButtonColor (Drawable background){ mColor = background; if (mConfirmButton != null && mColor != null) { mConfirmButton.setBackground(mColor); } return this; } private KAlertDialog setCancelButtonColor (Drawable background){ mCancelColor = background; if (mCancelButton != null && mCancelColor != null) { mCancelButton.setBackground(mCancelColor); } return this; } public void dismissWithAnimation () { dismissWithAnimation(false); } public void dismissWithAnimation ( boolean fromCancel){ mCloseFromCancel = fromCancel; mConfirmButton.startAnimation(mOverlayOutAnim); mDialogView.startAnimation(mModalOutAnim); } public static int spToPx ( float sp, Context context){ return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp, context.getResources().getDisplayMetrics()); } public int getAlertType () { return mAlertType; } public String getTitleText () { return mTitleText; } public boolean isShowTitleText () { return mShowTitleText; } public String getContentText () { return mContentText; } public String getInputText () { return mEditText.getText().toString(); } public void setInputText (String text){ mEditText.setText(text); } public boolean isShowCancelButton () { return mShowCancel; } public boolean isShowConfirmButton () { return mShowConfirm; } public boolean isShowContentText () { return mShowContent; } public String getCancelText () { return mCancelText; } public KAlertDialog setCancelText (String text){ mCancelText = text; if (mCancelButton != null && mCancelText != null) { showCancelButton(true); mCancelButton.setText(mCancelText); } return this; } public String getConfirmText () { return mConfirmText; } public KAlertDialog setConfirmText (String text){ mConfirmText = text; if (mConfirmButton != null && mConfirmText != null) { showConfirmButton(true); mConfirmButton.setText(mConfirmText); } return this; } public KAlertDialog confirmButtonColor (int color, Context context){ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return setConfirmButtonColor(getContext().getResources().getDrawable(color,context.getTheme())); }else { return setConfirmButtonColor(getContext().getResources().getDrawable(color)); } } public KAlertDialog cancelButtonColor (int color, Context context){ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return setCancelButtonColor(getContext().getResources().getDrawable(color,context.getTheme())); }else { return setCancelButtonColor(getContext().getResources().getDrawable(color)); } } public KAlertDialog setTitleTextSize(int value){ this.titleTextSize = value; return this; } public int getTitleTextSize() { return titleTextSize; } public KAlertDialog setContentTextSize ( int value){ this.contentTextSize = value; return this; } public int getContentTextSize () { return contentTextSize; } public KAlertDialog setCustomView (View view){ mCustomView = view; if (mCustomView != null && mCustomViewContainer != null) { mCustomViewContainer.addView(view); mCustomViewContainer.setVisibility(View.VISIBLE); } return this; } @Override public void onClick (View v){ if (v.getId() == R.id.cancel_button) { if (mCancelClickListener != null) { mCancelClickListener.onClick(KAlertDialog.this); } else { dismissWithAnimation(); } } else if (v.getId() == R.id.custom_confirm_button) { if (mConfirmClickListener != null) { mConfirmClickListener.onClick(KAlertDialog.this); } else { dismissWithAnimation(); } } } public ProgressHelper getProgressHelper () { return mProgressHelper; } }
[ "mastershen23@gmail.com" ]
mastershen23@gmail.com
c14b80af841c68191c5aec025409e81044173b5b
033a7f790ac81e57c52adc0e72984ef09d31e25e
/Planilla_Salarios_Lab2/src/planilla_salarios_lab2/Planilla_Salarios_Lab2.java
2f54e9de8e315b8b825ef9596e9fc6fbb8d86cc8
[]
no_license
Brayan-Cifuentes/Programacion-III
50f828c5eca56bc847d85dabaff817fa4b05a01b
1dfe4995bf6b27a4258efc7b54785fadacc8eb4a
refs/heads/master
2020-12-19T20:17:49.202751
2020-01-31T04:14:32
2020-01-31T04:14:32
235,840,646
0
0
null
null
null
null
UTF-8
Java
false
false
7,318
java
package planilla_salarios_lab2; import javax.swing.JOptionPane; public class Planilla_Salarios_Lab2 { public static void main(String[] args) { int N; float Suma_SO=0, Suma_SE=0, Suma_B = 0, Suma_C=0, Suma_Otros=0, Suma_TD=0; float Suma_IGSS=0, Suma_ISR=0, Suma_An=0, Suma_Jud=0, Suma_OD=0, Suma_Total_Descuentos=0, Suma_Total_Liquido=0; N = Integer.parseInt(JOptionPane.showInputDialog("Digite el No. de Registros: ")); float [][] Matriz= new float[N][13]; String [] Nombre= new String[N]; String [] Puesto= new String[N]; for (int i = 0; i < N; i++) { //filas Nombre[i]= JOptionPane.showInputDialog("Digite Nombre del Empleado: "); Puesto[i]= JOptionPane.showInputDialog("Digite Puesto: "); for (int j = 0; j < 13; j++) { //columnas if(j == 0 ){ Matriz[i][j]=Float.parseFloat(JOptionPane.showInputDialog("Digite Sueldo Ordinario: ")); //condicion para sueldo minimo if (Matriz[i][j]<2800) { JOptionPane.showInputDialog("La ley establece que el Salario Minimo es de Q. 2800"); Matriz[i][j]=2800; } Suma_SO+=Matriz[i][j]; }else if(j ==1){ Matriz[i][j]=Float.parseFloat(JOptionPane.showInputDialog("Digite Sueldo Extraordinario:")); Suma_SE+=Matriz[i][j]; }else if(j ==2){ Matriz[i][j]=Float.parseFloat(JOptionPane.showInputDialog("Digite Bonificacion: ")); Suma_B+=Matriz[i][j]; }else if(j ==3){ Matriz[i][j]=Float.parseFloat(JOptionPane.showInputDialog("Digite Comision: ")); Suma_C+=Matriz[i][j]; }else if(j ==4){ Matriz[i][j]=Float.parseFloat(JOptionPane.showInputDialog("Digite otros Ingresos: ")); Suma_Otros+=Matriz[i][j]; }else if (j==5) { //Total Devengado Matriz[i][j]= Matriz[i][j-5]+Matriz[i][j-4]+Matriz[i][j-3]+Matriz[i][j-2]+Matriz[i][j-1]; JOptionPane.showConfirmDialog(null, "TOTAL DEVENGADO: "+Matriz[i][j]); Suma_TD+=Matriz[i][j]; }else if (j==6) { //IGSS Matriz[i][j] = (float) ((Matriz[i][j-1])*(0.0483)); JOptionPane.showConfirmDialog(null, "IGSS: "+Matriz[i][j]); Suma_IGSS+=Matriz[i][j]; }else if (j==7) { //ISR if (Matriz[i][j-2]>6000 && Matriz[i][j-2]<7500) { Matriz[i][j]= (float) ((Matriz[i][j-2])*(0.05)); JOptionPane.showConfirmDialog(null,"ISR: "+Matriz[i][j]); } else if (Matriz[i][j-2]>7500 && Matriz[i][j-2]<9000) { Matriz[i][j]= (float) ((Matriz[i][j-2])*(0.06)); JOptionPane.showConfirmDialog(null,"ISR: "+Matriz[i][j]); }else if (Matriz[i][j-2]>9000){ Matriz[i][j]= (float) ((Matriz[i][j])*(0.08)); JOptionPane.showConfirmDialog(null, "ISR: "+Matriz[i][j]); }else{ JOptionPane.showMessageDialog(null, "No Paga ISR"); Matriz[i][j]=0; } Suma_ISR+=Matriz[i][j]; }else if (j==8) { Matriz[i][j]= Float.parseFloat(JOptionPane.showInputDialog("Digite su Anticipo: ")); Suma_An+=Matriz[i][j]; }else if (j==9) { Matriz[i][j]= Float.parseFloat(JOptionPane.showInputDialog("Digite Descuento Judicial: ")); Suma_Jud+=Matriz[i][j]; }else if (j==10) { Matriz[i][j]= Float.parseFloat(JOptionPane.showInputDialog("Digite Otro Descuento: ")); Suma_OD+=Matriz[i][j]; }else if (j==11) { //Total Descuentos Matriz[i][j]= Matriz[i][j-5]+Matriz[i][j-4]+Matriz[i][j-3]+Matriz[i][j-2]+Matriz[i][j-1]; Suma_Total_Descuentos+=Matriz[i][j]; }else if (j==12) { //Total Liquido Matriz[i][j]= Matriz[i][j-7] - Matriz[i][j-1]; Suma_Total_Liquido+=Matriz[i][j]; } } } System.out.println("--------------------------------------------------------------------------------------------------------------------------------------------------------------------"); System.out.println("Nombre: Puesto: Sueldo Ord: Sueldo ExtraOrd: Bonif: Comision: Otros: T_Devengado: IGSS: ISR: Antic: Jud: Otros: Otros Desc: Total Liquido:" ); System.out.println("--------------------------------------------------------------------------------------------------------------------------------------------------------------------"); for (int i = 0; i < N; i++) { System.out.print(Nombre[i]+" "); System.out.print(Puesto[i]+" "); for (int j = 0; j <13; j++) { System.out.print(" "+Matriz[i][j]); } System.out.println("\n"); } System.out.println("\n"); System.out.println("\nRESUMEN PLANILLA ------> SUMAS"); System.out.println("Total Sueldos Ordinarios Trabajadores: "+Suma_SO); System.out.println("Total Sueldos Extraordinarios Trabajadores: "+Suma_SE); System.out.println("Total Bonificaciones Trabajadores: "+Suma_B); System.out.println("Total Comisiones Trabajadores: "+Suma_C); System.out.println("Total Otros Ingresos Trabajadores: "+Suma_Otros); System.out.println("Total Devengado de los Trabajadores: "+Suma_TD); System.out.println("\nTotal IGSS Trabajadores: "+Suma_IGSS); System.out.println("Total ISR Trabajadores: "+Suma_ISR); System.out.println("Total Anticipos Trabajadores: "+Suma_An); System.out.println("Total Judiciales: "+Suma_Jud); System.out.println("Total Otros Descuentos: "+Suma_OD); System.out.println("Total De Descuentos Todos los trabajadores: "+Suma_Total_Descuentos); System.out.println("------------------------------------------------------------"); System.out.println("| TOTAL LIQUIDO DE TODA LA PLANILLA ----------> Q."+Suma_Total_Liquido+" |"); System.out.println("------------------------------------------------------------"); System.out.println("\n"); } }
[ "brayancifuentes33@gmail.com" ]
brayancifuentes33@gmail.com
540135eef55f88eb53ea681e33473067c45db53d
7c9f40c50e5cabcb320195e3116384de139002c6
/Plugin_Parser/src/tinyos/yeti/nesc12/collector/actions/Action758.java
3028d3bf589df3dd2761f5f5ee929b335e330a02
[]
no_license
phsommer/yeti
8e89ad89f1a4053e46693244256d03e71fe830a8
dec8c79e75b99c2a2a43aa5425f608128b883e39
refs/heads/master
2021-01-10T05:33:57.285499
2015-05-21T19:41:02
2015-05-21T19:41:02
36,033,399
3
0
null
null
null
null
UTF-8
Java
false
false
1,686
java
package tinyos.yeti.nesc12.collector.actions; import tinyos.yeti.nesc12.parser.StringRepository; import tinyos.yeti.nesc12.parser.ScopeStack; import tinyos.yeti.nesc12.parser.RawParser; import tinyos.yeti.nesc12.lexer.Token; import tinyos.yeti.nesc12.lexer.Lexer; import tinyos.yeti.nesc12.parser.ast.*; import tinyos.yeti.nesc12.parser.ast.nodes.*; import tinyos.yeti.nesc12.parser.ast.nodes.declaration.*; import tinyos.yeti.nesc12.parser.ast.nodes.definition.*; import tinyos.yeti.nesc12.parser.ast.nodes.error.*; import tinyos.yeti.nesc12.parser.ast.nodes.expression.*; import tinyos.yeti.nesc12.parser.ast.nodes.general.*; import tinyos.yeti.nesc12.parser.ast.nodes.nesc.*; import tinyos.yeti.nesc12.parser.ast.nodes.statement.*; import tinyos.yeti.nesc12.collector.*; public final class Action758 implements ParserAction{ public final java_cup.runtime.Symbol do_action( int CUP$parser$act_num, java_cup.runtime.lr_parser CUP$parser$parser, java.util.Stack CUP$parser$stack, int CUP$parser$top, parser parser) throws java.lang.Exception{ java_cup.runtime.Symbol CUP$parser$result; // c_type_specifier_notn ::= K_INT { TypeSpecifier RESULT =null; Token k = (Token)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value; RESULT = new PrimitiveSpecifier( k, PrimitiveSpecifier.Type.INT ); CUP$parser$result = parser.getSymbolFactory().newSymbol("c_type_specifier_notn",88, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT); } return CUP$parser$result; } }
[ "besigg@2a69fd7c-12de-fc47-e5bb-db751a41839b" ]
besigg@2a69fd7c-12de-fc47-e5bb-db751a41839b
acd4ee0b165320d2a9a140c855e7b16dd053982d
1588c770ce42665777192eef12f1f711af42d4bf
/src/ru/job4j/Echo.java
19cda3a33283f55f8c4b009c89a3e2035b1f7ae8
[]
no_license
Syberberg/job4j_elementary
ac886cdabbb3327e62940f0ab5cc36a92cf842a6
334a4a2013e8fdaba06a876279066bde90b42e94
refs/heads/master
2021-03-28T01:47:51.750248
2020-04-15T08:41:38
2020-04-15T08:41:38
247,825,367
0
0
null
2020-03-16T22:05:33
2020-03-16T22:05:32
null
UTF-8
Java
false
false
44
java
package ru.job4j; public class Echo { }
[ "vitkalenkoi@mail.ru" ]
vitkalenkoi@mail.ru