blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
deb5837e330a628f8e94b98d95fecfdbf3473e91
c93d33194d2ba621337e4a722af30f72c964a269
/gwt_spring_objectify/src/main/java/app/config/TwitterFactoryConfig.java
dc37f2a5d2113ae7d6f2e12416fcf888c66ef70e
[]
no_license
FingolfinTEK/lushlife
14862e745b08e50de7eed766442cab977ca9a288
269c23208356350969af1c7dead6c9325ec6678c
refs/heads/master
2016-09-14T14:35:37.641329
2011-07-18T03:56:26
2011-07-18T03:56:26
56,580,848
0
0
null
null
null
null
UTF-8
Java
false
false
564
java
package app.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import twitter4j.TwitterFactory; import twitter4j.conf.ConfigurationBuilder; @Configuration public class TwitterFactoryConfig { @Bean public TwitterFactory createFactory() { twitter4j.conf.Configuration config = new ConfigurationBuilder() .setOAuthConsumerKey("y1pqieH6ikgj3vEE0MuACw") .setOAuthConsumerSecret( "DN2V5CdN4G8MM5eLPI6Klrnn1Yk38VvqzdJEx24ogic").build(); return new TwitterFactory(config); } }
[ "konkicci@8efd8c2a-510e-11de-b541-f52ad3e57354" ]
konkicci@8efd8c2a-510e-11de-b541-f52ad3e57354
5f206483a5aa3ca88675cccf38c698ef5702fd27
9daac757a804bb49251780fe18692fa7f5bf9b99
/src/test/java/org/apache/commons/lang3/reflect/testbed/Ambig.java
9588f6c559dcb94786c78c2b8de8b278e8fc4fe8
[ "Apache-2.0" ]
permissive
Wrch1994/lang_1_buggy
45317afb1cb52de077b67e0f9691e63fb2afa240
6880e5adae9fe5c467047fcf258a2b720c71b4f2
refs/heads/master
2023-04-16T13:00:03.751697
2020-06-23T08:12:49
2020-06-23T08:12:49
274,347,445
0
0
Apache-2.0
2021-04-26T20:25:03
2020-06-23T08:08:51
Java
UTF-8
Java
false
false
922
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.lang3.reflect.testbed; /** * @version $Id$ */ public class Ambig implements Foo, Bar { }
[ "1830769105@qq.com" ]
1830769105@qq.com
185e611246abd91117506374c27ce00a49a9c9fd
3fd5312b53b37a78a3580a1fe21a1ce26d81561b
/src/test/java/de/ralleytn/api/gamejolt/tests/GameJoltTest.java
bbb7f2df52a37f88a4bbb66078ee38cc2e1af175
[ "MIT" ]
permissive
RalleYTN/GameJolt-Consumer
6826d58eab23f5de97147be40359cbf89c7ceb41
d929cf4c2241a824d61ea7aa7da86ac323f757c8
refs/heads/master
2021-01-24T20:14:33.103856
2018-03-14T20:23:55
2018-03-14T20:23:55
92,284,636
0
0
null
null
null
null
UTF-8
Java
false
false
2,936
java
package de.ralleytn.api.gamejolt.tests; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; import java.io.IOException; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import de.ralleytn.api.gamejolt.GameJolt; import de.ralleytn.api.gamejolt.GameJoltException; import de.ralleytn.api.gamejolt.GameJoltSession; import de.ralleytn.api.gamejolt.GameJoltSession.Status; import de.ralleytn.api.gamejolt.GameJoltUser; import de.ralleytn.simple.json.JSONParseException; class GameJoltTest { private static GameJolt API; private static GameJoltSession SESSION; private static ScheduledExecutorService SCHEDULER; private static final void checkUser(GameJoltUser user, String expectedName, GameJoltUser.Type expectedType) { assertNotNull(user); assertEquals(expectedName, user.getUsername()); assertEquals(expectedType, user.getType()); } @BeforeAll static void create() { API = new GameJolt(326317, "b98dd3b1ae8ae61b569f4ab782e9cec7"); try { // LOGIN API.login("GameJoltConsumerTest", "mRftPQ"); assertTrue(API.isUserLoggedIn()); // START NEW SESSION SESSION = API.getSession(); if(SESSION.isOpen()) { SESSION.close(); } SESSION.open(); // CREATE A SCHEDULER TO UPDATE THE SESSION EVERY 25 SECONDS SCHEDULER = Executors.newScheduledThreadPool(1); SCHEDULER.scheduleAtFixedRate(() -> { try { SESSION.ping(Status.ACTIVE); } catch (IOException | GameJoltException | JSONParseException exception) { fail(exception.getClass().getName() + ": " + exception.getMessage()); } }, 25, 25, TimeUnit.SECONDS); } catch(IOException | GameJoltException | JSONParseException exception) { fail(exception.getClass().getName() + ": " + exception.getMessage()); } } @Test void testUsers() { try { GameJoltUser loggedInUser = API.getUser(); GameJoltUser ralleytnByName = API.getUser("RalleYTN"); GameJoltUser ralleytnByID = API.getUser(ralleytnByName.getId()); assertEquals(ralleytnByID.toString(), ralleytnByName.toString()); checkUser(loggedInUser, "GameJoltConsumerTest", GameJoltUser.Type.DEVELOPER); checkUser(ralleytnByID, "RalleYTN", GameJoltUser.Type.DEVELOPER); checkUser(ralleytnByName, "RalleYTN", GameJoltUser.Type.DEVELOPER); } catch(IOException | GameJoltException | JSONParseException exception) { fail(exception.getClass().getName() + ": " + exception.getMessage()); } } @AfterAll static void destroy() { SCHEDULER.shutdown(); API.logout(); } }
[ "ralph.niemitz@gmx.de" ]
ralph.niemitz@gmx.de
866d83c877653a83c48241f495c5975ea05e1453
18ef166172ba28359a145414a65cacb1036a8763
/src/main/java/local/demo/test/web/rest/errors/ParameterizedErrorDTO.java
e06c63742b70451a39fbe2636472334af5be34b7
[]
no_license
Greenjam94/jHipsterTest
9d0f3324f69f28a225a7a3cb57c96f7ee4335087
71947d90976b858292974196b6227128c3b89fea
refs/heads/master
2016-09-06T18:20:01.769796
2015-08-04T23:10:34
2015-08-04T23:10:34
40,213,095
0
0
null
null
null
null
UTF-8
Java
false
false
583
java
package local.demo.test.web.rest.errors; import java.io.Serializable; /** * DTO for sending a parameterized error message. */ public class ParameterizedErrorDTO implements Serializable { private static final long serialVersionUID = 1L; private final String message; private final String[] params; public ParameterizedErrorDTO(String message, String... params) { this.message = message; this.params = params; } public String getMessage() { return message; } public String[] getParams() { return params; } }
[ "Greenjam94@gmail.com" ]
Greenjam94@gmail.com
a5af307baffbb15dab5c89210115a65532a7fc08
d76f6365dace8783b44bc1a90d6c9e802215041b
/app/src/androidTest/java/com/example/afsanehsguessinggameapp/ExampleInstrumentedTest.java
e9a3758af51c348b9a68015f992d56b7821690f9
[]
no_license
Afsanehbajoori/GuessingGameAndriodProject
8ed222288640930111721bc023f36d860c409b16
836ddc20afd395d26dbde5c49c87db7ac5c5a536
refs/heads/master
2023-04-14T03:20:47.594054
2021-04-26T11:25:40
2021-04-26T11:25:40
361,724,689
0
0
null
null
null
null
UTF-8
Java
false
false
784
java
package com.example.afsanehsguessinggameapp; 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.afsanehsguessinggameapp", appContext.getPackageName()); } }
[ "afsan.bajoori@hotmail.com" ]
afsan.bajoori@hotmail.com
eb27fe97c4fa5b3bbd4f873fb813140c3e734c2e
866b158410b85ce008e22134892cb9e27a2820ce
/study/src/main/java/io/gen/rpc/server/CalculatorServiceImpl.java
729d986ef590a2797ad03360ac53d765bcef49ac
[ "MIT" ]
permissive
Risingfly2/broloveStudy
b880d7995cd3b79eb79a93fd7ba2515881050819
9a336ba7013f78dc9d55228ba100197d73552658
refs/heads/main
2023-04-12T01:25:01.708320
2021-04-24T07:45:06
2021-04-24T07:45:06
305,058,881
0
0
null
null
null
null
UTF-8
Java
false
false
172
java
package io.gen.rpc.server; public class CalculatorServiceImpl implements CalculatorService{ @Override public int add(int a, int b) { return a + b; } }
[ "cwglee@163.com" ]
cwglee@163.com
b506fd3dae6e43accaede7c6e5c1d8075e1b789e
b21b29f3cb5f135c2c03fa097e9412bb98f5defe
/app/src/androidTest/java/com/example/androidstudio/kalkulaatoriii/ApplicationTest.java
ff251fb9089ce3ae952a9c22c1c4415c5c0095e6
[]
no_license
jtamm/Kalkulaator-III
aa4c2188874d46853d7856c2df6a7bec225cb93c
bd55434f9da2a65cba52f0a5f24324434c7a9034
refs/heads/master
2021-01-10T09:25:42.749939
2016-04-10T17:43:55
2016-04-10T17:43:55
55,913,546
0
0
null
null
null
null
UTF-8
Java
false
false
371
java
package com.example.androidstudio.kalkulaatoriii; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "johannes.tamm@itcollege.ee" ]
johannes.tamm@itcollege.ee
98427d8988da38f809682722fb8e8550a6a15917
530c9b94581eba3ffc2cffbecbb9ef542dd317de
/Lab5_1170300825/src/debug/FindMedianSortedArrays.java
a791458f6c3a84be0069917d791f1374ebf58ed9
[]
no_license
hahalidaxin/SoftwareConstruct
8ce561155dab63d9e7fa941e447fb95aa35c7656
4dfbd718618229eb23b9be2ee596abbc0bc997e2
refs/heads/master
2021-01-30T20:17:34.522410
2020-02-27T03:50:08
2020-02-27T03:50:08
243,506,205
1
0
null
2020-10-13T19:54:22
2020-02-27T11:45:25
HTML
UTF-8
Java
false
false
1,777
java
package debug; /** * Given two ordered integer arrays nums1 and nums2, with size m and n * Find out the median (double) of the two arrays. * You may suppose nums1 and nums2 cannot be null at the same time. * <p> * Example 1: * nums1 = [1, 3] * nums2 = [2] * The output would be 2.0 * <p> * Example 2: * nums1 = [1, 2] * nums2 = [3, 4] * The output would be 2.5 * <p> * Example 3: * nums1 = [1, 1, 1] * nums2 = [5, 6, 7] * The output would be 3.0 * <p> * Example 4: * nums1 = [1, 1] * nums2 = [1, 2, 3] * The output would be 1.0 */ public class FindMedianSortedArrays { public double findMedianSortedArrays(int[] A, int[] B) { int m = A.length; int n = B.length; if (m > n) { int[] temp = A; A = B; B = temp; int tmp = m; m = n; n = tmp; } int iMin = 0, iMax = m, halfLen = (m + n + 1) / 2; //halfLen从(m+n)/2改成(m+n+1)/2 while (iMin <= iMax) { int i = (iMin + iMax) / 2; //i从(iMin+iMax+1)/2改成(iMin+iMax)/2 int j = halfLen - i; if (i < iMax && B[j - 1] > A[i]) { iMin = i + 1; } else if (i > iMin && A[i - 1] > B[j]) { iMax = i - 1; } else { int maxLeft = 0; if (i == 0) { maxLeft = B[j - 1]; } else if (j == 0) { maxLeft = A[i - 1]; } else { maxLeft = Math.max(A[i - 1], B[j - 1]); } if ((m + n) % 2 == 1) { // 从(m+n+1)%2改成(m+n)%2 return maxLeft; } int minRight = 0; if (i == m) { minRight = B[j]; } else if (j == n) { minRight = A[i]; } else { minRight = Math.min(B[j], A[i]); } return (maxLeft + minRight) / 2.0; } } return 0.0; } }
[ "hahalidaxin@163.com" ]
hahalidaxin@163.com
b26e5377afe2f250d072da406e1ef28c09f59659
ae9c69b2955f1e8d3a25131b015e74761d5377f4
/app/src/main/java/com/trisula/abdinew/Fragment/FragmentRekap.java
210d73413088b78e208de718b2c1ed6dfc52f7fa
[]
no_license
developer-marketing-ubl/Abdinew
708dd8cf98a708a525bf91a23e0ec1cd3a21ff17
3b69da377083fe74aa80501532784aaec1e4400f
refs/heads/master
2020-06-21T05:23:10.129863
2019-07-20T07:56:36
2019-07-20T07:56:36
197,354,331
0
0
null
null
null
null
UTF-8
Java
false
false
1,473
java
package com.trisula.abdinew.Fragment; // Create Ari & Selamat import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Button; import android.widget.TextView; import androidx.cardview.widget.CardView; import androidx.fragment.app.Fragment; import com.google.android.material.bottomsheet.BottomSheetBehavior; import com.trisula.abdinew.Kelas.SharedVariabel; import com.trisula.abdinew.R; /** * A simple {@link Fragment} subclass. */ public class FragmentRekap extends Fragment { private WebView webs; public FragmentRekap() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.fragment_rekap, container, false); webs = view.findViewById(R.id.web); webs.getSettings().setJavaScriptEnabled(true); webs.setWebViewClient(new MyBrowser()); webs.loadUrl("http://ppikubl.com/api_absensi/dt_rekap.php?nip="+ SharedVariabel.NIP); return view; } private class MyBrowser extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } }
[ "ari.curnia.one@gmail.com" ]
ari.curnia.one@gmail.com
98675a68c773d832143dce33e0c6c3caf867af88
dfa337b0b32b14ff2f9fcbe836951df517b30b38
/src/main/java/com/bnpparibas/tpportal/service/mapper/CategoryMapper.java
4bc9c49572ba1df8fd0e879602f6666b54fd985c
[]
no_license
bzinoun/tdportal
42ef4f1aa2bf551e13885c293b0d343da0c4b788
e694561a08ceeaa1ea2f52d292f9595934edd820
refs/heads/master
2020-05-14T16:14:03.736751
2019-04-17T09:41:35
2019-04-17T09:41:35
181,860,110
0
0
null
null
null
null
UTF-8
Java
false
false
670
java
package com.bnpparibas.tpportal.service.mapper; import com.bnpparibas.tpportal.domain.*; import com.bnpparibas.tpportal.service.dto.CategoryDTO; import org.mapstruct.*; /** * Mapper for the entity Category and its DTO CategoryDTO. */ @Mapper(componentModel = "spring", uses = {}) public interface CategoryMapper extends EntityMapper<CategoryDTO, Category> { @Mapping(target = "categories", ignore = true) Category toEntity(CategoryDTO categoryDTO); default Category fromId(Long id) { if (id == null) { return null; } Category category = new Category(); category.setId(id); return category; } }
[ "C62043@meaa.net.intra" ]
C62043@meaa.net.intra
22c023134cb3a53b7c40d2dcfe3956e09a5724d4
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_2692487_1/java/fayyaz/B12013.java
69b6219e2b10f6f6e3b2247f9c1b011f7037507a
[]
no_license
alexandraback/datacollection
0bc67a9ace00abbc843f4912562f3a064992e0e9
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
refs/heads/master
2021-01-24T18:27:24.417992
2017-05-23T09:23:38
2017-05-23T09:23:38
84,313,442
2
4
null
null
null
null
UTF-8
Java
false
false
3,450
java
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.lang.reflect.Array; import java.util.Arrays; import java.util.StringTokenizer; public class B12013 { private static BufferedReader in; private static PrintWriter out; private static StringTokenizer input; public static void main(String[] args) throws IOException { //Initializing ... new B12013(); //------------------------------------------------------------------------- int testCases = nextInt(); int counter=0; while (testCases -- > 0){ counter++; //Here put the code..:) int a = nextInt(); int n = nextInt(); ns = new int[n]; remove = new boolean[n]; for (int i = 0; i < ns.length; i++) ns[i]=nextInt(); Arrays.sort(ns); min = 10000000; limit = n; for (int i = ns.length; i >=0; i--) { limit = i; solve(0,a,ns.length-i); } writeln("Case #"+counter+": "+min); } //------------------------------------------------------------------------- //closing up end(); //-------------------------------------------------------------------------- } private static void max() { int max = -1; int index = 0; for (int i = 0; i < ns.length; i++) { if(remove[i])continue; if(ns[i]>max){ max= ns[i]; index=i; } } remove[index]=true; } static int min; static int [] ns; static boolean [] remove; private static void solve(int i, int a, int j) { if(i==limit){ min= Math.min(min, j);return;} if(remove[i])solve(i+1, a, j); if(ns[i]<a) solve(i+1,a+ns[i],j); else if(a==1) return; else solve(i,2*a-1,j+1); } static int limit; public B12013() throws IOException { //Input Output for Console to be used for trying the test samples of the problem in = new BufferedReader(new InputStreamReader(System.in)); // out = new PrintWriter(System.out); //------------------------------------------------------------------------- //Input Output for File to be used for solving the small and large test files // in = new BufferedReader(new FileReader("Template.in")); out = new PrintWriter("1BA.in"); //------------------------------------------------------------------------- //Initalize Stringtokenizer input input = new StringTokenizer(in.readLine()); } private static int nextInt() throws IOException { if (!input.hasMoreTokens())input=new StringTokenizer(in.readLine()); return Integer.parseInt(input.nextToken()); } private static long nextLong() throws IOException { if (!input.hasMoreTokens())input=new StringTokenizer(in.readLine()); return Long.parseLong(input.nextToken()); } private static double nextDouble() throws IOException { if (!input.hasMoreTokens())input=new StringTokenizer(in.readLine()); return Double.parseDouble(input.nextToken()); } private static String nextString() throws IOException { if (!input.hasMoreTokens())input=new StringTokenizer(in.readLine()); return input.nextToken(); } private static void write(String output){ out.write(output); out.flush(); } private static void writeln(String output){ out.write(output+"\n"); out.flush(); } private static void end() throws IOException{ in.close(); out.close(); System.exit(0); } }
[ "eewestman@gmail.com" ]
eewestman@gmail.com
63ab20d855c0b48814e620d53615b77d24474420
80e6f4fc5ddecc44ea0a9bf114e4585e2cfd8d23
/CarRentalWebsite/src/servlets/lastServlet.java
975e4a485e5d8ab5bc73d8c9cb165c0fe40d1c50
[]
no_license
Wiktoria2308/Java-Projects
7efa5829db7f6ba50b1772383cb184a22971c355
f0818798726dd6b790ba2c0a73917c86d5f69761
refs/heads/master
2023-03-16T05:43:07.468554
2021-03-03T12:13:33
2021-03-03T12:13:33
344,061,548
0
0
null
null
null
null
UTF-8
Java
false
false
561
java
package servlets; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class lastServlet */ @WebServlet("/lastServlet") public class lastServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.sendRedirect("HomePage.jsp"); } }
[ "wiktoria@MacBook-Air-Wiktoria.local" ]
wiktoria@MacBook-Air-Wiktoria.local
95efc66efcf82b5c4058580dff29e7bc9a8ca620
1259e3aa17e80267ee82560bd0ad162bbfefd0ff
/android/src/io/ash/simpletoe/ui/MenuActivity.java
2a1ca84a1b37404ee6aa5d48c24636b61cb980f1
[ "Unlicense" ]
permissive
kyhoolee/simple-libgdx-tic-tac-toe
2468e13b3163edce51de9cce392b824d557936f3
86e78f269b58ea7e4b424e14638fef3fd0871c22
refs/heads/master
2022-04-15T07:35:09.491844
2020-04-07T10:08:16
2020-04-07T10:08:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,511
java
package io.ash.simpletoe.ui; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import androidx.navigation.fragment.NavHostFragment; import androidx.navigation.ui.NavigationUI; import com.google.android.material.bottomnavigation.BottomNavigationView; import java.util.Objects; import io.ash.simpletoe.AppContext; import io.ash.simpletoe.R; import io.socket.client.Socket; public class MenuActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_game_main); NavHostFragment navHostFragment = (NavHostFragment) getSupportFragmentManager().findFragmentById(R.id.nav_host_fragment); // Set navigation controller with graph NavigationUI.setupWithNavController( (BottomNavigationView) findViewById(R.id.bottom_navigation), navHostFragment.getNavController() ); } @Override protected void onDestroy() { // Clear up socket clearly way ((AppContext) getApplication()).getSocket().close(); super.onDestroy(); } /** * It's necessary, cos' instance destroying brings to session closing. * MainActivity can be destroyed in some cases. * @return public provider of socket instance from main context */ public Socket getSocket() { return ((AppContext) Objects.requireNonNull(getApplication())).getSocket(); } }
[ "an.shubin@outlook.com" ]
an.shubin@outlook.com
e8a5185ac81ddc8bfa50f681f2791323593d7c02
40099bad0f24db1e65514aa75843c77e99fc4ea0
/jpetstore_20180625_final/jpetstore/src/main/java/com/example/jpetstore/dao/mybatis/mapper/QAndAMapper.java
a9a61194544b4510c7e3d9d4a203fd4dd17190e1
[]
no_license
OYNee/JPetStore
c3e73d1fd3d50b50379c9d32d2bec27fad0075fa
5b1fc25a23502c0640bacf9504b010d282cec725
refs/heads/master
2022-12-26T09:51:35.398857
2020-09-20T19:54:34
2020-09-20T19:54:34
297,136,097
0
0
null
null
null
null
UTF-8
Java
false
false
262
java
package com.example.jpetstore.dao.mybatis.mapper; import java.util.List; import com.example.jpetstore.domain.QAndA; public interface QAndAMapper { List<QAndA> getQuestionByUsername(String username); List<QAndA> getAnswerByUsername(String username); }
[ "hallo_oynee75@naver.com" ]
hallo_oynee75@naver.com
4ee2b24b411564a36dd3e2eed11523b93b78b1c9
0bca44424b9936d873b50b9beee6d8b64bfd897f
/src/MainClass.java
103514241db89c23d1d918484285bbe0610bd3fa
[]
no_license
stalkerpnv/Lab10AlgProg
fffab6d8e562d827acf0635546177a2f4630fdca
4c88db5a618cd1617ebd6182162ec8c26db8305b
refs/heads/master
2023-03-03T11:10:25.443338
2021-02-16T06:01:28
2021-02-16T06:01:28
339,300,587
0
0
null
null
null
null
UTF-8
Java
false
false
164
java
public class MainClass { public static void main(String[] args) { Cat catOne = new Cat("Barsik"); System.out.println(catOne.jump(10)); } }
[ "stalker_pnv@mail.ru" ]
stalker_pnv@mail.ru
66f8246529330372fedba1b1a7a32c855e471587
8c085f12963e120be684f8a049175f07d0b8c4e5
/castor-spring/tags/1.3/src/test/java/org/exolab/castor/service/ProductServiceImplWithProgrammaticTransactionDeclaration.java
1c9f0b70813d31dbe14e27e51a803385aae3b202
[]
no_license
alam93mahboob/castor
9963d4110126b8f4ef81d82adfe62bab8c5f5bce
974f853be5680427a195a6b8ae3ce63a65a309b6
refs/heads/master
2020-05-17T08:03:26.321249
2014-01-01T20:48:45
2014-01-01T20:48:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,505
java
package org.exolab.castor.service; import java.util.Collection; import org.exolab.castor.dao.Product; import org.exolab.castor.dao.ProductDao; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.support.TransactionCallback; import org.springframework.transaction.support.TransactionTemplate; public class ProductServiceImplWithProgrammaticTransactionDeclaration implements ProductService { private PlatformTransactionManager transactionManager; private ProductDao productDao; public void setTransactionManager(PlatformTransactionManager transactionManager) { this.transactionManager = transactionManager; } public void setProductDao(ProductDao productDao) { this.productDao = productDao; } public Product load(final int id) { TransactionTemplate transactionTemplate = new TransactionTemplate(this.transactionManager); transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); return (Product) transactionTemplate.execute(new TransactionCallback() { public Object doInTransaction(TransactionStatus status) { Product product = productDao.loadProduct(id); return product; } }); } /** * @see org.exolab.castor.service.ProductService#createProduct(org.exolab.castor.dao.Product) */ public void create(final Product product) { TransactionTemplate transactionTemplate = new TransactionTemplate(this.transactionManager); transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); transactionTemplate.execute(new TransactionCallback() { public Object doInTransaction(TransactionStatus status) { productDao.createProduct (product); return null; } }); } /** * @see org.exolab.castor.service.ProductService#delete(org.exolab.castor.dao.Product) */ public void delete(final Product product) { TransactionTemplate transactionTemplate = new TransactionTemplate(this.transactionManager); transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); transactionTemplate.execute(new TransactionCallback() { public Object doInTransaction(TransactionStatus status) { productDao.deleteProduct(product); return null; } }); } /** * @see org.exolab.castor.service.ProductService#delete(org.exolab.castor.dao.Product) */ public void delete(final Collection products) { TransactionTemplate transactionTemplate = new TransactionTemplate(this.transactionManager); transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); transactionTemplate.execute(new TransactionCallback() { public Object doInTransaction(TransactionStatus status) { productDao.deleteProducts(products); return null; } }); } /** * @see org.exolab.castor.service.ProductService#update(org.exolab.castor.dao.Product) */ public void update(final Product product) { TransactionTemplate transactionTemplate = new TransactionTemplate(this.transactionManager); transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); transactionTemplate.execute(new TransactionCallback() { public Object doInTransaction(TransactionStatus status) { productDao.updateProduct(product); return null; } }); } /** * @see org.exolab.castor.service.ProductService#findProducts() */ public Collection find() { TransactionTemplate transactionTemplate = new TransactionTemplate(this.transactionManager); transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); return (Collection) transactionTemplate.execute(new TransactionCallback() { public Object doInTransaction(TransactionStatus status) { return productDao.findProducts (Product.class); } }); } /** * @see org.exolab.castor.service.ProductService#findProducts() */ public Collection findNative() { TransactionTemplate transactionTemplate = new TransactionTemplate(this.transactionManager); transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); return (Collection) transactionTemplate.execute(new TransactionCallback() { public Object doInTransaction(TransactionStatus status) { return productDao.findProductsNative (Product.class); } }); } /** * @see org.exolab.castor.service.ProductService#findProductsByName(java.lang.Object) */ public Collection findByName(final Object name) { TransactionTemplate transactionTemplate = new TransactionTemplate(this.transactionManager); transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); return (Collection) transactionTemplate.execute(new TransactionCallback() { public Object doInTransaction(TransactionStatus status) { return productDao.findProducts (Product.class, "WHERE name = $1", new Object[] { name }); } }); } /** * @see org.exolab.castor.service.ProductService#findProductsByNamedQuery(java.util.String) */ public Collection findByNamedQuery(final String queryName) { TransactionTemplate transactionTemplate = new TransactionTemplate(this.transactionManager); transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); return (Collection) transactionTemplate.execute(new TransactionCallback() { public Object doInTransaction(TransactionStatus status) { return productDao.findProductsByNamedQuery(queryName); } }); } /** * @see org.exolab.castor.service.ProductService#findProductsByNamedQuery(java.util.String) */ public Collection findByNamedQuery(final String queryName, final Object[] parameters) { TransactionTemplate transactionTemplate = new TransactionTemplate(this.transactionManager); transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); return (Collection) transactionTemplate.execute(new TransactionCallback() { public Object doInTransaction(TransactionStatus status) { return productDao.findProductsByNamedQuery(queryName, parameters); } }); } public void evict(final Product product) { TransactionTemplate transactionTemplate = new TransactionTemplate(this.transactionManager); transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); transactionTemplate.execute(new TransactionCallback() { public Object doInTransaction(TransactionStatus status) { productDao.evictProduct(product); return null; } }); } public boolean isCached(final Product product) { TransactionTemplate transactionTemplate = new TransactionTemplate(this.transactionManager); transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); Boolean returnValue = (Boolean) transactionTemplate.execute(new TransactionCallback() { public Object doInTransaction(TransactionStatus status) { return Boolean.valueOf(productDao.isProductCached(product)); } }); return returnValue.booleanValue(); } public void evictAll() { TransactionTemplate transactionTemplate = new TransactionTemplate(this.transactionManager); transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); transactionTemplate.execute(new TransactionCallback() { public Object doInTransaction(TransactionStatus status) { productDao.evictAll(); return null; } }); } }
[ "wguttmn@b24b0d9a-6811-0410-802a-946fa971d308" ]
wguttmn@b24b0d9a-6811-0410-802a-946fa971d308
88a12e56939915d40bec5f47691794ecc5ae485a
32b72e1dc8b6ee1be2e80bb70a03a021c83db550
/ast_results/westnordost_StreetComplete/app/src/main/java/de/westnordost/streetcomplete/data/osm/persist/ElementGeometryDao.java
6e15390dc738a7874c10e2798c0cacc3eb5d430d
[]
no_license
cmFodWx5YWRhdjEyMTA5/smell-and-machine-learning
d90c41a17e88fcd99d543124eeb6e93f9133cb4a
0564143d92f8024ff5fa6b659c2baebf827582b1
refs/heads/master
2020-07-13T13:53:40.297493
2019-01-11T11:51:18
2019-01-11T11:51:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,209
java
// isComment package de.westnordost.streetcomplete.data.osm.persist; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.database.sqlite.SQLiteStatement; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.inject.Inject; import de.westnordost.streetcomplete.data.osm.ElementGeometry; import de.westnordost.streetcomplete.util.Serializer; import de.westnordost.osmapi.map.data.Element; import de.westnordost.osmapi.map.data.LatLon; import de.westnordost.osmapi.map.data.OsmLatLon; public class isClassOrIsInterface { private final SQLiteOpenHelper isVariable; private final Serializer isVariable; private final SQLiteStatement isVariable; public static class isClassOrIsInterface { public isConstructor(Element.Type isParameter, long isParameter, ElementGeometry isParameter) { this.isFieldAccessExpr = isNameExpr; this.isFieldAccessExpr = isNameExpr; this.isFieldAccessExpr = isNameExpr; } public Element.Type isVariable; public long isVariable; public ElementGeometry isVariable; } @Inject public isConstructor(SQLiteOpenHelper isParameter, Serializer isParameter) { this.isFieldAccessExpr = isNameExpr; this.isFieldAccessExpr = isNameExpr; String isVariable = "isStringConstant" + isNameExpr.isFieldAccessExpr + "isStringConstant" + isNameExpr.isFieldAccessExpr.isFieldAccessExpr + "isStringConstant" + isNameExpr.isFieldAccessExpr.isFieldAccessExpr + "isStringConstant" + isNameExpr.isFieldAccessExpr.isFieldAccessExpr + "isStringConstant" + isNameExpr.isFieldAccessExpr.isFieldAccessExpr + "isStringConstant" + isNameExpr.isFieldAccessExpr.isFieldAccessExpr + "isStringConstant" + isNameExpr.isFieldAccessExpr.isFieldAccessExpr + "isStringConstant"; SQLiteDatabase isVariable = isNameExpr.isMethod(); isNameExpr = isNameExpr.isMethod(isNameExpr); } public void isMethod(Collection<Row> isParameter) { SQLiteDatabase isVariable = isNameExpr.isMethod(); isNameExpr.isMethod(); for (Row isVariable : isNameExpr) { isMethod(isNameExpr.isFieldAccessExpr, isNameExpr.isFieldAccessExpr, isNameExpr.isFieldAccessExpr); } isNameExpr.isMethod(); isNameExpr.isMethod(); } /** * isComment */ public void isMethod(Element.Type isParameter, long isParameter, ElementGeometry isParameter) { SQLiteDatabase isVariable = isNameExpr.isMethod(); isNameExpr.isMethod(); isMethod(isNameExpr, isNameExpr, isNameExpr); isNameExpr.isMethod(); isNameExpr.isMethod(); } private void isMethod(Element.Type isParameter, long isParameter, ElementGeometry isParameter) { isNameExpr.isMethod(isIntegerConstant, isNameExpr.isMethod()); isNameExpr.isMethod(isIntegerConstant, isNameExpr); if (isNameExpr.isFieldAccessExpr != null) isNameExpr.isMethod(isIntegerConstant, isNameExpr.isMethod(isNameExpr.isFieldAccessExpr)); else isNameExpr.isMethod(isIntegerConstant); if (isNameExpr.isFieldAccessExpr != null) isNameExpr.isMethod(isIntegerConstant, isNameExpr.isMethod(isNameExpr.isFieldAccessExpr)); else isNameExpr.isMethod(isIntegerConstant); isNameExpr.isMethod(isIntegerConstant, isNameExpr.isFieldAccessExpr.isMethod()); isNameExpr.isMethod(isIntegerConstant, isNameExpr.isFieldAccessExpr.isMethod()); isNameExpr.isMethod(); isNameExpr.isMethod(); } public ElementGeometry isMethod(Element.Type isParameter, long isParameter) { SQLiteDatabase isVariable = isNameExpr.isMethod(); String isVariable = isNameExpr.isFieldAccessExpr.isFieldAccessExpr + "isStringConstant" + isNameExpr.isFieldAccessExpr.isFieldAccessExpr + "isStringConstant"; String[] isVariable = { isNameExpr.isMethod(), isNameExpr.isMethod(isNameExpr) }; try (Cursor isVariable = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, null, isNameExpr, isNameExpr, null, null, null, "isStringConstant")) { if (!isNameExpr.isMethod()) return null; return isMethod(isNameExpr, isNameExpr); } } static ElementGeometry isMethod(Serializer isParameter, Cursor isParameter) { int isVariable = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr), isVariable = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr), isVariable = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr), isVariable = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr); List<List<LatLon>> isVariable = null, isVariable = null; if (!isNameExpr.isMethod(isNameExpr)) { isNameExpr = isNameExpr.isMethod(isNameExpr.isMethod(isNameExpr), ArrayList.class); } if (!isNameExpr.isMethod(isNameExpr)) { isNameExpr = isNameExpr.isMethod(isNameExpr.isMethod(isNameExpr), ArrayList.class); } LatLon isVariable = new OsmLatLon(isNameExpr.isMethod(isNameExpr), isNameExpr.isMethod(isNameExpr)); return new ElementGeometry(isNameExpr, isNameExpr, isNameExpr); } /** * isComment */ public int isMethod() { SQLiteDatabase isVariable = isNameExpr.isMethod(); /*isComment*/ String isVariable = "isStringConstant" + isNameExpr.isFieldAccessExpr.isFieldAccessExpr + isNameExpr + isNameExpr.isFieldAccessExpr.isFieldAccessExpr + "isStringConstant" + isMethod(isNameExpr.isFieldAccessExpr) + "isStringConstant" + isMethod(isNameExpr.isFieldAccessExpr) + "isStringConstant"; return isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr, null); } private static final String isVariable = "isStringConstant"; private static String isMethod(String isParameter) { return "isStringConstant" + isNameExpr.isFieldAccessExpr.isFieldAccessExpr + isNameExpr + isNameExpr.isFieldAccessExpr.isFieldAccessExpr + "isStringConstant" + isNameExpr; } }
[ "matheus@melsolucoes.net" ]
matheus@melsolucoes.net
0d62acadfb6e81eeb732398deb4638af20c462ff
34a810498cd496f9a24d11e3a6dbb15d54888aad
/src/main/java/com/jesaias/project/dominio/Categoria.java
6ae9b24b8f0bfb0b7145c2111b2487b3754e37cd
[]
no_license
jesasdev/projetos-spring
f17849d00f623cff6e80fda514cba3e11332833c
80cdc8ec254007366e3dee082b7cbc433bb66f74
refs/heads/main
2023-06-04T20:11:31.811786
2021-06-18T00:51:18
2021-06-18T00:51:18
374,834,438
0
0
null
null
null
null
UTF-8
Java
false
false
1,688
java
package com.jesaias.project.dominio; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToMany; import com.fasterxml.jackson.annotation.JsonManagedReference; @Entity public class Categoria implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; private String nome; //referencia o objeto associado @JsonManagedReference @ManyToMany(mappedBy = "categorias") private List<Produto> produtos = new ArrayList<>(); public Categoria() { } public Categoria(Integer id, String nome) { this.id = id; this.nome = nome; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public List<Produto> getProdutos() { return produtos; } public void setProdutos(List<Produto> produtos) { this.produtos = produtos; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Categoria other = (Categoria) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; } }
[ "jesasdev@gmail.com" ]
jesasdev@gmail.com
102325721640ee045d395f8098e82a549859871a
4bc4a174ee3c73848f16dd81a732a55e5b528553
/src/main/java/com/zipcodewilmington/froilansfarm/interfaces/FarmVehicle.java
44bdb478c6f72f6f27caaeae88761cb5f46770b7
[]
no_license
Charlesw03/Maven.FarmerFroilan
2a0f0f7de50da918348f0e475dccd14224696afb
310c95889b6ffbc3f747d310819c28465ad99356
refs/heads/master
2020-04-27T19:33:22.162573
2019-03-11T20:08:20
2019-03-11T20:08:20
174,623,947
0
0
null
2019-03-08T23:16:49
2019-03-08T23:16:48
null
UTF-8
Java
false
false
168
java
package com.zipcodewilmington.froilansfarm.interfaces; import com.zipcodewilmington.froilansfarm.Farm; public interface FarmVehicle { void operate(Farm farm); }
[ "marshillabrahma@zipcoders-MacBook-Pro-10.local" ]
marshillabrahma@zipcoders-MacBook-Pro-10.local
9b070c66b9d967e787448d3ab91f1b79de53ea88
b53dcdc06dd2013e5202d337b821e0b7fb6d87dd
/src/tm/GenerateMapTM.java
cf11aa20c6022c668b6ba663aa75390545ac80ff
[]
no_license
Kamil-Sabbagh/TerraMystica
7305e4cdbeae80d038b9a77349321ada2a22a862
26478b2cd15386c7e13d514e8bfcdaa3e24c3714
refs/heads/main
2023-07-26T13:40:13.797497
2021-09-06T14:57:49
2021-09-06T14:57:49
403,661,489
0
0
null
null
null
null
UTF-8
Java
false
false
4,749
java
package tm; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class GenerateMapTM { private static final String ORIGINAL_MAP = "U,S,G,B,Y,R,U,K,R,G,B,R,K;" + "Y,I,I,U,K,I,I,Y,K,I,I,Y;" + "I,I,K,I,S,I,G,I,G,I,S,I,I;" + "G,B,Y,I,I,R,B,I,R,I,R,U;" + "K,U,R,B,K,U,S,Y,I,I,G,K,B;" + "S,G,I,I,Y,G,I,I,I,U,S,U;" + "I,I,I,S,I,R,I,G,I,Y,K,B,Y;" + "Y,B,U,I,I,I,B,K,I,S,U,S;" + "R,K,S,B,R,G,Y,U,S,I,B,G,R;"; private static final String FIRE_ICE_1_MAP = "U,I,U,K,Y,I,S,G,R,B,Y,B;" + "R,Y,I,B,S,R,I,I,I,Y,U,K,S;" + "G,K,I,I,I,U,G,Y,I,I,I,I;" + "Y,S,G,Y,K,I,B,R,U,I,G,B,G;" + "I,I,U,I,I,R,K,G,S,I,U,K;" + "G,R,I,I,G,I,I,I,U,B,I,S,R;" + "S,I,Y,S,B,R,G,I,R,S,I,K;" + "K,B,I,K,U,S,B,I,Y,K,I,R,B;" + "S,G,I,R,Y,K,Y,I,B,U,I,U;"; private static final String FIRE_ICE_2_MAP = "U,S,G,B,U,R,U,K,R,B,G,R,K;" + "Y,I,I,Y,K,I,I,Y,G,I,I,Y;" + "I,I,K,I,S,I,G,I,K,I,R,I,I;" + "G,B,Y,I,I,R,B,I,R,I,S,U;" + "K,U,R,B,Y,U,G,Y,I,I,G,K,R;" + "S,G,I,I,K,S,I,I,I,U,S,Y;" + "I,I,I,S,I,R,I,G,I,Y,K,B,U;" + "Y,B,U,I,I,I,B,K,I,S,U,R;" + "B,K,S,B,R,G,Y,U,S,I,B,G,S;"; private static final String LOON_LAKES_MAP = "S,B,R,U,Y,B,Y,R,I,I,G,B;" + "Y,K,G,I,I,K,U,I,G,S,I,U,K;" + "U,I,I,G,R,S,I,K,B,R,I,Y;" + "B,R,S,I,Y,U,G,I,I,Y,I,K,R;" + "G,Y,I,K,B,I,I,R,I,S,G,U;" + "S,I,U,S,I,Y,I,S,I,U,K,B,R;" + "R,I,I,I,R,G,U,K,Y,I,I,S;" + "Y,B,K,I,B,S,B,I,I,S,G,I,B;" + "K,U,I,G,I,I,I,G,R,U,Y,K;"; private static final String FJORDS_MAP = "G,K,I,U,Y,S,K,S,Y,R,K,B,Y;" + "B,U,I,B,G,R,I,I,I,I,I,U;" + "S,G,R,I,I,U,I,K,S,U,Y,I,S;" + "I,I,I,S,I,I,G,R,B,G,R,I;" + "R,S,Y,I,B,R,I,U,Y,S,U,I,K;" + "K,U,I,G,Y,G,I,S,B,G,I,S;" + "Y,B,I,K,S,K,B,I,U,K,I,G,R;" + "G,I,U,R,U,Y,R,I,I,I,R,B;" + "K,I,I,G,B,S,B,I,G,Y,K,U,Y;"; public static MapTM getOriginalMap() { return convertMap(ORIGINAL_MAP); } public static MapTM getFjords() { return convertMap(FJORDS_MAP); } public static MapTM getFireIce2() { return convertMap(FIRE_ICE_2_MAP); } private static MapTM convertMap(String string) { MapTM map = new MapTM(); String[] rows = string.split(";", 0); for (int r = 0; r < rows.length; r++) { String row = rows[r]; String[] columns = row.split(",", 0); for (int c = 0; c < columns.length; c++) { String column = columns[c]; map.hexes[r][c] = convertLetter(column); } } return map; } private static TypeTerrain convertLetter(String letter) { switch (letter) { case "K": return TypeTerrain.BLACK; case "B": return TypeTerrain.BLUE; case "U": return TypeTerrain.BROWN; case "S": return TypeTerrain.GRAY; case "G": return TypeTerrain.GREEN; case "R": return TypeTerrain.RED; case "Y": return TypeTerrain.YELLOW; case "I": return TypeTerrain.RIVER; default: return TypeTerrain.NONE; } } public static MapTM generateRandomMapTM() { MapTM map = new MapTM(); List<TypeTerrain> allTypeTerrain = landTiles(); allTypeTerrain.addAll(riverTiles()); Collections.shuffle(allTypeTerrain); ArrayList<Coordinate> allCoordinates = Coordinate.allCoordinates(); for (Coordinate coordinate : allCoordinates) { map.hexes[coordinate.row][coordinate.column] = allTypeTerrain.remove(0); } return map; } /** * Configuration that distributes just rivers on the map * * @return */ public static MapTM generateRandomRiver() { MapTM riverMap = new MapTM(); ArrayList<Coordinate> allCoordinates = Coordinate.allCoordinates(); Collections.shuffle(allCoordinates); for (int i = 0; i < riverTiles().size(); i++) { Coordinate coordinate = allCoordinates.get(i); riverMap.hexes[coordinate.row][coordinate.column] = TypeTerrain.RIVER; } return riverMap; } /** * Given a full map (river and land hexes have been set), generate a new full * map considering that the rivers do NOT change their position. * * @param river Fixed river hexes * @return Map with the fixed rivers and randomly distributed land terrains */ public static MapTM generateRandomMapTM(MapTM river) { MapTM map = new MapTM(); // TODO return map; } protected static List<TypeTerrain> landTiles() { List<TypeTerrain> listTypeTerrain = new ArrayList<TypeTerrain>(); for (int i = 0; i < 11; i++) { listTypeTerrain.add(TypeTerrain.YELLOW); listTypeTerrain.add(TypeTerrain.BROWN); listTypeTerrain.add(TypeTerrain.BLACK); listTypeTerrain.add(TypeTerrain.BLUE); listTypeTerrain.add(TypeTerrain.GREEN); listTypeTerrain.add(TypeTerrain.GRAY); listTypeTerrain.add(TypeTerrain.RED); } return listTypeTerrain; } protected static List<TypeTerrain> riverTiles() { List<TypeTerrain> list = new ArrayList<TypeTerrain>(); for (int i = 0; i < 36; i++) list.add(TypeTerrain.RIVER); return list; } }
[ "noreply@github.com" ]
noreply@github.com
28551cf5665ab08455563d80570630a4ec056b79
9a2796c938aa2df7ff2d82b10a1d28ccedcf1272
/exodecorateur_angryballs/maladroit/vues/CadreAngryBalls.java
9f8b08fdb8a19a1092c3d61aa2ad6d691f12d7a3
[]
no_license
Aniki02/Angry_Balls_src
fdd2405258b453d50cc13f244c7d403c92bd5454
7a2528b555f912474fd3832ccb6915ef8eb65865
refs/heads/master
2020-12-05T00:28:05.725825
2020-01-13T15:35:03
2020-01-13T15:35:03
231,949,872
0
1
null
null
null
null
UTF-8
Java
false
false
1,923
java
package exodecorateur_angryballs.maladroit.vues; import java.awt.*; import java.util.Vector; import exodecorateur_angryballs.maladroit.modele.decorator.Bille; import outilsvues.EcouteurTerminaison; import outilsvues.Outils; /** * Vue dessinant les billes et contenant les 3 boutons de controle (arret du programme, lancer les billes, arreter les billes) * * ICI : IL N'Y A RIEN A CHANGER * * * */ public class CadreAngryBalls extends Frame implements VueBillard { TextField presentation; public Billard billard; public Button lancerBilles, arreterBilles; Panel haut, centre, bas; EcouteurTerminaison ecouteurTerminaison; public CadreAngryBalls(String titre, String message, Vector<Bille> billes) throws HeadlessException { super(titre); Outils.place(this, 0.33, 0.33, 0.5, 0.5); this.ecouteurTerminaison = new EcouteurTerminaison(this); this.haut = new Panel(); this.haut.setBackground(Color.LIGHT_GRAY); this.add(this.haut,BorderLayout.NORTH); this.centre = new Panel(); this.add(this.centre,BorderLayout.CENTER); this.bas = new Panel(); this.bas.setBackground(Color.LIGHT_GRAY); this.add(this.bas,BorderLayout.SOUTH); this.presentation = new TextField(message, 100); this.presentation.setEditable(false); this.haut.add(this.presentation); this.billard = new Billard(billes); this.add(this.billard); this.lancerBilles = new Button("lancer les billes"); this.bas.add(this.lancerBilles); this.arreterBilles = new Button("arreter les billes"); this.bas.add(this.arreterBilles); } public double largeurBillard() { return this.billard.getWidth(); } public double hauteurBillard() { return this.billard.getHeight(); } @Override public void miseAJour() { this.billard.repaint(); } /* (non-Javadoc) * @see exodecorateur.vues.VueBillard#montrer() */ @Override public void montrer() { this.setVisible(true); } }
[ "aniki01@MacBook-Air-de-Brahim.local" ]
aniki01@MacBook-Air-de-Brahim.local
f8d5489ad817949d1dfb080af8b8bef5109acb3f
722d8fb8affb6681a036d23a67fb7f7c1176f3e9
/projetSE/src/projetSE/MainClass.java
26de73d0e0aa2ad75ea5af153e77d6341856d6e8
[]
no_license
rakussan/SEprojet
99b80d3e6faf6eeec3b6eff6721406a73d7beca2
a4ebea394a30097f7ed2d7d16f020a883cae06c4
refs/heads/master
2020-11-24T07:02:08.597857
2019-12-14T12:54:50
2019-12-14T12:54:50
228,020,927
0
0
null
null
null
null
ISO-8859-1
Java
false
false
28,545
java
package projetSE; import java.awt.Desktop; import java.io.*; import java.nio.file.StandardOpenOption; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Scanner; public class MainClass { public static final String RESET = "\u001B[0m"; public static final String BLACK = "\u001B[30m"; public static final String RED = "\u001B[31m"; public static final String GREEN = "\u001B[32m"; public static final String YELLOW = "\u001B[33m"; public static final String BLUE = "\u001B[34m"; public static final String PURPLE = "\u001B[35m"; public static final String CYAN = "\u001B[36m"; public static final String WHITE = "\u001B[37m"; public static String newList = ""; public static String newHelp = ""; public static String newChangeDirectory = ""; public static String newCreate = ""; public static String newWriteOnFile = ""; public static String newExecuteFile = ""; public static String newRemoveFile = ""; public static String newPrecedentDirectory=""; public static void ls() { String curDir = System.getProperty("user.dir"); System.out.println ("$Le répertoire courant est: "+curDir); String chemin = curDir.replaceAll("/", "//"); File dir = new File(chemin); File[] children = (File[]) dir.listFiles(); if (children == null) { System.out.println("Le dossier n'existe pas."); } else { for (int i=0; i < children.length;i++){ File fichier = children[i]; System.out.println(fichier.getName()); } } } static ArrayList<String> allFiles = new ArrayList<String>(); static ArrayList<String> allRepertoire = new ArrayList<String>(); static ArrayList<String> all = new ArrayList<String>(); public static void getLsList(ArrayList<String> allFiles, ArrayList<String> allRepertoire) { String curDir = System.getProperty("user.dir"); allFiles.clear(); allRepertoire.clear(); all.clear(); String chemin = curDir.replaceAll("/", "//"); File dir = new File(chemin); File[] children = (File[]) dir.listFiles(); if (children == null) { System.out.println(RED+"Le dossier n'existe pas."); } else { for (int i=0; i < children.length;i++){ File fichier = children[i]; all.add(fichier.getName()); if(fichier.getName().indexOf(".")!=-1) { allRepertoire.add(fichier.getName()); } else { allFiles.add(fichier.getName()); } } } } public static void sortLs() { getLsList(allFiles, allRepertoire); java.util.Collections.sort(all); for(String elem: all) { System.out.println (GREEN+elem); } } public static void lsPipe(String[] separated) { getLsList(allFiles, allRepertoire); switch(separated[2]) { case "countFiles": if (allFiles.size()==0) { System.out.println(RED+"Ce répértoire est vide!"); } else { System.out.println(GREEN+"Ce répértoire contient "+allRepertoire.size()+ " fichiers."); } break; case "countRepo": if (allRepertoire.size()==0) { System.out.println(RED+"Ce répértoire est vide! "); } else { System.out.println(GREEN+"Ce répértoire contient "+allFiles.size()+ " dossiers."); } break; default: System.out.println(RED+"Commande invalide!"); break; } } //Récupérer home et path à partir du fichier public static void getPathAndHome() { try{ InputStream flux=new FileInputStream("C:\\Users\\dabdoub85\\Desktop\\mini_projet_se\\Mini_Project_SE\\home&path.txt"); InputStreamReader lecture=new InputStreamReader(flux); BufferedReader buff=new BufferedReader(lecture); String ligne; String path; String home; ligne=buff.readLine(); path=ligne.substring(5); ligne=buff.readLine(); home=ligne.substring(5); System.out.println(home); System.out.println(path); buff.close(); } catch (Exception e){ System.out.println(e.toString()); } } //création d'un dossier public static void cd(String newDirectory) { System.setProperty("user.dir", newDirectory); } public static void cdTwo() { String curDir = System.getProperty("user.dir"); int lastSlash = curDir.lastIndexOf("\\"); System.setProperty("user.dir", curDir.substring(0, lastSlash)); } public static void mkDir(String filename) { String curDir = System.getProperty("user.dir"); File f = new File(curDir+"\\"+filename); if (f.mkdir()) { System.out.println(GREEN+"Directory is created"); } else { System.out.println(RED+"Directory cannot be created"); } } //Ecrire dans un fichier txt public static void WriteOnANewFileWord(String fileName) throws IOException { String curDir = System.getProperty("user.dir"); File file = new File(curDir+"\\"+fileName+".txt"); //Create the file if (file.createNewFile()) { System.out.println(GREEN+"Fichié créé!"); } else { System.out.println(RED+"Fichié existe déjà!."); } try { if (Desktop.isDesktopSupported()) { Desktop.getDesktop().open(new File(file.getAbsolutePath())); } } catch (IOException ioe) { ioe.printStackTrace(); } } public static void help() { System.out.println(CYAN+"help: Afficher des informations sur chaque commande."); System.out.println(CYAN+"changeDirectory: Changer l'environnement de travail."); System.out.println(CYAN+"precedentDirectory: Retourner vers le répértoire précédent"); System.out.println(CYAN+"list: Afficher les les dossiers et les fichiers dans l'environnement de travail courant."); System.out.println(CYAN+" list: peut être utilisée avec l'option -s qui sert à trier la liste."); System.out.println(CYAN+" list: peut être utilisée avec '| countFiles' qui sert à compter le nombre des fichiers dans le répértoire courant."); System.out.println(CYAN+" list: peut être utilisée avec '| countRepo' qui sert à compter le nombre des dossiers dans le répértoire courant."); System.out.println(CYAN+"create fileName(.extension): Créer un dossier ou un fichier."); System.out.println(CYAN+"removeRepo repositoryName: supprimer un dossier."); System.out.println(CYAN+"writeOnFile fileName: Créer un nouveau fichier text et ouvrir le fichier avec bloc note."); System.out.println(CYAN+"executeFile fileName: Exécuter les commandes qui se trouvent dans un fichier text."); System.out.println(CYAN+"commande > fileName: Ecrire le résultat dans un fichier avec écrasement du contenu." ); System.out.println(CYAN+"commande >> fileName: Ecrire le résultat dans un fichier sans écrasement du contenu." ); } public static void ExecuteCommandsOnFile(String cmd) throws IOException { String curDir = System.getProperty("user.dir"); String[] separated = cmd.split(" "); switch(separated[0]) { case "help": help(); break; case "change_directory": cd(separated[1]); break; case "create": mkDir(separated[1]); break; case "list": ls(); break; case "write_on_file": WriteOnANewFileWord(separated[1]); break; case "executeFile": ExecuteFile(separated[1]); break; default: System.out.println(RED+"Commande invalide!"); } } public static void ExecuteFile(String fileName) { String curDir = System.getProperty("user.dir"); BufferedReader reader; try { reader = new BufferedReader(new FileReader(curDir+"\\"+fileName+".txt")); String line = reader.readLine(); while (line != null) { // read next line ExecuteCommandsOnFile(line); line = reader.readLine(); } reader.close(); } catch (IOException e) { e.printStackTrace(); } } public static void alias(String[] separated) { switch(separated[1]) { case "help": newHelp=separated[2]; break; case "changeDirectory": newChangeDirectory=separated[2]; break; case "create": newCreate=separated[2]; break; case "list": newList=separated[2]; break; case "writeOnFile": newWriteOnFile=separated[2]; break; case "removeFile": newRemoveFile=separated[2]; break; case "executeFile": newExecuteFile=separated[2]; break; case "precedentDirectory": newPrecedentDirectory=separated[2]; break; default: System.out.println(RED+"Commande invalide!"); break; } } public static void Redirection(String[] separated) throws IOException { String curDir = System.getProperty("user.dir"); String chemin = curDir.replaceAll("/", "//"); switch(separated[0]) { case "help": if(separated[1].equals(">>")) { File file = new File(curDir+"\\"+separated[2]+".txt"); //Create the file if (file.createNewFile()) { System.out.println(RED+"Fichié créé!"); } else { System.out.println(GREEN+"Fichié existe déjà!."); } BufferedWriter output = new BufferedWriter(new FileWriter(file,true)); output.append("help: Des informations sur chaque commande."); output.newLine(); output.append("Change_directory: Change l'environnement de travail."); output.newLine(); output.append("List: Affiche les les dossiers et les fichiers dans l'environnement de travail courant."); output.newLine(); output.append("Create fileName(.extension): Permet de créer un dossier ou un fichier."); output.newLine(); output.append("Write_on_file fileName: Cree un nouveau fichier text et ouvre le fichier avec bloc note."); output.newLine(); output.append("ExecuteCommandsOnFile fileName: Exécute les commandes qui se trouvent dans un fichier text."); output.close(); } else if (separated[1].equals(">")) { File file = new File(curDir+"\\"+separated[2]+".txt"); //Create the file if (file.createNewFile()) { System.out.println(GREEN+"Fichié créé!"); } else { System.out.println(PURPLE+"Fichié existe déjà!."); } BufferedWriter output = new BufferedWriter(new FileWriter(file)); output.append("help: Des informations sur chaque commande."); output.newLine(); output.append("Change_directory: Change l'environnement de travail."); output.newLine(); output.append("List: Affiche les les dossiers et les fichiers dans l'environnement de travail courant."); output.newLine(); output.append("Create fileName(.extension): Permet de créer un dossier ou un fichier."); output.newLine(); output.append("Write_on_file fileName: Cree un nouveau fichier text et ouvre le fichier avec bloc note."); output.newLine(); output.append("ExecuteCommandsOnFile fileName: Exécute les commandes qui se trouvent dans un fichier text."); output.close(); } else { System.out.println(RED+"Commande invalide!"); } break; case "list": File dir = new File(chemin); File[] children = (File[]) dir.listFiles(); if (children == null) { } else { if(separated[1].equals(">>")) { File file = new File(curDir+"\\"+separated[2]+".txt"); //Create the file if (file.createNewFile()) { System.out.println(GREEN+"Fichié créé!"); } else { System.out.println(PURPLE+"Fichié existe déjà!."); } BufferedWriter output = new BufferedWriter(new FileWriter(file,true)); for (int i=0; i < children.length;i++){ File fichier = children[i]; output.append(fichier.getName()); output.newLine(); } output.close(); } else if (separated[1].equals(">")){ File file = new File(curDir+"\\"+separated[2]+".txt"); //Create the file if (file.createNewFile()) { System.out.println(GREEN+"Fichié créé!"); } else { System.out.println(PURPLE+"Fichié existe déjà!."); } BufferedWriter output = new BufferedWriter(new FileWriter(file)); for (int i=0; i < children.length;i++){ File fichier = children[i]; output.append(fichier.getName()); output.newLine(); } output.close(); } else if (separated[1].equals("|")) { lsPipe(separated); } else { System.out.println(RED+"Commande invalide!"); } } break; default: System.out.println(RED+"Commande invalide!"); } } //} public static void removeFile(String fileName) { String curDir = System.getProperty("user.dir"); File file = new File(curDir+"\\"+fileName); if(file.delete()) { System.out.println("Le fichier a été supprimé avec succès."); } else { System.out.println("Fichier innexistant."); } } ////// Ordonnancement public static void Priority() { Scanner s = new Scanner(System.in); int x,n,p[],pp[],bt[],w[],t[],awt,atat,i; p = new int[10]; pp = new int[10]; bt = new int[10]; w = new int[10]; t = new int[10]; System.out.print(CYAN+"Entrez le nombre des processus : "); n = s.nextInt(); System.out.print(CYAN+"\n\t Enter burst time : time priorities \n"); for(i=0;i<n;i++) { System.out.print("\nProcessus["+(i+1)+"]:"); bt[i] = s.nextInt(); pp[i] = s.nextInt(); p[i]=i+1; } //sorting on the basis of priority for(i=0;i<n-1;i++) { for(int j=i+1;j<n;j++) { if(pp[i]>pp[j]) { x=pp[i]; pp[i]=pp[j]; pp[j]=x; x=bt[i]; bt[i]=bt[j]; bt[j]=x; x=p[i]; p[i]=p[j]; p[j]=x; } } } w[0]=0; awt=0; t[0]=bt[0]; atat=t[0]; for(i=1;i<n;i++) { w[i]=t[i-1]; awt+=w[i]; t[i]=w[i]+bt[i]; atat+=t[i]; } //Displaying the process System.out.print("\n\nProcessus \t Temps d exécution \t Temps d attente \t Temps de rotation Priorité \n"); for(i=0;i<n;i++) System.out.print("\n "+p[i]+"\t\t "+bt[i]+"\t\t "+w[i]+"\t\t "+t[i]+"\t\t "+pp[i]+"\n"); awt/=n; atat/=n; System.out.print("\n Temps d attente moyene : "+awt); System.out.print("\n Temps de rotation : "+atat); System.out.println("\n"); } //Round robin public static void RoundRobin(String p[], int a[], int b[], int n) { { // result of average times int res = 0; int resc = 0; // for sequence storage String seq = new String(); // copy the burst array and arrival array // for not effecting the actual array int res_b[] = new int[b.length]; int res_a[] = new int[a.length]; for (int i = 0; i < res_b.length; i++) { res_b[i] = b[i]; res_a[i] = a[i]; } // critical time of system int t = 0; // for store the waiting time int w[] = new int[p.length]; // for store the Completion time int comp[] = new int[p.length]; while (true) { boolean flag = true; for (int i = 0; i < p.length; i++) { // these condition for if // arrival is not on zero // check that if there come before qtime if (res_a[i] <= t) { if (res_a[i] <= n) { if (res_b[i] > 0) { flag = false; if (res_b[i] > n) { // make decrease the b time t = t + n; res_b[i] = res_b[i] - n; res_a[i] = res_a[i] + n; seq += "->" + p[i]; } else { // for last time t = t + res_b[i]; // store comp time comp[i] = t - a[i]; // store wait time w[i] = t - b[i] - a[i]; res_b[i] = 0; // add sequence seq += "->" + p[i]; } } } else if (res_a[i] > n) { // is any have less arrival time // the coming process then execute them for (int j = 0; j < p.length; j++) { // compare if (res_a[j] < res_a[i]) { if (res_b[j] > 0) { flag = false; if (res_b[j] > n) { t = t + n; res_b[j] = res_b[j] - n; res_a[j] = res_a[j] + n; seq += "->" + p[j]; } else { t = t + res_b[j]; comp[j] = t - a[j]; w[j] = t - b[j] - a[j]; res_b[j] = 0; seq += "->" + p[j]; } } } } // now the previous porcess according to // ith is process if (res_b[i] > 0) { flag = false; // Check for greaters if (res_b[i] > n) { t = t + n; res_b[i] = res_b[i] - n; res_a[i] = res_a[i] + n; seq += "->" + p[i]; } else { t = t + res_b[i]; comp[i] = t - a[i]; w[i] = t - b[i] - a[i]; res_b[i] = 0; seq += "->" + p[i]; } } } } // if no process is come on thse critical else if (res_a[i] > t) { t++; i--; } } // for exit the while loop if (flag) { break; } } System.out.println("Nom FExecution TAttente"); for (int i = 0; i < p.length; i++) { System.out.println(" " + p[i] + " " + comp[i] + " " + w[i]); res = res + w[i]; resc = resc + comp[i]; } System.out.println("Le temps d'attente moyenne est: " + (float)res / p.length); System.out.println("Le temps d'éxécution moyenne est " + (float)resc / p.length); System.out.println("La séquence est comme suit " + seq); } } // Fifo public static void main ( String [ ] args ) throws IOException { System.out.println(BLUE+"*****************************************Bienvenu à ISI'S Shell*******************************"); Scanner sc = new Scanner(System.in); System.out.println(CYAN+"Vous vouslez étudier la première ou la deuxieme partie?"); System.out.println(CYAN+"Pressez 1 pour utiliser les commandes"); System.out.println(CYAN+"Pressez 2 pour tester l ordonnancement"); int part= sc.nextInt(); while(true) { if(part==1){ String curDir = System.getProperty("user.dir"); //getPathAndHome(); System.out.println(curDir+" > "); Scanner sc1 = new Scanner(System.in); String commande = sc1.nextLine(); String[] separated = commande.split(" "); switch(separated[0]) { case "help": if (separated.length > 3 || separated.length == 0) { System.out.println(RED+"Commande invalide!"); } else if(separated.length==3) { Redirection(separated); } else { help(); } break; case "changeDirectory": if (separated.length > 3 || separated.length == 0) { System.out.println(RED+"Commande invalide!"); } else { cd(separated[1]); } break; case "create": if (separated.length > 3 || separated.length == 0) { System.out.println(RED+"Commande invalide!"); } else { mkDir(separated[1]); } break; case "list": if (separated.length > 3 || separated.length == 0) { System.out.println(RED+"Commande invalide!"); } else if(separated.length==2){ if(separated[1].equals("-s")) { sortLs(); } else { System.out.println(RED+"Commande invalide!"); } } else if(separated.length==3) { Redirection(separated); } else { ls(); } break; case "writeOnFile": if (separated.length > 3 || separated.length == 0) { System.out.println(RED+"Commande invalide!"); } else { WriteOnANewFileWord(separated[1]); } break; case "removeFile": if (separated.length > 3 || separated.length == 0) { System.out.println(RED+"Commande invalide!"); } else { removeFile(separated[1]); } break; case "executeFile": if (separated.length > 3 || separated.length == 0) { System.out.println(RED+"Commande invalide!"); } else { ExecuteFile(separated[1]); } break; case "precedentDirectory": cdTwo(); break; case "alias": alias(separated); break; case "exit": System.out.println(CYAN+"Vous vouslez étudier la première ou la deuxieme partie?"); System.out.println(CYAN+"Pressez 1 pour utiliser les commandes"); System.out.println(CYAN+"Pressez 2 pour tester l ordonnancement"); part= sc.nextInt(); break; default: if(newHelp.length()!=0) { if (separated.length > 3 || separated.length == 0) { System.out.println(RED+"Commande invalide!"); } else if(separated.length==3) { Redirection(separated); } else { help(); } } else if(newChangeDirectory.length()!=0) { if (separated.length > 3 || separated.length == 0) { System.out.println(RED+"Commande invalide!"); } else { cd(separated[1]); } } else if(newCreate.length()!=0) { if (separated.length > 3 || separated.length == 0) { System.out.println(RED+"Commande invalide!"); } else { mkDir(separated[1]); } } else if(newList.length()!=0) { if (separated.length > 3 || separated.length == 0) { System.out.println(RED+"Commande invalide!"); } else if(separated.length==2){ if(separated[1].equals("-s")) { sortLs(); } else { System.out.println(RED+"Commande invalide!"); } } else if(separated.length==3) { Redirection(separated); } else { ls(); } } else if(newWriteOnFile.length()!=0) { if (separated.length > 3 || separated.length == 0) { System.out.println(RED+"Commande invalide!"); } else { WriteOnANewFileWord(separated[1]); } } else if(newRemoveFile.length()!=0) { if (separated.length > 3 || separated.length == 0) { System.out.println(RED+"Commande invalide!"); } else { removeFile(separated[1]); } } else if(newExecuteFile.length()!=0) { if (separated.length > 3 || separated.length == 0) { System.out.println(RED+"Commande invalide!"); } else { ExecuteFile(separated[1]); } } else if(newPrecedentDirectory.length()!=0) { cdTwo(); } else { System.out.println(RED+"Commande invalide!"); } } }else if(part == 2) { int ordonancement; while(true) { System.out.println(CYAN+"Pressez 1 si vous voulez ordonnancer les processus selon la priorité"); System.out.println(CYAN+"Pressez 2 si vous voulez ordonnancer les processus selon l algorithme Round Robin"); System.out.println(CYAN+"Pressez 3 si vous voulez ordonnancer les processus selon l algorithme Fifo"); System.out.println(CYAN+"Pressez 4 si vous voulez ordonnancer les processus selon l algorithme SJF"); System.out.println(CYAN+"Pressez 5 si vous voulez sortire du partie ordonnacent "); ordonancement= sc.nextInt(); if(ordonancement==1) { Priority(); } else if(ordonancement==2) { String name[] = { "p1", "p2", "p3", "p4" }; int arrivaltime[] = { 0, 0, 0, 0 }; int bursttime[] = { 10, 4, 5, 3 }; int q = 2; RoundRobin(name, arrivaltime, bursttime, q); } else if(ordonancement==3) { System.out.println("Entrez le nombre des processus"); Scanner in = new Scanner(System.in); int numberOfProcesses = in.nextInt(); int pid[] = new int[numberOfProcesses]; int bt[] = new int[numberOfProcesses]; int ar[] = new int[numberOfProcesses]; int ct[] = new int[numberOfProcesses]; int ta[] = new int[numberOfProcesses]; int wt[] = new int[numberOfProcesses]; for(int i = 0; i < numberOfProcesses; i++) { System.out.println("Entrez le temps d arrivé du processus " + (i+1) + " :"); ar[i] = in.nextInt(); System.out.println("Entrez le temps d éxécution du processus " + (i+1) + " :"); bt[i] = in.nextInt(); pid[i] = i+1; } int temp; for (int i = 0; i < numberOfProcesses; i++) { for (int j = i+1; j < numberOfProcesses; j++) { if(ar[i] > ar[j]) { temp = ar[i]; ar[i] = ar[j]; ar[j] = temp; temp = pid[i]; pid[i] = pid[j]; pid[j] = temp; temp = bt[i]; bt[i] = bt[j]; bt[j] = temp; } } } System.out.println(); ct[0] = bt[0] + ar[0]; for(int i = 1; i < numberOfProcesses; i++) { ct[i] = ct[i - 1] + bt[i]; } for(int i = 0; i < numberOfProcesses; i++) { ta[i] = ct[i] - ar[i]; wt[i] = ta[i] - bt[i]; } System.out.println("Processus\t\tAT\t\tBT\t\tCT\t\tTAT\t\tWT"); for(int i = 0; i < numberOfProcesses; i++) { System.out.println(pid[i]+"\t\t\t" + ar[i] + "\t\t" + bt[i]+ "\t\t" + ct[i]+ "\t\t" + ta[i]+ "\t\t" + wt[i]); } System.out.println("Diagramme de gant: "); for(int i = 0; i < numberOfProcesses; i++) { System.out.print("P" + pid[i] +" "); } System.out.println("\n"); } else if(ordonancement == 4) { Scanner scR = new Scanner(System.in); System.out.println ("enter no of process:"); int n = scR.nextInt(); int pid[] = new int[n]; int at[] = new int[n]; int bt[] = new int[n]; int ct[] = new int[n]; int ta[] = new int[n]; int wt[] = new int[n]; int f[] = new int[n]; int st=0, tot=0; float avgwt=0, avgta=0; for(int i=0;i<n;i++) { System.out.println ("enter process " + (i+1) + " arrival time:"); at[i] = sc.nextInt(); System.out.println ("enter process " + (i+1) + " brust time:"); bt[i] = sc.nextInt(); pid[i] = i+1; f[i] = 0; } while(true) { int c=n, min = 999999; if (tot == n) break; for (int i=0; i<n; i++) { if ((at[i] <= st) && (f[i] == 0) && (bt[i]<min)) { min=bt[i]; c=i; } } if (c==n) st++; else { ct[c]=st+bt[c]; st+=bt[c]; ta[c]=ct[c]-at[c]; wt[c]=ta[c]-bt[c]; f[c]=1; pid[tot] = c + 1; tot++; } } System.out.println("\npid arrival brust complete turn waiting"); for(int i=0;i<n;i++) { avgwt+= wt[i]; avgta+= ta[i]; System.out.println(pid[i]+"\t\t"+at[i]+"\t\t"+bt[i]+"\t\t"+ct[i]+"\t\t"+ta[i]+"\t\t"+wt[i]); } System.out.println ("\naverage tat is "+ (float)(avgta/n)); System.out.println ("average wt is "+ (float)(avgwt/n)); for(int i=0;i<n;i++) { System.out.print(pid[i] + " "); } System.out.println("\n"); }else if (ordonancement == 5) { System.out.println(CYAN+"Vous vouslez étudier la première ou la deuxieme partie?"); System.out.println(CYAN+"Pressez 1 pour utiliser les commandes"); System.out.println(CYAN+"Pressez 2 pour tester l ordonnancement"); part= sc.nextInt(); break; } } } } } }
[ "Ahmed@DESKTOP-C10KUQO" ]
Ahmed@DESKTOP-C10KUQO
4d8de858b15013d05331a10a265d5dcea8b213fa
e4b1e0fdc40ad3295dcad6ad7c79d3844695ef6a
/StudentManageProject/src/kosta/student/service/SearchStudent.java
fb082b9c61897c0134b66534169292196d31cf54
[]
no_license
lyj8270/kosta
6275ded5477ee524e34b20f833c654bb0d09afc3
6bd39d850fcf6d2ccdbd49c53a5eecc3240d18e6
refs/heads/master
2020-12-30T10:23:49.767665
2017-08-02T09:04:32
2017-08-02T09:04:32
98,869,330
0
0
null
null
null
null
UHC
Java
false
false
2,738
java
package kosta.student.service; import java.util.Scanner; import kosta.student.manage.StudentManager; public class SearchStudent implements StudentService{ @Override public void excute(Scanner scan) { System.out.println(" ==================== 학생 정보 검색 ===================="); int menu = 0; while(menu !=3){ try { System.out.println("1.주소 검색\n2.이름 검색\n3.나가기"); System.out.print("메뉴를 선택하세요 > "); menu = scan.nextInt(); scan.nextLine(); System.out.println(); String parm = ""; switch(menu){ case 1: System.out.print("검색할 주소를 입력하세요 > "); parm = scan.nextLine(); System.out.println(); if(StudentManager.addrSearch(parm).isEmpty()){ System.out.println("해당 지역의 학생이 없습니다\n"); }else{ System.out.println(" ---------------------- "+parm+" 지역 학생 ----------------------"); System.out.println(" 번호 이름 지역 성별 반 키 나이 점수 학년 성적"); StudentManager.addrSearch(parm).stream() .forEach( s -> { System.out.printf( "%5d %5s %4s %3s %3s %4.1f %3d %4d %2d %2s\n", s.getNum(), s.getName(), s.getAddr(), s.getGender(), s.getBan(), s.getHeight(), s.getAge(), s.getScore(),s.getYear(),s.getGrade()); }); System.out.println(); } break; case 2: System.out.print("검색할 이름을 입력하세요 > "); parm = scan.nextLine(); System.out.println(); if(StudentManager.nameSearch(parm).isEmpty()){ System.out.println("해당 학생이 없습니다.\n"); }else{ System.out.println(" --------------------- 학생이름 : "+parm+" --------------------"); System.out.println(" 번호 이름 지역 성별 반 키 나이 점수 학년 성적"); StudentManager.nameSearch(parm).stream() .forEach( s -> { System.out.printf( "%5d %5s %4s %3s %3s %4.1f %3d %4d %2d %2s\n", s.getNum(), s.getName(), s.getAddr(), s.getGender(), s.getBan(), s.getHeight(), s.getAge(), s.getScore(),s.getYear(),s.getGrade()); }); System.out.println(); } break; case 3: System.out.println("이전 단계로 돌아갑니다\n"); break; default : System.out.println("메뉴의 숫자를 선택해주세요\n"); break; } } catch (Exception e) { System.out.println("메뉴의 숫자를 입력해주세요\n"); scan.nextLine(); } } } }
[ "kosta@kosta-HP" ]
kosta@kosta-HP
e433b57b89e0d37cb804220f97db5ca297f5b8ab
9a8868aa3293de026e6c834b552de35f6e5b6778
/src/main/java/com/needtostudy/gongzza/hashTag/HashTagServiceImpl.java
43a4976e73b6f2f0537e2bedb10e8a601d8e1718
[]
no_license
needtostudygroup/GongZZa_Server
4a48eb3b9a6b7d205f1672caa12171d29912254f
7e4f8ac8cacc1ba81b13a69b4c27ef346baeeaff
refs/heads/develop
2022-12-22T01:25:21.840944
2019-12-20T09:55:56
2019-12-20T09:55:56
220,578,159
0
0
null
2022-12-16T00:37:23
2019-11-09T02:09:14
Java
UTF-8
Java
false
false
623
java
package com.needtostudy.gongzza.hashTag; import com.needtostudy.gongzza.daos.HashTagDao; import com.needtostudy.gongzza.vos.HashTag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class HashTagServiceImpl implements HashTagService { @Autowired private HashTagDao hashTagDao; public void createHashTag(HashTag hashTag) { hashTagDao.insertHashTag(hashTag); } public List<HashTag> selectHashTagListByPostId(int postId) { return hashTagDao.selectHashTagListByPostId(postId); } }
[ "wind.dong.dream@gmail.com" ]
wind.dong.dream@gmail.com
740a15b7c95fc124387f4cb5679c19e4bf570e4d
332cfebf4c6ed9c9a62cbc14dcb7b2b97f01e906
/src/main/java/CaesarEncrypterImpl.java
4b84b4f96fd5aa0d17b0f1a716857e5d99537779
[]
no_license
pawiromitchel/caesar-cipher
be7a122aea4f18226cb6fbb1eec2ade983bf2fc0
3eb26f1e481e976c5414bec266cbeec89f440873
refs/heads/master
2022-07-10T06:57:56.942803
2018-05-23T22:55:40
2018-05-23T22:55:40
134,632,556
0
0
null
2019-03-07T07:57:02
2018-05-23T22:36:26
Java
UTF-8
Java
false
false
1,154
java
public class CaesarEncrypterImpl implements CaesarEncrypter { public String encrypt(String message, int shift){ String messageEncrypted = ""; // calculate the length of the message int len = message.length(); // loop through every character of the message for(int x = 0; x < len; x++){ // convert the String to char char c = (char)(message.charAt(x) + shift); // Add shift to the character and if it falls off the end of the alphabet then subtract shift from the number of letters in the alphabet (26) // If the shift does not make the character fall off the end of the alphabet, then add the shift to the character. if (c > 'z'){ messageEncrypted += (char)(message.charAt(x) - (26-shift)); } else if ((char)(message.charAt(x)) == ' ') { // detected a space, so dont shift the space messageEncrypted += (char)(message.charAt(x)); } else { messageEncrypted += (char)(message.charAt(x) + shift); } } return messageEncrypted; } }
[ "pawiromitchel@hotmail.com" ]
pawiromitchel@hotmail.com
687ee302cdb89f3390280b8aed34035fa061a853
d17ef9267fa111be77d4f1c369efd82012c77c9e
/app/src/main/java/org/tensorflow/lite/examples/classification/tflite/Classifier.java
8452a505d43a412dfc9b043000f1f41210493d8b
[]
no_license
karthickal/posit-oediv
c318ef09df7720ae1c1f73e0afdf3c2898206447
dfa745b18998d3bd42fbf3b3d16dc502c9120ebd
refs/heads/master
2022-04-01T02:51:43.444118
2020-01-15T14:50:05
2020-01-15T14:50:05
224,910,888
1
0
null
null
null
null
UTF-8
Java
false
false
12,019
java
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ package org.tensorflow.lite.examples.classification.tflite; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.RectF; import android.os.SystemClock; import android.os.Trace; import java.io.IOException; import java.nio.MappedByteBuffer; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.PriorityQueue; import org.tensorflow.lite.DataType; import org.tensorflow.lite.Interpreter; import org.tensorflow.lite.examples.classification.env.Logger; import org.tensorflow.lite.examples.classification.tflite.Classifier.Device; import org.tensorflow.lite.gpu.GpuDelegate; import org.tensorflow.lite.nnapi.NnApiDelegate; import org.tensorflow.lite.support.common.FileUtil; import org.tensorflow.lite.support.common.TensorOperator; import org.tensorflow.lite.support.common.TensorProcessor; import org.tensorflow.lite.support.image.ImageProcessor; import org.tensorflow.lite.support.image.TensorImage; import org.tensorflow.lite.support.image.ops.ResizeOp; import org.tensorflow.lite.support.image.ops.ResizeOp.ResizeMethod; import org.tensorflow.lite.support.image.ops.ResizeWithCropOrPadOp; import org.tensorflow.lite.support.image.ops.Rot90Op; import org.tensorflow.lite.support.label.TensorLabel; import org.tensorflow.lite.support.tensorbuffer.TensorBuffer; /** A classifier specialized to label images using TensorFlow Lite. */ public abstract class Classifier { private static final Logger LOGGER = new Logger(); /** The model type used for classification. */ public enum Model { FLOAT, QUANTIZED, } /** The runtime device type used for executing classification. */ public enum Device { CPU, NNAPI, GPU } /** Number of results to show in the UI. */ private static final int MAX_RESULTS = 3; /** The loaded TensorFlow Lite model. */ private MappedByteBuffer tfliteModel; /** Image size along the x axis. */ private final int imageSizeX; /** Image size along the y axis. */ private final int imageSizeY; /** Optional GPU delegate for accleration. */ private GpuDelegate gpuDelegate = null; /** Optional NNAPI delegate for accleration. */ private NnApiDelegate nnApiDelegate = null; /** An instance of the driver class to run model inference with Tensorflow Lite. */ protected Interpreter tflite; /** Options for configuring the Interpreter. */ private final Interpreter.Options tfliteOptions = new Interpreter.Options(); /** Labels corresponding to the output of the vision model. */ private List<String> labels; /** Input image TensorBuffer. */ private TensorImage inputImageBuffer; /** Output probability TensorBuffer. */ private final TensorBuffer outputProbabilityBuffer; /** Processer to apply post processing of the output probability. */ private final TensorProcessor probabilityProcessor; /** * Creates a classifier with the provided configuration. * * @param activity The current Activity. * @param model The model to use for classification. * @param device The device to use for classification. * @param numThreads The number of threads to use for classification. * @return A classifier with the desired configuration. */ public static Classifier create(Activity activity, Model model, Device device, int numThreads) throws IOException { if (model == Model.QUANTIZED) { return new ClassifierQuantizedMobileNet(activity, device, numThreads); } else { return new ClassifierFloatMobileNet(activity, device, numThreads); } } /** An immutable result returned by a Classifier describing what was recognized. */ public static class Recognition { /** * A unique identifier for what has been recognized. Specific to the class, not the instance of * the object. */ private final String id; /** Display name for the recognition. */ private final String title; /** * A sortable score for how good the recognition is relative to others. Higher should be better. */ private final Float confidence; /** Optional location within the source image for the location of the recognized object. */ private RectF location; public Recognition( final String id, final String title, final Float confidence, final RectF location) { this.id = id; this.title = title; this.confidence = confidence; this.location = location; } public String getId() { return id; } public String getTitle() { return title; } public Float getConfidence() { return confidence; } public RectF getLocation() { return new RectF(location); } public void setLocation(RectF location) { this.location = location; } @Override public String toString() { String resultString = ""; if (id != null) { resultString += "[" + id + "] "; } if (title != null) { resultString += title + " "; } if (confidence != null) { resultString += String.format("(%.1f%%) ", confidence * 100.0f); } if (location != null) { resultString += location + " "; } return resultString.trim(); } } /** Initializes a {@code Classifier}. */ protected Classifier(Activity activity, Device device, int numThreads) throws IOException { tfliteModel = FileUtil.loadMappedFile(activity, getModelPath()); switch (device) { case NNAPI: nnApiDelegate = new NnApiDelegate(); tfliteOptions.addDelegate(nnApiDelegate); break; case GPU: gpuDelegate = new GpuDelegate(); tfliteOptions.addDelegate(gpuDelegate); break; case CPU: break; } tfliteOptions.setNumThreads(numThreads); tflite = new Interpreter(tfliteModel, tfliteOptions); // Loads labels out from the label file. labels = FileUtil.loadLabels(activity, getLabelPath()); // Reads type and shape of input and output tensors, respectively. int imageTensorIndex = 0; int[] imageShape = tflite.getInputTensor(imageTensorIndex).shape(); // {1, height, width, 3} imageSizeY = imageShape[1]; imageSizeX = imageShape[2]; DataType imageDataType = tflite.getInputTensor(imageTensorIndex).dataType(); int probabilityTensorIndex = 0; int[] probabilityShape = tflite.getOutputTensor(probabilityTensorIndex).shape(); // {1, NUM_CLASSES} DataType probabilityDataType = tflite.getOutputTensor(probabilityTensorIndex).dataType(); // Creates the input tensor. inputImageBuffer = new TensorImage(imageDataType); // Creates the output tensor and its processor. outputProbabilityBuffer = TensorBuffer.createFixedSize(probabilityShape, probabilityDataType); // Creates the post processor for the output probability. probabilityProcessor = new TensorProcessor.Builder().add(getPostprocessNormalizeOp()).build(); LOGGER.d("Created a Tensorflow Lite Image Classifier."); } /** Runs inference and returns the classification results. */ public List<Recognition> recognizeImage(final Bitmap bitmap) { // Logs this method so that it can be analyzed with systrace. Trace.beginSection("recognizeImage"); Trace.beginSection("loadImage"); long startTimeForLoadImage = SystemClock.uptimeMillis(); inputImageBuffer = loadImage(bitmap); long endTimeForLoadImage = SystemClock.uptimeMillis(); Trace.endSection(); LOGGER.v("Timecost to load the image: " + (endTimeForLoadImage - startTimeForLoadImage)); // Runs the inference call. Trace.beginSection("runInference"); long startTimeForReference = SystemClock.uptimeMillis(); tflite.run(inputImageBuffer.getBuffer(), outputProbabilityBuffer.getBuffer().rewind()); long endTimeForReference = SystemClock.uptimeMillis(); Trace.endSection(); LOGGER.v("Timecost to run model inference: " + (endTimeForReference - startTimeForReference)); // Gets the map of label and probability. Map<String, Float> labeledProbability = new TensorLabel(labels, probabilityProcessor.process(outputProbabilityBuffer)) .getMapWithFloatValue(); Trace.endSection(); // Gets top-k results. return getTopKProbability(labeledProbability); } /** Closes the interpreter and model to release resources. */ public void close() { if (tflite != null) { tflite.close(); tflite = null; } if (gpuDelegate != null) { gpuDelegate.close(); gpuDelegate = null; } if (nnApiDelegate != null) { nnApiDelegate.close(); nnApiDelegate = null; } tfliteModel = null; } /** Get the image size along the x axis. */ public int getImageSizeX() { return imageSizeX; } /** Get the image size along the y axis. */ public int getImageSizeY() { return imageSizeY; } /** Loads input image, and applies preprocessing. */ private TensorImage loadImage(final Bitmap bitmap) { // Loads bitmap into a TensorImage. inputImageBuffer.load(bitmap); // Creates processor for the TensorImage. int cropSize = Math.min(bitmap.getWidth(), bitmap.getHeight()); // TODO(b/143564309): Fuse ops inside ImageProcessor. ImageProcessor imageProcessor = new ImageProcessor.Builder() .add(new ResizeWithCropOrPadOp(cropSize, cropSize)) .add(new ResizeOp(imageSizeX, imageSizeY, ResizeMethod.NEAREST_NEIGHBOR)) .add(getPreprocessNormalizeOp()) .build(); return imageProcessor.process(inputImageBuffer); } /** Gets the top-k results. */ private static List<Recognition> getTopKProbability(Map<String, Float> labelProb) { // Find the best classifications. PriorityQueue<Recognition> pq = new PriorityQueue<>( MAX_RESULTS, (lhs, rhs) -> { // Intentionally reversed to put high confidence at the head of the queue. return Float.compare(rhs.getConfidence(), lhs.getConfidence()); }); for (Map.Entry<String, Float> entry : labelProb.entrySet()) { pq.add(new Recognition("" + entry.getKey(), entry.getKey(), entry.getValue(), null)); } final ArrayList<Recognition> recognitions = new ArrayList<>(); int recognitionsSize = Math.min(pq.size(), MAX_RESULTS); for (int i = 0; i < recognitionsSize; ++i) { recognitions.add(pq.poll()); } return recognitions; } /** Gets the name of the model file stored in Assets. */ protected abstract String getModelPath(); /** Gets the name of the label file stored in Assets. */ protected abstract String getLabelPath(); /** Gets the TensorOperator to nomalize the input image in preprocessing. */ protected abstract TensorOperator getPreprocessNormalizeOp(); /** * Gets the TensorOperator to dequantize the output probability in post processing. * * <p>For quantized model, we need de-quantize the prediction with NormalizeOp (as they are all * essentially linear transformation). For float model, de-quantize is not required. But to * uniform the API, de-quantize is added to float model too. Mean and std are set to 0.0f and * 1.0f, respectively. */ protected abstract TensorOperator getPostprocessNormalizeOp(); }
[ "udhay2498@gmail.com" ]
udhay2498@gmail.com
a36b357fb93560e161284224b4ea1c678d793b86
b7da60539845b75cb587b9b24b193b283a5f199b
/factory-pattern/src/main/java/com/pattern/factory/abstractfactory/INote.java
92365b758e7a3ab7a538e031b9baab50f30ef9ba
[]
no_license
Meandmyguitar/design-patterns
5b24d00b790d2ee2d75f417411c1ac39a139150d
6e99f785674256afb9af8dc195e5fdf84069e67b
refs/heads/master
2023-01-18T19:20:49.171956
2020-12-01T03:07:13
2020-12-01T03:07:13
316,882,593
0
0
null
null
null
null
UTF-8
Java
false
false
142
java
package com.pattern.factory.abstractfactory; /** * 课堂笔记 * Created by wangzhengpeng */ public interface INote { void edit(); }
[ "wangzhengpeng@huohua.cn" ]
wangzhengpeng@huohua.cn
c7d40efa3ede1230d03832d023c697dcda7dffb7
dc820d55d9026364eaf021bfad882e655fc346cb
/ftp-util/src/main/java/com/cerner/ftp/data/sftp/UserPassBuilder.java
96398e22c275506ff6bb0354781fd3700cfbf9b4
[ "Apache-2.0" ]
permissive
cerner/ccl-testing
84ae19fc51463d2f40ca73e51a63893890bc7d11
e2f1411dc9178c304d4fc9388b02deadc86e099d
refs/heads/main
2023-05-12T10:39:02.673058
2023-04-28T20:18:53
2023-04-28T20:18:53
134,469,679
17
14
Apache-2.0
2023-04-28T20:18:54
2018-05-22T20:05:36
Java
UTF-8
Java
false
false
2,431
java
package com.cerner.ftp.data.sftp; import java.net.URI; import com.cerner.ftp.data.FtpProduct; import com.cerner.ftp.data.sftp.impl.SimpleUserPassBuilder; /** * An object that controls the behavior of the SFTP downloader using username and password to authenticate and * authorize. * * @author Joshua Hyde * */ public abstract class UserPassBuilder { /** * A read-only snapshot of the {@link UserPassBuilder} object that constructs it at the time of construction. * * @author Joshua Hyde * */ public interface UserPassProduct extends FtpProduct { /** * Get the password to be used to log into the remote server. * * @return The password. */ String getPassword(); } /** * Get an instance of a username/password builder. * * @return A instance of a {@link UserPassBuilder} implementation. */ public static UserPassBuilder getBuilder() { return new SimpleUserPassBuilder(); } /** * Construct a product out of the currently configuration stored within this builder. * * @return An instance of an {@link UserPassProduct} object. * @throws IllegalStateException * If the builder has not yet been fully fleshed-out and properly configured. */ public abstract UserPassProduct build(); /** * Set the password to be used to log into the remote server. * * @param password * The password. * @return This object. * @throws NullPointerException * If the given password is {@code null}. */ public abstract UserPassBuilder setPassword(String password); /** * Set the address of the server on which the SFTP server exists. * * @param serverAddress * A {@link URI} object representing the location of the server. * @return This object. * @throws NullPointerException * If the given URI is {@code null}. */ public abstract UserPassBuilder setServerAddress(URI serverAddress); /** * Set the username to be used to log into the remote SFTP server. * * @param username * The username. * @return This object. * @throws NullPointerException * If the given username is {@code null}. */ public abstract UserPassBuilder setUsername(String username); }
[ "fred.eckertson@cerner.com" ]
fred.eckertson@cerner.com
d638bbe8f7c475551cfce0b37fd154dc408fb0a6
1d4b142fdbc4e28b629dd02bd757c4f047024fe1
/scene6/src/sample/Controller.java
76cdeb1ffa807a4bcb1ef439963c4042f1ef0a0e
[]
no_license
radelka/laboratornye
6df97f9873b0e60083e4dda32254ac5440d9e790
5904563654b560c37b01dc4116d56ed2fbd72cdb
refs/heads/main
2023-01-31T17:19:58.619381
2020-12-17T11:53:16
2020-12-17T11:53:16
322,287,471
0
0
null
null
null
null
UTF-8
Java
false
false
2,191
java
package sample; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.stage.Stage; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Optional; public class Controller { @FXML private Button btn1; @FXML private TextField textField1; @FXML private TextField textField2; @FXML private Label label; @FXML private Button btn2; @FXML private Hyperlink hyper1; @FXML void initialize() { btn1.setOnAction(event -> { Users user = new Users(); user.login = textField1.getText(); user.password = textField2.getText(); boolean flag = false; try { flag = user.checkPsw(); } catch (FileNotFoundException e) { e.printStackTrace(); } if (flag) { label.setText("Пароль верный!"); } else { label.setText("Пароль не верный!"); } }); btn2.setOnAction(event -> { Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setTitle("Очистка"); alert.setHeaderText(""); alert.setContentText("Вы уверены что хотите очистить поля входа?"); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.OK) { textField1.setText(""); textField2.setText(""); } }); hyper1.setOnAction(event -> { hyper1.getScene().getWindow().hide(); FXMLLoader load = new FXMLLoader(); load.setLocation(getClass().getResource("regist.fxml")); try { load.load(); } catch (IOException e) { e.printStackTrace(); } Parent root = load.getRoot(); Stage stage = new Stage(); stage.setScene(new Scene(root)); stage.showAndWait(); }); } }
[ "thepowerfulkane@yandex.ru" ]
thepowerfulkane@yandex.ru
d8b73368c9e895843a1df215fdd8b70c4e3f7f30
150efb710ac4fece398cd840b2680aeca950c711
/cs-5200/examples/Web Services Java/GameRegistryService/src/org/datacontract/schemas/_2004/_07/common/EndPoint.java
a589b24cba2d3f6e1bfcd6b4337b0be46a4ede3d
[]
no_license
fayroslee/school
5a109674f6765f4def9101228844e4525b8396de
a41e96d304a92036a5de893922161a0b9052f6a6
refs/heads/master
2021-01-11T15:20:14.724069
2014-04-25T14:56:01
2014-04-25T14:56:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,092
java
package org.datacontract.schemas._2004._07.common; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for EndPoint complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="EndPoint"> * &lt;complexContent> * &lt;extension base="{http://schemas.datacontract.org/2004/07/Common}DistributableObject"> * &lt;sequence> * &lt;element name="Address" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> * &lt;element name="Port" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> * &lt;/sequence> * &lt;/extension> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "EndPoint", propOrder = { "address", "port" }) public class EndPoint extends DistributableObject { @XmlElement(name = "Address") protected Integer address; @XmlElement(name = "Port") protected Integer port; /** * Gets the value of the address property. * * @return * possible object is * {@link Integer } * */ public Integer getAddress() { return address; } /** * Sets the value of the address property. * * @param value * allowed object is * {@link Integer } * */ public void setAddress(Integer value) { this.address = value; } /** * Gets the value of the port property. * * @return * possible object is * {@link Integer } * */ public Integer getPort() { return port; } /** * Sets the value of the port property. * * @param value * allowed object is * {@link Integer } * */ public void setPort(Integer value) { this.port = value; } }
[ "alfy32@gmail.com" ]
alfy32@gmail.com
6759a453b5a9a852391bcf28725ce5c30372da33
39cd24a1413d90b63529c22dd8137d897001a7be
/springbootdemo01/src/main/java/com/offcn/controller/UserController.java
d56fe667891e8bad8cf6152fca053703b637e714
[]
no_license
crazy13-upup/springbootDemo02
c6ea56de54394903f7121adda95f7c125a972023
f9dd346bab242bf21485a0d5ccc8dcdb3d68ac66
refs/heads/master
2020-09-05T00:52:58.066800
2019-11-06T07:39:26
2019-11-06T07:39:26
219,938,647
0
0
null
null
null
null
UTF-8
Java
false
false
860
java
package com.offcn.controller; import com.offcn.dao.UserDao; import com.offcn.entity.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.Optional; @RestController @RequestMapping("/user") public class UserController { @Autowired private UserDao userDao; //添加 @RequestMapping("/saveInfo") public String saveInfo(){ User user = new User(); user.setAge(18); user.setUsername("小明"); userDao.save(user); return "success"; } //查询 @GetMapping("/getUsersById") public User getUserById(){ User user = userDao.getOne(1); return user; } }
[ "lqc980123@163.com" ]
lqc980123@163.com
b89b1f0ffe30ba608cf960ae928e7c0df70cc553
c8664fc194971e6e39ba8674b20d88ccfa7663b1
/com/tencent/mm/plugin/freewifi/a.java
6b977c4e0b1243a09cbb3eb5af08f7ed09c5280b
[]
no_license
raochuan/wexin1120
b926bc8d4143c4b523ed43e265cd20ef0c89ad40
1eaa71e1e3e7c9f9b9f96db8de56db3dfc4fb4d3
refs/heads/master
2020-05-17T23:57:00.000696
2017-11-03T02:33:27
2017-11-03T02:33:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,804
java
package com.tencent.mm.plugin.freewifi; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.net.NetworkInfo; import android.net.wifi.WifiManager; import com.tencent.gmtrace.GMTrace; import com.tencent.mm.sdk.platformtools.ab; import com.tencent.mm.sdk.platformtools.w; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; public final class a { private WifiManager aKu; public Activity activity; public Condition fiI; private long hmZ; public Lock mbr; public boolean mbs; public boolean mbt; private BroadcastReceiver mbu; public String ssid; public a(String paramString, Activity paramActivity) { GMTrace.i(7246952005632L, 53994); this.mbs = false; this.mbt = false; this.activity = paramActivity; this.hmZ = 15000L; this.ssid = paramString; this.mbr = new ReentrantLock(); this.fiI = this.mbr.newCondition(); this.aKu = ((WifiManager)ab.getContext().getSystemService("wifi")); GMTrace.o(7246952005632L, 53994); } private void azr() { GMTrace.i(7247220441088L, 53996); try { this.activity.unregisterReceiver(this.mbu); GMTrace.o(7247220441088L, 53996); return; } catch (IllegalArgumentException localIllegalArgumentException) { GMTrace.o(7247220441088L, 53996); } } /* Error */ public final void a(final a parama) { // Byte code: // 0: ldc2_w 107 // 3: ldc 109 // 5: invokestatic 42 com/tencent/gmtrace/GMTrace:i (JI)V // 8: new 6 com/tencent/mm/plugin/freewifi/a$1 // 11: dup // 12: aload_0 // 13: aload_1 // 14: invokespecial 112 com/tencent/mm/plugin/freewifi/a$1:<init> (Lcom/tencent/mm/plugin/freewifi/a;Lcom/tencent/mm/plugin/freewifi/a$a;)V // 17: astore_1 // 18: invokestatic 73 com/tencent/mm/sdk/platformtools/ab:getContext ()Landroid/content/Context; // 21: ldc 114 // 23: invokevirtual 81 android/content/Context:getSystemService (Ljava/lang/String;)Ljava/lang/Object; // 26: checkcast 116 android/net/ConnectivityManager // 29: iconst_1 // 30: invokevirtual 120 android/net/ConnectivityManager:getNetworkInfo (I)Landroid/net/NetworkInfo; // 33: invokevirtual 126 android/net/NetworkInfo:isConnected ()Z // 36: ifeq +31 -> 67 // 39: aload_0 // 40: getfield 54 com/tencent/mm/plugin/freewifi/a:ssid Ljava/lang/String; // 43: invokestatic 132 com/tencent/mm/plugin/freewifi/model/d:azY ()Ljava/lang/String; // 46: invokevirtual 138 java/lang/String:equals (Ljava/lang/Object;)Z // 49: ifeq +18 -> 67 // 52: aload_1 // 53: invokeinterface 141 1 0 // 58: ldc2_w 107 // 61: ldc 109 // 63: invokestatic 88 com/tencent/gmtrace/GMTrace:o (JI)V // 66: return // 67: invokestatic 147 java/lang/Thread:currentThread ()Ljava/lang/Thread; // 70: invokestatic 153 android/os/Looper:getMainLooper ()Landroid/os/Looper; // 73: invokevirtual 156 android/os/Looper:getThread ()Ljava/lang/Thread; // 76: if_acmpne +13 -> 89 // 79: new 158 java/lang/RuntimeException // 82: dup // 83: ldc -96 // 85: invokespecial 163 java/lang/RuntimeException:<init> (Ljava/lang/String;)V // 88: athrow // 89: aload_0 // 90: new 8 com/tencent/mm/plugin/freewifi/a$2 // 93: dup // 94: aload_0 // 95: invokespecial 166 com/tencent/mm/plugin/freewifi/a$2:<init> (Lcom/tencent/mm/plugin/freewifi/a;)V // 98: putfield 97 com/tencent/mm/plugin/freewifi/a:mbu Landroid/content/BroadcastReceiver; // 101: aload_0 // 102: getfield 59 com/tencent/mm/plugin/freewifi/a:mbr Ljava/util/concurrent/locks/Lock; // 105: invokeinterface 169 1 0 // 110: new 171 android/content/IntentFilter // 113: dup // 114: invokespecial 172 android/content/IntentFilter:<init> ()V // 117: astore 7 // 119: aload 7 // 121: ldc -82 // 123: invokevirtual 177 android/content/IntentFilter:addAction (Ljava/lang/String;)V // 126: aload 7 // 128: ldc -77 // 130: invokevirtual 177 android/content/IntentFilter:addAction (Ljava/lang/String;)V // 133: aload_0 // 134: getfield 48 com/tencent/mm/plugin/freewifi/a:activity Landroid/app/Activity; // 137: aload_0 // 138: getfield 97 com/tencent/mm/plugin/freewifi/a:mbu Landroid/content/BroadcastReceiver; // 141: aload 7 // 143: invokevirtual 183 android/app/Activity:registerReceiver (Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent; // 146: pop // 147: aload_0 // 148: getfield 85 com/tencent/mm/plugin/freewifi/a:aKu Landroid/net/wifi/WifiManager; // 151: invokevirtual 186 android/net/wifi/WifiManager:isWifiEnabled ()Z // 154: ifne +72 -> 226 // 157: new 188 com/tencent/mm/plugin/freewifi/e // 160: dup // 161: aload_0 // 162: getfield 48 com/tencent/mm/plugin/freewifi/a:activity Landroid/app/Activity; // 165: invokespecial 191 com/tencent/mm/plugin/freewifi/e:<init> (Landroid/app/Activity;)V // 168: invokevirtual 195 com/tencent/mm/plugin/freewifi/e:azt ()I // 171: istore_2 // 172: ldc -59 // 174: new 199 java/lang/StringBuilder // 177: dup // 178: ldc -55 // 180: invokespecial 202 java/lang/StringBuilder:<init> (Ljava/lang/String;)V // 183: iload_2 // 184: invokevirtual 206 java/lang/StringBuilder:append (I)Ljava/lang/StringBuilder; // 187: invokevirtual 209 java/lang/StringBuilder:toString ()Ljava/lang/String; // 190: invokestatic 214 com/tencent/mm/sdk/platformtools/w:i (Ljava/lang/String;Ljava/lang/String;)V // 193: iload_2 // 194: ifeq +32 -> 226 // 197: aload_1 // 198: iload_2 // 199: invokeinterface 218 2 0 // 204: aload_0 // 205: invokespecial 220 com/tencent/mm/plugin/freewifi/a:azr ()V // 208: aload_0 // 209: getfield 59 com/tencent/mm/plugin/freewifi/a:mbr Ljava/util/concurrent/locks/Lock; // 212: invokeinterface 223 1 0 // 217: ldc2_w 107 // 220: ldc 109 // 222: invokestatic 88 com/tencent/gmtrace/GMTrace:o (JI)V // 225: return // 226: aload_0 // 227: getfield 54 com/tencent/mm/plugin/freewifi/a:ssid Ljava/lang/String; // 230: invokestatic 227 com/tencent/mm/plugin/freewifi/model/d:xT (Ljava/lang/String;)I // 233: istore_2 // 234: iload_2 // 235: ifeq +36 -> 271 // 238: aload_0 // 239: invokespecial 220 com/tencent/mm/plugin/freewifi/a:azr ()V // 242: aload_1 // 243: iload_2 // 244: invokeinterface 218 2 0 // 249: aload_0 // 250: invokespecial 220 com/tencent/mm/plugin/freewifi/a:azr ()V // 253: aload_0 // 254: getfield 59 com/tencent/mm/plugin/freewifi/a:mbr Ljava/util/concurrent/locks/Lock; // 257: invokeinterface 223 1 0 // 262: ldc2_w 107 // 265: ldc 109 // 267: invokestatic 88 com/tencent/gmtrace/GMTrace:o (JI)V // 270: return // 271: iconst_0 // 272: istore_3 // 273: aload_0 // 274: getfield 44 com/tencent/mm/plugin/freewifi/a:mbs Z // 277: ifeq +13 -> 290 // 280: iload_3 // 281: istore 4 // 283: aload_0 // 284: getfield 46 com/tencent/mm/plugin/freewifi/a:mbt Z // 287: ifne +198 -> 485 // 290: invokestatic 233 java/lang/System:currentTimeMillis ()J // 293: lstore 5 // 295: aload_0 // 296: getfield 67 com/tencent/mm/plugin/freewifi/a:fiI Ljava/util/concurrent/locks/Condition; // 299: aload_0 // 300: getfield 52 com/tencent/mm/plugin/freewifi/a:hmZ J // 303: getstatic 239 java/util/concurrent/TimeUnit:MILLISECONDS Ljava/util/concurrent/TimeUnit; // 306: invokeinterface 245 4 0 // 311: istore_3 // 312: iload_3 // 313: istore 4 // 315: iload_3 // 316: ifeq +169 -> 485 // 319: invokestatic 233 java/lang/System:currentTimeMillis ()J // 322: lload 5 // 324: lsub // 325: lstore 5 // 327: aload_0 // 328: aload_0 // 329: getfield 52 com/tencent/mm/plugin/freewifi/a:hmZ J // 332: lload 5 // 334: lsub // 335: putfield 52 com/tencent/mm/plugin/freewifi/a:hmZ J // 338: ldc -59 // 340: new 199 java/lang/StringBuilder // 343: dup // 344: ldc -9 // 346: invokespecial 202 java/lang/StringBuilder:<init> (Ljava/lang/String;)V // 349: lload 5 // 351: invokevirtual 250 java/lang/StringBuilder:append (J)Ljava/lang/StringBuilder; // 354: ldc -4 // 356: invokevirtual 255 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; // 359: aload_0 // 360: getfield 52 com/tencent/mm/plugin/freewifi/a:hmZ J // 363: invokevirtual 250 java/lang/StringBuilder:append (J)Ljava/lang/StringBuilder; // 366: invokevirtual 209 java/lang/StringBuilder:toString ()Ljava/lang/String; // 369: invokestatic 214 com/tencent/mm/sdk/platformtools/w:i (Ljava/lang/String;Ljava/lang/String;)V // 372: aload_0 // 373: getfield 52 com/tencent/mm/plugin/freewifi/a:hmZ J // 376: lconst_0 // 377: lcmp // 378: ifle +99 -> 477 // 381: aload_0 // 382: getfield 52 com/tencent/mm/plugin/freewifi/a:hmZ J // 385: lstore 5 // 387: aload_0 // 388: lload 5 // 390: putfield 52 com/tencent/mm/plugin/freewifi/a:hmZ J // 393: goto -120 -> 273 // 396: astore 7 // 398: ldc -59 // 400: ldc_w 257 // 403: iconst_3 // 404: anewarray 4 java/lang/Object // 407: dup // 408: iconst_0 // 409: aload_0 // 410: getfield 48 com/tencent/mm/plugin/freewifi/a:activity Landroid/app/Activity; // 413: invokevirtual 261 android/app/Activity:getIntent ()Landroid/content/Intent; // 416: invokestatic 267 com/tencent/mm/plugin/freewifi/m:B (Landroid/content/Intent;)Ljava/lang/String; // 419: aastore // 420: dup // 421: iconst_1 // 422: aload_0 // 423: getfield 48 com/tencent/mm/plugin/freewifi/a:activity Landroid/app/Activity; // 426: invokevirtual 261 android/app/Activity:getIntent ()Landroid/content/Intent; // 429: invokestatic 271 com/tencent/mm/plugin/freewifi/m:C (Landroid/content/Intent;)I // 432: invokestatic 277 java/lang/Integer:valueOf (I)Ljava/lang/Integer; // 435: aastore // 436: dup // 437: iconst_2 // 438: aload 7 // 440: invokevirtual 280 java/lang/InterruptedException:getMessage ()Ljava/lang/String; // 443: aastore // 444: invokestatic 283 com/tencent/mm/sdk/platformtools/w:i (Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V // 447: aload_1 // 448: bipush -17 // 450: invokeinterface 218 2 0 // 455: aload_0 // 456: invokespecial 220 com/tencent/mm/plugin/freewifi/a:azr ()V // 459: aload_0 // 460: getfield 59 com/tencent/mm/plugin/freewifi/a:mbr Ljava/util/concurrent/locks/Lock; // 463: invokeinterface 223 1 0 // 468: ldc2_w 107 // 471: ldc 109 // 473: invokestatic 88 com/tencent/gmtrace/GMTrace:o (JI)V // 476: return // 477: ldc2_w 284 // 480: lstore 5 // 482: goto -95 -> 387 // 485: iload 4 // 487: ifne +33 -> 520 // 490: aload_1 // 491: bipush -16 // 493: invokeinterface 218 2 0 // 498: aload_0 // 499: invokespecial 220 com/tencent/mm/plugin/freewifi/a:azr ()V // 502: aload_0 // 503: getfield 59 com/tencent/mm/plugin/freewifi/a:mbr Ljava/util/concurrent/locks/Lock; // 506: invokeinterface 223 1 0 // 511: ldc2_w 107 // 514: ldc 109 // 516: invokestatic 88 com/tencent/gmtrace/GMTrace:o (JI)V // 519: return // 520: aload_1 // 521: invokeinterface 141 1 0 // 526: goto -28 -> 498 // 529: astore_1 // 530: aload_0 // 531: invokespecial 220 com/tencent/mm/plugin/freewifi/a:azr ()V // 534: aload_0 // 535: getfield 59 com/tencent/mm/plugin/freewifi/a:mbr Ljava/util/concurrent/locks/Lock; // 538: invokeinterface 223 1 0 // 543: aload_1 // 544: athrow // Local variable table: // start length slot name signature // 0 545 0 this a // 0 545 1 parama a // 171 73 2 i int // 272 44 3 bool1 boolean // 281 205 4 bool2 boolean // 293 188 5 l long // 117 25 7 localIntentFilter android.content.IntentFilter // 396 43 7 localInterruptedException InterruptedException // Exception table: // from to target type // 273 280 396 java/lang/InterruptedException // 283 290 396 java/lang/InterruptedException // 290 312 396 java/lang/InterruptedException // 319 387 396 java/lang/InterruptedException // 387 393 396 java/lang/InterruptedException // 101 193 529 finally // 197 204 529 finally // 226 234 529 finally // 238 249 529 finally // 273 280 529 finally // 283 290 529 finally // 290 312 529 finally // 319 387 529 finally // 387 393 529 finally // 398 455 529 finally // 490 498 529 finally // 520 526 529 finally } public static abstract interface a { public abstract void nC(int paramInt); public abstract void onSuccess(); } } /* Location: /Users/xianghongyan/decompile/dex2jar/classes2-dex2jar.jar!/com/tencent/mm/plugin/freewifi/a.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "15223790237@139.com" ]
15223790237@139.com
9efe51fd4c2b68446840ca4f2f6569238a16934a
d7c99be7b36d0ca7555485cc45da647ea66d2424
/barchart-feed-ddf-client/src/test/java/com/barchart/feed/ddf/client/provider/SymbolLimit.java
f5a01ababd7cd760042fccbe958e7c471c4dce22
[ "BSD-3-Clause" ]
permissive
barchart/barchart-feed-ddf
9558a2c2cf70e1e4f3ab78d81e089afd13937bcd
5d745f5a66402a40ab30cac7c087b740c54b6e65
refs/heads/master
2023-08-27T05:48:01.431376
2021-10-11T17:06:22
2021-10-11T17:06:22
3,918,537
2
2
null
2019-10-23T14:57:25
2012-04-03T14:00:41
Java
UTF-8
Java
false
false
2,567
java
package com.barchart.feed.ddf.client.provider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.barchart.feed.api.MarketObserver; import com.barchart.feed.api.Marketplace; import com.barchart.feed.api.connection.TimestampListener; import com.barchart.feed.api.consumer.ConsumerAgent; import com.barchart.feed.api.model.data.Book; import com.barchart.feed.api.model.data.Market; import com.barchart.feed.api.model.meta.Exchange; import com.barchart.feed.client.provider.BarchartMarketplace; import com.barchart.feed.client.provider.BarchartMarketplace.FeedType; import com.barchart.feed.inst.Exchanges; import com.barchart.util.value.api.Time; public class SymbolLimit { private static final Logger log = LoggerFactory.getLogger( SymbolLimit.class); private static final String[] exs = new String[] { //A", "X", "B", "M", "E", "L", "O", "t", "Q", "C", "J", "G", "h", "k", "1", "2", "4" "Q" }; public static void main(final String[] args) throws Exception { final String username = System.getProperty("barchart.username"); final String password = System.getProperty("barchart.password"); final Marketplace market = BarchartMarketplace.builder() .username(username) .password(password) .build(); market.startup(); // market.bindTimestampListener(new TimestampListener() { // // @Override // public void listen(final Time timestamp) { // log.debug("Time Diff = {}", System.currentTimeMillis() - timestamp.millisecond()); // } // // }); Thread.sleep(5000); log.debug("START SUBS"); //final ConsumerAgent agent = market.register(marketObs(), Market.class); final ConsumerAgent agent = market.register(bookObs(), Book.class); for(final String s : exs) { agent.include(Exchanges.fromCode(s).id()); } agent.activate(); log.debug("NUMBER OF SUBS = {}", market.numberOfSubscriptions()); Thread.sleep(10 * 60 * 1000); market.shutdown(); } private static MarketObserver<Market> marketObs() { return new MarketObserver<Market>() { @Override public void onNext(final Market m) { log.debug(m.session().timeOpened().toString()); } }; } private static MarketObserver<Book> bookObs() { return new MarketObserver<Book>() { @Override public void onNext(Book v) { final Book.Top t = v.top(); //log.debug("Time diff {}", System.currentTimeMillis() - v.updated().millisecond()); log.debug("Bid {} Ask {}", t.bid().price(), t.ask().price()); } }; } }
[ "gavin.litchfield@barchart.com" ]
gavin.litchfield@barchart.com
9d4844ddb7e2dce05ebf4eda3154d974a2f20f5c
ff0dc52edcff35ae435baa3a273740103aadd94f
/projectQLBenhVien/src/DAO/DAO_Session.java
925a1a9d3f4a3481f897b7a098de240bd0080db5
[]
no_license
youtrung/quan-ly-benh-vien
81b4defb7146c460901b7f9516ae43856d174e82
2f7db34f5635b3932a3efc1e0513b6db960f7884
refs/heads/master
2023-08-14T21:37:50.432645
2021-10-05T11:07:24
2021-10-05T11:07:24
413,780,738
0
0
null
null
null
null
UTF-8
Java
false
false
2,339
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package DAO; import POJO.POJO_Session; import POJO.POJO_User; import SqlServerProvider.SQLConnectThrowJDBC; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author Admin */ public class DAO_Session { public static ArrayList<POJO_Session> getlistSession() { ArrayList<POJO_Session> listS=new ArrayList<POJO_Session>(); SQLConnectThrowJDBC provider =new SQLConnectThrowJDBC(); POJO_User u=new POJO_User(); try { provider.Open(u.getUsername(),u.getPassword(),u.getEnable(),u.getHost(),u.getPort(),u.getSid()); String query="SELECT p.spid,s.sid, s.serial#,s.username,p.program \n" + "FROM v$session s, v$process p\n" + "WHERE s.paddr=p.addr and type!='BACKGROUND'"; ResultSet rs=provider.executeQuery(query); while (rs.next()) { POJO_Session ses=new POJO_Session(); ses.setSpid(rs.getString(1)); ses.setSid(rs.getString(2)); ses.setSerial(rs.getString(3)); ses.setUsername(rs.getString(4)); ses.setProgram(rs.getString(5)); listS.add(ses); } provider.Close(); } catch (SQLException ex) { Logger.getLogger(DAO_Instance.class.getName()).log(Level.SEVERE, null, ex); } return listS; } public static boolean killSession(String sid,String serial) throws SQLException { boolean kq=false; SQLConnectThrowJDBC provider =new SQLConnectThrowJDBC(); POJO_User u=new POJO_User(); provider.Open(u.getUsername(),u.getPassword(),u.getEnable(),u.getHost(),u.getPort(),u.getSid()); String query=String.format("alter system kill session '%s,%s' ",sid,serial); int n= provider.executeUpdate(query); provider.Close(); return kq; } }
[ "trungvm01@gmail.com" ]
trungvm01@gmail.com
8d8288fd15793e2f3ca17af59fc3922ac0ba187d
cde1e2696de868d1f08f8d22cc7b748a5b8e16cf
/src/main/java/com/javacloud/assetmanagenmentroot/handlers/MyLogoutSuccessHandler.java
ebfc63ce50d3047285cccb8db424608d13ff328e
[]
no_license
Divyashree311/Asset-Root
b0d5572ef9174a2b2689c1ebf21107d99702c88d
3ff128d29f2e2f67f7e06e13e187d5e57fddfe7a
refs/heads/master
2022-11-07T01:41:06.230140
2020-06-25T17:37:50
2020-06-25T17:37:50
274,975,671
0
0
null
null
null
null
UTF-8
Java
false
false
1,230
java
package com.javacloud.assetmanagenmentroot.handlers; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.http.MediaType; import org.springframework.security.core.Authentication; import org.springframework.security.web.authentication.logout.SimpleUrlLogoutSuccessHandler; import org.springframework.stereotype.Component; import com.fasterxml.jackson.databind.ObjectMapper; import com.javacloud.assetmanagenmentroot.response.Response; @Component public class MyLogoutSuccessHandler extends SimpleUrlLogoutSuccessHandler { @Override public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { Response response2 = new Response(); response2.setMessage("you are successfully logged out"); response.setStatus(200); response.setContentType(MediaType.APPLICATION_JSON_VALUE); ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(response2); PrintWriter printWriter = response.getWriter(); printWriter.write(json); } }
[ "61542309+Divyashree311@users.noreply.github.com" ]
61542309+Divyashree311@users.noreply.github.com
aa22cf3d0489421bbc5dd11d9f699add0d706aca
46258ffa27f761a69d29e4cd33fa01f609f87e12
/Android/FourInARow/app/src/main/java/com/csci448/dkern_a2/fourinarow/OptionsFragment.java
1941b611ca79cb54d6da50454a8e3f974dbc06ea
[]
no_license
dkern27/CollegeProgramming
eb5ffb9bfbf0a7a158eb63659cc47a3e22513542
83916177c17229c607eae53fd79fa2523c657009
refs/heads/master
2021-01-22T11:24:46.943672
2017-06-28T21:47:19
2017-06-28T21:47:19
91,986,722
0
0
null
null
null
null
UTF-8
Java
false
false
11,074
java
package com.csci448.dkern_a2.fourinarow; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.RadioButton; import android.widget.TextView; import static android.app.Activity.RESULT_OK; /** * Created by dkern on 2/22/17. */ public class OptionsFragment extends Fragment { private int mNumWins = 0; private int mNumLoss = 0; private int mNumDraw = 0; private int mNumPlayers = 1; private int mPlayer1Color = Color.RED; private int mPlayer2Color = Color.BLUE; Button onePlayerButton; Button twoPlayersButton; TextView scoreTextView; Button resetScoreButton; Button goBackButton; RadioButton rb_p1Red; RadioButton rb_p1Magenta; RadioButton rb_p1Yellow; RadioButton rb_p2Blue; RadioButton rb_p2Green; RadioButton rb_p2Cyan; /** * Makes a new options fragment with the passed in values * @param wins number of wins * @param losses number of losses * @param draws number of draws * @param players number of players * @param player1Color color of player 1 peice * @param player2Color color of player 2 piece * @return new fragment */ public static OptionsFragment newInstance(int wins, int losses, int draws, int players, int player1Color, int player2Color) { OptionsFragment f = new OptionsFragment(); Bundle args = new Bundle(); args.putInt(WelcomeActivity.KEY_WINS, wins); args.putInt(WelcomeActivity.KEY_LOSSES, losses); args.putInt(WelcomeActivity.KEY_DRAWS, draws); args.putInt(WelcomeActivity.KEY_PLAYERS, players); args.putInt(WelcomeActivity.KEY_PLAYER1COLOR, player1Color); args.putInt(WelcomeActivity.KEY_PLAYER2COLOR, player2Color); f.setArguments(args); return f; } /** * Creates fragment * @param savedInstanceState used to load any values from before */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mNumWins = getArguments().getInt(WelcomeActivity.KEY_WINS); mNumLoss = getArguments().getInt(WelcomeActivity.KEY_LOSSES); mNumDraw = getArguments().getInt(WelcomeActivity.KEY_DRAWS); mNumPlayers = getArguments().getInt(WelcomeActivity.KEY_PLAYERS); mPlayer1Color = getArguments().getInt(WelcomeActivity.KEY_PLAYER1COLOR); mPlayer2Color = getArguments().getInt(WelcomeActivity.KEY_PLAYER2COLOR); if(savedInstanceState != null) { mNumWins = savedInstanceState.getInt(WelcomeActivity.KEY_WINS); mNumLoss = savedInstanceState.getInt(WelcomeActivity.KEY_LOSSES); mNumDraw = savedInstanceState.getInt(WelcomeActivity.KEY_DRAWS); mNumPlayers = savedInstanceState.getInt(WelcomeActivity.KEY_PLAYERS); mPlayer1Color = savedInstanceState.getInt(WelcomeActivity.KEY_PLAYER1COLOR); mPlayer2Color = savedInstanceState.getInt(WelcomeActivity.KEY_PLAYER2COLOR); } } /** * Creates the view, sets default choices, and sets up listeners. * @param inflater inflates view * @param container * @param savedInstanceState * @return the view that was created */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_options, container, false); //Number of player buttons onePlayerButton = (Button)view.findViewById(R.id.onePlayersButton); onePlayerButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mNumPlayers = 1; onePlayerButton.setBackgroundColor(Color.GREEN); twoPlayersButton.setBackgroundColor(Color.GRAY); } }); twoPlayersButton = (Button)view.findViewById(R.id.twoPlayersButton); twoPlayersButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mNumPlayers = 2; onePlayerButton.setBackgroundColor(Color.GRAY); twoPlayersButton.setBackgroundColor(Color.GREEN); } }); //Set initial button color if(mNumPlayers == 1) { onePlayerButton.setBackgroundColor(Color.GREEN); twoPlayersButton.setBackgroundColor(Color.GRAY); } else { twoPlayersButton.setBackgroundColor(Color.GREEN); onePlayerButton.setBackgroundColor(Color.GRAY); } //Radio Buttons rb_p1Red = (RadioButton) view.findViewById(R.id.radio_red); rb_p1Red.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onRadioButtonClickedP1(v); } }); rb_p1Magenta = (RadioButton) view.findViewById(R.id.radio_magenta); rb_p1Magenta.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onRadioButtonClickedP1(v); } }); rb_p1Yellow = (RadioButton) view.findViewById(R.id.radio_yellow); rb_p1Yellow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onRadioButtonClickedP1(v); } }); rb_p2Blue = (RadioButton) view.findViewById(R.id.radio_blue); rb_p2Blue.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onRadioButtonClickedP2(v); } }); rb_p2Green = (RadioButton) view.findViewById(R.id.radio_green); rb_p2Green.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onRadioButtonClickedP2(v); } }); rb_p2Cyan = (RadioButton) view.findViewById(R.id.radio_cyan); rb_p2Cyan.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onRadioButtonClickedP2(v); } }); setDefaultRadioButtons(); //Score scoreTextView = (TextView)view.findViewById(R.id.score_text); scoreTextView.setText("W:" + mNumWins + " L:" + mNumLoss + " D:" + mNumDraw); resetScoreButton = (Button)view.findViewById(R.id.reset_score_button); resetScoreButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mNumWins = 0; mNumLoss = 0; mNumDraw = 0; scoreTextView.setText("W:" + mNumWins + " L:" + mNumLoss + " D:" + mNumDraw); } }); //Save options goBackButton = (Button)view.findViewById(R.id.options_go_back_button); goBackButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent returnIntent = new Intent(); returnIntent.putExtra(WelcomeActivity.KEY_PLAYERS, mNumPlayers); returnIntent.putExtra(WelcomeActivity.KEY_WINS, mNumWins); returnIntent.putExtra(WelcomeActivity.KEY_LOSSES, mNumLoss); returnIntent.putExtra(WelcomeActivity.KEY_DRAWS, mNumDraw); returnIntent.putExtra(WelcomeActivity.KEY_PLAYER1COLOR, mPlayer1Color); returnIntent.putExtra(WelcomeActivity.KEY_PLAYER2COLOR, mPlayer2Color); getActivity().setResult(RESULT_OK, returnIntent); getActivity().finish(); } }); return view; } /** * Saves wins, losses, draws, number of players, and color of players * @param savedInstanceState */ @Override public void onSaveInstanceState(Bundle savedInstanceState) { super.onSaveInstanceState(savedInstanceState); savedInstanceState.putInt(WelcomeActivity.KEY_WINS, mNumWins); savedInstanceState.putInt(WelcomeActivity.KEY_LOSSES,mNumLoss); savedInstanceState.putInt(WelcomeActivity.KEY_DRAWS,mNumDraw); savedInstanceState.putInt(WelcomeActivity.KEY_PLAYERS, mNumPlayers); savedInstanceState.putInt(WelcomeActivity.KEY_PLAYER1COLOR, mPlayer1Color); savedInstanceState.putInt(WelcomeActivity.KEY_PLAYER2COLOR, mPlayer2Color); } /** * OnClick action for player 1 radio buttons * @param view radio button that was clicked */ public void onRadioButtonClickedP1(View view) { boolean checked = ((RadioButton) view).isChecked(); switch(view.getId()) { case R.id.radio_red: if (checked) mPlayer1Color = Color.RED; break; case R.id.radio_magenta: if (checked) mPlayer1Color = Color.MAGENTA; break; case R.id.radio_yellow: if(checked) mPlayer1Color = Color.YELLOW; break; } } /** * OnClick action for player 2 radio buttons * @param view radio button that was clicked */ public void onRadioButtonClickedP2(View view) { boolean checked = ((RadioButton) view).isChecked(); switch(view.getId()) { case R.id.radio_blue: if (checked) mPlayer2Color = Color.BLUE; break; case R.id.radio_green: if (checked) mPlayer2Color = Color.GREEN; break; case R.id.radio_cyan: if(checked) mPlayer2Color = Color.CYAN; break; } } /** * Sets the default choice for the radio button */ private void setDefaultRadioButtons() { switch (mPlayer1Color) { case Color.RED: rb_p1Red.setChecked(true); break; case Color.MAGENTA: rb_p1Magenta.setChecked(true); break; case Color.YELLOW: rb_p1Yellow.setChecked(true); } switch (mPlayer2Color) { case Color.BLUE: rb_p2Blue.setChecked(true); break; case Color.GREEN: rb_p2Green.setChecked(true); break; case Color.CYAN: rb_p2Cyan.setChecked(true); } } }
[ "dyl.kern@gmail.com" ]
dyl.kern@gmail.com
df704334a065b24f17f6e0c5f187cd32558afa6e
7cfef33020d1f18f2852ea8f7a4bcb946819ed1a
/src/main/java/com/littlea/sharingplatform/service/impl/UserServiceImpl.java
1f82bec9c0348003064bd93f50ecbbd420e11327
[]
no_license
6a6bb/sharingplatform
07df180db822c54182b7057a2a3ddcc6df19ac0c
0d69684bc40e7ee405db997bad1c328c2200d7a3
refs/heads/linxinran
2022-06-29T09:30:52.224856
2020-02-28T04:23:00
2020-02-28T04:23:00
238,826,785
0
0
null
2022-06-17T02:51:07
2020-02-07T02:20:44
Java
UTF-8
Java
false
false
6,284
java
package com.littlea.sharingplatform.service.impl; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.littlea.sharingplatform.bo.UserLoginBo; import com.littlea.sharingplatform.bo.UserLoginResultBo; import com.littlea.sharingplatform.constant.ResultConstant; import com.littlea.sharingplatform.constant.RoleConstant; import com.littlea.sharingplatform.constant.SystemConstant; import com.littlea.sharingplatform.entity.User; import com.littlea.sharingplatform.entity.UserInformation; import com.littlea.sharingplatform.entity.UserRole; import com.littlea.sharingplatform.mapper.PermissionMapper; import com.littlea.sharingplatform.mapper.UserMapper; import com.littlea.sharingplatform.mapper.UserRoleMapper; import com.littlea.sharingplatform.security.util.JwtUtil; import com.littlea.sharingplatform.security.util.RedisUtil; import com.littlea.sharingplatform.service.UserService; import com.littlea.sharingplatform.vo.Result; import lombok.NonNull; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Value; import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.scheduling.annotation.Async; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.interceptor.TransactionAspectSupport; import java.util.Objects; import java.util.Set; /** * @author chenqiting */ @Service @RequiredArgsConstructor public class UserServiceImpl implements UserService { @NonNull private PasswordEncoder passwordEncoder; @NonNull private UserMapper userMapper; @NonNull private JwtUtil jwtUtil; @NonNull private RedisUtil redisUtil; @NonNull private PermissionMapper permissionMapper; @NonNull private UserRoleMapper userRoleMapper; @NonNull private JavaMailSender javaMailSender; @Value("${spring.mail.username}") private String emailSender; @Override public Result login(UserLoginBo userLoginBo) { //检查参数是否错误 if (Objects.isNull(userLoginBo.getPassword()) || Objects.isNull(userLoginBo.getUsername())){ return ResultConstant.ARGS_ERROR; } //从数据库获取该用户的数据 User user = userMapper.selectOne(new QueryWrapper<User>().eq("user_name", userLoginBo.getUsername())); //账号不存在或者密码错误,都直接返回 if (Objects.isNull(user) || !passwordEncoder.matches(userLoginBo.getPassword(), user.getUserPassword())){ return ResultConstant.PASSWORD_ERROR; } Integer roleId = userRoleMapper.selectByUserId(user.getId()); //查询该用户的权限 Set<String> authorities = permissionMapper.selectByRoleId(roleId); //此时账号信息都对,开始生成token String token = SystemConstant.BEARER + jwtUtil.createToken(user.getUserName(), user.getId()); //包装信息存储 UserInformation userInformation = new UserInformation(user.getId(), roleId, authorities); //将userInformation存储进redis redisUtil.set(SystemConstant.AUTHORIZATION_PREFIX + user.getId(), JSONObject.toJSONString(userInformation)); return new Result<>(new UserLoginResultBo(roleId, token)); } @Transactional(rollbackFor = Exception.class) @Override public Result register(User user) { if (Objects.isNull(user.getEmail()) || Objects.isNull(user.getTeamGroup()) || Objects.isNull(user.getUserPassword()) || Objects.isNull(user.getUserName())){ return ResultConstant.ARGS_ERROR; } //先去user里查看是否存在username相同的情况 User oldUser = userMapper.selectOne(new QueryWrapper<User>().eq("user_name", user.getUserName())); if (Objects.nonNull(oldUser)) { return ResultConstant.USERNAME_EXIST; } String password = passwordEncoder.encode(user.getUserPassword()); //设置加密后的密码 try { user.setUserPassword(password); userMapper.insert(user); //分配角色权限 UserRole userRole = new UserRole(null, user.getId(), RoleConstant.RAND_MEMBER); userRoleMapper.insert(userRole); }catch (Exception e){ e.printStackTrace(); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); return ResultConstant.SYSTEM_ERROR; } //返回成功 return ResultConstant.SUCCESS; } @Override public Result sendEmailForRegister(String email, int result) { //查询一下邮箱是否已经被注册了 User user = userMapper.selectOne(new QueryWrapper<User>().eq("email", email)); if (Objects.nonNull(user)) { return ResultConstant.EMAIL_HOST_EXIST; } return new Result<>(result); } @Async("emailExecutor") @Override public void sendEmailSender(int validationCode, String email) { SimpleMailMessage message = new SimpleMailMessage(); //生成验证码 message.setFrom(this.emailSender); message.setText("您的验证码是:" + validationCode); message.setSubject("小A共享平台"); message.setTo(email); //进行邮件发送 javaMailSender.send(message); } @Override public Result logout(Integer userId) { redisUtil.delete(SystemConstant.AUTHORIZATION_PREFIX + userId); return ResultConstant.SUCCESS; } @Override public Result updatePassword(String password, Integer userId) { //加密处理 password = passwordEncoder.encode(password); User user = new User(); user.setId(userId); user.setUserPassword(password); int success = userMapper.updateById(user); if (success == 1){ redisUtil.delete(SystemConstant.AUTHORIZATION_PREFIX + userId); return ResultConstant.SUCCESS; } return ResultConstant.SYSTEM_ERROR; } }
[ "softwareCQT@users.noreply.github.com" ]
softwareCQT@users.noreply.github.com
bd69405b52daaa0c2ca0f2955582f895a1ff13b5
f6d6ada9069e5440be743ee5f181523d45653d38
/src/main/java/io/nextpos/reporting/web/model/SalesDistributionResponse.java
44968bd10fa908921e9b9a58a27d3390260b37ec
[]
no_license
tingjan1982/nextpos-service
57f70621cddcc56b7efc31c4a2aaa694d2b3d964
4b26cce17a50f032963c0c7113f499417696f25e
refs/heads/master
2023-03-17T19:06:29.470672
2023-03-15T00:43:13
2023-03-15T00:43:13
189,748,319
1
0
null
null
null
null
UTF-8
Java
false
false
377
java
package io.nextpos.reporting.web.model; import io.nextpos.reporting.data.SalesDistribution; import lombok.AllArgsConstructor; import lombok.Data; import java.util.List; @Data @AllArgsConstructor public class SalesDistributionResponse { private List<SalesDistribution.MonthlySales> salesByMonth; private List<SalesDistribution.MonthlySales> salesByMonthLastYear; }
[ "tingjan1982@gmail.com" ]
tingjan1982@gmail.com
7d6a1baa52477f24072470c5c94ed7b84957c970
8dab0d1cf7645084cb333a535b1a860da863b9a7
/src/com/know/interfaces/Lesson_01_Interface_Default_Method.java
c6d848b9aa0e4ac3436fcc3667772436ca680d56
[]
no_license
KnowGroup/Java8Features
2ef3948bf52941cb3d5dd383864fa54e7fc0c15e
fd0319a0489613ecc9f3b0e6f533025a68c35057
refs/heads/master
2020-04-10T22:18:31.329058
2019-03-06T08:54:19
2019-03-06T08:54:19
161,161,374
0
0
null
null
null
null
UTF-8
Java
false
false
1,192
java
package com.know.interfaces; /** * Concrete methods can be implemented in Interface since Java 1.8 * by using default key word * * * @author KnowGroup */ public class Lesson_01_Interface_Default_Method { interface Intref { // Conrete method created using default keyword, which is not same as // default package of class default int m1(){ System.out.println("I am m1 , Concrete method of Intref"); return 999; } void m2(); // Abstract method default void m3(){ System.out.println("I am m3 , Concrete method of Intref"); } } public static void main(String arg[]){ Intref i1 = () -> System.out.println("I am m2 , Abstract Method of Intref"); i1.m1(); i1.m2(); i1.m3(); Intref i2 = new Intref(){ public void m2() { System.out.println("Inner class m2 implementation"); } @Override public void m3() { System.out.println("Inner class overring default interface m3"); } }; i2.m1(); i2.m2(); i2.m3(); } }
[ "info.knowgroup@gmail.com" ]
info.knowgroup@gmail.com
63148700c34bd84e9c7efdf3d82ab03c9206be49
1fcebc31ace144eaf27cc23dbb8d81673e0acd4e
/src/ie/tippinst/jod/fm/model/Round.java
f1d85d626e5225a547e51188cbcfa1c84fcd5a6b
[]
no_license
hshtag33/football-manager
867d701750160a7b96603e213b7091c65159ba10
d453a353513c4a88cb5d4157bdc70a69c15ce929
refs/heads/master
2016-09-05T20:19:39.982907
2010-03-21T22:42:49
2010-03-21T22:42:49
42,160,617
0
0
null
null
null
null
UTF-8
Java
false
false
6,239
java
package ie.tippinst.jod.fm.model; import java.io.Serializable; import java.util.ArrayList; import java.util.Calendar; import java.util.Iterator; import java.util.List; public class Round implements Serializable{ private static final long serialVersionUID = 5399588609114576339L; private List<Calendar> roundDate = new ArrayList<Calendar>(); private List<Calendar> earliestRoundDate = new ArrayList<Calendar>(); private int roundNumber; private Calendar drawDate; private List<Club> teams = new ArrayList<Club>(); private List<Match> matches = new ArrayList<Match>(); private List<Match> replays = new ArrayList<Match>(); private int numberOfTeams; private List<Club> winners = new ArrayList<Club>(); private boolean twoLegs; private double winnerPrizeMoney = 0; private double loserPrizeMoney = 0; public Round() { } public void setRoundDate(List<Calendar> roundDate) { this.roundDate = roundDate; } public List<Calendar> getRoundDate() { return roundDate; } public void setRoundNumber(int roundNumber) { this.roundNumber = roundNumber; } public int getRoundNumber() { return roundNumber; } public void setDrawDate(Calendar drawDate) { this.drawDate = drawDate; } public Calendar getDrawDate() { return drawDate; } public void setTeams(List<Club> teams) { this.teams = teams; } public List<Club> getTeams() { return teams; } public void setMatches(List<Match> matches) { this.matches = matches; } public List<Match> getMatches() { return matches; } public void setNumberOfTeams(int numberOfTeams) { this.numberOfTeams = numberOfTeams; } public int getNumberOfTeams() { return numberOfTeams; } public void setWinners(List<Club> winners) { this.winners = winners; } public List<Club> getWinners() { return winners; } public void playMatches(Calendar date){ Iterator<Calendar> iterator = this.getRoundDate().iterator(); while(iterator.hasNext()){ Calendar c = iterator.next(); Calendar cal = (Calendar) c.clone(); cal.add(Calendar.DATE, 10); if((c.get(Calendar.DAY_OF_MONTH) == date.get(Calendar.DAY_OF_MONTH)) && (c.get(Calendar.MONTH) == date.get(Calendar.MONTH)) && (c.get(Calendar.YEAR) == date.get(Calendar.YEAR))){ Iterator<Match> i = this.getMatches().iterator(); while(i.hasNext()){ Match m = i.next(); if((m.getDate().get(Calendar.DAY_OF_MONTH) == date.get(Calendar.DAY_OF_MONTH)) && (m.getDate().get(Calendar.MONTH) == date.get(Calendar.MONTH)) && (m.getDate().get(Calendar.YEAR) == date.get(Calendar.YEAR))){ m.getHomeTeam().setSelectedTeam(m.getHomeTeam().getBestTeam(m.getHomeTeam().getAvailablePlayers())); m.getAwayTeam().setSelectedTeam(m.getAwayTeam().getBestTeam(m.getAwayTeam().getAvailablePlayers())); if(this.hasTwoLegs() && c.compareTo(this.getRoundDate().get(this.getRoundDate().size() - 1)) == 0){ int index = (this.getMatches().indexOf(m)) - (this.getNumberOfTeams() / 2); m.setHomeFirstLegScore(this.getMatches().get(index).getHomeScore()); m.setAwayFirstLegScore(this.getMatches().get(index).getAwayScore()); m.generateResult(); this.getWinners().add(m.getWinner()); } else if(this.hasTwoLegs()){ m.generateResult(); } else{ m.generateResult(); if(m.hasReplay() && m.getHomeScore() == m.getAwayScore()){ //generate replay Match match = new Match(); match.setPenalties(true); match.setAwayScore(-1); match.setHomeScore(-1); match.setCompetition(m.getCompetition()); match.setHomeTeam(m.getAwayTeam()); match.setAwayTeam(m.getHomeTeam()); match.setStadium(match.getHomeTeam().getHomeGround()); match.setDate((Calendar) m.getDate().clone()); match.getDate().add(Calendar.DATE, 10); this.getReplays().add(match); } else{ this.getWinners().add(m.getWinner()); } } } } } else if((cal.get(Calendar.DAY_OF_MONTH) == date.get(Calendar.DAY_OF_MONTH)) && (cal.get(Calendar.MONTH) == date.get(Calendar.MONTH)) && (cal.get(Calendar.YEAR) == date.get(Calendar.YEAR))){ Iterator<Match> i = this.getReplays().iterator(); while(i.hasNext()){ Match m = i.next(); if((m.getDate().get(Calendar.DAY_OF_MONTH) == date.get(Calendar.DAY_OF_MONTH)) && (m.getDate().get(Calendar.MONTH) == date.get(Calendar.MONTH)) && (m.getDate().get(Calendar.YEAR) == date.get(Calendar.YEAR))){ m.getHomeTeam().setSelectedTeam(m.getHomeTeam().getBestTeam(m.getHomeTeam().getAvailablePlayers())); m.getAwayTeam().setSelectedTeam(m.getAwayTeam().getBestTeam(m.getAwayTeam().getAvailablePlayers())); m.generateResult(); this.getWinners().add(m.getWinner()); m.getWinner().setBankBalance(m.getWinner().getBankBalance() + this.getWinnerPrizeMoney()); if(m.getHomeTeam().getId() == m.getWinner().getId()){ m.getAwayTeam().setBankBalance(m.getAwayTeam().getBankBalance() + this.getLoserPrizeMoney()); } else{ m.getHomeTeam().setBankBalance(m.getHomeTeam().getBankBalance() + this.getLoserPrizeMoney()); } } } } } } public void setTwoLegs(boolean twoLegs) { this.twoLegs = twoLegs; } public boolean hasTwoLegs() { return twoLegs; } public void setEarliestRoundDate(List<Calendar> earliestRoundDate) { this.earliestRoundDate = earliestRoundDate; } public List<Calendar> getEarliestRoundDate() { return earliestRoundDate; } public void setReplays(List<Match> replays) { this.replays = replays; } public List<Match> getReplays() { return replays; } public void setWinnerPrizeMoney(double winnerPrizeMoney) { this.winnerPrizeMoney = winnerPrizeMoney; } public double getWinnerPrizeMoney() { return winnerPrizeMoney; } public void setLoserPrizeMoney(double loserPrizeMoney) { this.loserPrizeMoney = loserPrizeMoney; } public double getLoserPrizeMoney() { return loserPrizeMoney; } }
[ "josephod89@823fb9be-bce2-11de-8784-f7ad4773dbab" ]
josephod89@823fb9be-bce2-11de-8784-f7ad4773dbab
de871f38153ce4619daaaf94631a6a0ba4886eff
c4b7a0ee9124553520c6360c1bf1de4fb024a120
/src/main/java/pe/edu/adra/biaticos/dao/PresupuestoDao.java
78160c8a035e6eeaf8f7bda3ec9726bf5682835a
[]
no_license
JeanPier1/Adra_Viaticos_Real
f7204f4241eb2fd0fdbcd175f455d76f0e9db256
2d1c8e836415f260e7749d05968ec000fef130d1
refs/heads/master
2020-06-05T15:10:35.249936
2019-10-03T22:14:12
2019-10-03T22:14:12
192,468,397
0
0
null
null
null
null
UTF-8
Java
false
false
296
java
package pe.edu.adra.biaticos.dao; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import pe.edu.adra.biaticos.entities.Viajes.Presupuesto; @Repository public interface PresupuestoDao extends JpaRepository<Presupuesto, Long>{ }
[ "38229799+JeanPier1@users.noreply.github.com" ]
38229799+JeanPier1@users.noreply.github.com
6cbabed03da1f78563caff2145f9878f731f5bd3
b8728222a52799598a06c73d752a81ced88d73e3
/Material/agenda-digital-ws-client/src/main/java/com/everis/academia/java/agendadigital/ws/client/soap/generated/Update.java
be6499e9cde29bfe086bf9d3547255119b4f91a0
[]
no_license
JoaoCMSerrano/Agenda
04d2487a74dc8d891277c26e520c3aa67e98061f
b36b86bfe3049d8c621e84d16dd1d713de950568
refs/heads/master
2022-12-21T14:30:17.725470
2019-07-16T00:43:06
2019-07-16T00:43:06
194,242,481
0
0
null
2022-05-25T06:54:36
2019-06-28T09:02:49
Java
UTF-8
Java
false
false
1,374
java
package com.everis.academia.java.agendadigital.ws.client.soap.generated; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for update complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="update"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="cidade" type="{http://soap.web.agendadigital.java.academia.everis.com/}cidade" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "update", propOrder = { "cidade" }) public class Update { protected Cidade cidade; /** * Gets the value of the cidade property. * * @return * possible object is * {@link Cidade } * */ public Cidade getCidade() { return cidade; } /** * Sets the value of the cidade property. * * @param value * allowed object is * {@link Cidade } * */ public void setCidade(Cidade value) { this.cidade = value; } }
[ "jcmserrano@sapo.pt" ]
jcmserrano@sapo.pt
6ae4e9ee995b34aaba45f242c42f03e39a4d750a
c1ac2447d0665d46c5a1c8c6eac46a36b03bb5d4
/src/main/java/xyz/skettios/dungeonmaster/command/impl/CommandAudio.java
c48f7cedf9a50101efc463d186776b3285b923ce
[ "Apache-2.0" ]
permissive
skettios/Dungeon-Master
f4456ec75c0d151157bbb233c3fd36b27d2a8f5f
f18543b1781a6fb0798cff95d8e0db566bd12a45
refs/heads/master
2021-01-01T16:12:10.458095
2017-07-27T13:58:37
2017-07-27T13:58:37
97,787,453
0
0
null
null
null
null
UTF-8
Java
false
false
2,177
java
package xyz.skettios.dungeonmaster.command.impl; import sx.blah.discord.handle.obj.IChannel; import sx.blah.discord.handle.obj.IGuild; import sx.blah.discord.handle.obj.IUser; import sx.blah.discord.handle.obj.IVoiceChannel; import sx.blah.discord.util.audio.AudioPlayer; import xyz.skettios.dungeonmaster.DungeonMaster; import xyz.skettios.dungeonmaster.command.CommandContext; import xyz.skettios.dungeonmaster.command.ICommand; import javax.sound.sampled.UnsupportedAudioFileException; import java.io.File; import java.io.IOException; public class CommandAudio implements ICommand { @Override public String[] getAliases() { return new String[]{"join_voice", "leave_voice", "play_sound"}; } @Override public void execute(CommandContext ctx) { IUser user = ctx.getAuthor(); IUser self = ctx.getClient().getOurUser(); switch (ctx.getCommand()) { case "join_voice": IVoiceChannel vc = user.getVoiceStateForGuild(ctx.getGuild()).getChannel(); vc.join(); break; case "leave_voice": IVoiceChannel selfVC = self.getVoiceStateForGuild(ctx.getGuild()).getChannel(); selfVC.leave(); break; case "play_sound": playSound(ctx.getArgs().get(0), ctx.getGuild(), ctx.getChannel()); default: break; } } private void playSound(String name, IGuild guild, IChannel channel) { AudioPlayer player = AudioPlayer.getAudioPlayerForGuild(guild); File[] soundDir = new File("sounds").listFiles(file -> file.getName().contains(name)); for (File file : soundDir) System.out.println(file.getName()); try { player.queue(soundDir[0]); } catch (IOException ioe) { DungeonMaster.getInstance().LOGGER.error(ioe.getMessage()); } catch (UnsupportedAudioFileException ue) { DungeonMaster.getInstance().LOGGER.error(ue.getMessage()); channel.sendMessage("Unsupported Format"); } } }
[ "brandonjpascual@gmail.com" ]
brandonjpascual@gmail.com
9905a48bd466160b5f05a272477a1f13bfe74f7d
85fb8e063bc036da6d81f4ab23f6bbe31ee2f244
/core/src/com/engicorp/oop/World.java
e732f5d22ce020bf083cf5eebaf0c48bf5f15654
[ "Apache-2.0" ]
permissive
AdityaPutraS/Engi-Corp-Java
a915d1c269ce0c8f22f95fd75fa521f12a71f8fe
da6ea5813cf60249dea91e382fba74aec6f6e895
refs/heads/master
2020-05-15T22:31:30.546789
2019-04-21T12:17:03
2019-04-21T12:17:03
182,528,846
0
0
null
null
null
null
UTF-8
Java
false
false
9,690
java
package com.engicorp.oop; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.engicorp.oop.cell.*; import com.engicorp.oop.exception.TasKepenuhan; import com.engicorp.oop.livingbeing.*; import com.engicorp.oop.misc.Point; import com.engicorp.oop.product.*; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; public class World { static private World instance; private int width, height; private boolean[][] terisi; private Land[][] mapLand; private ArrayList<Animal> listAnimal; private ArrayList<Facility> listFacil; private ArrayList<String> listMsg; public World() { width = 0; height = 0; } public World(int _w, int _h) { width = _w; height = _h; terisi = new boolean[_h][_w]; mapLand = new Land[_h][_w]; //Default : Grassland for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { mapLand[y][x] = new Grassland(new Point(x, y),false); } } listAnimal = new ArrayList<Animal>(); listFacil = new ArrayList<Facility>(); listMsg = new ArrayList<String>(); } //FUNGSI DEBUG public void printWorld() { for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { if(mapLand[y][x].hasGrass()) { System.out.print("V "); }else{ System.out.print("- "); } } System.out.println(); } } ////////////// public void disposeAll() { for(Animal a : listAnimal) { a.dispose(); } for(Facility f : listFacil) { f.dispose(); } } public int getWidth() { return width; } public int getHeight() { return height; } public static World getInstance() { return instance; } static public void init(int _w, int _h) { Showable.setWidth(_w); Showable.setHeight(_h); Showable.setTileSize(100); instance = new World(_w, _h); for (int y = 0; y < 5; y++) { for (int x = 0; x < 5; x++) { instance.setLand(new Point(x,y), new Barn(new Point(x,y),false)); } } for (int y = 8; y < 11; y++) { for (int x = 0; x < 3; x++) { instance.setLand(new Point(x,y), new Coop(new Point(x,y),false)); } } instance.setLand(new Point(0,0), new Barn(new Point(0,0), false)); instance.setLand(new Point(_w-1, _h-1), new Grassland(new Point(_w-1, _h-1), false)); instance.setLand(new Point(_w-1, 0), new Coop(new Point(_w-1,0), false)); Mixer.initCatalog(); instance.addAnimal(new Point(1,0), new Chicken(new Point(1,0))); instance.addAnimal(new Point(3,3), new Diplodocus(new Point(3,3))); instance.addAnimal(new Point(1,9), new Platypus(new Point(1,7))); instance.addAnimal(new Point(6,7), new Lamb(new Point(6,7))); instance.addAnimal(new Point(0,3), new LandSalmon(new Point(0,3))); instance.addAnimal(new Point(7,8), new Cow(new Point(7,8))); instance.addFacility(new Point(7, 10), new Well(new Point(7, 10))); instance.addFacility(new Point(6, 10), new Truck(new Point(6, 10))); instance.addFacility(new Point(5, 10), new Mixer(new Point(5, 10))); try { Player.getInstance().getTas().addBarang(new ChickenEgg()); Player.getInstance().getTas().addBarang(new CowMeat()); Player.getInstance().getTas().addBarang(new DiplodocusEgg()); Player.getInstance().getTas().addBarang(new DiplodocusMeat()); Player.getInstance().getTas().addBarang(new CowMilk()); Player.getInstance().getTas().addBarang(new ChickenEgg()); Player.getInstance().getTas().addBarang(new CowMeat()); Player.getInstance().getTas().addBarang(new DiplodocusEgg()); Player.getInstance().getTas().addBarang(new DiplodocusMeat()); Player.getInstance().getTas().addBarang(new CowMilk()); Player.getInstance().getTas().addBarang(new ChickenEgg()); Player.getInstance().getTas().addBarang(new CowMeat()); Player.getInstance().getTas().addBarang(new DiplodocusEgg()); Player.getInstance().getTas().addBarang(new DiplodocusMeat()); Player.getInstance().getTas().addBarang(new CowMilk()); }catch(TasKepenuhan T) { } } public void setLand(Point pos, Land l) { mapLand[(int)pos.y][(int)pos.x] = l; } public void addAnimal(Point pos, Animal a) { a.setPos(pos); listAnimal.add(a); terisi[(int)pos.y][(int)pos.x] = true; } public void addFacility(Point pos, Facility f) { f.setPos(pos); listFacil.add(f); terisi[(int)pos.y][(int)pos.x] = true; } public void hapusAnimal(int i) { Animal a = listAnimal.get(i); terisi[(int)a.getPos().y][(int)a.getPos().x] = false; listAnimal.remove(i); } public void hapusAnimal(Animal a) { int i = 0; for(Animal tempA : listAnimal) { if(a.compareTo(tempA) == 0) { hapusAnimal(i); return; }else{ i++; } } } public void hapusFacility(int i) { Facility a = listFacil.get(i); terisi[(int)a.getPos().y][(int)a.getPos().x] = false; listFacil.remove(i); } public Animal getAnimal(Point p) { for(Animal tempA : listAnimal) { if(tempA.getPos().compareTo(p) == 0) { return tempA; } } return null; } public Facility getFacility(Point p) { for(Facility tempF : listFacil) { if(tempF.getPos().compareTo(p) == 0) { return tempF; } } return null; } public void addMsg(String s) { if(listMsg.size() >= 20) { listMsg.remove(0); } if(s.length() > 47) { s = s.substring(0, 47); System.out.println(s); } listMsg.add(s); UI.getInstance().updateTableMsg(listMsg); } public Land getLand(Point pos) { return mapLand[(int)pos.y][(int)pos.x]; } public void setTerisi(Point pos, boolean isi) { terisi[(int)pos.y][(int)pos.x] = isi; } public boolean isTerisi(Point pos) { return terisi[(int)pos.y][(int)pos.x]; } public boolean isValidPoint(Point pos) { return (pos.x >= 0 && pos.x < width && pos.y >= 0 && pos.y < height); } //Harus dipanggil diantara batch begin dan batch end public void renderAll(SpriteBatch batch) { double xPosReal, yPosReal, zPosReal; //Gambar map for(int y = height-1; y >= 0; y--) { for(int x = width-1; x >= 0; x--) { mapLand[y][x].setPos(new Point(x, y, 0)); mapLand[y][x].render(batch); } } //Gambar facility for(Facility f :listFacil) { f.render(batch); } //Gambar animal //Sort animal berdasar jarak Comparator<Animal> compareByJarak = new Comparator<Animal>() { @Override public int compare(Animal a1, Animal a2) { return a1.getPos().compareTo(a2.getPos()); } }; Collections.sort(listAnimal, compareByJarak); for(Animal a : listAnimal) { a.animate(batch); } //Gambar player Player.getInstance().animate(batch); //System.out.println(Player.getInstance().getPos().x +", " + Player.getInstance().getPos().y); } public void updateAll() { //Cek apakah ada yang mati ArrayList<Point> mati = new ArrayList<Point>(); for(Animal a : listAnimal) { if(a.getHungerMeter() <= -5) { mati.add(a.getPos()); a.die(true); } } for(Point p : mati) { hapusAnimal(getAnimal(p)); } //Update kelaparan & gerak semua for(Animal a : listAnimal) { a.setHungerMeter(a.getHungerMeter()-1); // System.out.println("Ayam : "+a.getPos().x+", "+a.getPos().y); a.moveRandom(); // System.out.println("AyamMove : "+a.getPos().x+", "+a.getPos().y); } //Cek apakah ada yang kelaparan & makan rumput jika ada for(Animal a : listAnimal) { if(a.getHungerMeter() <= 0) { if(getLand(a.getPos()).hasGrass()) { a.eat(); getLand(a.getPos()).setGrass(false); } } if(a.getHungerMeter() <= 0) { // System.out.println("Animal lapar"); // System.out.println(a.getHungerMeter()); a.setAnimatedHungry(true); a.setDefaultJumpInPlace(); }else if(a.getHungerMeter() > 0) { a.setAnimatedHungry(false); a.setDefaultJump(); } } } }
[ "adityaputra159@gmail.com" ]
adityaputra159@gmail.com
b156cf5d3d7dc09910cac3269b8e0fe59ded1f8a
af3cc9a51c57cfd598161c00ad7ff132ad0448fa
/src/main/java/com/findroom/dao/IUserDAO.java
83285260f00066b59ff46223747d3140541f8a50
[]
no_license
DiemCuongdevelopweb/findroom-Diem_Cuong-1
d45047f936cf99fb98c68825b2dd754ac39cbd18
1aad49c09574439c6238f300edd001ea126c7da9
refs/heads/master
2023-02-04T13:52:32.012240
2020-12-27T07:58:40
2020-12-27T07:58:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
58
java
package com.findroom.dao; public interface IUserDAO { }
[ "63099820+manhcuong197@users.noreply.github.com" ]
63099820+manhcuong197@users.noreply.github.com
0ca3847ba102d8f85385d8b0a5e858c837b818ad
51df7af9d6589b8deb64869b220f308e93a1874e
/app/src/main/java/ir/jcafe/instagramdownload/Classes/MediaList/MediaItem.java
f919b63371c5bf7f9dc156957988af8468083fe5
[]
no_license
AliJenadeleh/InstagramDownloader
9e852252a88416a162a579e62760a7eab73db5e9
282114bd2758f2504ab493ff25149bfffe1c81cf
refs/heads/master
2020-03-17T11:40:47.593817
2018-05-15T18:59:23
2018-05-15T18:59:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
191
java
package ir.jcafe.instagramdownload.Classes.MediaList; /** * Created by hp on 7/1/2017. */ public class MediaItem { public boolean isVideo; public String Src; public int Id; }
[ "alixw24@gmail.com" ]
alixw24@gmail.com
8d6d6eaf37d6711db5a207b6d37d90008fd311b4
00d8cb6d91007d7f08c48f142b7191a585893739
/huahua_parent1608/huahua_qa/src/main/java/com/huahua/qa/eureka/LabelEureka.java
566142963532b744cdc21f8897fffc8658d3620f
[]
no_license
shenqiang0530/huahua
5ef070581ab17eacf50fa98c962cfb8b5c06492d
af50b3319fc46baac085da99b9bacf8db8343cbd
refs/heads/master
2020-05-20T23:22:48.935356
2019-05-09T13:24:01
2019-05-09T13:24:01
185,798,855
0
0
null
null
null
null
UTF-8
Java
false
false
510
java
package com.huahua.qa.eureka; import huahua.common.Result; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @FeignClient("huahua-base") public interface LabelEureka { @RequestMapping(method = RequestMethod.GET,value = "/label/{labelId}") public Result queryById(@PathVariable("labelId") String labelId); }
[ "884437323@qq.com" ]
884437323@qq.com
934487e324682fd20cd66eda16e1ae2c85dda245
0ee2a192f7c576d5df0cddb746db4ebfff65e8e6
/src/main/java/SeleniumDemo.java
4abeb7b8fe5aac5e751e66467158b6f094ab6f91
[]
no_license
rambo90/AutomationTest2
5fb40889409096fad02834412bb115efe096ea8a
238f8c498d3b6ac03e7cbca05f1de9fdacd9a25b
refs/heads/master
2021-01-19T18:23:46.798630
2017-04-15T16:01:02
2017-04-15T16:01:02
88,357,323
0
0
null
null
null
null
UTF-8
Java
false
false
1,651
java
import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.List; import static java.lang.Thread.sleep; public class SeleniumDemo { public static void main(String[] args) throws Exception { String property = System.getProperty("user.dir") + "/driver/chromedriver.exe"; System.setProperty("webdriver.chrome.driver", property); WebDriver driver = new ChromeDriver(); driver.manage().window().maximize(); driver.get("http://prestashop-automation.qatestlab.com.ua/admin147ajyvk0/"); WebElement element = driver.findElement(By.name("email")); element.sendKeys("webinar.test@gmail.com"); element = driver.findElement(By.name("passwd")); element.sendKeys("Xcg7299bnSmMuRLp9ITw"); element.submit(); sleep(1000); List<WebElement> elements = driver.findElements(By.className("maintab")); for (int i = 0; i < elements.size(); i++) { elements = driver.findElements(By.className("maintab")); if (elements.size() == 0) { elements = driver.findElements(By.className("link-levelone")); } elements.get(i).click(); String before = driver.getTitle(); System.out.println(before); sleep(1000); driver.navigate().refresh(); String after = driver.getTitle(); if (!after.equals(before)) { System.out.println("Другая страница"); } sleep(1000); } } }
[ "rambo1946@gmail.com" ]
rambo1946@gmail.com
0289b310d34662cdc6350190e22daffbdf2eeeae
5598faaaaa6b3d1d8502cbdaca903f9037d99600
/code_changes/Apache_projects/HDFS-35/5d110e145e4978eedc4e8fd13b9a3f6b52eb7972/~TestFileCorruption.java
3b5797550a41fd7e063d23db25f2703ba636ffe2
[]
no_license
SPEAR-SE/LogInBugReportsEmpirical_Data
94d1178346b4624ebe90cf515702fac86f8e2672
ab9603c66899b48b0b86bdf63ae7f7a604212b29
refs/heads/master
2022-12-18T02:07:18.084659
2020-09-09T16:49:34
2020-09-09T16:49:34
286,338,252
0
2
null
null
null
null
UTF-8
Java
false
false
8,063
java
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.hdfs; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileOutputStream; import java.util.ArrayList; import junit.framework.TestCase; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.impl.Log4JLogger; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.ChecksumException; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.protocol.DatanodeInfo; import org.apache.hadoop.hdfs.protocol.ExtendedBlock; import org.apache.hadoop.hdfs.server.common.GenerationStamp; import org.apache.hadoop.hdfs.server.datanode.DataNode; import org.apache.hadoop.hdfs.server.datanode.DataNodeTestUtils; import org.apache.hadoop.hdfs.server.namenode.FSNamesystem; import org.apache.hadoop.hdfs.server.namenode.NameNode; import org.apache.hadoop.hdfs.server.protocol.DatanodeRegistration; import org.apache.log4j.Level; /** * A JUnit test for corrupted file handling. */ public class TestFileCorruption extends TestCase { { ((Log4JLogger)NameNode.stateChangeLog).getLogger().setLevel(Level.ALL); ((Log4JLogger)LogFactory.getLog(FSNamesystem.class)).getLogger().setLevel(Level.ALL); ((Log4JLogger)DFSClient.LOG).getLogger().setLevel(Level.ALL); ((Log4JLogger)DataNode.LOG).getLogger().setLevel(Level.ALL); } static Log LOG = ((Log4JLogger)NameNode.stateChangeLog); /** check if DFS can handle corrupted blocks properly */ public void testFileCorruption() throws Exception { MiniDFSCluster cluster = null; DFSTestUtil util = new DFSTestUtil.Builder().setName("TestFileCorruption"). setNumFiles(20).build(); try { Configuration conf = new HdfsConfiguration(); cluster = new MiniDFSCluster.Builder(conf).numDataNodes(3).build(); FileSystem fs = cluster.getFileSystem(); util.createFiles(fs, "/srcdat"); // Now deliberately remove the blocks File storageDir = cluster.getInstanceStorageDir(2, 0); String bpid = cluster.getNamesystem().getBlockPoolId(); File data_dir = MiniDFSCluster.getFinalizedDir(storageDir, bpid); assertTrue("data directory does not exist", data_dir.exists()); File[] blocks = data_dir.listFiles(); assertTrue("Blocks do not exist in data-dir", (blocks != null) && (blocks.length > 0)); for (int idx = 0; idx < blocks.length; idx++) { if (!blocks[idx].getName().startsWith("blk_")) { continue; } System.out.println("Deliberately removing file "+blocks[idx].getName()); assertTrue("Cannot remove file.", blocks[idx].delete()); } assertTrue("Corrupted replicas not handled properly.", util.checkFiles(fs, "/srcdat")); util.cleanup(fs, "/srcdat"); } finally { if (cluster != null) { cluster.shutdown(); } } } /** check if local FS can handle corrupted blocks properly */ public void testLocalFileCorruption() throws Exception { Configuration conf = new HdfsConfiguration(); Path file = new Path(System.getProperty("test.build.data"), "corruptFile"); FileSystem fs = FileSystem.getLocal(conf); DataOutputStream dos = fs.create(file); dos.writeBytes("original bytes"); dos.close(); // Now deliberately corrupt the file dos = new DataOutputStream(new FileOutputStream(file.toString())); dos.writeBytes("corruption"); dos.close(); // Now attempt to read the file DataInputStream dis = fs.open(file, 512); try { System.out.println("A ChecksumException is expected to be logged."); dis.readByte(); } catch (ChecksumException ignore) { //expect this exception but let any NPE get thrown } fs.delete(file, true); } /** Test the case that a replica is reported corrupt while it is not * in blocksMap. Make sure that ArrayIndexOutOfBounds does not thrown. * See Hadoop-4351. */ public void testArrayOutOfBoundsException() throws Exception { MiniDFSCluster cluster = null; try { Configuration conf = new HdfsConfiguration(); cluster = new MiniDFSCluster.Builder(conf).numDataNodes(2).build(); cluster.waitActive(); FileSystem fs = cluster.getFileSystem(); final Path FILE_PATH = new Path("/tmp.txt"); final long FILE_LEN = 1L; DFSTestUtil.createFile(fs, FILE_PATH, FILE_LEN, (short)2, 1L); // get the block final String bpid = cluster.getNamesystem().getBlockPoolId(); File storageDir = cluster.getInstanceStorageDir(0, 0); File dataDir = MiniDFSCluster.getFinalizedDir(storageDir, bpid); ExtendedBlock blk = getBlock(bpid, dataDir); if (blk == null) { storageDir = cluster.getInstanceStorageDir(0, 1); dataDir = MiniDFSCluster.getFinalizedDir(storageDir, bpid); blk = getBlock(bpid, dataDir); } assertFalse(blk==null); // start a third datanode cluster.startDataNodes(conf, 1, true, null, null); ArrayList<DataNode> datanodes = cluster.getDataNodes(); assertEquals(datanodes.size(), 3); DataNode dataNode = datanodes.get(2); // report corrupted block by the third datanode DatanodeRegistration dnR = DataNodeTestUtils.getDNRegistrationForBP(dataNode, blk.getBlockPoolId()); FSNamesystem ns = cluster.getNamesystem(); ns.writeLock(); try { cluster.getNamesystem().getBlockManager().findAndMarkBlockAsCorrupt( blk, new DatanodeInfo(dnR), "TEST"); } finally { ns.writeUnlock(); } // open the file fs.open(FILE_PATH); //clean up fs.delete(FILE_PATH, false); } finally { if (cluster != null) { cluster.shutdown(); } } } private ExtendedBlock getBlock(String bpid, File dataDir) { assertTrue("data directory does not exist", dataDir.exists()); File[] blocks = dataDir.listFiles(); assertTrue("Blocks do not exist in dataDir", (blocks != null) && (blocks.length > 0)); int idx = 0; String blockFileName = null; for (; idx < blocks.length; idx++) { blockFileName = blocks[idx].getName(); if (blockFileName.startsWith("blk_") && !blockFileName.endsWith(".meta")) { break; } } if (blockFileName == null) { return null; } long blockId = Long.parseLong(blockFileName.substring("blk_".length())); long blockTimeStamp = GenerationStamp.GRANDFATHER_GENERATION_STAMP; for (idx=0; idx < blocks.length; idx++) { String fileName = blocks[idx].getName(); if (fileName.startsWith(blockFileName) && fileName.endsWith(".meta")) { int startIndex = blockFileName.length()+1; int endIndex = fileName.length() - ".meta".length(); blockTimeStamp = Long.parseLong(fileName.substring(startIndex, endIndex)); break; } } return new ExtendedBlock(bpid, blockId, blocks[idx].length(), blockTimeStamp); } }
[ "archen94@gmail.com" ]
archen94@gmail.com
9ffc64672c9ffab31b483d7608b1270931c9c98f
a8a0b4f4b31aa8d301bd88a3e4efd527bd929bdd
/Step Spring Boot/L'ArtDeLire/src/main/java/com/example/Gestion/des/taches/project/controller/TaskController.java
0be97f7f699126e9ff59df38377e1220da797a60
[]
no_license
hamouda-bh/BookStore
cba3c40162f343d57328de339e868f72c910f9d1
a8042379a27c82a2e3a396b18b544e7512264da4
refs/heads/master
2023-02-26T22:28:04.602227
2020-12-29T23:01:33
2020-12-29T23:01:33
315,936,212
1
1
null
null
null
null
UTF-8
Java
false
false
1,970
java
package com.example.Gestion.des.taches.project.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.Mapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import java.util.ArrayList; import java.util.Date; import java.util.List; import com.example.Gestion.des.taches.project.model.Task; import com.example.Gestion.des.taches.project.service.StateService; import com.example.Gestion.des.taches.project.service.TaskService; @Controller public class TaskController { @Autowired private TaskService taskService ; @Autowired private StateService stateService; @GetMapping("list-tasks") public String listTasks(Model model) { model.addAttribute("tasks", taskService.findAll()); return "views/list-tasks"; } @GetMapping("add-tasks") public String addTasks(Model model) { model.addAttribute("task", new Task()); model.addAttribute("states", stateService.findAll()); return "views/add-tasks"; } @PostMapping("add-tasks") public String addTasks(Model model , Task task) { taskService.save(task); return "redirect:/add-tasks"; } @GetMapping("delete-task") public String deleteTask(@RequestParam("idTask") Long id) { taskService.delete(id); return "redirect:/list-tasks"; } @GetMapping("detail-tasks") public String detailTasks(@RequestParam("idTask") Long id, Model model) { model.addAttribute("taskDB", taskService.findOne(id).get()); return "views/detail-tasks"; } @GetMapping("edit-task") public String editTask(@RequestParam("idTask") Long id, Model model, Task task) { model.addAttribute("task", taskService.findOne(id).get()); model.addAttribute("states", stateService.findAll()); return "views/add-tasks"; } }
[ "benhamouda.mohamed@esprit.tn" ]
benhamouda.mohamed@esprit.tn
3387d3c1f6bc61654c24276b6675e9ef1e2feb3a
86f4b5154b4de30e3d080b9faacb6b45049f9fd6
/src/main/java/com/guru/controller/ManageInvoiceController.java
497fe10b1554fcfb93a1573e5e8a95b7499ffc2c
[]
no_license
longlch/cdio4
9469977683be3ad1abbaab126de5d5df0ae97053
4f8b0d722e16e002b22771301761463810419628
refs/heads/master
2021-06-13T11:05:55.736069
2016-12-02T14:01:33
2016-12-02T14:01:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,612
java
package com.guru.controller; import java.util.Locale; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import com.guru.entities.InvoiceEntity; import com.guru.service.InvoiceDetailEntityManager; import com.guru.service.InvoiceEntityManager; @Controller @RequestMapping(value = "/admin") public class ManageInvoiceController { private static final Logger logger = LoggerFactory.getLogger(ManageInvoiceController.class); @Autowired InvoiceEntityManager invoiceEntityManager; @Autowired InvoiceDetailEntityManager invoiceDetailEntityManager; @RequestMapping(value = "/invoice", method = RequestMethod.GET) public String invoice(Locale locale, ModelMap model) { logger.info("Welcome home! The client locale is {}.", locale); model.addAttribute("invoiceEntities",invoiceEntityManager.getAll()); return "manageInvoicePage"; } @RequestMapping(value = "/invoice/delete", method = RequestMethod.GET) public String deleteInvoice(@RequestParam("id") String id, Locale locale, ModelMap model) { logger.info("Welcome home! The client locale is {}.", locale); InvoiceEntity invoiceEntity = invoiceEntityManager.findById(id); invoiceEntityManager.deleteInvoice(invoiceEntity); return "redirect:invoice"; } }
[ "toannxm.itedu@gmail.com" ]
toannxm.itedu@gmail.com
0424b85979202b3bc9b30974025b6218b46bb51d
74243a4da63069491bd7022d18dd723b8eb56504
/codeLibrary/src/test/java/JsoupTraversalLinks.java
bc675acb5c4da9061ab007cafe60d610ab5d7785
[]
no_license
leeshare/MyJavaLib
388fe891c40c5ad3363c29a28edd9e77b928bc16
1505c4f1725763162a4b9ea3e5f39894cd7b6c41
refs/heads/master
2022-11-30T22:30:42.762996
2021-08-01T10:48:54
2021-08-01T10:48:54
82,890,193
0
0
null
2022-11-16T01:37:05
2017-02-23T05:57:59
Java
UTF-8
Java
false
false
5,583
java
import com.sun.org.apache.xpath.internal.operations.Bool; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.util.LinkedHashMap; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Created by Administrator on 3/6/2018. * * 未完成,没使用 Jsoup 2018-03-07 */ public class JsoupTraversalLinks { public static void main(String[] args) { JsoupTraversalLinks webCrawlerDemo = new JsoupTraversalLinks(); webCrawlerDemo.myPrint("http://www.zifangsky.cn"); } public void myPrint(String baseUrl) { Map<String, Boolean> oldMap = new LinkedHashMap<String, Boolean>(); // 存储链接-是否被遍历 // 键值对 String oldLinkHost = ""; //host Pattern p = Pattern.compile("(https?://)?[^/\\s]*"); //比如:http://www.zifangsky.cn Matcher m = p.matcher(baseUrl); if (m.find()) { oldLinkHost = m.group(); } oldMap.put(baseUrl, false); oldMap = crawlLinks(oldLinkHost, oldMap); for (Map.Entry<String, Boolean> mapping : oldMap.entrySet()) { System.out.println("链接:" + mapping.getKey()); } } /** * 抓取一个网站所有可以抓取的网页链接,在思路上使用了广度优先算法 * 对未遍历过的新链接不断发起GET请求,一直到遍历完整个集合都没能发现新的链接 * 则表示不能发现新的链接了,任务结束 * * @param oldLinkHost 域名,如:http://www.zifangsky.cn * @param oldMap 待遍历的链接集合 * * @return 返回所有抓取到的链接集合 * */ private Map<String, Boolean> crawlLinks(String oldLinkHost, Map<String, Boolean> oldMap) { Map<String, Boolean> newMap = new LinkedHashMap<String, Boolean>(); String oldLink = ""; for (Map.Entry<String, Boolean> mapping : oldMap.entrySet()) { System.out.println("link:" + mapping.getKey() + "--------check:" + mapping.getValue()); // 如果没有被遍历过 if (!mapping.getValue()) { oldLink = mapping.getKey(); // 发起GET请求 try { URL url = new URL(oldLink); HttpURLConnection connection = (HttpURLConnection) url .openConnection(); connection.setRequestMethod("GET"); connection.setConnectTimeout(2000); connection.setReadTimeout(2000); if (connection.getResponseCode() == 200) { InputStream inputStream = connection.getInputStream(); BufferedReader reader = new BufferedReader( new InputStreamReader(inputStream, "UTF-8")); String line = ""; Pattern pattern = Pattern .compile("<a.*?href=[\"']?((https?://)?/?[^\"']+)[\"']?.*?>(.+)</a>"); Matcher matcher = null; while ((line = reader.readLine()) != null) { matcher = pattern.matcher(line); if (matcher.find()) { String newLink = matcher.group(1).trim(); // 链接 // String title = matcher.group(3).trim(); //标题 // 判断获取到的链接是否以http开头 if (!newLink.startsWith("http")) { if (newLink.startsWith("/")) newLink = oldLinkHost + newLink; else newLink = oldLinkHost + "/" + newLink; } //去除链接末尾的 / if(newLink.endsWith("/")) newLink = newLink.substring(0, newLink.length() - 1); //去重,并且丢弃其他网站的链接 if (!oldMap.containsKey(newLink) && !newMap.containsKey(newLink) && newLink.startsWith(oldLinkHost)) { // System.out.println("temp2: " + newLink); newMap.put(newLink, false); } } } } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } oldMap.replace(oldLink, false, true); } } //有新链接,继续遍历 if (!newMap.isEmpty()) { oldMap.putAll(newMap); oldMap.putAll(crawlLinks(oldLinkHost, oldMap)); //由于Map的特性,不会导致出现重复的键值对 } return oldMap; } }
[ "lixuliang@shenmo.com" ]
lixuliang@shenmo.com
d78eadd17ac21f1f14d8dcb6d1294fb649b1eaac
b9d49602619ddca2c8662150bfd92bb768e25b0b
/nio/com/damonzh/nio/asyn/multithread/OperationClient.java
a43bae447bb4e317aceaaa72f124689f76380c46
[]
no_license
aries-demos/ServerDemo
37b4593eae91d3c352c946f32fe9646644a60219
a1b8af6d93646938fff88329998f78b487633f4d
refs/heads/master
2021-01-11T02:10:41.918854
2016-10-13T10:35:41
2016-10-13T10:35:41
70,795,877
0
0
null
null
null
null
UTF-8
Java
false
false
1,467
java
package com.damonzh.nio.asyn.multithread; import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.nio.channels.SocketChannel; import java.nio.charset.Charset; import java.nio.charset.CharsetDecoder; public class OperationClient { // Charset and decoder for US-ASCII private static Charset charset = Charset.forName("US-ASCII"); // Direct byte buffer for reading private static ByteBuffer dbuf = ByteBuffer.allocateDirect(1024); // Ask the given host what time it is // private static void query(String host, int port) throws IOException { byte inBuffer[] = new byte[100]; InetSocketAddress isa = new InetSocketAddress(InetAddress.getByName(host), port); SocketChannel sc = null; while (true) { try { System.in.read(inBuffer); sc = SocketChannel.open(); sc.connect(isa); dbuf.clear(); dbuf.put(inBuffer); dbuf.flip(); sc.write(dbuf); dbuf.clear(); } finally { // Make sure we close the channel (and hence the socket) if (sc != null) sc.close(); } } } public static void main(String[] args) throws IOException { query("localhost", 8090);//A+B // query("localhost", 9090);//A*B } }
[ "damonzh@126.com" ]
damonzh@126.com
4cccc0c799a7a341b21b9d6edce23547b213387a
f22b52cbf6056462ce2dbc1dcd54b1d0d33a545f
/src/test/java/lection4/OpenMenuItemsTest.java
a2b80d5089477f9585ab4612ada66e85334c4d2c
[]
no_license
aprystavko/software-testing.ru_lection2_1
e31bf7ed14d6f70eea75f5a71849b5321b5b87a6
ec99c76862b754171e78ff82a75e7ef58ff5a526
refs/heads/master
2023-02-07T20:02:22.445395
2021-01-01T13:30:18
2021-01-01T13:30:18
313,281,990
0
0
null
null
null
null
UTF-8
Java
false
false
6,480
java
package lection4; import lection2.BaseTest; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.NoSuchElementException; import static org.junit.Assert.assertTrue; public class OpenMenuItemsTest extends BaseTest { // Before start test fill data into login and password fields String login = ""; String password = ""; // Urls: String adminUrl = "https://litecart.stqa.ru/admin/login.php"; String baseUrl = "https://litecart.stqa.ru/admin/"; String appearanceUrl = "?app=appearance&doc=template"; String catalogUrl = "?app=catalog&doc=catalog"; String countriesUrl = "?app=countries&doc=countries"; String currenciesUrl = "?app=currencies&doc=currencies"; String customersUrl = "?app=customers&doc=customers"; String geoZoneUrl = "?app=geo_zones&doc=geo_zones"; String languagesUrl = "?app=languages&doc=languages"; String modulesUrl = "?app=modules&doc=jobs"; String ordersUrl = "?app=orders&doc=orders"; String pagesUrl = "?app=pages&doc=pages"; String reportsUrl = "?app=reports&doc=monthly_sales"; String settingsUrl = "?app=settings&doc=store_info"; String slidesUrl = "?app=slides&doc=slides"; String taxUrl = "?app=tax&doc=tax_classes"; String translationsUrl = "?app=translations&doc=search"; String usersUrl = "?app=users&doc=users"; String vqmodsUrl = "?app=vqmods&doc=vqmods"; private void authenticate() { driver.findElement(By.xpath("//input[@name=\"username\"]")).sendKeys(login); driver.findElement(By.xpath("//input[@name=\"password\"]")).sendKeys(password); driver.findElement(By.xpath("//button[@name=\"login\"]")).sendKeys(Keys.ENTER); } public boolean isElementPresent(By locator) { try { driver.findElement(locator); return true; } catch (NoSuchElementException ex) { return false; } } private void openUrl(String url) { driver.navigate().to(url); } private void openUrlAndCheckHeader(String url) { driver.navigate().to(url); assertTrue(isElementPresent(By.xpath("//h1"))); } private void openAppearenceMenuItem() { openUrlAndCheckHeader(baseUrl + appearanceUrl); } private void openCatalogMenuItem() { openUrlAndCheckHeader(baseUrl + catalogUrl); } private void openCountriesMenuItem() { openUrlAndCheckHeader(baseUrl + countriesUrl); } private void openCurrenciesMenuItem() { openUrlAndCheckHeader(baseUrl + currenciesUrl); } private void openCustomersMenuItem() { openUrlAndCheckHeader(baseUrl + customersUrl); } private void openGeoZoneMenuItem() { openUrlAndCheckHeader(baseUrl + geoZoneUrl); } private void openLanguagesMenuItem() { openUrlAndCheckHeader(baseUrl + languagesUrl); } private void openModulesMenuItem() { openUrlAndCheckHeader(baseUrl + modulesUrl); } private void openOrdersMenuItem() { openUrlAndCheckHeader(baseUrl + ordersUrl); } private void openPagesUrlMenuItem() { openUrlAndCheckHeader(baseUrl + pagesUrl); } private void openReportsMenuItem() { openUrlAndCheckHeader(baseUrl + reportsUrl); } private void openSettingsMenuItem() { openUrlAndCheckHeader(baseUrl + settingsUrl); } private void openSlidesMenuItem() { openUrlAndCheckHeader(baseUrl + slidesUrl); } private void openTaxMenuItem() { openUrlAndCheckHeader(baseUrl + taxUrl); } private void openTranslationsMenuItem() { openUrlAndCheckHeader(baseUrl + translationsUrl); } private void openUsersMenuItem() { openUrlAndCheckHeader(baseUrl + usersUrl); } private void openVqmodsUrlMenuItem() { openUrlAndCheckHeader(baseUrl + vqmodsUrl); } private void openSubMenuItem(String menuName) { driver.findElement(By.xpath("//span[contains(text(),'" + menuName + "')]")).click(); } @Test public void LoginTest() { openUrl(adminUrl); authenticate(); openAppearenceMenuItem(); openSubMenuItem("Template"); openSubMenuItem("Logotype"); openCatalogMenuItem(); openSubMenuItem("Catalog"); openSubMenuItem("Product Groups"); openSubMenuItem("Option Groups"); openSubMenuItem("Manufacturers"); openSubMenuItem("Suppliers"); openSubMenuItem("Delivery Statuses"); openSubMenuItem("Sold Out Statuses"); openSubMenuItem("Quantity Units"); openSubMenuItem("CSV Import/Export"); openCountriesMenuItem(); openCurrenciesMenuItem(); openCustomersMenuItem(); openSubMenuItem("Customers"); openSubMenuItem("CSV Import/Export"); openSubMenuItem("Newsletter"); openGeoZoneMenuItem(); openLanguagesMenuItem(); openSubMenuItem("Languages"); openSubMenuItem("Storage Encoding"); openModulesMenuItem(); openSubMenuItem("Background Jobs"); driver.navigate().to("https://litecart.stqa.ru/admin/?app=modules&doc=customer"); openSubMenuItem("Shipping"); openSubMenuItem("Payment"); openSubMenuItem("Order Total"); openSubMenuItem("Order Success"); openSubMenuItem("Order Action"); openOrdersMenuItem(); openSubMenuItem("Orders"); openSubMenuItem("Order Statuses"); openPagesUrlMenuItem(); openReportsMenuItem(); openSubMenuItem("Monthly Sales"); openSubMenuItem("Most Sold Products"); openSubMenuItem("Most Shopping Customers"); openSettingsMenuItem(); openSubMenuItem("Store Info"); openSubMenuItem("Defaults"); openSubMenuItem("General"); openSubMenuItem("Listings"); openSubMenuItem("Images"); openSubMenuItem("Checkout"); openSubMenuItem("Advanced"); openSubMenuItem("Security"); openSlidesMenuItem(); openTaxMenuItem(); openSubMenuItem("Tax Classes"); openSubMenuItem("Tax Rates"); openTranslationsMenuItem(); openSubMenuItem("Search Translations"); openSubMenuItem("Scan Files"); openSubMenuItem("CSV Import/Export"); openUsersMenuItem(); openVqmodsUrlMenuItem(); openSubMenuItem("vQmods"); } }
[ "a.prystavko@wnb.com.ua" ]
a.prystavko@wnb.com.ua
071663f390a9f530b5ddc45efc12ef60c54c1393
a8b94b43944a13b3357ff0178a072d8cf3893786
/src/main/java/com/example/myapp/services/CourseServices.java
a33ae46780ecc3c62524bbdf11f956d991976c8c
[]
no_license
Parmeetsinghsaluja/Course_Manager_Application_SpringBoot
1caca9167341d9e0d733f144169eb027f96ca45a
8b2b1c4804f34e713d6833b93f5bbfbc54c731bf
refs/heads/master
2020-03-16T13:26:39.273816
2018-06-04T23:53:19
2018-06-04T23:53:19
132,690,542
0
0
null
null
null
null
UTF-8
Java
false
false
2,045
java
package com.example.myapp.services; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import com.example.myapp.models.Course; import com.example.myapp.repositories.CourseRepository; @RestController @CrossOrigin(origins = "*", maxAge = 3600) public class CourseServices { @Autowired CourseRepository courseRepository; @GetMapping("/api/course") public Iterable<Course> findAllCourses() { return courseRepository.findAll(); } @GetMapping("/api/course{courseId}") public Course findCourseById(@PathVariable("courseId") int id) { Optional<Course> data = courseRepository.findById(id); if(data.isPresent()) { return data.get(); } else { return null; } } @PostMapping("/api/course") public Course createCourse(@RequestBody Course course) { return courseRepository.save(course); } @PutMapping("/api/course/{courseId}") @ResponseBody public Course updateCourse(@PathVariable("courseId") int courseId, @RequestBody Course newCourse) { Optional<Course> data = courseRepository.findById(courseId); if(data.isPresent()) { Course course = data.get(); course.setTitle(newCourse.getTitle()); course.setCreated(newCourse.getCreated()); course.setModified(newCourse.getModified()); courseRepository.save(course); return course; } else { return null; } } @DeleteMapping("/api/course/{courseId}") public void deleteCourse(@PathVariable("courseId") int id) { courseRepository.deleteById(id); } }
[ "saluja.parmeetsingh@gmail.com" ]
saluja.parmeetsingh@gmail.com
a9aa53b3351cc8c407dbae771d26b3fb18f4e97e
b8860bf75eb7c7570e44db1a5bb999dc4c9ccf76
/src/main/java/com/pku/smart/modules/sys/service/ISysNoticeService.java
735d97b5b77d0d3bc0f94f77ce95766dd5dc2422
[ "Apache-2.0" ]
permissive
lrlfriend1975/smart-pay-plus
b7adec45c16deb2d57cfd06b09ed54b8691de128
c5ad6874530d1c58ca6d422464a3254bf489fcab
refs/heads/master
2022-04-23T10:01:37.105541
2020-04-05T12:46:13
2020-04-05T12:46:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,134
java
package com.pku.smart.modules.sys.service; import com.pku.smart.modules.sys.entity.SysNotice; import java.util.List; public interface ISysNoticeService { /** * 查询公告信息 * * @param noticeId 公告ID * @return 公告信息 */ SysNotice selectNoticeById(Long noticeId); /** * 查询公告列表 * * @param notice 公告信息 * @return 公告集合 */ List<SysNotice> selectNoticeList(SysNotice notice); /** * 新增公告 * * @param notice 公告信息 * @return 结果 */ int insertNotice(SysNotice notice); /** * 修改公告 * * @param notice 公告信息 * @return 结果 */ int updateNotice(SysNotice notice); /** * 删除公告信息 * * @param noticeId 公告ID * @return 结果 */ int deleteNoticeById(Long noticeId); /** * 批量删除公告信息 * * @param noticeIds 需要删除的公告ID * @return 结果 */ int deleteNoticeByIds(Long[] noticeIds); }
[ "zhunian2003@163.com" ]
zhunian2003@163.com
209d75d75fad968d1e742c722b28cc84ea5a314e
111dbf73f1ab0f5134e1c6b18d3d22564f462b82
/app/src/main/java/aca/com/magicasakura/widgets/Tintable.java
d2b12c1ee37c35f11e0eb3c08a68ebb22861ed7d
[]
no_license
xiaozhentoudemajia/android_remote
5a7e8affc33c82f04929f076b63a270484ddd79f
0d334a19a3204e3f4fd39538736596125eaa62c3
refs/heads/master
2018-12-20T22:34:08.682398
2018-09-18T05:54:43
2018-09-18T05:54:43
108,094,537
0
1
null
null
null
null
UTF-8
Java
false
false
756
java
/* * Copyright (C) 2016 Bilibili * * 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 aca.com.magicasakura.widgets; /** * Created by xyczero on 15/9/6. * Email : xyczero@sina.com */ public interface Tintable { void tint(); }
[ "kavana83" ]
kavana83
94d51145f26c181ece6c9183f5bb97c62be1a29c
26cae0b25b7c023daffdd90df228ec2a9d7cd17a
/ch03/recipe_3_2/src/test/java/com/apress/springbootrecipes/library/rest/BookControllerTest.java
9b845fbf87d06572becd4bb51252d69a8e904e3a
[]
no_license
mdeinum/spring-boot-recipes-code
d648bb78b62cd05d39e98cdd7262e1edb8b6744b
e043d8ea0bc40dba0815e5a2b23f73be30ee88f7
refs/heads/master
2020-03-21T17:33:22.537246
2018-06-27T06:37:46
2018-06-27T06:37:46
138,838,920
0
2
null
null
null
null
UTF-8
Java
false
false
2,426
java
package com.apress.springbootrecipes.library.rest; import com.apress.springbootrecipes.library.Book; import com.apress.springbootrecipes.library.BookService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import java.util.Arrays; import java.util.Optional; import static org.hamcrest.Matchers.*; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringRunner.class) @WebMvcTest(BookController.class) public class BookControllerTest { @Autowired private MockMvc mockMvc; @MockBean private BookService bookService; @Test public void shouldReturnListOfBooks() throws Exception { when(bookService.findAll()).thenReturn(Arrays.asList( new Book("123", "Spring 5 Recipes", "Marten Deinum", "Josh Long"), new Book("321", "Pro Spring MVC", "Marten Deinum", "Colin Yates"))); mockMvc.perform(get("/books")) .andExpect(status().isOk()) .andExpect(MockMvcResultMatchers.jsonPath("$", hasSize(2))) .andExpect(MockMvcResultMatchers.jsonPath("$[*].isbn", containsInAnyOrder("123", "321"))) .andExpect(MockMvcResultMatchers.jsonPath("$[*].title", containsInAnyOrder("Spring 5 Recipes", "Pro Spring MVC"))); } @Test public void shouldReturn404WhenBookNotFound() throws Exception { when(bookService.find(anyString())).thenReturn(Optional.empty()); mockMvc.perform(get("/books/123")) .andExpect(status().isNotFound()); } @Test public void shouldReturnBookWhenFound() throws Exception { when(bookService.find(anyString())).thenReturn( Optional.of(new Book("123", "Spring 5 Recipes", "Marten Deinum", "Josh Long"))); mockMvc.perform(get("/books/123")) .andExpect(status().isOk()) .andExpect(MockMvcResultMatchers.jsonPath("$.isbn", equalTo("123"))) .andExpect(MockMvcResultMatchers.jsonPath("$.title", equalTo("Spring 5 Recipes"))); } }
[ "mdeinum@gmail.com" ]
mdeinum@gmail.com
785f69700aecde4074bbfb506a8a6ffeeed46f67
4946979c14217ddb38272a97951b0a3ea44553c5
/app/src/main/java/com/example/user/onlinekhabar3/AboutUs.java
3fa14cc1ac9857dda5c417c9c183cf1470ccd3f5
[]
no_license
sushmagiri/Onlinekhabar
c8e31c676c97493adfa159a9cb571ee117d2611a
edf7d6b8be9c7347129666e0025ae2695d457da6
refs/heads/master
2021-01-11T23:02:24.964439
2017-01-10T13:56:38
2017-01-10T13:56:38
78,538,171
0
0
null
null
null
null
UTF-8
Java
false
false
3,571
java
package com.example.user.onlinekhabar3; import android.app.ProgressDialog; import android.content.Context; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.ListView; import android.widget.Toast; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; /** * Created by user on 7/4/2016. */ public class AboutUs extends AppCompatActivity { ListView lv; Context context; String url = "http://192.168.1.5/onlinekhabar/test.php"; ArrayList<Entity> entityArrayList; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about_us); lv=(ListView)findViewById(R.id.listView); new Homesync().execute(url); } private class Homesync extends AsyncTask<String, String, String> { JSONArray jsonArray; ProgressDialog progressDialog; String jsonString; protected void onPreExecute() { super.onPreExecute(); progressDialog = new ProgressDialog(AboutUs.this); progressDialog.setMessage("Loading........."); progressDialog.show(); } @Override protected String doInBackground(String... params) { System.out.println(params[0]); DownloadUtil downloadUtil = new DownloadUtil(params[0], getApplicationContext()); jsonString = downloadUtil.downloadStringContent(); return jsonString; } protected void onPostExecute(String responseString) { super.onPostExecute(responseString); if (responseString.equalsIgnoreCase(DownloadUtil.NotOnline)) { progressDialog.dismiss(); Toast.makeText(getApplicationContext(), "No internet connection!", Toast.LENGTH_LONG).show(); } else { entityArrayList = new ArrayList<Entity>(); try { entityArrayList = new ArrayList<Entity>(); jsonArray = new JSONArray(responseString); for (int i = 0; i < jsonArray.length(); i++) { // Entity entity = new Entity(); JSONObject jsonObject = jsonArray.getJSONObject(i); entityArrayList.add(new Entity(jsonObject.getInt("event_id"),jsonObject.getString("name"), jsonObject.getString("image"),jsonObject.getString("date"),jsonObject.getString("comment"),jsonObject.getInt("category_id"),jsonObject.getString("event_title"))); /*String Id = jsonObject.getString("event_id"); String Name = jsonObject.getString("name"); String Image = jsonObject.getString("image"); String Date = jsonObject.getString("date"); String Comment = jsonObject.getString("comment"); entity.setId(Id); entity.setName(Name); entity.setDate(Date); entity.setImage(Image); entity.setComment(Comment); entityArrayList.add(entity);*/ } lv.setAdapter(new CustomAdapter(getApplicationContext(), entityArrayList)); } catch (JSONException e) { e.printStackTrace(); } } } } }
[ "suh.giri123@gmailcom" ]
suh.giri123@gmailcom
8614f1437bf5a85f445c942b44145390a4cc7855
4ed1795d0d90fca6911791c8dbbd3bf6a3ebe2e6
/com.lunifera.geo.store.api/src/com/lunifera/geo/store/api/query/OrFilter.java
55ade8a74b9bf7b1efcd5d2b2ef52b861e8d1228
[ "Apache-2.0" ]
permissive
lunifera/com.lunifera.geo
401ef8b77d0f7bda7eeb399d4b7d956cad6a135d
a1cd35da7b98496b0c7a9efc51c74069bec21cdd
refs/heads/master
2020-04-09T23:54:51.113764
2016-06-17T13:28:53
2016-06-17T13:28:53
60,843,894
0
0
null
null
null
null
UTF-8
Java
false
false
477
java
package com.lunifera.geo.store.api.query; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; public class OrFilter implements Filter { List<Filter> filters = new ArrayList<>(); public OrFilter(Filter... filters) { this.filters.addAll(Arrays.asList(filters)); } public void add(Filter filter) { filters.add(filter); } public List<Filter> getFilters() { return Collections.unmodifiableList(filters); } }
[ "florian.pirchner@gmail.com" ]
florian.pirchner@gmail.com
bdd19e323ff5e7fd3ea3ad56cb84e435834ac8de
3a56346d529844691278baaf5288005d80c2404a
/Module01/src/com/chapter1/TestDaemon.java
8f8b73dd2685e24274e484fdc1a9b7f38722b8ee
[]
no_license
lxy-git-code/Project-Module4
7394200666e6a45607417c864008ac1d0ca3d3c1
e923f49aca465b4f5a725864929f44c05c756c5c
refs/heads/master
2022-09-24T20:52:11.060461
2020-05-31T10:56:13
2020-05-31T10:56:13
268,243,444
0
0
null
null
null
null
UTF-8
Java
false
false
760
java
package com.chapter1; /** * @author LiXingyu * @date 2020-04-17 9:33 上午 */ public class TestDaemon { public static void main(String[] args) { Thread thread = new Thread(new Runnable() { @Override public void run() { try { System.out.println(Thread.currentThread().getName() + "begin...."); Thread.sleep(1_0000); System.out.println(Thread.currentThread().getName() + "end"); } catch (InterruptedException e) { e.printStackTrace(); } } }); //thread.setDaemon(true); thread.start(); System.out.println(Thread.currentThread().getName()); } }
[ "Xingy.li@sunyard.com" ]
Xingy.li@sunyard.com
7f88516d8897a97ab459e7cc5fec6865b99eb7da
f4431698e2d61c4aeb786a194f0237e87895f2d4
/src/main/java/com/everis/beca/GestionPago/solicitudes/repository/proveedorRepository.java
70a14fa3e5f5076554f91fa7f472e798eb9596f6
[]
no_license
mauricdev/solicitudes
757f93711bb7a58abe0ae71f8aee97ac048d01a3
985b59e93dd806b13aa5513863504681f9e1fb44
refs/heads/main
2023-03-30T18:10:08.615337
2021-04-04T13:50:14
2021-04-04T13:50:14
354,555,743
0
0
null
null
null
null
UTF-8
Java
false
false
347
java
package com.everis.beca.GestionPago.solicitudes.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.everis.beca.GestionPago.solicitudes.entity.proveedorEntity; @Repository public interface proveedorRepository extends JpaRepository<proveedorEntity, Integer>{ }
[ "49356191+mauricdev@users.noreply.github.com" ]
49356191+mauricdev@users.noreply.github.com
11801083439ff98b7e6a87e186a0871570e4d9b8
8a5545b0f27b7de5a09cb61b5df1f9f3a631c459
/engine/src/xyz.raultaylor/fgp.engine/pool/SpritesPool.java
b18a4f2e6ff0af50d6c08ec58fc06839f6f99e2c
[]
no_license
RaulTaylor/FinalGameProject
61ba7ce0748b7376f3c9effe81707cb5749e2405
3b73189d137d698c6724ddb8518dda45ca36b8d6
refs/heads/master
2021-01-24T00:09:40.227886
2018-02-24T16:03:53
2018-02-24T16:03:53
122,755,441
0
0
null
null
null
null
UTF-8
Java
false
false
2,090
java
package xyz.raultaylor.fgp.engine.pool; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import xyz.raultaylor.fgp.engine.Sprite; public abstract class SpritesPool<T extends Sprite> { // список активных объектов protected final List<T> activeObjects = new LinkedList<T>(); // список свободных объектов protected final List<T> freeObjects = new ArrayList<T>(); protected abstract T newObject(); public T obtain() { T object; if (freeObjects.isEmpty()) { object = newObject(); } else { object = freeObjects.remove(freeObjects.size() - 1); } activeObjects.add(object); debugLog(); return object; } public void updateActiveObjects(float delta) { for (int i = 0; i < activeObjects.size(); i++) { activeObjects.get(i).update(delta); } } public void drawActiveObjects(SpriteBatch batch) { for (int i = 0; i < activeObjects.size(); i++) { activeObjects.get(i).draw(batch); } } public void freeAllDestroyedActiveObjects() { for (int i = 0; i < activeObjects.size(); i++) { T sprite = activeObjects.get(i); if (sprite.isDestroyed()) { free(sprite); i--; sprite.setDestroyed(false); } } } public void freeAllActiveObjects() { freeObjects.addAll(activeObjects); activeObjects.clear(); } public void free(T object) { if (!activeObjects.remove(object)) { throw new RuntimeException("Попытка удаления несуществующего объекта"); } freeObjects.add(object); } public void dispose() { activeObjects.clear(); freeObjects.clear(); } protected void debugLog() { } public List<T> getActiveObjects() { return activeObjects; } }
[ "raultaylor.web@gmail.com" ]
raultaylor.web@gmail.com
58924c4a11f8d7ce8701145c115a5486f5373099
fbc20f7d5364602d5ee0b2fbbbc29cf7efd7f90f
/eg-spring-boot/eg-spring-boot-minimum/src/main/java/com/lenicliu/spring/boot/Application.java
54ebab66e334ee1fa631264035f6ba38382d370f
[]
no_license
lenicliu/eg-spring
c75469c000c1786bcf57c3b6efbff0ce948805cd
bb12c94b7998a577af6025b4440672c591f70274
refs/heads/master
2021-09-14T21:01:30.494725
2018-05-19T14:52:11
2018-05-19T14:52:11
54,939,201
22
9
null
null
null
null
UTF-8
Java
false
false
605
java
package com.lenicliu.spring.boot; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @Controller @SpringBootApplication public class Application { @RequestMapping("/") public @ResponseBody String greetings() { return "hi,spring boot"; } public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
[ "lenicliu@163.com" ]
lenicliu@163.com
57baa70f29bf817a51ceff509b5be63e505fccd3
d2cb1f4f186238ed3075c2748552e9325763a1cb
/methods_all/nonstatic_methods/javax_swing_JCheckBoxMenuItem_getComponentOrientation.java
20d4a1234bf81cfd07aaa46f5cc394f8671208da
[]
no_license
Adabot1/data
9e5c64021261bf181b51b4141aab2e2877b9054a
352b77eaebd8efdb4d343b642c71cdbfec35054e
refs/heads/master
2020-05-16T14:22:19.491115
2019-05-25T04:35:00
2019-05-25T04:35:00
183,001,929
4
0
null
null
null
null
UTF-8
Java
false
false
196
java
class javax_swing_JCheckBoxMenuItem_getComponentOrientation{ public static void function() {javax.swing.JCheckBoxMenuItem obj = new javax.swing.JCheckBoxMenuItem();obj.getComponentOrientation();}}
[ "peter2008.ok@163.com" ]
peter2008.ok@163.com
6b31b68fe0b9512254f333bad1ae0d56e0d2eb31
7a9991efad028a1e264f9fd725be16338b70f4de
/src/Ball.java
b5cb7c6f74fc571f94f2a2dd61a4e3db932eb308
[]
no_license
Potzy12323123125y7/INTERAKTIVGRAFIK_SPEL
4b3f79fb84cdbcec4e6d0445b92a3a3e7315e79f
ed29adc3a45812a95b9fa42aa8ff90188cec5e91
refs/heads/master
2021-05-21T14:33:56.968532
2020-05-28T13:34:29
2020-05-28T13:34:29
252,682,803
0
0
null
null
null
null
UTF-8
Java
false
false
3,136
java
import java.awt.*; import java.util.Random; public class Ball { private int p1Score, p2Score; private int xDirection, yDirection; private int[] pixels; private Rectangle boundingBox; private int height = 10; private int width = 10; public Ball(int x, int y){ pixels = new int[width*height]; /*for(int j = 0 ; j < height ; j++ ) { for (int i = 0 ; i < width ; i++) { if ((i-width/2)*(i-width/2) + (j-height/2)*(j-height/2) < width*width/4) { pixels[i] = 0xFFFFFFFF; } else { pixels[i] = 0x00000000; } } }*/ for (int i = 0 ; i < pixels.length ; i++) pixels[i] = 0xFFFFFFFF; boundingBox = new Rectangle(x, y, width, height); Random r = new Random(); int rDir = r.nextInt(1); if(rDir == 0) { rDir--; } setXDirection(rDir); int yrDir = r.nextInt(1); if(yrDir == 0) { yrDir--; } setYDirection(yrDir); } public void setXDirection(int xdir){ xDirection = xdir; } public void setYDirection(int ydir){ yDirection = ydir; } public int getXDirection() { return xDirection; } public int getYDirection() { return yDirection; } public void draw(int[] Screen, int screenWidth){ for (int i = 0 ; i < height ; i++) { for (int j = 0 ; j < width ; j++) { Screen[(boundingBox.y+i)*screenWidth + boundingBox.x+j] = pixels[i*width+j]; } } } public void collision(Rectangle r){ if(boundingBox.intersects(r)) { if (getXDirection() > 0 && Math.abs(r.x - (boundingBox.x + boundingBox.width)) <= getXDirection()) { setXDirection(-1); p1Score++; } else if (getXDirection() < 0 && Math.abs(r.x + r.width - boundingBox.x) <= -getXDirection()) { setXDirection(+1); p2Score++; } else if (getYDirection() > 0 && Math.abs(r.y - (boundingBox.y + boundingBox.height)) <= getYDirection()) { setYDirection(-1); } else if (getYDirection() < 0 && Math.abs(r.y + r.height - boundingBox.y) <= -getYDirection()) { setYDirection(1); } } } public int move() { boundingBox.x += xDirection; boundingBox.y += yDirection; System.out.println(); //Bounce the ball when edge is detected if (boundingBox.x <= 0) { setXDirection(+1); p2Score++; } if (boundingBox.x >= 390) { setXDirection(-1); p1Score++; } if (boundingBox.y <= 0) setYDirection(+1); if (boundingBox.y >= 290) setYDirection(-1); return 0; } public int getP1Score() { return p1Score; } public int getP2Score() { return p2Score; } public void update(Rectangle r) { collision(r); move(); collision(r); } }
[ "alexander.naslund2@elev.ga.ntig.se" ]
alexander.naslund2@elev.ga.ntig.se
46a8b654cb7c5819ea1951c2de6ff73e42ce69c7
6cddcfb8d9d11057c0965c1a59a149c2577543fe
/SourceCode/View/FrmMainMenu.java
f3aecb1c191ef8a9d5c22c8ceda201e7c21fe919
[]
no_license
sendyga/RPL-16S1SI08-10-TokoBonekaKita
c09e7ae66acdf862ec845dbab16a090aaf727b70
0943fc24e1c1a57122584d5d7800da1a93d78f9e
refs/heads/master
2020-03-30T03:57:46.453835
2019-01-13T17:14:09
2019-01-13T17:14:09
150,717,084
0
0
null
null
null
null
UTF-8
Java
false
false
3,250
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package View; /** * * @author Garjito */ public class FrmMainMenu extends javax.swing.JFrame { /** * Creates new form FrmMainMenu */ public FrmMainMenu() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 613, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 294, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(FrmMainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(FrmMainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(FrmMainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(FrmMainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new FrmMainMenu().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables }
[ "sendigarjito46@gmail.com" ]
sendigarjito46@gmail.com
2fcc96457d628c856cb2309b500547909dcbf5ac
8e99e10165adb1f736e598779d725cb1549646a6
/DataStrucure/src/com/rajesh/stack/ExpressinValidator.java
e4bd9db051beda367d9981fbf5b42fc0418c4fab
[]
no_license
rjs5613/PracticeRepo
3e5307ea9e6def4bd6b100cce30f240e567f1ddb
bdfcb8713575e6f0e415b037c29da740a07288e9
refs/heads/master
2020-04-06T07:09:38.761634
2016-08-29T05:47:45
2016-08-29T05:47:45
60,282,204
0
0
null
null
null
null
UTF-8
Java
false
false
2,562
java
/** * */ package com.rajesh.stack; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; /** * @author rjs56 * */ public class ExpressinValidator { private static final List<Character> OPENING_BRACKETS = Arrays.asList('(', '{', '['); private static final List<Character> CLOSING_BRACKETS = Arrays.asList(')', '}', ']'); private static final int ZERO = 0; public static boolean validateExpression(String expression) { if (Objects.isNull(expression) || expression.isEmpty()) { return false; } if (!OPENING_BRACKETS.contains(expression.charAt(ZERO))) { return false; } MyStack<Character> characterStack = new MyStack<>(); int length = expression.length(); for (int i = 0; i < length; i++) { char character = expression.charAt(i); if (OPENING_BRACKETS.contains(character)) { characterStack.push(character); } else if (CLOSING_BRACKETS.contains(character)) { if (characterStack.isEmpty()) { return false; } char topChar = characterStack.peek(); switch (character) { case ')': if (topChar == '(') { characterStack.pop(); } else { return false; } break; case '}': if (topChar == '{') { characterStack.pop(); } else { return false; } break; case ']': if (topChar == '[') { characterStack.pop(); } else { return false; } break; default: break; } } } if (characterStack.isEmpty()) { return true; } return false; } public static boolean validateExpression1(String expression) { if (Objects.isNull(expression) || expression.isEmpty()) { return false; } Map<Character, Character> characterMap = new HashMap<>(); characterMap.put('(', ')'); characterMap.put('{', '}'); characterMap.put('[', ']'); if (!characterMap.keySet().contains(expression.charAt(ZERO))) { return false; } MyStack<Character> characterStack = new MyStack<>(); int length = expression.length(); for (int i = 0; i < length; i++) { char character = expression.charAt(i); if (characterMap.keySet().contains(character)) { characterStack.push(character); } else if (characterMap.values().contains(character)) { char topChar = characterStack.peek(); if (characterStack.isEmpty()) { return false; } if (character == characterMap.get(topChar)) { characterStack.pop(); } else { return false; } } } return characterStack.isEmpty(); } }
[ "rjs5613@gmail.com" ]
rjs5613@gmail.com
e85cf94aa08397d7f39b64d1a679d272c823553e
501278ae6e64e80a1aa00b665c0af7cb3b0b7299
/Sugar.java
a777acf50cda047e64352b19959dbde30a05c8ee
[]
no_license
sankertw/Lab10
f971fa514b4a0b5a50d442105db5c95e2edc1e8d
7e9b3ac2e515d9e6628f1ae208bbb8de529dd2e0
refs/heads/master
2023-01-21T12:23:25.759148
2020-12-03T05:39:23
2020-12-03T05:39:23
318,087,261
0
0
null
null
null
null
UTF-8
Java
false
false
805
java
class Sugar extends Cookie{ String cookShape; boolean isDecorated; public Sugar(){ cookShape =""; isDecorated = false; } public Sugar(String aCookShape, boolean aIsDecorated){ cookShape = aCookShape; isDecorated = aIsDecorated; } public String getShape(){ return cookShape; } public void setShape(String aCookShape){ this.cookShape = aCookShape; } public void cutCookie(String cookShape, int cookCount){ getShape(); System.out.println(cookCount + " cookies were cut into " + cookShape); super.setCount(cookCount); } public void decCookie(){ if(super.getIsBaked()){ isDecorated = true; System.out.println("The Cookies were decorated"); } else { System.out.println("Make sure to bake the cookies first!"); } } }
[ "sankertw@mail.uc.edu" ]
sankertw@mail.uc.edu
7cd10296bc0200b864bc4da3d73edbd47972d969
275ae65b8f428fcebac68fbf46e3a19891c998e9
/FrameworkPre/mybatis-study/bank/src/main/java/com/bjsxt/pojo/Account.java
d23b5d3afc132197ea925c6e7526a528fd678cd6
[]
no_license
HelloKittycoder/JavaWebLearning
2226745233a3e99f7262a2ebbed545950e29ca4a
9f7c6e7eacb65fe23ae8923775ab54e96309f15b
refs/heads/master
2022-12-22T03:30:17.782246
2022-02-23T10:22:51
2022-02-23T10:22:51
129,604,550
2
2
null
2022-12-09T22:40:42
2018-04-15T11:42:47
Java
UTF-8
Java
false
false
914
java
package com.bjsxt.pojo; /** * Create by Administrator on 2019/3/20 * 账户信息 */ public class Account { private int id; private String accNo; private int password; private double balance; private String name; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getAccNo() { return accNo; } public void setAccNo(String accNo) { this.accNo = accNo; } public int getPassword() { return password; } public void setPassword(int password) { this.password = password; } public double getBalance() { return balance; } public void setBalance(double balance) { this.balance = balance; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
[ "shucheng2015@outlook.com" ]
shucheng2015@outlook.com
feb9b256c30fcff8413762831ab8d6cb46f274f1
a885a1fd7b78a127c424c733e6740446bb9bbe9b
/src/main/java/io/github/jhipster/store/config/apidoc/PageableParameterBuilderPlugin.java
e93ee6baa95d60e0910627f33473be188262ab2a
[]
no_license
seungkyua/devoxx-2016
535b36124813c86cbf13ac80665317d3005c1311
db69708be18692388e92154d65bfd7de3577a01b
refs/heads/master
2021-01-13T14:18:35.796499
2017-01-16T04:12:33
2017-01-16T04:12:33
79,083,251
0
1
null
2020-09-18T11:58:41
2017-01-16T04:37:33
Java
UTF-8
Java
false
false
3,900
java
package io.github.jhipster.store.config.apidoc; import io.github.jhipster.store.config.Constants; import com.fasterxml.classmate.ResolvedType; import com.fasterxml.classmate.TypeResolver; import com.google.common.base.Function; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Profile; import org.springframework.core.annotation.Order; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Component; import springfox.documentation.schema.ModelReference; import springfox.documentation.schema.TypeNameExtractor; import springfox.documentation.service.Parameter; import springfox.documentation.service.ResolvedMethodParameter; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.schema.contexts.ModelContext; import springfox.documentation.spi.service.ParameterBuilderPlugin; import springfox.documentation.spi.service.contexts.ParameterContext; import springfox.documentation.swagger.common.SwaggerPluginSupport; import java.util.List; import static com.google.common.collect.Lists.newArrayList; import static springfox.documentation.schema.ResolvedTypes.modelRefFactory; import static springfox.documentation.spi.schema.contexts.ModelContext.inputParam; @Component @Order(SwaggerPluginSupport.SWAGGER_PLUGIN_ORDER) @Profile(Constants.SPRING_PROFILE_SWAGGER) public class PageableParameterBuilderPlugin implements ParameterBuilderPlugin { private final TypeNameExtractor nameExtractor; private final TypeResolver resolver; @Autowired public PageableParameterBuilderPlugin(TypeNameExtractor nameExtractor, TypeResolver resolver) { this.nameExtractor = nameExtractor; this.resolver = resolver; } @Override public boolean supports(DocumentationType delimiter) { return true; } private Function<ResolvedType, ? extends ModelReference> createModelRefFactory(ParameterContext context) { ModelContext modelContext = inputParam(context.resolvedMethodParameter().getParameterType(), context.getDocumentationType(), context.getAlternateTypeProvider(), context.getGenericNamingStrategy(), context.getIgnorableParameterTypes()); return modelRefFactory(modelContext, nameExtractor); } @Override public void apply(ParameterContext context) { ResolvedMethodParameter parameter = context.resolvedMethodParameter(); Class<?> type = parameter.getParameterType().getErasedType(); if (type != null && Pageable.class.isAssignableFrom(type)) { Function<ResolvedType, ? extends ModelReference> factory = createModelRefFactory(context); ModelReference intModel = factory.apply(resolver.resolve(Integer.TYPE)); ModelReference stringModel = factory.apply(resolver.resolve(List.class, String.class)); List<Parameter> parameters = newArrayList( context.parameterBuilder() .parameterType("query").name("page").modelRef(intModel) .description("Page number of the requested page") .build(), context.parameterBuilder() .parameterType("query").name("size").modelRef(intModel) .description("Size of a page") .build(), context.parameterBuilder() .parameterType("query").name("sort").modelRef(stringModel).allowMultiple(true) .description("Sorting criteria in the format: property(,asc|desc). " + "Default sort order is ascending. " + "Multiple sort criteria are supported.") .build()); context.getOperationContext().operationBuilder().parameters(parameters); } } }
[ "seungkyua@gmail.com" ]
seungkyua@gmail.com
31a09c5b70b869b15665509ebb0e00b2081dce28
bf3615067408c79e5f5292cd87663916b403b690
/app/src/main/java/com/unbi/widgettimer/Alarm.java
4934feb9705a88e287598633e8c4c3ea02e7fa8c
[]
no_license
ProjectUNBI/Quicktimer
74cf07c2cc40b93dfe5b5176b2840cb879fda37d
420c90e38cdaf228b788a819dfa8e3b77699f385
refs/heads/master
2020-03-28T11:32:46.028637
2018-09-17T22:29:42
2018-09-17T22:29:42
148,224,408
0
0
null
null
null
null
UTF-8
Java
false
false
18,280
java
package com.unbi.widgettimer; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Typeface; import android.os.Bundle; import android.provider.AlarmClock; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.Toast; import com.ncorti.slidetoact.SlideToActView; import com.shawnlin.numberpicker.NumberPicker; import com.tuyenmonkey.AutoFillEditText; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Set; public class Alarm extends AppCompatActivity { private SimpleDateFormat dateFormat; public static List<String> wordListA = new ArrayList<String>(); @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.aram_activity); dateFormat = new SimpleDateFormat("HH:mm:ss", getResources().getConfiguration().locale); final AutoFillEditText editTextalarm = (AutoFillEditText) findViewById(R.id.texteditalarm); SharedPreferences prfs = getSharedPreferences("WORDS", Context.MODE_PRIVATE); String words = prfs.getString("words", "Timer,Countdown,"); String[] wordsme = words.split(","); for (String s : wordsme) { //Do your stuff here // System.out.println(s); wordListA.add(s); } editTextalarm.addSuggestions(wordListA); // Toolbar toolbar = findViewById(R.id.toolbar); // setSupportActionBar(toolbar); final NumberPicker hour1 = findViewById(R.id.hour1alarm); hour1.setTypeface(Typeface.create(getString(R.string.roboto_light), Typeface.NORMAL)); hour1.setTypeface(getString(R.string.roboto_light), Typeface.NORMAL); hour1.setTypeface(getString(R.string.roboto_light)); hour1.setTypeface(R.string.roboto_light, Typeface.NORMAL); hour1.setTypeface(R.string.roboto_light); String[] data = {"0", "1", "2", "0", "1", "2", "0", "1", "2"}; hour1.setMinValue(1); hour1.setMaxValue(data.length); hour1.setDisplayedValues(data); hour1.setValue(1); // Set fading edge enabled hour1.setFadingEdgeEnabled(true); // Set scroller enabled hour1.setScrollerEnabled(true); // Set wrap selector wheel hour1.setWrapSelectorWheel(true); final NumberPicker hour2 = findViewById(R.id.hour2alarm); hour2.setTypeface(Typeface.create(getString(R.string.roboto_light), Typeface.NORMAL)); hour2.setTypeface(getString(R.string.roboto_light), Typeface.NORMAL); hour2.setTypeface(getString(R.string.roboto_light)); setnum(hour2, 9); final NumberPicker min1 = findViewById(R.id.minute1alarm); min1.setTypeface(Typeface.create(getString(R.string.roboto_light), Typeface.NORMAL)); min1.setTypeface(getString(R.string.roboto_light), Typeface.NORMAL); min1.setTypeface(getString(R.string.roboto_light)); setnum(min1, 5); final NumberPicker min2 = findViewById(R.id.minute2alarm); min2.setTypeface(Typeface.create(getString(R.string.roboto_light), Typeface.NORMAL)); min2.setTypeface(getString(R.string.roboto_light), Typeface.NORMAL); min2.setTypeface(getString(R.string.roboto_light)); setnum(min2, 9); SharedPreferences pref = getApplicationContext().getSharedPreferences("WORDS", MODE_PRIVATE); setupEventCallbacksalarm(hour1, hour2, min1, min2, editTextalarm, pref); setupUI(findViewById(R.id.linearLayout1), editTextalarm); // // // // Set typeface // numberPicker.setTypeface(Typeface.create(getString(R.string.roboto_light), Typeface.NORMAL)); // numberPicker.setTypeface(getString(R.string.roboto_light), Typeface.NORMAL); // numberPicker.setTypeface(getString(R.string.roboto_light)); // numberPicker.setTypeface(R.string.roboto_light, Typeface.NORMAL); // numberPicker.setTypeface(R.string.roboto_light); // // // Set fading edge enabled // numberPicker.setFadingEdgeEnabled(true); // // // Set scroller enabled // numberPicker.setScrollerEnabled(true); // // // Set wrap selector wheel // numberPicker.setWrapSelectorWheel(true); // // // OnClickListener // numberPicker.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View view) { // Log.d("TAG", "Click on current value"); // } // }); // // // OnValueChangeListener // numberPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() { // @Override // public void onValueChange(NumberPicker picker, int oldVal, int newVal) { // Log.d("TAG", String.format(Locale.US, "oldVal: %d, newVal: %d", oldVal, newVal)); // } // }); hour1.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() { @Override public void onValueChange(NumberPicker picker, int oldVal, int newVal) { // Log.d("hour1", String.format(Locale.US, "oldVal: %d, newVal: %d", oldVal, newVal)); if (newVal == 3 || newVal == 6 || newVal == 9) { hour2.setMaxValue(3); } else { hour2.setMaxValue(9); } hour1.setWrapSelectorWheel(true); hour2.setWrapSelectorWheel(true); } }); hour2.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() { @Override public void onValueChange(NumberPicker picker, int oldVal, int newVal) { // Log.d("hou2", String.format(Locale.US, "oldVal: %d, newVal: %d", oldVal, newVal)); // if (hour1.getValue()==3||hour1.getValue()==6||hour1.getValue()==9){ // if (oldVal == 3 & newVal == 0) { // int sec1val = hour1.getValue(); // sec1val = sec1val + 1; // hour1.setValue(sec1val); // } // if (oldVal == 0 & newVal == 3) { // int sec1val = hour1.getValue(); // sec1val = sec1val - 1; // hour1.setValue(sec1val); // } // } else { // if (oldVal == 9 & newVal == 0) { // int sec1val = hour1.getValue(); // sec1val = sec1val + 1; // hour1.setValue(sec1val); // } // if (oldVal == 0 & newVal == 9) { // int sec1val = hour1.getValue(); // sec1val = sec1val - 1; // hour1.setValue(sec1val); // } // } // if (hour1.getValue()==3||hour1.getValue()==6||hour1.getValue()==9) { // hour2.setMaxValue(3); // } else { // hour2.setMaxValue(9); // } // hour1.setWrapSelectorWheel(true); // hour2.setWrapSelectorWheel(true); } }); min1.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() { @Override public void onValueChange(NumberPicker picker, int oldVal, int newVal) { // Log.d("min1", String.format(Locale.US, "oldVal: %d, newVal: %d", oldVal, newVal)); } }); min2.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() { @Override public void onValueChange(NumberPicker picker, int oldVal, int newVal) { // Log.d("min2", String.format(Locale.US, "oldVal: %d, newVal: %d", oldVal, newVal)); if (oldVal == 9 & newVal == 0) { int sec1val = min1.getValue(); sec1val = sec1val + 1; min1.setValue(sec1val); } if (oldVal == 0 & newVal == 9) { int sec1val = min1.getValue(); sec1val = sec1val - 1; min1.setValue(sec1val); } } }); editTextalarm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editTextalarm.setCursorVisible(true); } }); hour1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { hour1.setValue(1); hour2.setValue(0); hour2.setMaxValue(9); } }); hour2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { hour1.setValue(1); hour2.setValue(0); hour2.setMaxValue(9); } }); min1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { min1.setValue(0); min2.setValue(0); } }); min2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { min1.setValue(0); min2.setValue(0); } }); } private static void setnum(NumberPicker numberPicker, int max) { // Set typeface numberPicker.setTypeface(R.string.roboto_light, Typeface.NORMAL); numberPicker.setTypeface(R.string.roboto_light); // Set fading edge enabled numberPicker.setFadingEdgeEnabled(true); numberPicker.setMaxValue(max); // Set scroller enabled numberPicker.setScrollerEnabled(true); // Set wrap selector wheel numberPicker.setWrapSelectorWheel(true); // OnValueChangeListener } private void setupEventCallbacksalarm(final NumberPicker h1, final NumberPicker h2, final NumberPicker m1, final NumberPicker m2, final AutoFillEditText edittext, final SharedPreferences spref) { final SlideToActView slideme = findViewById(R.id.timerbuttonalarm); slideme.setOnSlideCompleteListener(new SlideToActView.OnSlideCompleteListener() { @Override public void onSlideComplete(@NonNull SlideToActView view) { // Log.d("PRESS", "\n" + getTime() + " onSlideComplete"); //TODO DESTRO AND SEND INTENT timeobject timeobjects = gettimertime(h1, h2, m1, m2, edittext); // Log.d("KKKKKKKKKKKKK", timeobjects.label); // if(timertime==0){return;} timerdonow(timeobjects, spref, getApplicationContext()); SharedPreferences sprefme = getSharedPreferences("switch", MODE_PRIVATE); if (!MainActivity.getskipuialarm(sprefme)) { alarmbroadcastIntentskipui(timeobjects.hour, timeobjects.min, timeobjects.label); } else { alarmbroadcastIntent(timeobjects.hour, timeobjects.min, timeobjects.label); } finish(); } }); slideme.setOnSlideResetListener(new SlideToActView.OnSlideResetListener() { @Override public void onSlideReset(@NonNull SlideToActView view) { // Log.d("PRESS", "\n" + getTime() + " onSlideReset"); } }); slideme.setOnSlideToActAnimationEventListener(new SlideToActView.OnSlideToActAnimationEventListener() { @Override public void onSlideCompleteAnimationStarted(@NonNull SlideToActView view, float threshold) { // Log.d("PRESS", "\n" + getTime() + " onSlideCompleteAnimationStarted - " + threshold + ""); } @Override public void onSlideCompleteAnimationEnded(@NonNull SlideToActView view) { // Log.d("PRESS", "\n" + getTime() + " onSlideCompleteAnimationEnded"); } @Override public void onSlideResetAnimationStarted(@NonNull SlideToActView view) { // Log.d("PRESS", "\n" + getTime() + " onSlideResetAnimationStarted"); } @Override public void onSlideResetAnimationEnded(@NonNull SlideToActView view) { // Log.d("PRESS", "\n" + getTime() + " onSlideResetAnimationEnded"); } }); } private String getTime() { return dateFormat.format(new Date()); } private static timeobject gettimertime(NumberPicker hour1, NumberPicker hour2, NumberPicker min1, NumberPicker min2, AutoFillEditText editText) { timeobject timeob = new timeobject(); int h1 = hour1.getValue(); if (h1 == 1 || h1 == 4 || h1 == 7) { h1 = 0; } if (h1 == 2 || h1 == 5 || h1 == 8) { h1 = 1; } if (h1 == 3 || h1 == 6 || h1 == 9) { h1 = 2; } int h2 = hour2.getValue(); timeob.hour = String.valueOf(h1) + String.valueOf(h2); int m1 = min1.getValue(); int m2 = min2.getValue(); timeob.min = String.valueOf(m1) + String.valueOf(m2); // int s1 = sec1.getValue(); // int s2 = sec2.getValue(); // timeob.sec = String.valueOf(s1)+ String.valueOf(s2); timeob.label = String.valueOf(editText.getText()); return timeob; } private static void timerdonow(timeobject timeobj, SharedPreferences pref, Context context) { if (timeobj.label == null || timeobj.label.equals("")) { timeobj.label = "Alarm"; } // Log.d("TSSSSSSSSS", timeobj.label); // Log.d(timeobj.label, String.valueOf(timeobj.hour) + " " + String.valueOf(timeobj.min) + " " + String.valueOf(timeobj.sec)); wordListA.add(timeobj.label); // add elements to al, including duplicates Set<String> hs = new HashSet<>(); hs.addAll(wordListA); wordListA.clear(); wordListA.addAll(hs); String[] stockArr = new String[wordListA.size()]; stockArr = wordListA.toArray(stockArr); StringBuilder builder = new StringBuilder(); for (String s : stockArr) { builder.append(s); builder.append(","); } String str = builder.toString(); // Log.d("GHJK", str); SharedPreferences.Editor editor = pref.edit(); editor.putString("words", str); editor.apply(); // long i=0; // String string=timeobj.hour+":"+timeobj.min // Log.d("TIMECHIE",string); // try { // DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); // Date reference = dateFormat.parse("00:00:00"); // Date date = dateFormat.parse(string); // long seconds = (date.getTime() - reference.getTime()) / 1000L; // i=seconds; // } catch (Exception e){ // Toast.makeText(context,"Cant'Parse Time",Toast.LENGTH_SHORT); // } } public void setupUI(View view, final AutoFillEditText editme) { // this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); // Set up touch listener for non-text box views to hide keyboard. if (!(view instanceof EditText)) { view.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { hidekeyboard.hideSoftKeyboard(Alarm.this); editme.setCursorVisible(false); return false; } }); } else { editme.setCursorVisible(true); } //If a layout container, iterate over children and seed recursion. if (view instanceof ViewGroup) { for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) { View innerView = ((ViewGroup) view).getChildAt(i); setupUI(innerView, editme); } } } public void alarmbroadcastIntent(String hour, String min, String msg) { // Log.d("WEARE",String.valueOf(val)); // int ival = (int) val; // Intent i = new Intent("android.intent.action.SET_TIMER"); // i.putExtra("android.intent.extra.alarm.SKIP_UI",false); // i.putExtra("android.intent.extra.alarm.LENGTH", ival); // i.putExtra("android.intent.extra.alarm.MESSAGE",msg); // startActivity(i); Intent i = new Intent(AlarmClock.ACTION_SET_ALARM); i.putExtra(AlarmClock.EXTRA_SKIP_UI, false); i.putExtra(AlarmClock.EXTRA_HOUR, Integer.parseInt(hour)); i.putExtra(AlarmClock.EXTRA_MINUTES, Integer.parseInt(min)); i.putExtra(AlarmClock.EXTRA_MESSAGE, msg); startActivity(i); } public void alarmbroadcastIntentskipui(String hour, String min, String msg) { // int ival = (int) val; // // Intent i = new Intent("android.intent.action.SET_TIMER"); // i.putExtra("android.intent.extra.alarm.SKIP_UI",true); // i.putExtra("android.intent.extra.alarm.LENGTH", ival); // i.putExtra("android.intent.extra.alarm.MESSAGE",msg); // startActivity(i); Intent i = new Intent(AlarmClock.ACTION_SET_ALARM); i.putExtra(AlarmClock.EXTRA_SKIP_UI, true); i.putExtra(AlarmClock.EXTRA_HOUR, Integer.parseInt(hour)); i.putExtra(AlarmClock.EXTRA_MINUTES, Integer.parseInt(min)); i.putExtra(AlarmClock.EXTRA_MESSAGE, msg); startActivity(i); } @Override protected void onResume() { final SlideToActView slideme = findViewById(R.id.timerbuttonalarm); slideme.resetSlider(); super.onResume(); } }
[ "projectunbi@gmail.com" ]
projectunbi@gmail.com
089dc120993d3c9b44a59f71bd82f51ad37ad043
fa0c6d950fdb62bfc98b74d9c9e64e9c575868ed
/A-Star/src/a/star/Node.java
533dc6f1351927b2d1ebeb2678b370d078b5a710
[]
no_license
Pashah/a-star
be41a659a4efc6f5c13b2a4438115a138de8c97d
de1af2e269f175bc484674e2c1cc09577e82ca94
refs/heads/master
2021-01-22T09:50:34.945505
2013-06-16T19:35:00
2013-06-16T19:35:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,817
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package a.star; import java.util.Random; /** * Node-luokka, node tietää paikkansa, arvonsa, etäisyyden maaliin, onko se maalinode * sekä lisäksi sen onko nodessa jo käyty. Sisältää myös apumetodeja maalin vaihtamiseen * nodesta toiseen * * @author Miika */ public class Node { private int x; private int y; private int arvo; private boolean visited; private int distanceToGoal; private boolean goalNode; /** * Tyhjä konstruktori */ public Node() { } /** * Konstruktori parametrien kanssa * * @param x x-koordinaatti * @param y y-koordinaatti */ public Node(int x, int y) { this.x = x; this.y = y; this.arvo = 0; this.visited = false; } public int getArvo() { return arvo; } public void setArvo(int arvo) { this.arvo = arvo; } public int getX() { return x; } public int getY() { return y; } public boolean isVisited() { return visited; } public void setVisited(boolean visited) { this.visited = visited; } public int getDistanceToGoal() { return distanceToGoal; } public void setDistanceToGoal(int distanceToGoal) { this.distanceToGoal = distanceToGoal; } public boolean isGoalNode() { return goalNode; } public void setGoalNode(boolean goalNode) { this.goalNode = goalNode; } /** * Liikuttaa maalia, käyttää apuna findGoalNode- ja setNewGoalNode-metodeita. * @param nodeMap kartta, jota käydään läpi */ public void moveGoalNode(Node[][] nodeMap) { Node currentGoalNode = findGoalNode(nodeMap); if (currentGoalNode == null) { System.out.print("No goal node set! Set one before moving it!"); } else { setNewGoalNode(currentGoalNode, nodeMap); } } /** * Etsii nodeMapista noden joka on maali * @param nodeMap kartta, josta etsitään maali * @return palauttaa maaliNoden */ public Node findGoalNode(Node[][] nodeMap) { Node foundGoal; for (int i = 0; i < nodeMap.length; i++) { for (int j = 0; j < nodeMap[0].length; j++) { if (nodeMap[i][j].isGoalNode()) { foundGoal = nodeMap[i][j]; return foundGoal; } } } return null; } /** * Asettaa maalin uuteen nodeen. Kokeilee maalin asettamista jokaiseen suuntaan * kunnes löytyy node jonne maali voi siirtyä * @param oldGoal node jossa maali ennen oli * @param nodeMap kartta jota käydään läpi */ private void setNewGoalNode(Node oldGoal, Node[][] nodeMap) { oldGoal.setGoalNode(false); if (oldGoal.getX() + 1 < nodeMap.length) { nodeMap[oldGoal.getX() + 1][oldGoal.getY()].setGoalNode(true); return; } if (oldGoal.getY() + 1 < nodeMap[0].length) { nodeMap[oldGoal.getX()][oldGoal.getY() + 1].setGoalNode(true); return; } if (oldGoal.getX() + 1 < nodeMap.length && oldGoal.getY() >= 0) { nodeMap[oldGoal.getX() + 1][oldGoal.getY() - 1].setGoalNode(true); return; } if (oldGoal.getX() + 1 < nodeMap.length && oldGoal.getY() + 1 < nodeMap[0].length) { nodeMap[oldGoal.getX() + 1][oldGoal.getY() + 1].setGoalNode(true); return; } if (oldGoal.getY() - 1 >= 0) { nodeMap[oldGoal.getX()][oldGoal.getY() - 1].setGoalNode(true); return; } if (oldGoal.getX() - 1 >= 0 && oldGoal.getY() + 1 < nodeMap[0].length) { nodeMap[oldGoal.getX() - 1][oldGoal.getY() + 1].setGoalNode(true); return; } if (oldGoal.getX() - 1 >= 0 && oldGoal.getY() - 1 >= 0) { nodeMap[oldGoal.getX() - 1][oldGoal.getY() - 1].setGoalNode(true); return; } if (oldGoal.getX() -1 >= 0) { nodeMap[oldGoal.getX() - 1][oldGoal.getY()].setGoalNode(true); } } /** * Laskee nodemapista etäisyyden nykyisestä nodesta maalinodeen. * Etäisyys on itseisarvo * @param nodeMap kartta josta etäisyys lasketaan * @param currentNode nykyinen node josta etäisyys lasketaan * @return */ public int calculateDistanceToGoal(Node currentNode, Node[][] nodeMap) { Node goal = findGoalNode(nodeMap); int distance = Math.abs(goal.getX() - currentNode.getX()) + Math.abs(goal.getY() - currentNode.getY() ); return distance; } }
[ "miika.kalske@luukku.com" ]
miika.kalske@luukku.com
b7f8866af7f5de37a70c7f03fc83893a2d17f8b2
762332e99a060f7d9a540406fade30f0d25f8a91
/src/test/java/com/eck_analytics/EckAnalyticsApplicationTests.java
0c5b705e3460b0fab56a165139a4887c88c746c7
[]
no_license
AnnaTsts/EckAnalytics
4a2c398be17402f0ba3c4e17ba69bfcd767a798e
ed43779423623f7d73895189aa00d0f9a65148a3
refs/heads/master
2022-11-23T23:01:26.380663
2020-07-18T07:54:55
2020-07-18T07:54:55
260,901,219
0
0
null
null
null
null
UTF-8
Java
false
false
228
java
package com.eck_analytics; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; //@SpringBootTest class EckAnalyticsApplicationTests { // @Test void contextLoads() { } }
[ "ann.tsytsyluik@gmail.com" ]
ann.tsytsyluik@gmail.com
4a1de6883e83e2fef5660a90fdd1c0161cf17d41
14d031689ea6ca8573212c5ff6dae87a86fbd431
/subprojects/base-services/src/main/java/org/gradle/internal/service/ReflectionBasedServiceMethod.java
a5984e9e8cb160275c975e3634c4a8a0b2cb3462
[ "BSD-3-Clause", "LGPL-2.1-or-later", "MIT", "CPL-1.0", "Apache-2.0", "LGPL-2.1-only", "LicenseRef-scancode-mit-old-style" ]
permissive
sonya1st/gradle
f7d644b2e57b066a240e19b6faa43c6bf7318d65
c7e9eb1053fb989eafd03d52c2472aa67bae4960
refs/heads/master
2023-04-14T12:06:44.059683
2020-06-07T21:49:24
2020-06-07T21:49:24
161,296,509
1
0
Apache-2.0
2018-12-11T07:45:54
2018-12-11T07:45:53
null
UTF-8
Java
false
false
1,368
java
/* * Copyright 2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gradle.internal.service; import org.gradle.internal.UncheckedException; import org.gradle.internal.reflect.JavaMethod; import org.gradle.internal.reflect.JavaReflectionUtil; import java.lang.reflect.Method; class ReflectionBasedServiceMethod extends AbstractServiceMethod { private final JavaMethod<Object, Object> javaMethod; ReflectionBasedServiceMethod(Method target) { super(target); javaMethod = JavaReflectionUtil.method(Object.class, target); } @Override public Object invoke(Object target, Object... args) { try { return javaMethod.invoke(target, args); } catch (Exception e) { throw UncheckedException.throwAsUncheckedException(e); } } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
e3426ee984d1a8efcfba7ad7269e5c022f6f6dc1
73267be654cd1fd76cf2cb9ea3a75630d9f58a41
/services/workspaceapp/src/main/java/com/huaweicloud/sdk/workspaceapp/v1/model/ReinstallServerReq.java
89dd2c83172a399e1d567a79cfd080c2460b316c
[ "Apache-2.0" ]
permissive
huaweicloud/huaweicloud-sdk-java-v3
51b32a451fac321a0affe2176663fed8a9cd8042
2f8543d0d037b35c2664298ba39a89cc9d8ed9a3
refs/heads/master
2023-08-29T06:50:15.642693
2023-08-24T08:34:48
2023-08-24T08:34:48
262,207,545
91
57
NOASSERTION
2023-09-08T12:24:55
2020-05-08T02:27:00
Java
UTF-8
Java
false
false
1,933
java
package com.huaweicloud.sdk.workspaceapp.v1.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Objects; /** * 重建服务器的请求体 */ public class ReinstallServerReq { @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "update_access_agent") private Boolean updateAccessAgent; public ReinstallServerReq withUpdateAccessAgent(Boolean updateAccessAgent) { this.updateAccessAgent = updateAccessAgent; return this; } /** * 是否自动升级hda版本 * @return updateAccessAgent */ public Boolean getUpdateAccessAgent() { return updateAccessAgent; } public void setUpdateAccessAgent(Boolean updateAccessAgent) { this.updateAccessAgent = updateAccessAgent; } @Override public boolean equals(java.lang.Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } ReinstallServerReq that = (ReinstallServerReq) obj; return Objects.equals(this.updateAccessAgent, that.updateAccessAgent); } @Override public int hashCode() { return Objects.hash(updateAccessAgent); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ReinstallServerReq {\n"); sb.append(" updateAccessAgent: ").append(toIndentedString(updateAccessAgent)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
[ "hwcloudsdk@huawei.com" ]
hwcloudsdk@huawei.com
2bdbceb7db320cc2b70eedbcafc41f43bb9cc1e6
a86417df4cd86daa6e52ffbaf2c92336b509bd5c
/eth/src/main/java/contract/MasterRelayed.java
369088562b57f78b7d56e82f2a6001604111ba31
[ "Apache-2.0" ]
permissive
d3ledger/d3-eth
f46385d5f803a0ae930147043094f3572a367c71
5c246c32991e4a30194cc320b77641190f1497e5
refs/heads/develop
2021-07-09T15:49:35.606611
2020-08-19T15:25:56
2020-08-19T15:25:56
184,047,300
2
4
Apache-2.0
2020-08-19T15:25:58
2019-04-29T10:07:53
Kotlin
UTF-8
Java
false
false
48,712
java
package contract; import io.reactivex.Flowable; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.web3j.abi.EventEncoder; import org.web3j.abi.FunctionEncoder; import org.web3j.abi.TypeReference; import org.web3j.abi.datatypes.Address; import org.web3j.abi.datatypes.Bool; import org.web3j.abi.datatypes.Event; import org.web3j.abi.datatypes.Function; import org.web3j.abi.datatypes.Type; import org.web3j.abi.datatypes.generated.Uint256; import org.web3j.crypto.Credentials; import org.web3j.protocol.Web3j; import org.web3j.protocol.core.DefaultBlockParameter; import org.web3j.protocol.core.RemoteCall; import org.web3j.protocol.core.methods.request.EthFilter; import org.web3j.protocol.core.methods.response.Log; import org.web3j.protocol.core.methods.response.TransactionReceipt; import org.web3j.tx.Contract; import org.web3j.tx.TransactionManager; import org.web3j.tx.gas.ContractGasProvider; /** * <p>Auto generated code. * <p><strong>Do not modify!</strong> * <p>Please use the <a href="https://docs.web3j.io/command_line.html">web3j command line tools</a>, * or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the * <a href="https://github.com/web3j/web3j/tree/master/codegen">codegen module</a> to update. * * <p>Generated with web3j version 4.2.0. */ public class MasterRelayed extends Contract { private static final String BINARY = "60806040523480156200001157600080fd5b50604051620035f4380380620035f4833981810160405260408110156200003757600080fd5b8151602083018051919392830192916401000000008111156200005957600080fd5b820160208101848111156200006d57600080fd5b81518560208202830111640100000000821117156200008b57600080fd5b5050929190505050620000a6338383620000ae60201b60201c565b50506200025d565b60005460ff1615620000bf57600080fd5b600080546001600160a01b0380861661010002610100600160a81b0319909216919091178255600580548583166001600160a01b0319918216179182905560068054909116919092161790555b81518160ff1610156200014b5762000141828260ff16815181106200012d57fe5b6020026020010151620001f560201b60201c565b506001016200010c565b506000805260086020527f5eff886ea0ce6ca488a3d6e336d6c0f75f46d19b42c06ce5ee98e42c96d256c7805460ff191660011790556040516200018f906200024f565b604051809103906000f080158015620001ac573d6000803e3d6000fd5b50600780546001600160a01b0319166001600160a01b039283161790819055166000908152600860205260408120805460ff199081166001908117909255825416179055505050565b6001600160a01b03811660009081526001602052604081205460ff16156200021c57600080fd5b506001600160a01b03166000908152600160208190526040909120805460ff191682179055600280549091019081905590565b610da5806200284f83390190565b6125e2806200026d6000396000f3fe608060405260043610620001165760003560e01c80638f32d59b11620000a3578063ca70cf6e116200006d578063ca70cf6e1462000763578063d48bfca71462000937578063e7663079146200096e578063e991232b1462000986578063eea29e3e146200099e5762000116565b80638f32d59b14620006bc5780639f1a156c14620006d4578063ae6664e0146200070b578063b07c411f14620007355762000116565b8063658afed411620000e5578063658afed4146200021157806377a24f3614620002295780637874962014620002f757806389c39baf14620004e85762000116565b806319f3736114620001245780631b042ef9146200016f5780631d345ebb14620001a35780633e44cf7814620001da575b36156200012257600080fd5b005b3480156200013157600080fd5b506200015b600480360360208110156200014a57600080fd5b50356001600160a01b031662000b8f565b604080519115158252519081900360200190f35b3480156200017c57600080fd5b506200018762000ba4565b604080516001600160a01b039092168252519081900360200190f35b348015620001b057600080fd5b506200015b60048036036020811015620001c957600080fd5b50356001600160a01b031662000bb3565b348015620001e757600080fd5b506200015b600480360360208110156200020057600080fd5b50356001600160a01b031662000bc8565b3480156200021e57600080fd5b506200018762000bdd565b3480156200023657600080fd5b5062000122600480360360608110156200024f57600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b8111156200028357600080fd5b8201836020820111156200029657600080fd5b803590602001918460208302840111600160201b83111715620002b857600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955062000bec945050505050565b3480156200030457600080fd5b506200012260048036036101008110156200031e57600080fd5b6001600160a01b0382358116926020810135926040820135909216916060820135919081019060a081016080820135600160201b8111156200035f57600080fd5b8201836020820111156200037257600080fd5b803590602001918460208302840111600160201b831117156200039457600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115620003e457600080fd5b820183602082011115620003f757600080fd5b803590602001918460208302840111600160201b831117156200041957600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156200046957600080fd5b8201836020820111156200047c57600080fd5b803590602001918460208302840111600160201b831117156200049e57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505090356001600160a01b0316915062000d2d9050565b348015620004f557600080fd5b506200015b600480360360a08110156200050e57600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b8111156200053e57600080fd5b8201836020820111156200055157600080fd5b803590602001918460208302840111600160201b831117156200057357600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115620005c357600080fd5b820183602082011115620005d657600080fd5b803590602001918460208302840111600160201b83111715620005f857600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156200064857600080fd5b8201836020820111156200065b57600080fd5b803590602001918460208302840111600160201b831117156200067d57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955062000ef9945050505050565b348015620006c957600080fd5b506200015b62000fa2565b348015620006e157600080fd5b506200015b60048036036020811015620006fa57600080fd5b50356001600160a01b031662000fb8565b3480156200071857600080fd5b506200072362000fd6565b60408051918252519081900360200190f35b3480156200074257600080fd5b506200015b600480360360208110156200075b57600080fd5b503562000fdc565b3480156200077057600080fd5b506200015b600480360360a08110156200078957600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b811115620007b957600080fd5b820183602082011115620007cc57600080fd5b803590602001918460208302840111600160201b83111715620007ee57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156200083e57600080fd5b8201836020820111156200085157600080fd5b803590602001918460208302840111600160201b831117156200087357600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115620008c357600080fd5b820183602082011115620008d657600080fd5b803590602001918460208302840111600160201b83111715620008f857600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955062000ff1945050505050565b3480156200094457600080fd5b5062000122600480360360208110156200095d57600080fd5b50356001600160a01b03166200109b565b3480156200097b57600080fd5b5062000187620010fa565b3480156200099357600080fd5b50620001876200110e565b348015620009ab57600080fd5b50620001226004803603610100811015620009c557600080fd5b6001600160a01b0382358116926020810135926040820135909216916060820135919081019060a081016080820135600160201b81111562000a0657600080fd5b82018360208201111562000a1957600080fd5b803590602001918460208302840111600160201b8311171562000a3b57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111562000a8b57600080fd5b82018360208201111562000a9e57600080fd5b803590602001918460208302840111600160201b8311171562000ac057600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111562000b1057600080fd5b82018360208201111562000b2357600080fd5b803590602001918460208302840111600160201b8311171562000b4557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505090356001600160a01b031691506200111d9050565b60086020526000908152604090205460ff1681565b6007546001600160a01b031681565b60046020526000908152604090205460ff1681565b60016020526000908152604090205460ff1681565b6005546001600160a01b031681565b60005460ff161562000bfd57600080fd5b600080546001600160a01b0380861661010002610100600160a81b0319909216919091178255600580548583166001600160a01b0319918216179182905560068054909116919092161790555b81518160ff16101562000c835762000c79828260ff168151811062000c6b57fe5b60200260200101516200147d565b5060010162000c4a565b506000805260086020527f5eff886ea0ce6ca488a3d6e336d6c0f75f46d19b42c06ce5ee98e42c96d256c7805460ff1916600117905560405162000cc790620017fa565b604051809103906000f08015801562000ce4573d6000803e3d6000fd5b50600780546001600160a01b0319166001600160a01b039283161790819055166000908152600860205260408120805460ff199081166001908117909255825416179055505050565b6007546001600160a01b0389811691161462000d4857600080fd5b6006546040805163a10cda9960e01b81526001600160a01b03848116600483015289811660248301529151919092169163a10cda99916044808301926020929190829003018186803b15801562000d9e57600080fd5b505afa15801562000db3573d6000803e3d6000fd5b505050506040513d602081101562000dca57600080fd5b505162000dd657600080fd5b60008581526003602052604090205460ff161562000df357600080fd5b6040805160608a811b6bffffffffffffffffffffffff19908116602080850191909152603484018c90528a831b82166054850152606884018a90529185901b1660888301528251808303607c018152609c909201909252805191012062000e5d90858585620014d7565b62000e6757600080fd5b60075460408051633c37699760e21b81526001600160a01b038981166004830152602482018b90529151919092169163f0dda65c91604480830192600092919082900301818387803b15801562000ebd57600080fd5b505af115801562000ed2573d6000803e3d6000fd5b50505060009586525050600360205250506040909120805460ff1916600117905550505050565b60008481526003602052604081205460ff161562000f1657600080fd5b62000f67868660405160200180836001600160a01b03166001600160a01b031660601b81526014018281526020019250505060405160208183030381529060405280519060200120858585620014d7565b62000f7157600080fd5b62000f7c86620016d9565b506000848152600360205260409020805460ff1916600190811790915595945050505050565b60005461010090046001600160a01b0316331490565b6001600160a01b031660009081526008602052604090205460ff1690565b60025481565b60036020526000908152604090205460ff1681565b60008481526003602052604081205460ff16156200100e57600080fd5b6200105f868660405160200180836001600160a01b03166001600160a01b031660601b81526014018281526020019250505060405160208183030381529060405280519060200120858585620014d7565b6200106957600080fd5b62001074866200147d565b50506000848152600360205260409020805460ff1916600190811790915595945050505050565b620010a562000fa2565b620010af57600080fd5b6001600160a01b03811660009081526008602052604090205460ff1615620010d657600080fd5b6001600160a01b03166000908152600860205260409020805460ff19166001179055565b60005461010090046001600160a01b031681565b6006546001600160a01b031681565b620011288862000fb8565b6200113257600080fd5b6006546040805163a10cda9960e01b81526001600160a01b03848116600483015289811660248301529151919092169163a10cda99916044808301926020929190829003018186803b1580156200118857600080fd5b505afa1580156200119d573d6000803e3d6000fd5b505050506040513d6020811015620011b457600080fd5b5051620011c057600080fd5b60008581526003602052604090205460ff1615620011dd57600080fd5b6040805160608a811b6bffffffffffffffffffffffff19908116602080850191909152603484018c90528a831b82166054850152606884018a90529185901b1660888301528251808303607c018152609c90920190925280519101206200124790858585620014d7565b6200125157600080fd5b6001600160a01b0388166200130a573031871115620012b557604080516001600160a01b03808b1682528816602082015281517f33d1e0301846de1496df73b1da3d17c85b7266dd832d21e10ff21a1f143ef293929181900390910190a162001304565b600085815260036020526040808220805460ff19166001179055516001600160a01b0388169189156108fc02918a91818181858888f1935050505015801562001302573d6000803e3d6000fd5b505b62001473565b604080516370a0823160e01b81523060048201529051899189916001600160a01b038416916370a08231916024808301926020929190829003018186803b1580156200135557600080fd5b505afa1580156200136a573d6000803e3d6000fd5b505050506040513d60208110156200138157600080fd5b50511015620013d557604080516001600160a01b03808c1682528916602082015281517f33d1e0301846de1496df73b1da3d17c85b7266dd832d21e10ff21a1f143ef293929181900390910190a162001471565b6000868152600360209081526040808320805460ff19166001179055805163a9059cbb60e01b81526001600160a01b038b81166004830152602482018d905291519185169363a9059cbb9360448084019491939192918390030190829087803b1580156200144257600080fd5b505af115801562001457573d6000803e3d6000fd5b505050506040513d60208110156200146e57600080fd5b50505b505b5050505050505050565b6001600160a01b03811660009081526001602052604081205460ff1615620014a457600080fd5b506001600160a01b03166000908152600160208190526040909120805460ff191682179055600280549091019081905590565b600060016002541015620014ea57600080fd5b8251845114620014f957600080fd5b81518351146200150857600080fd5b60006003600160025403816200151a57fe5b0460025403905080835110156200153057600080fd5b60008090506060845160405190808252806020026020018201604052801562001563578160200160208202803883390190505b50905060005b855181101562001671576000620015bf8a8a84815181106200158757fe5b60200260200101518a85815181106200159c57fe5b60200260200101518a8681518110620015b157fe5b602002602001015162001730565b6001600160a01b03811660009081526001602081905260409091205491925060ff90911615151415806200161057506001600160a01b03811660009081526004602052604090205460ff1615156001145b156200161d575062001668565b808385815181106200162b57fe5b6001600160a01b0392831660209182029290920181019190915291166000908152600490915260409020805460ff19166001908117909155909201915b60010162001569565b5060005b82811015620016cc576000600460008484815181106200169157fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905560010162001675565b5050101595945050505050565b6001600160a01b03811660009081526001602081905260409091205460ff161515146200170557600080fd5b6001600160a01b03166000908152600160205260409020805460ff1916905560028054600019019055565b6000808560405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c01828152602001915050604051602081830303815290604052805190602001209050600060018287878760405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015620017e4573d6000803e3d6000fd5b5050604051601f19015198975050505050505050565b610da580620018098339019056fe60806040523480156200001157600080fd5b506040518060400160405280600a81526020017f536f726120546f6b656e000000000000000000000000000000000000000000008152506040518060400160405280600381526020017f584f520000000000000000000000000000000000000000000000000000000000815250601282600390805190602001906200009892919062000204565b508151620000ae90600490602085019062000204565b506005805460ff191660ff9290921691909117610100600160a81b03191661010033810291909117918290556040516001600160a01b0391909204169250600091507f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a36200012b3360006001600160e01b036200013116565b620002a9565b6001600160a01b0382166200014557600080fd5b6200016181600254620001ea60201b620008901790919060201c565b6002556001600160a01b038216600090815260208181526040909120546200019491839062000890620001ea821b17901c565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600082820183811015620001fd57600080fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200024757805160ff191683800117855562000277565b8280016001018555821562000277579182015b82811115620002775782518255916020019190600101906200025a565b506200028592915062000289565b5090565b620002a691905b8082111562000285576000815560010162000290565b90565b610aec80620002b96000396000f3fe608060405234801561001057600080fd5b50600436106101215760003560e01c8063715018a6116100ad578063a457c2d711610071578063a457c2d714610332578063a9059cbb1461035e578063dd62ed3e1461038a578063f0dda65c146103b8578063f2fde38b146103e457610121565b8063715018a6146102ca57806379cc6790146102d25780638da5cb5b146102fe5780638f32d59b1461032257806395d89b411461032a57610121565b80632ff2e9dc116100f45780632ff2e9dc14610233578063313ce5671461023b578063395093511461025957806342966c681461028557806370a08231146102a457610121565b806306fdde0314610126578063095ea7b3146101a357806318160ddd146101e357806323b872dd146101fd575b600080fd5b61012e61040a565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610168578181015183820152602001610150565b50505050905090810190601f1680156101955780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101cf600480360360408110156101b957600080fd5b506001600160a01b0381351690602001356104a0565b604080519115158252519081900360200190f35b6101eb6104b6565b60408051918252519081900360200190f35b6101cf6004803603606081101561021357600080fd5b506001600160a01b038135811691602081013590911690604001356104bc565b6101eb610513565b610243610518565b6040805160ff9092168252519081900360200190f35b6101cf6004803603604081101561026f57600080fd5b506001600160a01b038135169060200135610521565b6102a26004803603602081101561029b57600080fd5b503561055d565b005b6101eb600480360360208110156102ba57600080fd5b50356001600160a01b031661056a565b6102a2610585565b6102a2600480360360408110156102e857600080fd5b506001600160a01b0381351690602001356105e6565b6103066105f4565b604080516001600160a01b039092168252519081900360200190f35b6101cf610608565b61012e61061e565b6101cf6004803603604081101561034857600080fd5b506001600160a01b03813516906020013561067f565b6101cf6004803603604081101561037457600080fd5b506001600160a01b0381351690602001356106bb565b6101eb600480360360408110156103a057600080fd5b506001600160a01b03813581169160200135166106c8565b6102a2600480360360408110156103ce57600080fd5b506001600160a01b0381351690602001356106f3565b6102a2600480360360208110156103fa57600080fd5b50356001600160a01b031661070e565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104965780601f1061046b57610100808354040283529160200191610496565b820191906000526020600020905b81548152906001019060200180831161047957829003601f168201915b5050505050905090565b60006104ad338484610728565b50600192915050565b60025490565b60006104c98484846107b0565b6001600160a01b038416600090815260016020908152604080832033808552925290912054610509918691610504908663ffffffff61087b16565b610728565b5060019392505050565b600081565b60055460ff1690565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916104ad918590610504908663ffffffff61089016565b61056733826108a9565b50565b6001600160a01b031660009081526020819052604090205490565b61058d610608565b61059657600080fd5b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360058054610100600160a81b0319169055565b6105f08282610950565b5050565b60055461010090046001600160a01b031690565b60055461010090046001600160a01b0316331490565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104965780601f1061046b57610100808354040283529160200191610496565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916104ad918590610504908663ffffffff61087b16565b60006104ad3384846107b0565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6106fb610608565b61070457600080fd5b6105f08282610995565b610716610608565b61071f57600080fd5b61056781610a3d565b6001600160a01b03821661073b57600080fd5b6001600160a01b03831661074e57600080fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0382166107c357600080fd5b6001600160a01b0383166000908152602081905260409020546107ec908263ffffffff61087b16565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610821908263ffffffff61089016565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008282111561088a57600080fd5b50900390565b6000828201838110156108a257600080fd5b9392505050565b6001600160a01b0382166108bc57600080fd5b6002546108cf908263ffffffff61087b16565b6002556001600160a01b0382166000908152602081905260409020546108fb908263ffffffff61087b16565b6001600160a01b038316600081815260208181526040808320949094558351858152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35050565b61095a82826108a9565b6001600160a01b0382166000908152600160209081526040808320338085529252909120546105f0918491610504908563ffffffff61087b16565b6001600160a01b0382166109a857600080fd5b6002546109bb908263ffffffff61089016565b6002556001600160a01b0382166000908152602081905260409020546109e7908263ffffffff61089016565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6001600160a01b038116610a5057600080fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0390921661010002610100600160a81b031990921691909117905556fea265627a7a72305820332223d26ddabcb0063e47e2563255a244ad435fb5313e225d08e2c9862bdb6564736f6c63430005090032a265627a7a7230582017ea3a671ae5522e22409e3138cd555aec75d88ae472d0e9fc952334801987a164736f6c6343000509003260806040523480156200001157600080fd5b506040518060400160405280600a81526020017f536f726120546f6b656e000000000000000000000000000000000000000000008152506040518060400160405280600381526020017f584f520000000000000000000000000000000000000000000000000000000000815250601282600390805190602001906200009892919062000204565b508151620000ae90600490602085019062000204565b506005805460ff191660ff9290921691909117610100600160a81b03191661010033810291909117918290556040516001600160a01b0391909204169250600091507f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a36200012b3360006001600160e01b036200013116565b620002a9565b6001600160a01b0382166200014557600080fd5b6200016181600254620001ea60201b620008901790919060201c565b6002556001600160a01b038216600090815260208181526040909120546200019491839062000890620001ea821b17901c565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600082820183811015620001fd57600080fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200024757805160ff191683800117855562000277565b8280016001018555821562000277579182015b82811115620002775782518255916020019190600101906200025a565b506200028592915062000289565b5090565b620002a691905b8082111562000285576000815560010162000290565b90565b610aec80620002b96000396000f3fe608060405234801561001057600080fd5b50600436106101215760003560e01c8063715018a6116100ad578063a457c2d711610071578063a457c2d714610332578063a9059cbb1461035e578063dd62ed3e1461038a578063f0dda65c146103b8578063f2fde38b146103e457610121565b8063715018a6146102ca57806379cc6790146102d25780638da5cb5b146102fe5780638f32d59b1461032257806395d89b411461032a57610121565b80632ff2e9dc116100f45780632ff2e9dc14610233578063313ce5671461023b578063395093511461025957806342966c681461028557806370a08231146102a457610121565b806306fdde0314610126578063095ea7b3146101a357806318160ddd146101e357806323b872dd146101fd575b600080fd5b61012e61040a565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610168578181015183820152602001610150565b50505050905090810190601f1680156101955780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101cf600480360360408110156101b957600080fd5b506001600160a01b0381351690602001356104a0565b604080519115158252519081900360200190f35b6101eb6104b6565b60408051918252519081900360200190f35b6101cf6004803603606081101561021357600080fd5b506001600160a01b038135811691602081013590911690604001356104bc565b6101eb610513565b610243610518565b6040805160ff9092168252519081900360200190f35b6101cf6004803603604081101561026f57600080fd5b506001600160a01b038135169060200135610521565b6102a26004803603602081101561029b57600080fd5b503561055d565b005b6101eb600480360360208110156102ba57600080fd5b50356001600160a01b031661056a565b6102a2610585565b6102a2600480360360408110156102e857600080fd5b506001600160a01b0381351690602001356105e6565b6103066105f4565b604080516001600160a01b039092168252519081900360200190f35b6101cf610608565b61012e61061e565b6101cf6004803603604081101561034857600080fd5b506001600160a01b03813516906020013561067f565b6101cf6004803603604081101561037457600080fd5b506001600160a01b0381351690602001356106bb565b6101eb600480360360408110156103a057600080fd5b506001600160a01b03813581169160200135166106c8565b6102a2600480360360408110156103ce57600080fd5b506001600160a01b0381351690602001356106f3565b6102a2600480360360208110156103fa57600080fd5b50356001600160a01b031661070e565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104965780601f1061046b57610100808354040283529160200191610496565b820191906000526020600020905b81548152906001019060200180831161047957829003601f168201915b5050505050905090565b60006104ad338484610728565b50600192915050565b60025490565b60006104c98484846107b0565b6001600160a01b038416600090815260016020908152604080832033808552925290912054610509918691610504908663ffffffff61087b16565b610728565b5060019392505050565b600081565b60055460ff1690565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916104ad918590610504908663ffffffff61089016565b61056733826108a9565b50565b6001600160a01b031660009081526020819052604090205490565b61058d610608565b61059657600080fd5b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360058054610100600160a81b0319169055565b6105f08282610950565b5050565b60055461010090046001600160a01b031690565b60055461010090046001600160a01b0316331490565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104965780601f1061046b57610100808354040283529160200191610496565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916104ad918590610504908663ffffffff61087b16565b60006104ad3384846107b0565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6106fb610608565b61070457600080fd5b6105f08282610995565b610716610608565b61071f57600080fd5b61056781610a3d565b6001600160a01b03821661073b57600080fd5b6001600160a01b03831661074e57600080fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0382166107c357600080fd5b6001600160a01b0383166000908152602081905260409020546107ec908263ffffffff61087b16565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610821908263ffffffff61089016565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008282111561088a57600080fd5b50900390565b6000828201838110156108a257600080fd5b9392505050565b6001600160a01b0382166108bc57600080fd5b6002546108cf908263ffffffff61087b16565b6002556001600160a01b0382166000908152602081905260409020546108fb908263ffffffff61087b16565b6001600160a01b038316600081815260208181526040808320949094558351858152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35050565b61095a82826108a9565b6001600160a01b0382166000908152600160209081526040808320338085529252909120546105f0918491610504908563ffffffff61087b16565b6001600160a01b0382166109a857600080fd5b6002546109bb908263ffffffff61089016565b6002556001600160a01b0382166000908152602081905260409020546109e7908263ffffffff61089016565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6001600160a01b038116610a5057600080fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0390921661010002610100600160a81b031990921691909117905556fea265627a7a72305820332223d26ddabcb0063e47e2563255a244ad435fb5313e225d08e2c9862bdb6564736f6c63430005090032"; public static final String FUNC_ISTOKEN = "isToken"; public static final String FUNC_XORTOKENINSTANCE = "xorTokenInstance"; public static final String FUNC_UNIQUEADDRESSES = "uniqueAddresses"; public static final String FUNC_ISPEER = "isPeer"; public static final String FUNC_RELAYREGISTRYADDRESS = "relayRegistryAddress"; public static final String FUNC_INITIALIZE = "initialize"; public static final String FUNC_MINTTOKENSBYPEERS = "mintTokensByPeers"; public static final String FUNC_REMOVEPEERBYPEER = "removePeerByPeer"; public static final String FUNC_ISOWNER = "isOwner"; public static final String FUNC_CHECKTOKENADDRESS = "checkTokenAddress"; public static final String FUNC_PEERSCOUNT = "peersCount"; public static final String FUNC_USED = "used"; public static final String FUNC_ADDPEERBYPEER = "addPeerByPeer"; public static final String FUNC_ADDTOKEN = "addToken"; public static final String FUNC_OWNER_ = "owner_"; public static final String FUNC_RELAYREGISTRYINSTANCE = "relayRegistryInstance"; public static final String FUNC_WITHDRAW = "withdraw"; public static final Event INSUFFICIENTFUNDSFORWITHDRAWAL_EVENT = new Event("InsufficientFundsForWithdrawal", Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {})); ; @Deprecated protected MasterRelayed(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); } protected MasterRelayed(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { super(BINARY, contractAddress, web3j, credentials, contractGasProvider); } @Deprecated protected MasterRelayed(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); } protected MasterRelayed(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); } public RemoteCall<Boolean> isToken(String param0) { final Function function = new Function(FUNC_ISTOKEN, Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(param0)), Arrays.<TypeReference<?>>asList(new TypeReference<Bool>() {})); return executeRemoteCallSingleValueReturn(function, Boolean.class); } public RemoteCall<String> xorTokenInstance() { final Function function = new Function(FUNC_XORTOKENINSTANCE, Arrays.<Type>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {})); return executeRemoteCallSingleValueReturn(function, String.class); } public RemoteCall<Boolean> uniqueAddresses(String param0) { final Function function = new Function(FUNC_UNIQUEADDRESSES, Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(param0)), Arrays.<TypeReference<?>>asList(new TypeReference<Bool>() {})); return executeRemoteCallSingleValueReturn(function, Boolean.class); } public RemoteCall<Boolean> isPeer(String param0) { final Function function = new Function(FUNC_ISPEER, Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(param0)), Arrays.<TypeReference<?>>asList(new TypeReference<Bool>() {})); return executeRemoteCallSingleValueReturn(function, Boolean.class); } public RemoteCall<String> relayRegistryAddress() { final Function function = new Function(FUNC_RELAYREGISTRYADDRESS, Arrays.<Type>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {})); return executeRemoteCallSingleValueReturn(function, String.class); } public RemoteCall<TransactionReceipt> initialize(String owner, String relayRegistry, List<String> initialPeers) { final Function function = new Function( FUNC_INITIALIZE, Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(owner), new org.web3j.abi.datatypes.Address(relayRegistry), new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.Address>( org.web3j.abi.datatypes.Address.class, org.web3j.abi.Utils.typeMap(initialPeers, org.web3j.abi.datatypes.Address.class))), Collections.<TypeReference<?>>emptyList()); return executeRemoteCallTransaction(function); } public RemoteCall<TransactionReceipt> mintTokensByPeers(String tokenAddress, BigInteger amount, String beneficiary, byte[] txHash, List<BigInteger> v, List<byte[]> r, List<byte[]> s, String from) { final Function function = new Function( FUNC_MINTTOKENSBYPEERS, Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(tokenAddress), new org.web3j.abi.datatypes.generated.Uint256(amount), new org.web3j.abi.datatypes.Address(beneficiary), new org.web3j.abi.datatypes.generated.Bytes32(txHash), new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Uint8>( org.web3j.abi.datatypes.generated.Uint8.class, org.web3j.abi.Utils.typeMap(v, org.web3j.abi.datatypes.generated.Uint8.class)), new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Bytes32>( org.web3j.abi.datatypes.generated.Bytes32.class, org.web3j.abi.Utils.typeMap(r, org.web3j.abi.datatypes.generated.Bytes32.class)), new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Bytes32>( org.web3j.abi.datatypes.generated.Bytes32.class, org.web3j.abi.Utils.typeMap(s, org.web3j.abi.datatypes.generated.Bytes32.class)), new org.web3j.abi.datatypes.Address(from)), Collections.<TypeReference<?>>emptyList()); return executeRemoteCallTransaction(function); } public RemoteCall<TransactionReceipt> removePeerByPeer(String peerAddress, byte[] txHash, List<BigInteger> v, List<byte[]> r, List<byte[]> s) { final Function function = new Function( FUNC_REMOVEPEERBYPEER, Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(peerAddress), new org.web3j.abi.datatypes.generated.Bytes32(txHash), new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Uint8>( org.web3j.abi.datatypes.generated.Uint8.class, org.web3j.abi.Utils.typeMap(v, org.web3j.abi.datatypes.generated.Uint8.class)), new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Bytes32>( org.web3j.abi.datatypes.generated.Bytes32.class, org.web3j.abi.Utils.typeMap(r, org.web3j.abi.datatypes.generated.Bytes32.class)), new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Bytes32>( org.web3j.abi.datatypes.generated.Bytes32.class, org.web3j.abi.Utils.typeMap(s, org.web3j.abi.datatypes.generated.Bytes32.class))), Collections.<TypeReference<?>>emptyList()); return executeRemoteCallTransaction(function); } public RemoteCall<Boolean> isOwner() { final Function function = new Function(FUNC_ISOWNER, Arrays.<Type>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<Bool>() {})); return executeRemoteCallSingleValueReturn(function, Boolean.class); } public RemoteCall<Boolean> checkTokenAddress(String tokenAddress) { final Function function = new Function(FUNC_CHECKTOKENADDRESS, Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(tokenAddress)), Arrays.<TypeReference<?>>asList(new TypeReference<Bool>() {})); return executeRemoteCallSingleValueReturn(function, Boolean.class); } public RemoteCall<BigInteger> peersCount() { final Function function = new Function(FUNC_PEERSCOUNT, Arrays.<Type>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {})); return executeRemoteCallSingleValueReturn(function, BigInteger.class); } public RemoteCall<Boolean> used(byte[] param0) { final Function function = new Function(FUNC_USED, Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Bytes32(param0)), Arrays.<TypeReference<?>>asList(new TypeReference<Bool>() {})); return executeRemoteCallSingleValueReturn(function, Boolean.class); } public RemoteCall<TransactionReceipt> addPeerByPeer(String newPeerAddress, byte[] txHash, List<BigInteger> v, List<byte[]> r, List<byte[]> s) { final Function function = new Function( FUNC_ADDPEERBYPEER, Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(newPeerAddress), new org.web3j.abi.datatypes.generated.Bytes32(txHash), new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Uint8>( org.web3j.abi.datatypes.generated.Uint8.class, org.web3j.abi.Utils.typeMap(v, org.web3j.abi.datatypes.generated.Uint8.class)), new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Bytes32>( org.web3j.abi.datatypes.generated.Bytes32.class, org.web3j.abi.Utils.typeMap(r, org.web3j.abi.datatypes.generated.Bytes32.class)), new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Bytes32>( org.web3j.abi.datatypes.generated.Bytes32.class, org.web3j.abi.Utils.typeMap(s, org.web3j.abi.datatypes.generated.Bytes32.class))), Collections.<TypeReference<?>>emptyList()); return executeRemoteCallTransaction(function); } public RemoteCall<TransactionReceipt> addToken(String newToken) { final Function function = new Function( FUNC_ADDTOKEN, Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(newToken)), Collections.<TypeReference<?>>emptyList()); return executeRemoteCallTransaction(function); } public RemoteCall<String> owner_() { final Function function = new Function(FUNC_OWNER_, Arrays.<Type>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {})); return executeRemoteCallSingleValueReturn(function, String.class); } public RemoteCall<String> relayRegistryInstance() { final Function function = new Function(FUNC_RELAYREGISTRYINSTANCE, Arrays.<Type>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {})); return executeRemoteCallSingleValueReturn(function, String.class); } public RemoteCall<TransactionReceipt> withdraw(String tokenAddress, BigInteger amount, String to, byte[] txHash, List<BigInteger> v, List<byte[]> r, List<byte[]> s, String from) { final Function function = new Function( FUNC_WITHDRAW, Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(tokenAddress), new org.web3j.abi.datatypes.generated.Uint256(amount), new org.web3j.abi.datatypes.Address(to), new org.web3j.abi.datatypes.generated.Bytes32(txHash), new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Uint8>( org.web3j.abi.datatypes.generated.Uint8.class, org.web3j.abi.Utils.typeMap(v, org.web3j.abi.datatypes.generated.Uint8.class)), new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Bytes32>( org.web3j.abi.datatypes.generated.Bytes32.class, org.web3j.abi.Utils.typeMap(r, org.web3j.abi.datatypes.generated.Bytes32.class)), new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Bytes32>( org.web3j.abi.datatypes.generated.Bytes32.class, org.web3j.abi.Utils.typeMap(s, org.web3j.abi.datatypes.generated.Bytes32.class)), new org.web3j.abi.datatypes.Address(from)), Collections.<TypeReference<?>>emptyList()); return executeRemoteCallTransaction(function); } public List<InsufficientFundsForWithdrawalEventResponse> getInsufficientFundsForWithdrawalEvents(TransactionReceipt transactionReceipt) { List<Contract.EventValuesWithLog> valueList = extractEventParametersWithLog(INSUFFICIENTFUNDSFORWITHDRAWAL_EVENT, transactionReceipt); ArrayList<InsufficientFundsForWithdrawalEventResponse> responses = new ArrayList<InsufficientFundsForWithdrawalEventResponse>(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { InsufficientFundsForWithdrawalEventResponse typedResponse = new InsufficientFundsForWithdrawalEventResponse(); typedResponse.log = eventValues.getLog(); typedResponse.asset = (String) eventValues.getNonIndexedValues().get(0).getValue(); typedResponse.recipient = (String) eventValues.getNonIndexedValues().get(1).getValue(); responses.add(typedResponse); } return responses; } public Flowable<InsufficientFundsForWithdrawalEventResponse> insufficientFundsForWithdrawalEventFlowable(EthFilter filter) { return web3j.ethLogFlowable(filter).map(new io.reactivex.functions.Function<Log, InsufficientFundsForWithdrawalEventResponse>() { @Override public InsufficientFundsForWithdrawalEventResponse apply(Log log) { Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(INSUFFICIENTFUNDSFORWITHDRAWAL_EVENT, log); InsufficientFundsForWithdrawalEventResponse typedResponse = new InsufficientFundsForWithdrawalEventResponse(); typedResponse.log = log; typedResponse.asset = (String) eventValues.getNonIndexedValues().get(0).getValue(); typedResponse.recipient = (String) eventValues.getNonIndexedValues().get(1).getValue(); return typedResponse; } }); } public Flowable<InsufficientFundsForWithdrawalEventResponse> insufficientFundsForWithdrawalEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); filter.addSingleTopic(EventEncoder.encode(INSUFFICIENTFUNDSFORWITHDRAWAL_EVENT)); return insufficientFundsForWithdrawalEventFlowable(filter); } @Deprecated public static MasterRelayed load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { return new MasterRelayed(contractAddress, web3j, credentials, gasPrice, gasLimit); } @Deprecated public static MasterRelayed load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { return new MasterRelayed(contractAddress, web3j, transactionManager, gasPrice, gasLimit); } public static MasterRelayed load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { return new MasterRelayed(contractAddress, web3j, credentials, contractGasProvider); } public static MasterRelayed load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { return new MasterRelayed(contractAddress, web3j, transactionManager, contractGasProvider); } public static RemoteCall<MasterRelayed> deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider, String relayRegistry, List<String> initialPeers) { String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(relayRegistry), new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.Address>( org.web3j.abi.datatypes.Address.class, org.web3j.abi.Utils.typeMap(initialPeers, org.web3j.abi.datatypes.Address.class)))); return deployRemoteCall(MasterRelayed.class, web3j, credentials, contractGasProvider, BINARY, encodedConstructor); } public static RemoteCall<MasterRelayed> deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider, String relayRegistry, List<String> initialPeers) { String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(relayRegistry), new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.Address>( org.web3j.abi.datatypes.Address.class, org.web3j.abi.Utils.typeMap(initialPeers, org.web3j.abi.datatypes.Address.class)))); return deployRemoteCall(MasterRelayed.class, web3j, transactionManager, contractGasProvider, BINARY, encodedConstructor); } @Deprecated public static RemoteCall<MasterRelayed> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, String relayRegistry, List<String> initialPeers) { String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(relayRegistry), new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.Address>( org.web3j.abi.datatypes.Address.class, org.web3j.abi.Utils.typeMap(initialPeers, org.web3j.abi.datatypes.Address.class)))); return deployRemoteCall(MasterRelayed.class, web3j, credentials, gasPrice, gasLimit, BINARY, encodedConstructor); } @Deprecated public static RemoteCall<MasterRelayed> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, String relayRegistry, List<String> initialPeers) { String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(relayRegistry), new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.Address>( org.web3j.abi.datatypes.Address.class, org.web3j.abi.Utils.typeMap(initialPeers, org.web3j.abi.datatypes.Address.class)))); return deployRemoteCall(MasterRelayed.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor); } public static class InsufficientFundsForWithdrawalEventResponse { public Log log; public String asset; public String recipient; } }
[ "noreply@github.com" ]
noreply@github.com
b5202c761610a1da43589cee6f711bf600717a01
e3f68a447ad0c59474c94982b1081853a33582f3
/src/main/java/cn/fjut/gmxx/exception/GlobalException.java
da03705e2c4d2ec6edce39c1ec85513f0913c9ad
[]
no_license
shenjindui/campus-club-redis-chat
bec566c8b2904ebf8311f413c2dc65935ef3e3a9
e676074235a1c377f81b7104211766e9589a6a87
refs/heads/master
2022-06-12T16:21:54.346432
2020-05-05T15:24:53
2020-05-05T15:24:53
261,508,979
0
0
null
null
null
null
UTF-8
Java
false
false
305
java
package cn.fjut.gmxx.exception; import lombok.Getter; import lombok.Setter; /** * 全局Runtime异常捕获 * */ public class GlobalException extends RuntimeException { @Getter @Setter private String msg; public GlobalException(String message) { this.msg = message; } }
[ "2802630961@qq.com" ]
2802630961@qq.com
0c32c0ca7298e31d47442faa96563407607720ff
f42d7da85f9633cfb84371ae67f6d3469f80fdcb
/com4j-20120426-2/samples/excel/build/src/excel/IRoutingSlip.java
f7b16dcb869a4b5936eaacf3570fc70cb493e1ae
[ "BSD-2-Clause" ]
permissive
LoongYou/Wanda
ca89ac03cc179cf761f1286172d36ead41f036b5
2c2c4d1d14e95e98c0a3af365495ec53775cc36b
refs/heads/master
2023-03-14T13:14:38.476457
2021-03-06T10:20:37
2021-03-06T10:20:37
231,610,760
1
0
null
null
null
null
UTF-8
Java
false
false
4,151
java
package excel ; import com4j.*; @IID("{000208AA-0001-0000-C000-000000000046}") public interface IRoutingSlip extends Com4jObject { // Methods: /** * <p> * Getter method for the COM property "Application" * </p> * @return Returns a value of type excel._Application */ @VTID(7) excel._Application getApplication(); /** * <p> * Getter method for the COM property "Creator" * </p> * @return Returns a value of type excel.XlCreator */ @VTID(8) excel.XlCreator getCreator(); /** * <p> * Getter method for the COM property "Parent" * </p> * @return Returns a value of type com4j.Com4jObject */ @VTID(9) @ReturnValue(type=NativeType.Dispatch) com4j.Com4jObject getParent(); /** * <p> * Getter method for the COM property "Delivery" * </p> * @return Returns a value of type excel.XlRoutingSlipDelivery */ @VTID(10) excel.XlRoutingSlipDelivery getDelivery(); /** * <p> * Setter method for the COM property "Delivery" * </p> * @param rhs Mandatory excel.XlRoutingSlipDelivery parameter. */ @VTID(11) void setDelivery( excel.XlRoutingSlipDelivery rhs); /** * <p> * Getter method for the COM property "Message" * </p> * @return Returns a value of type java.lang.Object */ @VTID(12) @ReturnValue(type=NativeType.VARIANT) java.lang.Object getMessage(); /** * <p> * Setter method for the COM property "Message" * </p> * @param rhs Mandatory java.lang.Object parameter. */ @VTID(13) void setMessage( @MarshalAs(NativeType.VARIANT) java.lang.Object rhs); /** * <p> * Getter method for the COM property "Recipients" * </p> * @param index Optional parameter. Default value is com4j.Variant.getMissing() * @return Returns a value of type java.lang.Object */ @VTID(14) @ReturnValue(type=NativeType.VARIANT) java.lang.Object getRecipients( @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object index); /** * <p> * Setter method for the COM property "Recipients" * </p> * @param index Optional parameter. Default value is com4j.Variant.getMissing() * @param rhs Mandatory java.lang.Object parameter. */ @VTID(15) void setRecipients( @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object index, @MarshalAs(NativeType.VARIANT) java.lang.Object rhs); /** * @return Returns a value of type java.lang.Object */ @VTID(16) @ReturnValue(type=NativeType.VARIANT) java.lang.Object reset(); /** * <p> * Getter method for the COM property "ReturnWhenDone" * </p> * @return Returns a value of type boolean */ @VTID(17) boolean getReturnWhenDone(); /** * <p> * Setter method for the COM property "ReturnWhenDone" * </p> * @param rhs Mandatory boolean parameter. */ @VTID(18) void setReturnWhenDone( boolean rhs); /** * <p> * Getter method for the COM property "Status" * </p> * @return Returns a value of type excel.XlRoutingSlipStatus */ @VTID(19) excel.XlRoutingSlipStatus getStatus(); /** * <p> * Getter method for the COM property "Subject" * </p> * @return Returns a value of type java.lang.Object */ @VTID(20) @ReturnValue(type=NativeType.VARIANT) java.lang.Object getSubject(); /** * <p> * Setter method for the COM property "Subject" * </p> * @param rhs Mandatory java.lang.Object parameter. */ @VTID(21) void setSubject( @MarshalAs(NativeType.VARIANT) java.lang.Object rhs); /** * <p> * Getter method for the COM property "TrackStatus" * </p> * @return Returns a value of type boolean */ @VTID(22) boolean getTrackStatus(); /** * <p> * Setter method for the COM property "TrackStatus" * </p> * @param rhs Mandatory boolean parameter. */ @VTID(23) void setTrackStatus( boolean rhs); // Properties: }
[ "815234949@qq.com" ]
815234949@qq.com
61a02c4eefdc2802715f2797acd0503e95099ae3
aabb2b00c0050bc717a8e9042b8d54ad21e871b9
/Algorithm/src/LeetCode/Q171_Excel_Sheet_Column_Number.java
b8d89090302376988a5be708fc76905a21c8fbd6
[]
no_license
littlexiaoxiao/Algorithm
7da4427bf7aeae110578077c746dcfd1a9f4b235
ff9b088558f1ba58fc48ffda404067a5d355f9eb
refs/heads/master
2016-09-06T01:10:05.260434
2015-09-22T03:11:16
2015-09-22T03:11:16
42,678,320
0
0
null
null
null
null
UTF-8
Java
false
false
610
java
package LeetCode; public class Q171_Excel_Sheet_Column_Number { public static void main(String[] args) { String s= "BA"; int res = titleToNumber(s); System.out.println(res); } public static int titleToNumber(String s) { if(s == null || s.length() == 0) return 0; //26进制 → 十进制 26^0, 26^1... String str = new StringBuilder(s).reverse().toString(); System.out.println(str); int res = 0; for(int i = 0; i< str.length(); i++){ res += Math.pow(26, i) * (str.charAt(i) -'A' + 1); } return res; } }
[ "maojiewen@maojiewens-air.wv.cc.cmu.edu" ]
maojiewen@maojiewens-air.wv.cc.cmu.edu
f20981a86af6450c45b4d8e25ad497c859933f95
69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e
/methods/Method_45262.java
862fc9d62e057b065b76d153a4bd5445a9c16b69
[]
no_license
P79N6A/icse_20_user_study
5b9c42c6384502fdc9588430899f257761f1f506
8a3676bc96059ea2c4f6d209016f5088a5628f3c
refs/heads/master
2020-06-24T08:25:22.606717
2019-07-25T15:31:16
2019-07-25T15:31:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
339
java
private Configuration createConfiguration(final TemplateLoader templateLoader,final Charset charset){ Configuration cfg=new Configuration(CURRENT_VERSION); cfg.setObjectWrapper(new DefaultObjectWrapperBuilder(CURRENT_VERSION).build()); cfg.setDefaultEncoding(charset.name()); cfg.setTemplateLoader(templateLoader); return cfg; }
[ "sonnguyen@utdallas.edu" ]
sonnguyen@utdallas.edu
1926227e6eb57d03ee9df0c84aad16c156a96d87
7f0f26dfdfb19f65694f57aa2297c53b5df14406
/rabbitMQ-log-Produce/src/main/java/com/cfyj/rabbitMQ/config/RoutingKey.java
b5f1cb2d68f94405b6af8e2d4771ed2a2024307b
[]
no_license
yqxz045000/springcloud
c5515d35d999531cf88d2b5a5b8192d1429ed2e6
933f53877528310114a6dbe91d0123bf7688d592
refs/heads/master
2020-03-25T08:00:34.133317
2018-08-05T08:16:25
2018-08-05T08:16:25
130,549,339
0
0
null
null
null
null
UTF-8
Java
false
false
372
java
package com.cfyj.rabbitMQ.config; /** * 路由key * @author exception * */ public class RoutingKey { public final static String log_warn = "log_warn"; public final static String log_debug = "log_debug"; public final static String log_info = "log_info"; public final static String log_error = "log_error"; public final static String log_user = "log.user"; }
[ "yqxz045000@163.com" ]
yqxz045000@163.com
0302fda0982b79628cbe68e69b08b5599ef1f96c
ae26066bf7b9ea7a061506ce6c707a5921a379e6
/src/main/java/PageFactory/GithubHomePage.java
54f3bac96e46f40cd66928c243fa498db1a4d65e
[]
no_license
MikaSilaen/UI_Automation_POM
e4506c2786bce6669cf4d2d52cf5ffbda70b193d
67e568164cc2ece340e0d61ce5ffdd985000309f
refs/heads/master
2023-03-21T16:31:56.539337
2021-03-09T09:05:43
2021-03-09T09:05:43
345,944,878
0
0
null
null
null
null
UTF-8
Java
false
false
670
java
package PageFactory; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; public class GithubHomePage { WebDriver driver; @FindBy(xpath="/html/body/div[1]/div/div[3]/nav/a[2]") WebElement homePageUserName; public GithubHomePage(WebDriver driver){ this.driver = driver; //This initElements method will create all WebElements PageFactory.initElements(driver, this); } //Get the User name from Home Page public String getHomePageDashboardUserName(){ return homePageUserName.getText(); } }
[ "adl.mikas@xl.co.id" ]
adl.mikas@xl.co.id
80cdcbbd0d45139178bacab7ef28515c74387aa2
1eef0e6c2d8220b747c59af1252fced23f1a53e9
/src/main/java/com/example/demo/House.java
198d7f9e12dc82c093a4a2817bc188c247ba3c37
[]
no_license
hayle778/204
7797abe8d798e3a08e3d022115a27f62a4325819
71221687e844e7fd752784f0467f35d7b9d42f1a
refs/heads/master
2020-08-07T15:50:12.868050
2019-10-08T01:11:44
2019-10-08T01:11:44
213,513,738
0
0
null
null
null
null
UTF-8
Java
false
false
958
java
package com.example.demo; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; public class House { @NotNull @Min(1) private long id; @NotNull @Size(min=3, max=20) private String name; @NotNull@Size(min=3, max=10) private String type; @NotNull@Size(min=10, max=30) private String description; public long getId() { return id; } public void setId(long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } }
[ "eden@Edens-MacBook-Pro.local" ]
eden@Edens-MacBook-Pro.local
685e3f3371cc269a9aff87d9a6fdb6dc9b793700
53ef934ae81c7f7ac8c88b1c653eee14525e8329
/src/impl/Floor.java
68a5a0d1f268cee58ee8b8591de88640386f2de5
[]
no_license
SharmaNehaa/ChristmasGame
93137c3d49e67d1d7dd53028ef084f8421e0477d
2f52dd68cdc1d908cbac7eaf8c287511d5647369
refs/heads/main
2023-05-27T21:57:14.760812
2021-06-07T20:48:26
2021-06-07T20:48:26
374,789,967
0
0
null
null
null
null
UTF-8
Java
false
false
528
java
package impl; import interfaces.FloorVisitor; import interfaces.Visitable; import model.VisitResponse; public class Floor implements Visitable { private int floorNumber; public Floor(int floorNumber) { this.floorNumber = floorNumber; } @Override public VisitResponse acceptVisit(FloorVisitor santa) { return santa.visit(this); } @Override public int getVisitableId() { return floorNumber; } public int getFloorNumber() { return floorNumber; } }
[ "vartikas@jivox.com" ]
vartikas@jivox.com
8707f56a8af123c63611bff07ba13ca30e363295
29b300111f9ab33d939536b674545d52e0a1dae2
/src/main/java/com/ccjjltx/observer/Person.java
6dfc6eb4b00bc3ee768380762637664145668745
[]
no_license
783081406/designPattern
325bae880c1ed42e65a5429062b2978834a4cdb6
8f61d321599eb1d9ebdaf681628a0bfd24bdaf11
refs/heads/master
2020-03-18T21:13:39.761289
2018-05-29T15:31:26
2018-05-29T15:31:26
135,267,843
0
0
null
null
null
null
UTF-8
Java
false
false
925
java
package com.ccjjltx.observer; import java.util.Observable; public class Person extends Observable { private String name; private String sex; private int age; public String getName() { return name; } public void setName(String name) { this.name = name; //System.out.println(this.hasChanged()); this.setChanged(); //当对象改变的时候,通知观察者 this.notifyObservers(); } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; this.setChanged(); //当对象改变的时候,通知观察者 this.notifyObservers(); } public int getAge() { return age; } public void setAge(int age) { this.age = age; this.setChanged(); //当对象改变的时候,通知观察者 this.notifyObservers(); } }
[ "783081406ccj@gmail.com" ]
783081406ccj@gmail.com
e3456a08094e8fe8c734cb0d3d100df576500306
7ea1b578c1cdbba910e76a527537a72167ae5bfb
/my-springsecurity/security-authorize/src/main/java/com/leo/security/rbac/service/impl/ResourceServiceImpl.java
b28af2c52e660abf4cf620a5f13f06b48c7e100f
[]
no_license
lzlqq/my-springboot
d277c147d6ba21487f0e54e4abbaf1c9faa44836
90312187c25148a7a2c21abe63df56bd0b1ee163
refs/heads/master
2022-12-03T00:10:29.801163
2022-01-25T09:25:05
2022-01-25T09:25:05
172,305,396
0
0
null
2022-11-24T04:45:11
2019-02-24T06:43:31
JavaScript
UTF-8
Java
false
false
2,814
java
/** * */ package com.leo.security.rbac.service.impl; import java.util.List; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.leo.security.rbac.domain.Admin; import com.leo.security.rbac.domain.Resource; import com.leo.security.rbac.dto.ResourceInfo; import com.leo.security.rbac.repository.AdminRepository; import com.leo.security.rbac.repository.ResourceRepository; import com.leo.security.rbac.service.ResourceService; /** * @author zhailiang * */ @Service @Transactional public class ResourceServiceImpl implements ResourceService { @Autowired private ResourceRepository resourceRepository; @Autowired private AdminRepository adminRepository; @Override public ResourceInfo getTree(Long adminId) { Admin admin = adminRepository.findOne(adminId); return resourceRepository.findByName("根节点").toTree(admin); } /** (non-Javadoc) * @see com.imooc.security.rbac.service.ResourceService#getInfo(java.lang.Long) */ @Override public ResourceInfo getInfo(Long id) { Resource resource = resourceRepository.findOne(id); ResourceInfo resourceInfo = new ResourceInfo(); BeanUtils.copyProperties(resource, resourceInfo); return resourceInfo; } @Override public ResourceInfo create(ResourceInfo info) { Resource parent = resourceRepository.findOne(info.getParentId()); if(parent == null){ parent = resourceRepository.findByName("根节点"); } Resource resource = new Resource(); BeanUtils.copyProperties(info, resource); parent.addChild(resource); info.setId(resourceRepository.save(resource).getId()); return info; } @Override public ResourceInfo update(ResourceInfo info) { Resource resource = resourceRepository.findOne(info.getId()); BeanUtils.copyProperties(info, resource); return info; } @Override public void delete(Long id) { resourceRepository.delete(id); } @Override public Long move(Long id, boolean up) { Resource resource = resourceRepository.findOne(id); int index = resource.getSort(); List<Resource> childs = resource.getParent().getChilds(); for (int i = 0; i < childs.size(); i++) { Resource current = childs.get(i); if(current.getId().equals(id)) { if(up){ if(i != 0) { Resource pre = childs.get(i - 1); resource.setSort(pre.getSort()); pre.setSort(index); resourceRepository.save(pre); } }else{ if(i != childs.size()-1) { Resource next = childs.get(i + 1); resource.setSort(next.getSort()); next.setSort(index); resourceRepository.save(next); } } } } resourceRepository.save(resource); return resource.getParent().getId(); } }
[ "390650599@qq.com" ]
390650599@qq.com
90cbd52d0bf56dc67a0c672f13d82fe73f1fcc07
a020447d46eb8863df160ceffb312c92ce297733
/app/mobile/src/main/java/com/isas/lukasplevac/ClassFragment.java
04c8d71fef9c4edd4411b9d2cb1cbba0adbcd9b2
[ "Apache-2.0" ]
permissive
Lukas0025/ZakajdaDoKapsy
9590de85093a931c4e02129aa725d3b3d0d030f6
5c1a213ddb91603cced6198d8b5a0e06e995ea38
refs/heads/master
2020-05-25T15:38:53.549169
2019-05-22T19:06:25
2019-05-22T19:06:25
187,873,383
0
0
null
null
null
null
UTF-8
Java
false
false
1,097
java
package com.isas.lukasplevac; import android.graphics.Color; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import org.eazegraph.lib.charts.PieChart; import org.eazegraph.lib.models.PieModel; public class ClassFragment extends Fragment { public Boolean created = false; public View nodata; public PieChart pieChart; public ClassFragment() { // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.class_mark_info, container, false); pieChart = (PieChart) view.findViewById(R.id.piechart); nodata = view.findViewById(R.id.nodataclass); created = true; return view; } }
[ "lukasplevac@gmail.com" ]
lukasplevac@gmail.com
ebc4bc9b4ed4a9ce30ee95c88cddea91b0e918ed
e73148cb204db123dd4f6369f6d33b28eb9904c7
/src/com/dziennik/view/ChartsPanel.java
1708f8a3f692ec46222444b80aad47acd34e0fc1
[]
no_license
g0nzo/calorie-counter
ebb5c72f80d55795c40b3c674d74a8a242cffe4f
8f0fb3a07e47d2bbf133afae6e22ab9711c8fe06
refs/heads/master
2021-01-10T21:26:57.435792
2015-09-08T18:01:37
2015-09-08T18:01:37
42,129,477
0
0
null
null
null
null
UTF-8
Java
false
false
1,064
java
package com.dziennik.view; import java.awt.Color; import javax.swing.JComboBox; import javax.swing.JPanel; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; import org.jfree.data.time.Day; import org.jfree.data.time.Month; import org.jfree.data.time.TimeSeries; import org.jfree.data.time.TimeSeriesCollection; import org.jfree.data.xy.XYDataset; public class ChartsPanel extends JPanel { private JComboBox minuteList; private JComboBox hourList; private JComboBox dayList; private JComboBox monthList; private JComboBox yearList; ChartsPanel() { dayList = new javax.swing.JComboBox(); monthList = new javax.swing.JComboBox(); yearList = new javax.swing.JComboBox(); hourList = new javax.swing.JComboBox(); minuteList = new javax.swing.JComboBox(); add(dayList); } public void addChartPanel(ChartPanel chartPanel) { add(chartPanel); } }
[ "wujcik14@interia.pl" ]
wujcik14@interia.pl
90ec94f899099d61ca4e8273bcd78d38a0fdfc13
799c3a9fc4c9e2d8899e343001dc053907540c6c
/src/main/java/com/lv/cloud/service/UserService.java
b22e973f98edf12f34ace7456697f91d7d6e7b43
[]
no_license
lvning300/scp-ribbon-consumer
69af800b9dacca7851a16348c587243303dc3585
c51e43c5c3d4f7fd09cce5f0eeebd0515cf4f3f6
refs/heads/master
2020-06-15T03:28:16.011692
2019-07-04T07:39:25
2019-07-04T07:39:25
195,192,623
0
0
null
null
null
null
UTF-8
Java
false
false
1,366
java
package com.lv.cloud.service; import com.lv.cloud.dto.User; import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @Service public class UserService { @Autowired RestTemplate restTemplate; @HystrixCommand(fallbackMethod = "failMessage") public List<User> queryUser(){ ParameterizedTypeReference<List<User>> typeRef = new ParameterizedTypeReference<List<User>>() { }; Map<String, Object> params = new HashMap<>(); ResponseEntity<List<User>> responseEntity = restTemplate.exchange("http://SCP-API-MANAGER/api/v1/user/all", HttpMethod.GET, new HttpEntity<>(params), typeRef); return responseEntity.getBody(); } public List<User> failMessage(){ User build = User.builder() .userName("默认值") .email("默认值") .build(); return Arrays.asList(build); } }
[ "lvning300@163.com" ]
lvning300@163.com
7f92f52a363487b207dee6b0f5eac23c6b4b11ff
fd28e28d665ef4c8d43d73fc1eea4c2c37e979be
/bus-health/src/main/java/org/aoju/bus/health/unix/openbsd/software/OpenBsdOperatingSystem.java
32c3acbc9efdd6b98934e772831f3335505dc51e
[ "MIT" ]
permissive
xiaoyue6/bus
c6691b46f9d2e685cbb4a9edf574ba2a0a356a25
a4ad0103bb267b5de5a3c53777bdd67e6d9b86f5
refs/heads/master
2023-07-26T20:54:29.291855
2021-08-31T15:50:42
2021-08-31T15:50:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,501
java
/********************************************************************************* * * * The MIT License (MIT) * * * * Copyright (c) 2015-2021 aoju.org OSHI and other contributors. * * * * Permission is hereby granted, free of charge, to any person obtaining a copy * * of this software and associated documentation files (the "Software"), to deal * * in the Software without restriction, including without limitation the rights * * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included in * * all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * * THE SOFTWARE. * * * ********************************************************************************/ package org.aoju.bus.health.unix.openbsd.software; import org.aoju.bus.core.annotation.ThreadSafe; import org.aoju.bus.core.lang.Normal; import org.aoju.bus.core.lang.Symbol; import org.aoju.bus.core.lang.tuple.Pair; import org.aoju.bus.health.Builder; import org.aoju.bus.health.Executor; import org.aoju.bus.health.builtin.software.*; import org.aoju.bus.health.unix.openbsd.OpenBsdLibc; import org.aoju.bus.health.unix.openbsd.OpenBsdSysctlKit; import org.aoju.bus.logger.Logger; import java.io.File; import java.util.*; import java.util.stream.Collectors; /** * OpenBsd is a free and open-source Unix-like operating system descended from * the Berkeley Software Distribution (BSD), which was based on Research Unix. * The first version of OpenBsd was released in 1993. In 2005, OpenBsd was the * most popular open-source BSD operating system, accounting for more than * three-quarters of all installed simply, permissively licensed BSD systems. * * @author Kimi Liu * @version 6.2.8 * @since JDK 1.8+ */ @ThreadSafe public class OpenBsdOperatingSystem extends AbstractOperatingSystem { static final String PS_COMMAND_ARGS = Arrays.stream(PsKeywords.values()).map(Enum::name).map(String::toLowerCase) .collect(Collectors.joining(",")); private static final long BOOTTIME = querySystemBootTime(); private static List<OSProcess> getProcessListFromPS(int pid) { List<OSProcess> procs = new ArrayList<>(); // https://man.openbsd.org/ps#KEYWORDS // missing are threadCount and kernelTime which is included in cputime String psCommand = "ps -awwxo " + PS_COMMAND_ARGS; if (pid >= 0) { psCommand += " -p " + pid; } List<String> procList = Executor.runNative(psCommand); if (procList.isEmpty() || procList.size() < 2) { return procs; } // remove header row procList.remove(0); // Fill list for (String proc : procList) { Map<PsKeywords, String> psMap = Builder.stringToEnumMap(PsKeywords.class, proc.trim(), Symbol.C_SPACE); // Check if last (thus all) value populated if (psMap.containsKey(PsKeywords.ARGS)) { procs.add(new OpenBsdOSProcess( pid < 0 ? Builder.parseIntOrDefault(psMap.get(PsKeywords.PID), 0) : pid, psMap)); } } return procs; } private static long querySystemBootTime() { // Boot time will be the first consecutive string of digits. return Builder.parseLongOrDefault( Executor.getFirstAnswer("sysctl -n kern.boottime").split(",")[0].replaceAll("\\D", Normal.EMPTY), System.currentTimeMillis() / 1000); } @Override public String queryManufacturer() { return "Unix/BSD"; } @Override public Pair<String, OSVersionInfo> queryFamilyVersionInfo() { int[] mib = new int[2]; mib[0] = OpenBsdLibc.CTL_KERN; mib[1] = OpenBsdLibc.KERN_OSTYPE; String family = OpenBsdSysctlKit.sysctl(mib, "OpenBSD"); mib[1] = OpenBsdLibc.KERN_OSRELEASE; String version = OpenBsdSysctlKit.sysctl(mib, Normal.EMPTY); mib[1] = OpenBsdLibc.KERN_VERSION; String versionInfo = OpenBsdSysctlKit.sysctl(mib, Normal.EMPTY); String buildNumber = versionInfo.split(":")[0].replace(family, "").replace(version, Normal.EMPTY).trim(); return Pair.of(family, new OSVersionInfo(version, null, buildNumber)); } @Override protected int queryBitness(int jvmBitness) { if (jvmBitness < 64 && Executor.getFirstAnswer("uname -m").indexOf("64") == -1) { return jvmBitness; } return 64; } @Override public FileSystem getFileSystem() { return new OpenBsdFileSystem(); } @Override public InternetProtocolStats getInternetProtocolStats() { return new OpenBsdInternetProtocolStats(); } @Override public List<OSProcess> queryAllProcesses() { return getProcessListFromPS(-1); } @Override public OSProcess getProcess(int pid) { List<OSProcess> procs = getProcessListFromPS(pid); if (procs.isEmpty()) { return null; } return procs.get(0); } @Override public int getProcessId() { return OpenBsdLibc.INSTANCE.getpid(); } @Override public int getProcessCount() { List<String> procList = Executor.runNative("ps -axo pid"); if (!procList.isEmpty()) { // Subtract 1 for header return procList.size() - 1; } return 0; } @Override public int getThreadCount() { // -H "Also display information about kernel visible threads" // -k "Also display information about kernel threads" // column TID holds thread ID List<String> threadList = Executor.runNative("ps -axHo tid"); if (!threadList.isEmpty()) { // Subtract 1 for header return threadList.size() - 1; } return 0; } @Override public long getSystemUptime() { return System.currentTimeMillis() / 1000 - BOOTTIME; } @Override public long getSystemBootTime() { return BOOTTIME; } @Override public NetworkParams getNetworkParams() { return new OpenBsdNetworkParams(); } @Override public OSService[] getServices() { // Get running services List<OSService> services = new ArrayList<>(); Set<String> running = new HashSet<>(); for (OSProcess p : getChildProcesses(1, ProcessFiltering.ALL_PROCESSES, ProcessSorting.PID_ASC, 0)) { OSService s = new OSService(p.getName(), p.getProcessID(), OSService.State.RUNNING); services.add(s); running.add(p.getName()); } // Get Directories for stopped services File dir = new File("/etc/rc.d"); File[] listFiles; if (dir.exists() && dir.isDirectory() && null != (listFiles = dir.listFiles())) { for (File f : listFiles) { String name = f.getName(); if (!running.contains(name)) { OSService s = new OSService(name, 0, OSService.State.STOPPED); services.add(s); } } } else { Logger.error("Directory: /etc/rc.d does not exist"); } return services.toArray(new OSService[0]); } @Override public List<OSProcess> queryChildProcesses(int parentPid) { List<OSProcess> allProcs = queryAllProcesses(); Set<Integer> descendantPids = getChildrenOrDescendants(allProcs, parentPid, false); return allProcs.stream().filter(p -> descendantPids.contains(p.getProcessID())).collect(Collectors.toList()); } @Override public List<OSProcess> queryDescendantProcesses(int parentPid) { List<OSProcess> allProcs = queryAllProcesses(); Set<Integer> descendantPids = getChildrenOrDescendants(allProcs, parentPid, true); return allProcs.stream().filter(p -> descendantPids.contains(p.getProcessID())).collect(Collectors.toList()); } enum PsKeywords { STATE, PID, PPID, USER, UID, GROUP, GID, PRI, VSZ, RSS, ETIME, CPUTIME, COMM, MAJFLT, MINFLT, NVCSW, NIVCSW, ARGS; // ARGS must always be last } }
[ "839536@qq.com" ]
839536@qq.com
41c7064314e6b6b24803f30d00809146e01b81e4
c55f6c5f4981c31d7a2930718ac47796604773f1
/S02JavaWeb/code01JavaWeb/day04AjaxJson/src/main/java/site/newvalue/web/servlet/FindUserServlet.java
38c163478446f82f6d1829e1612a6e4d1935f3cf
[]
no_license
siyuanzhou/JavaWebCode
59e488118a670f06da74b9f617d4bea4932f24f4
ec6699881f09af1f6f2f534eadfd2cf2e2c03a48
refs/heads/master
2022-12-24T02:08:36.581082
2020-10-12T12:49:49
2020-10-12T12:49:49
238,839,803
0
0
null
2022-12-16T04:26:00
2020-02-07T03:59:00
JavaScript
UTF-8
Java
false
false
1,821
java
package site.newvalue.web.servlet; import com.fasterxml.jackson.databind.ObjectMapper; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.HashMap; import java.util.Map; @WebServlet("/findUserServlet") public class FindUserServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //1.获取用户名 String username = request.getParameter("username"); //2.调用service层判断用户名是否存在 //期望服务器响应回的数据格式:{"userExsit":true,"msg":"此用户名太受欢迎,请更换一个"} // {"userExsit":false,"msg":"用户名可用"} //设置响应的数据格式为json response.setContentType("application/json;charset=utf-8"); Map<String, Object> map = new HashMap<String, Object>(); if ("tom".equals(username)) { //存在 map.put("userExsit", true); map.put("msg", "此用户名太受欢迎,请更换一个"); } else { //不存在 map.put("userExsit", false); map.put("msg", "用户名可用"); } //将map转为json,并且传递给客户端 //将map转为json ObjectMapper mapper = new ObjectMapper(); //并且传递给客户端 mapper.writeValue(response.getWriter(), map); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { this.doPost(request, response); } }
[ "siyuanzhou@163.com" ]
siyuanzhou@163.com
de70024eaec811659176b36c8ece2330ccf798af
21ad956213d303d931a5f116b87b1e8249ddaf35
/GCDdemo.java
2df40ccb35c2072d32810599b2877d0514f841c8
[]
no_license
rico-adrian/CS301JavaProgrammingLanguage
ff0d80b8af65bb3507b595cee6b6da00d30477ac
d52c4900e559a334b3ce91a96704f895fc23f2a8
refs/heads/master
2021-04-06T11:12:48.505412
2018-03-10T09:03:26
2018-03-10T09:03:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,509
java
import java.util.Scanner; /** This program demonstrates the recursive gcd method. */ public class GCDdemo { public static void main(String[] args) { int num1, num2; // Two numbers for GCD calculation // Create a Scanner object for keyboard input. Scanner keyboard = new Scanner(System.in); // Get the first number from the user. System.out.print("Enter an integer: "); num1 = keyboard.nextInt(); // Get the second number from the user. System.out.print("Enter another integer: "); num2 = keyboard.nextInt(); // Display the GCD. System.out.println("The greatest common divisor " + "of these two numbers is " + gcd(num1, num2)); while(gcd(num1,num2)>1) { System.out.println("Enter another integer"); num2=keyboard.nextInt(); int b=gcd(num1,num2); System.out.println("The greatest common divisor " + "of these two numbers is " + b); } } /** The gcd method calculates the greatest common divisor of the arguments passed into x and y. @param x A number. @param y Another number. @returns The greatest common divisor of x and y. */ public static int gcd(int x, int y) { if (x % y == 0) return y; else return gcd(y, x % y); } }
[ "noreply@github.com" ]
noreply@github.com
c49f6c955b56a1a1f771e35c5759b118ca26f5b7
8d96e2a22f0a4f33931ef8963c0ac303758e59f5
/src/main/java/io/renren/modules/generator/dao/FilterEnDao.java
1a7ed2fb064451bb780cac661e1cc2d2fdbb2356
[ "Apache-2.0" ]
permissive
zhao750456695/companyweb-backend
6e4fcb921e352f6f9d913a667215c9684d56eb01
70df68f0d78d8838cc414cbeb4282931c6c5c819
refs/heads/main
2023-08-08T01:23:37.774042
2021-09-15T12:31:50
2021-09-15T12:31:50
406,755,383
0
0
null
null
null
null
UTF-8
Java
false
false
376
java
package io.renren.modules.generator.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import io.renren.modules.generator.entity.FilterEnEntity; import org.apache.ibatis.annotations.Mapper; /** * * * @author chenshun * @email sunlightcs@gmail.com * @date 2021-06-23 07:48:06 */ @Mapper public interface FilterEnDao extends BaseMapper<FilterEnEntity> { }
[ "zhao750456695@163.com" ]
zhao750456695@163.com
132fd1907a5e9dcfd5820c8b54771793f4cdb115
af2f3c0e0fc10e77b106636ac53addb6e4b82356
/service1/src/main/java/cn/demo/service1/config/RedisCacheConfig.java
16653537a0330616480c0323fcf988ab18fd30fe
[]
no_license
dancesfly/spring-cloud-demo
0bc2ce080e3e944817715648fcb2768764f104f5
cb1c4be8dafb4172d526678c821a94520702d437
refs/heads/master
2020-12-02T22:08:46.915678
2017-07-03T09:52:42
2017-07-03T09:52:42
96,090,588
0
0
null
null
null
null
UTF-8
Java
false
false
2,802
java
package cn.demo.service1.config; import java.lang.reflect.Method; import org.springframework.cache.CacheManager; import org.springframework.cache.annotation.CachingConfigurerSupport; import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.interceptor.KeyGenerator; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.cache.RedisCacheManager; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; import org.springframework.data.redis.serializer.StringRedisSerializer; import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.PropertyAccessor; import com.fasterxml.jackson.databind.ObjectMapper; /** * 缓存管理(注解用) * @author lizheng * */ @Configuration @EnableCaching public class RedisCacheConfig extends CachingConfigurerSupport { /*** * 生成key的策略 */ @Bean public KeyGenerator wiselyKeyGenerator() { return new KeyGenerator() { @Override public Object generate(Object target, Method method, Object... params) { StringBuilder sb = new StringBuilder(); sb.append(target.getClass().getName()); sb.append(method.getName()); for (Object obj : params) { sb.append(obj.toString()); } return sb.toString(); } }; } /** * 管理缓存 * */ @Bean public CacheManager cacheManager(RedisTemplate<Object, Object> redisTemplate) { return new RedisCacheManager(redisTemplate); } /** * RedisTemplate配置 */ @Bean public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory factory) { RedisTemplate<Object, Object> template = new RedisTemplate<Object, Object>(); template.setConnectionFactory(factory); Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<Object>(Object.class); ObjectMapper om = new ObjectMapper(); om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); jackson2JsonRedisSerializer.setObjectMapper(om); template.setValueSerializer(jackson2JsonRedisSerializer); template.setKeySerializer(new StringRedisSerializer()); template.afterPropertiesSet(); return template; } }
[ "dancesfly@126.com" ]
dancesfly@126.com
a5279e88087ddb084b7f1f24bc15fd2f91845165
5ee1f4d98f1e57d15463ca90c192174e08834b7f
/app/src/androidTest/java/com/luantc/android_workaround_widget/ExampleInstrumentedTest.java
77f9554479f644ff759708aeb30638dec6a3fe63
[]
no_license
luantc/Android-Workaround-Widget
c58a0f29d66536864bbd6732a637eafbd82f80fc
abb12323569039b2b6bc69f4d209e0bb5f9f5b9b
refs/heads/master
2020-03-21T17:10:34.268550
2018-06-27T02:28:39
2018-06-27T02:28:39
138,817,732
0
0
null
null
null
null
UTF-8
Java
false
false
756
java
package com.luantc.android_workaround_widget; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.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.getTargetContext(); assertEquals("com.luantc.android_workaround_widget", appContext.getPackageName()); } }
[ "luan.truong@persol.co.jp" ]
luan.truong@persol.co.jp
8c715bdc7687e087827d982ebe72c92d072a32c7
b754c8da25fc4243fed2a8d30f03572b8ff75ce5
/src/com/rs/game/player/actions/PlayerCombat.java
389392014c2c1ad4bd51a4223623635ad81ee439
[]
no_license
seeocon/Eliwen-Server
7cce862c74db996c984d4f89626c8c8af8e68655
864e56bdb2dba8f58ef34f75d201d77b1527e606
refs/heads/master
2020-06-16T07:12:22.179451
2016-11-30T23:37:24
2016-11-30T23:37:24
75,236,264
0
0
null
null
null
null
UTF-8
Java
false
false
133,364
java
package com.rs.game.player.actions; import java.util.ArrayList; import java.util.List; import java.util.Random; import com.rs.cache.loaders.ItemDefinitions; import com.rs.game.Animation; import com.rs.game.Entity; import com.rs.game.Graphics; import com.rs.game.Hit; import com.rs.game.Hit.HitLook; import com.rs.game.Region; import com.rs.game.World; import com.rs.game.WorldTile; import com.rs.game.item.Item; import com.rs.game.npc.NPC; import com.rs.game.npc.familiar.Familiar; import com.rs.game.npc.familiar.Steeltitan; import com.rs.game.npc.fightkiln.HarAken; import com.rs.game.npc.fightkiln.HarAkenTentacle; import com.rs.game.npc.godwars.zaros.NexMinion; import com.rs.game.npc.qbd.QueenBlackDragon; import com.rs.game.player.CombatDefinitions; import com.rs.game.player.Equipment; import com.rs.game.player.Player; import com.rs.game.player.Skills; import com.rs.game.player.content.Combat; import com.rs.game.player.content.Magic; import com.rs.game.tasks.WorldTask; import com.rs.game.tasks.WorldTasksManager; import com.rs.utils.MapAreas; import com.rs.utils.Utils; public class PlayerCombat extends Action { private Entity target; private int max_hit; // temporary constant private double base_mage_xp; // temporary constant private int mage_hit_gfx; // temporary constant private int magic_sound; // temporary constant private int max_poison_hit; // temporary constant private int freeze_time; // temporary constant private boolean reduceAttack; // temporary constant private boolean blood_spell; // temporary constant private boolean block_tele; private int spellcasterGloves; public PlayerCombat(Entity target) { this.target = target; } @Override public boolean start(Player player) { player.setNextFaceEntity(target); if (checkAll(player)) { return true; } player.setNextFaceEntity(null); return false; } @Override public boolean process(Player player) { return checkAll(player); } private boolean forceCheckClipAsRange(Entity target) { return target instanceof NexMinion || target instanceof HarAken || target instanceof HarAkenTentacle || target instanceof QueenBlackDragon; } @Override public int processWithDelay(Player player) { int isRanging = isRanging(player); int spellId = player.getCombatDefinitions().getSpellId(); if (spellId < 1 && hasPolyporeStaff(player)) { spellId = 65535; } int maxDistance = isRanging != 0 || spellId > 0 ? 7 : 0; int distanceX = player.getX() - target.getX(); int distanceY = player.getY() - target.getY(); double multiplier = 1.0; if (player.getAttributes().get("miasmic_effect") == Boolean.TRUE) multiplier = 1.5; int size = target.getSize(); if (!player.clipedProjectile(target, maxDistance == 0 && !forceCheckClipAsRange(target))) return 0; if (player.hasWalkSteps()) maxDistance += 1; if (distanceX > size + maxDistance || distanceX < -1 - maxDistance || distanceY > size + maxDistance || distanceY < -1 - maxDistance) return 0; if (!player.getControlerManager().keepCombating(target)) return -1; addAttackedByDelay(player); if (spellId > 0) { boolean manualCast = spellId != 65535 && spellId >= 256; Item gloves = player.getEquipment().getItem(Equipment.SLOT_HANDS); spellcasterGloves = gloves != null && gloves.getDefinitions().getName().contains("Spellcaster glove") && player.getEquipment().getWeaponId() == -1 && new Random().nextInt(30) == 0 ? spellId : -1; int delay = mageAttack(player, manualCast ? spellId - 256 : spellId, !manualCast); if (player.getNextAnimation() != null && spellcasterGloves > 0) { player.setNextAnimation(new Animation(14339)); spellcasterGloves = -1; } return delay; } else { if (isRanging == 0) { int attackDelay = (int) (meleeAttack(player) * multiplier); return attackDelay; } else if (isRanging == 1) { player.getPackets().sendGameMessage("This ammo is not very effective with this weapon."); return -1; } else if (isRanging == 3) { player.getPackets().sendGameMessage("You dont have any ammo in your backpack."); return -1; } else { return (int) (rangeAttack(player) * multiplier); } } } private void addAttackedByDelay(Entity player) { target.setAttackedBy(player); target.setAttackedByDelay(Utils.currentTimeMillis() + 8000); // 8seconds } private int getRangeCombatDelay(int weaponId, int attackStyle) { int delay = 6; if (weaponId != -1) { String weaponName = ItemDefinitions.getItemDefinitions(weaponId) .getName().toLowerCase(); if (weaponName.contains("shortbow") || weaponName.contains("karil's crossbow")) delay = 3; else if (weaponName.contains("crossbow")) delay = 5; else if (weaponName.contains("dart") || weaponName.contains("knife") || weaponName.contains("chinchompa")) delay = 2; else { switch (weaponId) { case 15241: delay = 7; break; case 24472: delay = 3; break; case 11235: // dark bows case 15701: case 15702: case 15703: case 15704: delay = 9; break; default: delay = 6; break; } } } if (attackStyle == 1) delay--; else if (attackStyle == 2) delay++; return delay; } public Entity[] getMultiAttackTargets(Player player) { return getMultiAttackTargets(player, 1, 9); } public Entity[] getMultiAttackTargets(Player player, int maxDistance, int maxAmtTargets) { List<Entity> possibleTargets = new ArrayList<Entity>(); possibleTargets.add(target); if(target.isAtMultiArea()) { y: for (int regionId : target.getMapRegionsIds()) { Region region = World.getRegion(regionId); if(target instanceof Player) { List<Integer> playerIndexes = region.getPlayerIndexes(); if(playerIndexes == null) continue; for (int playerIndex : playerIndexes) { Player p2 = World.getPlayers().get(playerIndex); if (p2 == null || p2 == player || p2 == target || p2.isDead() || !p2.hasStarted() || p2.hasFinished() || !p2.isCanPvp() || !p2.isAtMultiArea() || !p2.withinDistance(target, maxDistance) || !player.getControlerManager().canHit(p2)) continue; possibleTargets.add(p2); if(possibleTargets.size() == maxAmtTargets) break y; } }else{ List<Integer> npcIndexes = region.getNPCsIndexes(); if(npcIndexes == null) continue; for (int npcIndex : npcIndexes) { NPC n = World.getNPCs().get(npcIndex); if (n == null || n == target || n == player.getFamiliar() || n.isDead() || n.hasFinished() || !n.isAtMultiArea() || !n.withinDistance(target, maxDistance) || !n.getDefinitions().hasAttackOption() || !player.getControlerManager().canHit(n)) continue; possibleTargets.add(n); if(possibleTargets.size() == maxAmtTargets) break y; } } } } return possibleTargets.toArray(new Entity[possibleTargets.size()]); } public int mageAttack(final Player player, int spellId, boolean autocast) { if (!autocast) { player.getCombatDefinitions().resetSpells(false); player.getActionManager().forceStop(); } if (!Magic.checkCombatSpell(player, spellId, -1, true)) { if (autocast) player.getCombatDefinitions().resetSpells(true); return -1; // stops } if (spellId == 65535) { player.setNextFaceEntity(target); player.setNextGraphics(new Graphics(2034)); player.setNextAnimation(new Animation(15448)); mage_hit_gfx = 2036; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, (5 * player.getSkills().getLevel(Skills.MAGIC)) - 180))); World.sendProjectile(player, target, 2035, 60, 32, 50, 50, 0, 0); return 4; } if (player.getCombatDefinitions().getSpellBook() == 192) { switch (spellId) { case 25: // air strike player.setNextAnimation(new Animation(14221)); mage_hit_gfx = 2700; base_mage_xp = 5.5; int baseDamage = 20; if (player.getEquipment().getGlovesId() == 205) { baseDamage = 90; } delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, baseDamage))); World.sendProjectile(player, target, 2699, 18, 18, 50, 50, 0, 0); return 5; case 28: // water strike player.setNextGraphics(new Graphics(2701)); player.setNextAnimation(new Animation(14221)); mage_hit_gfx = 2708; base_mage_xp = 7.5; baseDamage = 40; if (player.getEquipment().getGlovesId() == 205) { baseDamage = 100; } delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, baseDamage))); World.sendProjectile(player, target, 2703, 18, 18, 50, 50, 0, 0); return 5; case 36:// bind player.setNextGraphics(new Graphics(177)); player.setNextAnimation(new Animation(710)); mage_hit_gfx = 181; base_mage_xp = 60.5; Hit magicHit = getMagicHit(player, getRandomMagicMaxHit(player, 20)); delayMagicHit(2, magicHit); World.sendProjectile(player, target, 178, 18, 18, 50, 50, 0, 0); long currentTime = Utils.currentTimeMillis(); if (magicHit.getDamage() > 0 && target.getFrozenBlockedDelay() < currentTime) target.addFreezeDelay(5000, true); return 5; case 55:// snare player.setNextGraphics(new Graphics(177)); player.setNextAnimation(new Animation(710)); mage_hit_gfx = 180; base_mage_xp = 91.1; Hit snareHit = getMagicHit(player, getRandomMagicMaxHit(player, 30)); delayMagicHit(2, snareHit); if (snareHit.getDamage() > 0 && target.getFrozenBlockedDelay() < Utils .currentTimeMillis()) target.addFreezeDelay(10000, true); World.sendProjectile(player, target, 178, 18, 18, 50, 50, 0, 0); return 5; case 81:// entangle player.setNextGraphics(new Graphics(177)); player.setNextAnimation(new Animation(710)); mage_hit_gfx = 179; base_mage_xp = 91.1; Hit entangleHit = getMagicHit(player, getRandomMagicMaxHit(player, 50)); delayMagicHit(2, entangleHit); if (entangleHit.getDamage() > 0 && target.getFrozenBlockedDelay() < Utils .currentTimeMillis()) target.addFreezeDelay(20000, true); World.sendProjectile(player, target, 178, 18, 18, 50, 50, 0, 0); return 5; case 30: // earth strike player.setNextGraphics(new Graphics(2713)); player.setNextAnimation(new Animation(14221)); mage_hit_gfx = 2723; base_mage_xp = 9.5; baseDamage = 60; if (player.getEquipment().getGlovesId() == 205) { baseDamage = 110; } delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, baseDamage))); World.sendProjectile(player, target, 2718, 18, 18, 50, 50, 0, 0); return 5; case 32: // fire strike player.setNextGraphics(new Graphics(2728)); player.setNextAnimation(new Animation(14221)); mage_hit_gfx = 2737; base_mage_xp = 11.5; baseDamage = 80; if (player.getEquipment().getGlovesId() == 205) { baseDamage = 120; } int damage = getRandomMagicMaxHit(player, baseDamage); if (target instanceof NPC) { NPC n = (NPC) target; if (n.getId() == 9463) // ice verm damage *= 2; } delayMagicHit(2, getMagicHit(player, damage)); World.sendProjectile(player, target, 2729, 18, 18, 50, 50, 0, 0); return 5; case 34: // air bolt player.setNextAnimation(new Animation(14220)); mage_hit_gfx = 2700; base_mage_xp = 13.5; baseDamage = 90; if (player.getEquipment().getGlovesId() == 777) { baseDamage = 120; } delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, baseDamage))); World.sendProjectile(player, target, 2699, 18, 18, 50, 50, 0, 0); return 5; case 39: // water bolt player.setNextGraphics(new Graphics(2707, 0, 100)); player.setNextAnimation(new Animation(14220)); mage_hit_gfx = 2709; base_mage_xp = 16.5; baseDamage = 100; if (player.getEquipment().getGlovesId() == 777) { baseDamage = 130; } delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, baseDamage))); World.sendProjectile(player, target, 2704, 18, 18, 50, 50, 0, 0); return 5; case 42: // earth bolt player.setNextGraphics(new Graphics(2714)); player.setNextAnimation(new Animation(14222)); mage_hit_gfx = 2724; base_mage_xp = 19.5; baseDamage = 110; if (player.getEquipment().getGlovesId() == 777) { baseDamage = 140; } delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, baseDamage))); World.sendProjectile(player, target, 2719, 18, 18, 50, 50, 0, 0); return 5; case 45: // fire bolt player.setNextGraphics(new Graphics(2728)); player.setNextAnimation(new Animation(14223)); mage_hit_gfx = 2738; base_mage_xp = 22.5; baseDamage = 120; if (player.getEquipment().getGlovesId() == 777) { baseDamage = 150; } damage = getRandomMagicMaxHit(player, baseDamage); if (target instanceof NPC) { NPC n = (NPC) target; if (n.getId() == 9463) // ice verm damage *= 2; } delayMagicHit(2, getMagicHit(player, damage)); World.sendProjectile(player, target, 2731, 18, 18, 50, 50, 0, 0); return 5; case 49: // air blast player.setNextAnimation(new Animation(14221)); mage_hit_gfx = 2700; base_mage_xp = 25.5; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, 130))); World.sendProjectile(player, target, 2699, 18, 18, 50, 50, 0, 0); return 5; case 52: // water blast player.setNextGraphics(new Graphics(2701)); player.setNextAnimation(new Animation(14220)); mage_hit_gfx = 2710; base_mage_xp = 31.5; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, 140))); World.sendProjectile(player, target, 2705, 18, 18, 50, 50, 0, 0); return 5; case 58: // earth blast player.setNextGraphics(new Graphics(2715)); player.setNextAnimation(new Animation(14222)); mage_hit_gfx = 2725; base_mage_xp = 31.5; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, 150))); World.sendProjectile(player, target, 2720, 18, 18, 50, 50, 0, 0); return 5; case 63: // fire blast player.setNextGraphics(new Graphics(2728)); player.setNextAnimation(new Animation(14223)); mage_hit_gfx = 2739; base_mage_xp = 34.5; damage = getRandomMagicMaxHit(player, 160); if (target instanceof NPC) { NPC n = (NPC) target; if (n.getId() == 9463) // ice verm damage *= 2; } delayMagicHit(2, getMagicHit(player, damage)); World.sendProjectile(player, target, 2733, 18, 18, 50, 50, 0, 0); return 5; case 66:// Saradomin Strike player.setNextAnimation(new Animation(811)); mage_hit_gfx = 76; base_mage_xp = 34.5; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, 300))); return 5; case 67: // Claws of Guthix player.setNextAnimation(new Animation(811)); mage_hit_gfx = 77; base_mage_xp = 34.5; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, 300))); return 5; case 68: // Flames of Zamorak player.setNextAnimation(new Animation(811)); mage_hit_gfx = 78; base_mage_xp = 34.5; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, 300))); return 5; case 70: // air wave player.setNextAnimation(new Animation(14221)); mage_hit_gfx = 2700; base_mage_xp = 36; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, 170))); World.sendProjectile(player, target, 2699, 18, 18, 50, 50, 0, 0); return 5; case 73: // water wave player.setNextGraphics(new Graphics(2702)); player.setNextAnimation(new Animation(14220)); mage_hit_gfx = 2710; base_mage_xp = 37.5; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, 180))); World.sendProjectile(player, target, 2706, 18, 18, 50, 50, 0, 0); return 5; case 77: // earth wave player.setNextGraphics(new Graphics(2716)); player.setNextAnimation(new Animation(14222)); mage_hit_gfx = 2726; base_mage_xp = 42.5; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, 190))); World.sendProjectile(player, target, 2721, 18, 18, 50, 50, 0, 0); return 5; case 80: // fire wave player.setNextGraphics(new Graphics(2728)); player.setNextAnimation(new Animation(14223)); mage_hit_gfx = 2740; base_mage_xp = 42.5; damage = getRandomMagicMaxHit(player, 200); if (target instanceof NPC) { NPC n = (NPC) target; if (n.getId() == 9463) // ice verm damage *= 2; } delayMagicHit(2, getMagicHit(player, damage)); World.sendProjectile(player, target, 2735, 18, 18, 50, 50, 0, 0); return 5; case 86: // teleblock if (target instanceof Player && ((Player) target).getTeleBlockDelay() <= Utils .currentTimeMillis()) { player.setNextGraphics(new Graphics(1841)); player.setNextAnimation(new Animation(10503)); mage_hit_gfx = 1843; base_mage_xp = 80; block_tele = true; Hit hit = getMagicHit(player, getRandomMagicMaxHit(player, 30)); delayMagicHit(2, hit); World.sendProjectile(player, target, 1842, 18, 18, 50, 50, 0, 0); } else { player.getPackets().sendGameMessage( "This player is already effected by this spell.", true); } return 5; case 84:// air surge player.setNextGraphics(new Graphics(457)); player.setNextAnimation(new Animation(10546)); mage_hit_gfx = 2700; base_mage_xp = 80; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, 220))); World.sendProjectile(player, target, 462, 18, 18, 50, 50, 0, 0); return 5; case 87:// water surge player.setNextGraphics(new Graphics(2701)); player.setNextAnimation(new Animation(10542)); mage_hit_gfx = 2712; base_mage_xp = 80; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, 240))); World.sendProjectile(player, target, 2707, 18, 18, 50, 50, 3, 0); return 5; case 89:// earth surge player.setNextGraphics(new Graphics(2717)); player.setNextAnimation(new Animation(14209)); mage_hit_gfx = 2727; base_mage_xp = 80; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, 260))); World.sendProjectile(player, target, 2722, 18, 18, 50, 50, 0, 0); return 5; case 91:// fire surge player.setNextGraphics(new Graphics(2728)); player.setNextAnimation(new Animation(2791)); mage_hit_gfx = 2741; base_mage_xp = 80; damage = getRandomMagicMaxHit(player, 280); if (damage > 0 && target instanceof NPC) { NPC n = (NPC) target; if (n.getId() == 9463) // ice verm damage *= 2; } delayMagicHit(2, getMagicHit(player, damage)); World.sendProjectile(player, target, 2735, 18, 18, 50, 50, 3, 0); World.sendProjectile(player, target, 2736, 18, 18, 50, 50, 20, 0); World.sendProjectile(player, target, 2736, 18, 18, 50, 50, 110, 0); return 5; case 99: // Storm of armadyl //Sonic and Tyler dumped player.setNextGraphics(new Graphics(457)); player.setNextAnimation(new Animation(10546)); mage_hit_gfx = 1019; base_mage_xp = 70; int boost = (player.getSkills().getLevelForXp(Skills.MAGIC) - 77) * 5; int hit = getRandomMagicMaxHit(player, 160 + boost); if (hit > 0 && hit < boost) hit += boost; delayMagicHit(2, getMagicHit(player, hit)); World.sendProjectile(player, target, 1019, 18, 18, 50, 30, 0, 0); return player.getEquipment().getWeaponId() == 21777 ? 4 : 5; } } else if (player.getCombatDefinitions().getSpellBook() == 193) { switch (spellId) { case 28:// Smoke Rush player.setNextAnimation(new Animation(1978)); mage_hit_gfx = 385; base_mage_xp = 30; max_poison_hit = 20; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, 150))); World.sendProjectile(player, target, 386, 18, 18, 50, 50, 0, 0); return 4; case 32:// Shadow Rush player.setNextAnimation(new Animation(1978)); mage_hit_gfx = 379; base_mage_xp = 31; reduceAttack = true; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, 160))); World.sendProjectile(player, target, 380, 18, 18, 50, 50, 0, 0); return 4; case 36: //Miasmic rush player.setNextAnimation(new Animation(10513)); player.setNextGraphics(new Graphics(1845)); mage_hit_gfx = 1847; base_mage_xp = 35; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, 200))); World.sendProjectile(player, target, 1846, 43, 22, 51, 50, 16, 0); if (target.getAttributes().get("miasmic_immunity") == Boolean.TRUE) { return 4; } if (target instanceof Player) { ((Player) target).getPackets().sendGameMessage("You feel slowed down."); } target.getAttributes().put("miasmic_immunity", Boolean.TRUE); target.getAttributes().put("miasmic_effect", Boolean.TRUE); final Entity t = target; WorldTasksManager.schedule(new WorldTask() { @Override public void run() { t.getAttributes().remove("miasmic_effect"); WorldTasksManager.schedule(new WorldTask() { @Override public void run() { t.getAttributes().remove("miasmic_immunity"); stop(); } }, 15); stop(); } }, 20); return 4; case 37: //Miasmic blitz player.setNextAnimation(new Animation(10524)); player.setNextGraphics(new Graphics(1850)); mage_hit_gfx = 1851; base_mage_xp = 48; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, 280))); World.sendProjectile(player, target, 1852, 43, 22, 51, 50, 16, 0); if (target.getAttributes().get("miasmic_immunity") == Boolean.TRUE) { return 4; } if (target instanceof Player) { ((Player) target).getPackets().sendGameMessage("You feel slowed down."); } target.getAttributes().put("miasmic_immunity", Boolean.TRUE); target.getAttributes().put("miasmic_effect", Boolean.TRUE); final Entity t0 = target; WorldTasksManager.schedule(new WorldTask() { @Override public void run() { t0.getAttributes().remove("miasmic_effect"); WorldTasksManager.schedule(new WorldTask() { @Override public void run() { t0.getAttributes().remove("miasmic_immunity"); stop(); } }, 15); stop(); } }, 60); return 4; case 38: //Miasmic burst player.setNextAnimation(new Animation(10516)); player.setNextGraphics(new Graphics(1848)); attackTarget(getMultiAttackTargets(player), new MultiAttack() { private boolean nextTarget; @Override public boolean attack() { mage_hit_gfx = 1849; base_mage_xp = 42; int damage = getRandomMagicMaxHit(player, 240); delayMagicHit(2, getMagicHit(player, damage)); if (target.getAttributes().get("miasmic_immunity") != Boolean.TRUE) { if (target instanceof Player) { ((Player) target).getPackets().sendGameMessage("You feel slowed down."); } target.getAttributes().put("miasmic_immunity", Boolean.TRUE); target.getAttributes().put("miasmic_effect", Boolean.TRUE); final Entity t = target; WorldTasksManager.schedule(new WorldTask() { @Override public void run() { t.getAttributes().remove("miasmic_effect"); WorldTasksManager.schedule(new WorldTask() { @Override public void run() { t.getAttributes().remove("miasmic_immunity"); stop(); } }, 15); stop(); } }, 40); } if (!nextTarget) { if (damage == -1) { return false; } nextTarget = true; } return nextTarget; } }); return 4; case 39: //Miasmic barrage player.setNextAnimation(new Animation(10518)); player.setNextGraphics(new Graphics(1853)); attackTarget(getMultiAttackTargets(player), new MultiAttack() { private boolean nextTarget; @Override public boolean attack() { mage_hit_gfx = 1854; base_mage_xp = 54; int damage = getRandomMagicMaxHit(player, 320); delayMagicHit(2, getMagicHit(player, damage)); if (target.getAttributes().get("miasmic_immunity") != Boolean.TRUE) { if (target instanceof Player) { ((Player) target).getPackets().sendGameMessage("You feel slowed down."); } target.getAttributes().put("miasmic_immunity", Boolean.TRUE); target.getAttributes().put("miasmic_effect", Boolean.TRUE); final Entity t = target; WorldTasksManager.schedule(new WorldTask() { @Override public void run() { t.getAttributes().remove("miasmic_effect"); WorldTasksManager.schedule(new WorldTask() { @Override public void run() { t.getAttributes().remove("miasmic_immunity"); stop(); } }, 15); stop(); } }, 80); } if (!nextTarget) { if (damage == -1) { return false; } nextTarget = true; } return nextTarget; } }); return 4; case 24:// Blood rush player.setNextAnimation(new Animation(1978)); mage_hit_gfx = 373; base_mage_xp = 33; blood_spell = true; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, 170))); World.sendProjectile(player, target, 374, 18, 18, 50, 50, 0, 0); return 4; case 20:// Ice rush player.setNextAnimation(new Animation(1978)); mage_hit_gfx = 361; base_mage_xp = 34; freeze_time = 5000; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, 180))); World.sendProjectile(player, target, 362, 18, 18, 50, 50, 0, 0); return 4; //TODO burst case 30:// Smoke burst player.setNextAnimation(new Animation(1979)); attackTarget(getMultiAttackTargets(player), new MultiAttack() { private boolean nextTarget; //real target is first player on array @Override public boolean attack() { mage_hit_gfx = 389; base_mage_xp = 36; max_poison_hit = 20; int damage = getRandomMagicMaxHit(player, 190); delayMagicHit(2, getMagicHit(player, damage)); World.sendProjectile(player, target, 388, 18, 18, 50, 50, 0, 0); if(!nextTarget) { if(damage == -1) return false; nextTarget = true; } return nextTarget; } }); return 4; case 34:// Shadow burst player.setNextAnimation(new Animation(1979)); attackTarget(getMultiAttackTargets(player), new MultiAttack() { private boolean nextTarget; //real target is first player on array @Override public boolean attack() { mage_hit_gfx = 382; base_mage_xp = 37; reduceAttack = true; int damage = getRandomMagicMaxHit(player, 200); delayMagicHit(2, getMagicHit(player, damage)); if(!nextTarget) { if(damage == -1) return false; nextTarget = true; } return nextTarget; } }); return 4; case 26:// Blood burst player.setNextAnimation(new Animation(1979)); attackTarget(getMultiAttackTargets(player), new MultiAttack() { private boolean nextTarget; //real target is first player on array @Override public boolean attack() { mage_hit_gfx = 376; base_mage_xp = 39; blood_spell = true; int damage = getRandomMagicMaxHit(player, 210); delayMagicHit(2, getMagicHit(player, damage)); if(!nextTarget) { if(damage == -1) return false; nextTarget = true; } return nextTarget; } }); return 4; case 22:// Ice burst player.setNextGraphics(new Graphics(366)); player.setNextAnimation(new Animation(1979)); attackTarget(getMultiAttackTargets(player), new MultiAttack() { private boolean nextTarget; //real target is first player on array @Override public boolean attack() { mage_hit_gfx = 367; base_mage_xp = 46; freeze_time = 15000; magic_sound = 169; int damage = getRandomMagicMaxHit(player, 220); delayMagicHit(4, getMagicHit(player, damage)); World.sendProjectile(player, target, 366, 43, 0, 120, 0, 50, 64); if(!nextTarget) { if(damage == -1) return false; nextTarget = true; } return nextTarget; } }); return 4; case 29:// Smoke Blitz player.setNextAnimation(new Animation(1978)); mage_hit_gfx = 387; base_mage_xp = 42; max_poison_hit = 40; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, 230))); World.sendProjectile(player, target, 386, 18, 18, 50, 50, 0, 0); return 4; case 33:// Shadow Blitz player.setNextAnimation(new Animation(1978)); mage_hit_gfx = 381; base_mage_xp = 43; reduceAttack = true; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, 240))); World.sendProjectile(player, target, 380, 18, 18, 50, 50, 0, 0); return 4; case 25:// Blood Blitz player.setNextAnimation(new Animation(1978)); mage_hit_gfx = 375; base_mage_xp = 45; blood_spell = true; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, 250))); World.sendProjectile(player, target, 374, 18, 18, 50, 50, 0, 0); return 4; case 21:// Ice Blitz player.setNextGraphics(new Graphics(366)); player.setNextAnimation(new Animation(1978)); mage_hit_gfx = 367; base_mage_xp = 46; freeze_time = 15000; magic_sound = 169; delayMagicHit(2, getMagicHit(player, getRandomMagicMaxHit(player, 260))); World.sendProjectile(player, target, 368, 60, 32, 50, 50, 0, 0); return 4; case 31:// Smoke barrage player.setNextAnimation(new Animation(1979)); attackTarget(getMultiAttackTargets(player), new MultiAttack() { private boolean nextTarget; //real target is first player on array @Override public boolean attack() { mage_hit_gfx = 391; base_mage_xp = 48; max_poison_hit = 40; int damage = getRandomMagicMaxHit(player, 270); delayMagicHit(2, getMagicHit(player, damage)); World.sendProjectile(player, target, 390, 18, 18, 50, 50, 0, 0); if(!nextTarget) { if(damage == -1) return false; nextTarget = true; } return nextTarget; } }); return 4; case 35:// shadow barrage player.setNextAnimation(new Animation(1979)); attackTarget(getMultiAttackTargets(player), new MultiAttack() { private boolean nextTarget; //real target is first player on array @Override public boolean attack() { mage_hit_gfx = 383; base_mage_xp = 49; reduceAttack = true; int damage = getRandomMagicMaxHit(player, 280); delayMagicHit(2, getMagicHit(player, damage)); if(!nextTarget) { if(damage == -1) return false; nextTarget = true; } return nextTarget; } }); return 4; case 27:// blood barrage attackTarget(getMultiAttackTargets(player), new MultiAttack() { private boolean nextTarget; //real target is first player on array @Override public boolean attack() { mage_hit_gfx = 377; base_mage_xp = 51; max_poison_hit = 40; int damage = getRandomMagicMaxHit(player, 290); delayMagicHit(2, getMagicHit(player, damage)); World.sendProjectile(player, target, 390, 18, 18, 50, 50, 0, 0); if(!nextTarget) { if(damage == -1) return false; nextTarget = true; } return nextTarget; } }); return 4; case 23: // ice barrage player.setNextAnimation(new Animation(1979)); playSound(171, player, target); attackTarget(getMultiAttackTargets(player, 9, 4), new MultiAttack() { private boolean nextTarget; //real target is first player on array @Override public boolean attack() { magic_sound = 168; long currentTime = Utils.currentTimeMillis(); if (target.getSize() >= 2 || target.getFreezeDelay() >= currentTime || target.getFrozenBlockedDelay() >= currentTime) { mage_hit_gfx = 1677; } else { mage_hit_gfx = 369; freeze_time = 20000; } base_mage_xp = 52; int damage = getRandomMagicMaxHit(player, 300); Hit hit = getMagicHit(player, damage); delayMagicHit(Utils.getDistance(player, target) > 3 ? 4 : 2, hit); World.sendProjectile(player, target, 368, 60, 32, 50, 50, 0, 0); if(!nextTarget) { if(damage == -1) return false; nextTarget = true; } return nextTarget; } }); return 4; } } return -1; // stops atm } public interface MultiAttack { public boolean attack(); } public void attackTarget(Entity[] targets, MultiAttack perform) { Entity realTarget = target; for(Entity t : targets) { target = t; if(!perform.attack()) break; } target = realTarget; } public int getRandomMagicMaxHit(Player player, int baseDamage) { int current = getMagicMaxHit(player, baseDamage); if (current <= 0) //Splash. return -1; int hit = Utils.random(current+1); if (hit > 0) { if (target instanceof NPC) { NPC n = (NPC) target; if (n.getId() == 9463 && hasFireCape(player)) // ice verm hit += 40; } } return hit; } /** * Gets the current maximum magic hit (depending if the hit was accurate or not). * @param player The player. * @param baseDamage The base damage of the spell. * @return The current maximum hit. */ /*public int getMagicMaxHit(Player player, int baseDamage) { //older formula double effectiveAttack = (Math.round((player.getSkills().getLevel(Skills.MAGIC) * player.getPrayer().getMageMultiplier())) + 8) + player.getCombatDefinitions().getBonuses()[CombatDefinitions.MAGIC_ATTACK]; if (fullVoidEquipped(player, new int[] { 11663, 11674 })) effectiveAttack *= 1.3; effectiveAttack *= player.getAuraManager().getMagicAccurayMultiplier(); double totalDefence = 0; if (target instanceof Player) { Player p2 = (Player) target; double effectiveDefence = (Math.round(p2.getSkills().getLevel(Skills.DEFENCE) + (p2.getPrayer().getDefenceMultiplier() + Utils.random(0, 14))) + 8) + p2.getCombatDefinitions().getBonuses()[CombatDefinitions.MAGIC_DEF]; double effectiveMagicDefence = p2.getSkills().getLevel(Skills.MAGIC) + p2.getPrayer().getMageMultiplier(); effectiveMagicDefence *= 0.7; effectiveDefence *= 0.3; totalDefence = Math.round(effectiveMagicDefence + effectiveDefence); } else { NPC n = (NPC) target; totalDefence = n.getBonuses() != null ? n.getBonuses()[CombatDefinitions.MAGIC_DEF] : 0; } double attack = Math.round((effectiveAttack * (64 + player.getCombatDefinitions().getBonuses()[CombatDefinitions.MAGIC_ATTACK])) / 10); double defence = Math.round(((totalDefence * (64 + player.getCombatDefinitions().getBonuses()[CombatDefinitions.MAGIC_DEF])) / 10)); double accuracy = 0.5; if (attack < defence) accuracy = (attack - 1) / (2 * defence); else if (attack > defence) accuracy = 1 - (defence + 1) / (2 * attack); if (accuracy > 0.90) accuracy = 0.90; else if (accuracy < 0.01) accuracy = 0.01; if (accuracy < Math.random()) { return 0; } max_hit = baseDamage; double boost = 1 + ((player.getSkills().getLevel(Skills.MAGIC) - player .getSkills().getLevelForXp(Skills.MAGIC)) * 0.03); if (boost > 1) max_hit *= boost; double magicPerc = player.getCombatDefinitions().getBonuses()[CombatDefinitions.MAGIC_DAMAGE]; if (spellcasterGloves > 0) { if (baseDamage > 60 || spellcasterGloves == 28 || spellcasterGloves == 25) { magicPerc += 17; if (target instanceof Player) { Player p = (Player) target; p.getSkills().drainLevel(0, p.getSkills().getLevel(0) / 10); p.getSkills().drainLevel(1, p.getSkills().getLevel(1) / 10); p.getSkills().drainLevel(2, p.getSkills().getLevel(2) / 10); p.getPackets().sendGameMessage("Your melee skills have been drained."); player.getPackets().sendGameMessage("Your spell weakened your enemy."); } player.getPackets().sendGameMessage("Your magic surged with extra power."); } } boost = magicPerc / 100 + 1; max_hit *= boost; return (int) Math.floor(max_hit); }*/ /*public int getMagicMaxHit(Player player, int baseDamage) { double EA = (Math.round(player.getSkills().getLevel(Skills.MAGIC) * player.getPrayer().getMageMultiplier()) + 8); if (fullVoidEquipped(player, new int[] { 11663, 11674 })) EA *= 1.3; EA *= player.getAuraManager().getMagicAccurayMultiplier(); double ED = 0, DB; if (target instanceof Player) { Player p2 = (Player) target; double EMD = p2.getSkills().getLevel(Skills.MAGIC) * p2.getPrayer().getMageMultiplier(); if (p2.getFamiliar() != null && (p2.getFamiliar().getId() == 6870 || p2.getFamiliar().getId() == 6871)) EMD *= 1.05; Math.round(EMD); double ERD = (Math.round(p2.getSkills().getLevel(Skills.DEFENCE) * p2.getPrayer().getDefenceMultiplier()) + 8) + (player.getCombatDefinitions().isDefensiveCasting() ? 3 : 0); EMD *= 0.7; ERD *= 0.3; ED = (EMD + ERD); DB = p2.getCombatDefinitions().getBonuses()[CombatDefinitions.MAGIC_DEF]; } else { NPC n = (NPC) target; DB = ED = n.getBonuses() != null ? n.getBonuses()[CombatDefinitions.MAGIC_DEF] : 0; } double A = (EA * (64 + player.getCombatDefinitions().getBonuses()[CombatDefinitions.MAGIC_ATTACK])) / 10; double D = (ED * (64 + DB)) / 10; double accuracy = 0.05; //so a level 3 can hit a level 138 if (A < D) accuracy = (A-1) / (2 * D); else if (A > D) accuracy = 1 - (D + 1) / (2 * A); if (accuracy < Math.random()) { return 0; } max_hit = baseDamage; double boost = 1 + ((player.getSkills().getLevel(Skills.MAGIC) - player .getSkills().getLevelForXp(Skills.MAGIC)) * 0.03); if (boost > 1) max_hit *= boost; double magicPerc = player.getCombatDefinitions().getBonuses()[CombatDefinitions.MAGIC_DAMAGE]; if (spellcasterGloves > 0) { if (baseDamage > 60 || spellcasterGloves == 28 || spellcasterGloves == 25) { magicPerc += 17; if (target instanceof Player) { Player p = (Player) target; p.getSkills().drainLevel(0, p.getSkills().getLevel(0) / 10); p.getSkills().drainLevel(1, p.getSkills().getLevel(1) / 10); p.getSkills().drainLevel(2, p.getSkills().getLevel(2) / 10); p.getPackets().sendGameMessage("Your melee skills have been drained."); player.getPackets().sendGameMessage("Your spell weakened your enemy."); } player.getPackets().sendGameMessage("Your magic surged with extra power."); } } boost = magicPerc / 100 + 1; max_hit *= boost; return (int) Math.floor(max_hit); }*/ private int getMagicMaxHit(Player player, int baseDamage) { double EA = (Math.round(player.getSkills().getLevel(Skills.MAGIC) * player.getPrayer().getMageMultiplier()) + 11); if (fullVoidEquipped(player, new int[] { 11663, 11674 })) EA *= 1.3; EA *= player.getAuraManager().getMagicAccurayMultiplier(); double ED = 0, DB; if (target instanceof Player) { Player p2 = (Player) target; double EMD = ((Math.round(p2.getSkills().getLevel(Skills.MAGIC) * p2.getPrayer().getMageMultiplier()) + 8) + (player.getCombatDefinitions().isDefensiveCasting() ? 3 : 0)); if (p2.getFamiliar() != null && (p2.getFamiliar().getId() == 6870 || p2.getFamiliar().getId() == 6871)) EMD *= 1.05; Math.round(EMD); double ERD = (Math.round(p2.getSkills().getLevel(Skills.DEFENCE) * p2.getPrayer().getDefenceMultiplier()) + 8); EMD *= 0.7; ERD *= 0.3; ED = (EMD + ERD); DB = p2.getCombatDefinitions().getBonuses()[CombatDefinitions.MAGIC_DEF]; } else { NPC n = (NPC) target; DB = ED = n.getBonuses() != null ? n.getBonuses()[CombatDefinitions.MAGIC_DEF] / 1.6 : 0; } double A = (EA * (1 + player.getCombatDefinitions().getBonuses()[CombatDefinitions.MAGIC_ATTACK]) / 64); double D = (ED * (1 + DB)) / 64; double accuracy = 0.05; //so a level 3 can hit a level 138 if (A < D) accuracy = (A - 1) / (2 * D); else if (A > D) accuracy = 1 - (D + 1) / (2 * A); if (accuracy < Math.random()) { return 0; } max_hit = baseDamage; double boost = 1 + ((player.getSkills().getLevel(Skills.MAGIC) - player.getSkills().getLevelForXp(Skills.MAGIC)) * 0.03); if (boost > 1) max_hit *= boost; double magicPerc = player.getCombatDefinitions().getBonuses()[CombatDefinitions.MAGIC_DAMAGE]; if (spellcasterGloves > 0) { if (baseDamage > 60 || spellcasterGloves == 28 || spellcasterGloves == 25) { magicPerc += 17; if (target instanceof Player) { Player p = (Player) target; p.getSkills().drainLevel(0, p.getSkills().getLevel(0) / 10); p.getSkills().drainLevel(1, p.getSkills().getLevel(1) / 10); p.getSkills().drainLevel(2, p.getSkills().getLevel(2) / 10); p.getPackets().sendGameMessage("Your melee skills have been drained."); player.getPackets().sendGameMessage("Your spell weakened your enemy."); } player.getPackets().sendGameMessage("Your magic surged with extra power."); } } boost = magicPerc / 100 + 1; max_hit *= boost; return (int) Math.floor(max_hit); } /** * Gets the magic accuracy. * @param e The player. * @param baseDamage The base damage. * @param extraDamage The extra damage. * @return The magic accuracy value. */ @SuppressWarnings("unused") private double getMagicAccuracy(Player e, int baseDamage, int extraDamage) { int magicLevel = e.getSkills().getLevel(Skills.MAGIC) + 1; int magicBonus = e.getCombatDefinitions().getBonuses()[CombatDefinitions.MAGIC_ATTACK]; if ((baseDamage << 2) < 60 && spellcasterGloves > 0 && spellcasterGloves != 28 && spellcasterGloves != 25) { magicBonus += 20; } double prayer = 1.0 * e.getPrayer().getMageMultiplier(); double accuracy = ((magicLevel + (magicBonus * 4))) * prayer; accuracy += (extraDamage + baseDamage) >> 1; if (fullVoidEquipped(e, 11663, 11674)) { accuracy *= 1.106; } return accuracy < 1 ? 1 : accuracy; } /** * Gets the magic defence of an entity. * @param e The entity. * @return The magic defence value. */ /* private double getMagicDefence(Entity e) { Player p = e instanceof Player ? (Player) e : null; int style = p != null ? 0 : 1; if (p != null) { int type = CombatDefinitions.getXpStyle(p.getEquipment().getWeaponId(), p.getCombatDefinitions().getAttackStyle()); style += type == Skills.DEFENCE ? 3 : type == CombatDefinitions.SHARED ? 1 : 0; } double defLvl = (p != null ? p.getSkills().getLevel(Skills.DEFENCE) : ((NPC) e).getCombatLevel() * 0.7) * 0.3; defLvl += (p != null ? p.getSkills().getLevel(Skills.MAGIC) : ((NPC) e).getCombatLevel() * 0.7) * 0.7; int defBonus = p != null ? p.getCombatDefinitions().getBonuses()[CombatDefinitions.MAGIC_DEF] : ((NPC) e).getBonuses() != null ? ((NPC) e).getBonuses()[CombatDefinitions.MAGIC_DEF] : 5; double defMult = 1.0; if (p != null) { defMult += p.getPrayer().getDefenceMultiplier(); } double defence = ((defLvl + (defBonus << 2)) + style) * defMult; return defence < 1 ? 1 : defence; }*/ private int rangeAttack(final Player player) { final int weaponId = player.getEquipment().getWeaponId(); final int attackStyle = player.getCombatDefinitions().getAttackStyle(); int combatDelay = getRangeCombatDelay(weaponId, attackStyle); int soundId = getSoundId(weaponId, attackStyle); if (player.getCombatDefinitions().isUsingSpecialAttack()) { int specAmt = getSpecialAmmount(weaponId); if (specAmt == 0) { player.getPackets() .sendGameMessage( "This weapon has no special Attack, if you still see special bar please relogin."); player.getCombatDefinitions().desecreaseSpecialAttack(0); return combatDelay; } if (player.getCombatDefinitions().hasRingOfVigour()) specAmt *= 0.9; if (player.getCombatDefinitions().getSpecialAttackPercentage() < specAmt) { player.getPackets().sendGameMessage( "You don't have enough power left."); player.getCombatDefinitions().desecreaseSpecialAttack(0); return combatDelay; } player.getCombatDefinitions().desecreaseSpecialAttack(specAmt); switch (weaponId) { case 19149:// zamorak bow case 19151: player.setNextAnimation(new Animation(426)); player.setNextGraphics(new Graphics(97)); World.sendProjectile(player, target, 100, 41, 16, 25, 35, 16, 0); delayHit( 1, weaponId, attackStyle, getRangeHit( player, getRandomMaxHit(player, weaponId, attackStyle, true, true, 1.0, true))); dropAmmo(player, 1); break; case 19146: case 19148:// guthix bow player.setNextAnimation(new Animation(426)); player.setNextGraphics(new Graphics(95)); World.sendProjectile(player, target, 98, 41, 16, 25, 35, 16, 0); delayHit( 1, weaponId, attackStyle, getRangeHit( player, getRandomMaxHit(player, weaponId, attackStyle, true, true, 1.0, true))); dropAmmo(player, 1); break; case 19143:// saradomin bow case 19145: player.setNextAnimation(new Animation(426)); player.setNextGraphics(new Graphics(96)); World.sendProjectile(player, target, 99, 41, 16, 25, 35, 16, 0); delayHit( 1, weaponId, attackStyle, getRangeHit( player, getRandomMaxHit(player, weaponId, attackStyle, true, true, 1.0, true))); dropAmmo(player, 1); break; case 10034: case 10033: attackTarget(getMultiAttackTargets(player), new MultiAttack() { private boolean nextTarget; //real target is first player on array @Override public boolean attack() { int damage = getRandomMaxHit(player, weaponId, attackStyle, true, true, weaponId == 10034 ? 1.2 : 1.0, true); player.setNextAnimation(new Animation(2779)); World.sendProjectile(player, target, weaponId == 10034 ? 909 : 908, 41, 16, 31, 35, 16, 0); delayHit(1, weaponId, attackStyle, getRangeHit(player, damage)); WorldTasksManager.schedule(new WorldTask() { @Override public void run() { player.setNextGraphics(new Graphics(2739, 0, 96 << 16)); } }, 2); if(!nextTarget) { if(damage == -1) return false; nextTarget = true; } return nextTarget; } }); break; case 859: // magic longbow case 861: // magic shortbow case 10284: // Magic composite bow case 18332: // Magic longbow (sighted) player.setNextAnimation(new Animation(1074)); player.setNextGraphics(new Graphics(249, 0, 100)); World.sendProjectile(player, target, 249, 41, 16, 31, 35, 16, 0); World.sendProjectile(player, target, 249, 41, 16, 25, 35, 21, 0); delayHit( 2, weaponId, attackStyle, getRangeHit( player, getRandomMaxHit(player, weaponId, attackStyle, true, true, 1.0, true))); delayHit( 3, weaponId, attackStyle, getRangeHit( player, getRandomMaxHit(player, weaponId, attackStyle, true, true, 1.0, true))); dropAmmo(player, 2); break; case 15241: // Hand cannon WorldTasksManager.schedule(new WorldTask() { int loop = 0; @Override public void run() { if ((target.isDead() || player.isDead() || loop > 1) && !World.getNPCs().contains(target)) { stop(); return; } if (loop == 0) { player.setNextAnimation(new Animation(12174)); player.setNextGraphics(new Graphics(2138)); World.sendProjectile(player, target, 2143, 18, 18, 50, 50, 0, 0); delayHit( 1, weaponId, attackStyle, getRangeHit( player, getRandomMaxHit(player, weaponId, attackStyle, true, true, 1.0, true))); } else if (loop == 1) { player.setNextAnimation(new Animation(12174)); player.setNextGraphics(new Graphics(2138)); World.sendProjectile(player, target, 2143, 18, 18, 50, 50, 0, 0); delayHit( 1, weaponId, attackStyle, getRangeHit( player, getRandomMaxHit(player, weaponId, attackStyle, true, true, 1.0, true))); stop(); } loop++; } }, 0, (int) 0.25); combatDelay = 9; break; case 11235: // dark bows case 15701: case 15702: case 15703: case 15704: int ammoId = player.getEquipment().getAmmoId(); player.setNextAnimation(new Animation(getWeaponAttackEmote(weaponId, attackStyle))); player.setNextGraphics(new Graphics(getArrowThrowGfxId(weaponId, ammoId), 0, 100)); if (ammoId == 11212) { int damage = getRandomMaxHit(player, weaponId, attackStyle, true, true, 1.5, true); if (damage < 80) damage = 80; int damage2 = getRandomMaxHit(player, weaponId, attackStyle, true, true, 1.5, true); if (damage2 < 80) damage2 = 80; World.sendProjectile(player, target, 1099, 41, 16, 31, 35, 16, 0); World.sendProjectile(player, target, 1099, 41, 16, 25, 35, 21, 0); delayHit(2, weaponId, attackStyle, getRangeHit(player, damage)); delayHit(3, weaponId, attackStyle, getRangeHit(player, damage2)); WorldTasksManager.schedule(new WorldTask() { @Override public void run() { target.setNextGraphics(new Graphics(1100, 0, 100)); } }, 2); } else { int damage = getRandomMaxHit(player, weaponId, attackStyle, true, true, 1.3, true); if (damage < 50) damage = 50; int damage2 = getRandomMaxHit(player, weaponId, attackStyle, true, true, 1.3, true); if (damage2 < 50) damage2 = 50; World.sendProjectile(player, target, 1101, 41, 16, 31, 35, 16, 0); World.sendProjectile(player, target, 1101, 41, 16, 25, 35, 21, 0); delayHit(2, weaponId, attackStyle, getRangeHit(player, damage)); delayHit(3, weaponId, attackStyle, getRangeHit(player, damage2)); } dropAmmo(player, 2); break; case 14684: // zanik cbow player.setNextAnimation(new Animation(getWeaponAttackEmote(weaponId, attackStyle))); player.setNextGraphics(new Graphics(1714)); World.sendProjectile(player, target, 2001, 41, 41, 41, 35, 0, 0); delayHit( 2, weaponId, attackStyle, getRangeHit( player, getRandomMaxHit(player, weaponId, attackStyle, true, true, 1.0, true) + 30 + Utils.getRandom(120))); dropAmmo(player); break; case 13954:// morrigan javelin case 12955: case 13956: case 13879: case 13880: case 13881: case 13882: player.setNextGraphics(new Graphics(1836)); player.setNextAnimation(new Animation(10501)); World.sendProjectile(player, target, 1837, 41, 41, 41, 35, 0, 0); final int hit = getRandomMaxHit(player, weaponId, attackStyle, true, true, 1.0, true); delayHit(2, weaponId, attackStyle, getRangeHit(player, hit)); if (hit > 0) { final Entity finalTarget = target; WorldTasksManager.schedule(new WorldTask() { int damage = hit; @Override public void run() { if (finalTarget.isDead() || finalTarget.hasFinished()) { stop(); return; } if (damage > 50) { damage -= 50; finalTarget.applyHit(new Hit(player, 50, HitLook.REGULAR_DAMAGE)); } else { finalTarget.applyHit(new Hit(player, damage, HitLook.REGULAR_DAMAGE)); stop(); } } }, 4, 2); } dropAmmo(player, -1); break; case 13883: case 13957:// morigan thrown axe player.setNextGraphics(new Graphics(1838)); player.setNextAnimation(new Animation(10504)); World.sendProjectile(player, target, 1839, 41, 41, 41, 35, 0, 0); delayHit( 2, weaponId, attackStyle, getRangeHit( player, getRandomMaxHit(player, weaponId, attackStyle, true, true, 1.0, true))); dropAmmo(player, -1); break; default: player.getPackets() .sendGameMessage( "This weapon has no special Attack, if you still see special bar please relogin."); return combatDelay; } } else { if (weaponId != -1) { String weaponName = ItemDefinitions .getItemDefinitions(weaponId).getName().toLowerCase(); if (weaponName.contains("throwing axe") || weaponName.contains("knife") || weaponName.contains("dart") || weaponName.contains("javelin") || weaponName.contains("thrownaxe")) { if (!weaponName.contains("javelin") && !weaponName.contains("thrownaxe")) player.setNextGraphics(new Graphics( getKnifeThrowGfxId(weaponId), 0, 100)); World.sendProjectile(player, target, getKnifeThrowGfxId(weaponId), 41, 36, 41, 32, 15, 0); int hit = getRandomMaxHit(player, weaponId, attackStyle, true); delayHit(1, weaponId, attackStyle, getRangeHit(player, hit)); checkSwiftGlovesEffect(player, 1, attackStyle, weaponId, hit, getKnifeThrowGfxId(weaponId), 41, 36, 41, 32, 15, 0); dropAmmo(player, -1); } else if (weaponName.contains("crossbow")) { int damage = 0; int ammoId = player.getEquipment().getAmmoId(); if (ammoId != -1 && Utils.getRandom(10) == 5) { switch (ammoId) { case 9237: damage = getRandomMaxHit(player, weaponId, attackStyle, true); target.setNextGraphics(new Graphics(755)); if (target instanceof Player) { Player p2 = (Player) target; p2.stopAll(); } else { NPC n = (NPC) target; n.setTarget(null); } soundId = 2914; break; case 9242: max_hit = Short.MAX_VALUE; damage = (int) (target.getHitpoints() * 0.2); target.setNextGraphics(new Graphics(754)); player.applyHit(new Hit(target, player .getHitpoints() > 20 ? (int) (player .getHitpoints() * 0.1) : 1, HitLook.REFLECTED_DAMAGE)); soundId = 2912; break; case 9243: damage = getRandomMaxHit(player, weaponId, attackStyle, true, false, 1.15, true); target.setNextGraphics(new Graphics(751)); soundId = 2913; break; case 9244: damage = getRandomMaxHit(player, weaponId, attackStyle, true, false, !Combat.hasAntiDragProtection(target) ? 1.45 : 1.0, true); target.setNextGraphics(new Graphics(756)); soundId = 2915; break; case 9245: damage = getRandomMaxHit(player, weaponId, attackStyle, true, false, 1.15, true); target.setNextGraphics(new Graphics(753)); player.heal((int) (player.getMaxHitpoints() * 0.25)); soundId = 2917; break; default: damage = getRandomMaxHit(player, weaponId, attackStyle, true); } } else { damage = getRandomMaxHit(player, weaponId, attackStyle, true); checkSwiftGlovesEffect(player, 2, attackStyle, weaponId, damage, 27, 38, 36, 41, 32, 5, 0); } World.sendProjectile(player, target, 27, 38, 36, 41, 32, 5, 0); delayHit(2, weaponId, attackStyle, getRangeHit(player, damage)); if (weaponId != 4740) dropAmmo(player); else player.getEquipment().removeAmmo(ammoId, 1); } else if (weaponId == 15241) {// handcannon if (Utils.getRandom(player.getSkills().getLevel(Skills.FIREMAKING) << 1) == 0) { // explode player.setNextGraphics(new Graphics(2140)); player.getEquipment().getItems().set(3, null); player.getEquipment().refresh(3); player.getAppearence().generateAppearenceData(); player.applyHit(new Hit(player, Utils.getRandom(150) + 10, HitLook.REGULAR_DAMAGE)); player.setNextAnimation(new Animation(12175)); return combatDelay; } else { player.setNextGraphics(new Graphics(2138)); World.sendProjectile(player, target, 2143, 18, 18, 60, 30, 0, 0); delayHit(1, weaponId, attackStyle, getRangeHit(player, getRandomMaxHit(player, weaponId, attackStyle, true))); dropAmmo(player, -2); } } else if (weaponName.contains("crystal bow")) { player.setNextAnimation(new Animation(getWeaponAttackEmote(weaponId, attackStyle))); player.setNextGraphics(new Graphics(250)); World.sendProjectile(player, target, 249, 41, 36, 41, 35, 0, 0); int hit = getRandomMaxHit(player, weaponId, attackStyle, true); delayHit(2, weaponId, attackStyle, getRangeHit(player, hit)); checkSwiftGlovesEffect(player, 2, attackStyle, weaponId, hit, 249, 41, 36, 41, 35, 0, 0); } else if (weaponId == 21365) { //if (player.getRights() == 0) { //player.getPackets().sendGameMessage("You have to be donator to be using Bolas."); //return combatDelay; //} dropAmmo(player, -3); player.setNextAnimation(new Animation(3128)); World.sendProjectile(player, target, 468, 41, 41, 41, 35, 0, 0); int delay = 15000; if (target instanceof Player) { Player p = (Player) target; Item weapon = p.getEquipment().getItem(3); boolean slashBased = weapon != null; if (weapon != null) { int slash = p.getCombatDefinitions().getBonuses()[CombatDefinitions.SLASH_ATTACK]; for (int i = 0; i < 5; i++) { if (p.getCombatDefinitions().getBonuses()[i] > slash) { slashBased = false; break; } } } if (p.getInventory().containsItem(946, 1) || slashBased) { delay /= 2; } if (p.getPrayer().usingPrayer(0, 18) || p.getPrayer().usingPrayer(1, 8)) { delay /= 2; } if (delay < 5000) { delay = 5000; } } long currentTime = Utils.currentTimeMillis(); if (getRandomMaxHit(player, weaponId, attackStyle, true) > 0 && target.getFrozenBlockedDelay() < currentTime) { target.addFreezeDelay(delay, true); WorldTasksManager.schedule(new WorldTask() { @Override public void run() { target.setNextGraphics(new Graphics(469, 0, 96)); } }, 2); } playSound(soundId, player, target); return combatDelay; } else { // bow/default final int ammoId = player.getEquipment().getAmmoId(); player.setNextGraphics(new Graphics(getArrowThrowGfxId(weaponId, ammoId), 0, 100)); World.sendProjectile(player, target, getArrowProjectileGfxId(weaponId, ammoId), 41, 36, 20, 35, 16, 0); int hit = getRandomMaxHit(player, weaponId, attackStyle, true); delayHit(2, weaponId, attackStyle, getRangeHit(player, hit)); checkSwiftGlovesEffect(player, 2, attackStyle, weaponId, hit, getArrowProjectileGfxId(weaponId, ammoId), 41, 36, 20, 35, 16, 0); if (weaponId == 11235 || weaponId == 15701 || weaponId == 15702 || weaponId == 15703 || weaponId == 15704) { // dbows World.sendProjectile(player, target,getArrowProjectileGfxId(weaponId, ammoId), 41, 35, 36, 35, 21, 0); delayHit(3, weaponId, attackStyle, getRangeHit(player, getRandomMaxHit(player, weaponId, attackStyle, true))); dropAmmo(player, 2); } else { if (weaponId != -1) { if (!weaponName.endsWith("bow full") && !weaponName.equals("zaryte bow") && weaponId != 24474 && weaponId != 24457) dropAmmo(player); } } } player.setNextAnimation(new Animation(getWeaponAttackEmote(weaponId, attackStyle))); } } playSound(soundId, player, target); return combatDelay; } /** * Handles the swift gloves effect. * @param player The player. * @param hitDelay The delay before hitting the target. * @param attackStyle The attack style used. * @param weaponId The weapon id. * @param hit The hit done. * @param gfxId The gfx id. * @param startHeight The start height of the original projectile. * @param endHeight The end height of the original projectile. * @param speed The speed of the original projectile. * @param delay The delay of the original projectile. * @param curve The curve of the original projectile. * @param startDistanceOffset The start distance offset of the original projectile. */ private void checkSwiftGlovesEffect(Player player, int hitDelay, int attackStyle, int weaponId, int hit, int gfxId, int startHeight, int endHeight, int speed, int delay, int curve, int startDistanceOffset) { Item gloves = player.getEquipment().getItem(Equipment.SLOT_HANDS); if (gloves == null || !gloves.getDefinitions().getName().contains("Swift glove")) { return; } if (hit != 0 && hit < ((max_hit / 3) * 2) || new Random().nextInt(3) != 0) { return; } player.getPackets().sendGameMessage("You fired an extra shot."); World.sendProjectile(player, target, gfxId, startHeight - 5, endHeight - 5, speed, delay, curve - 5 < 0 ? 0 : curve - 5, startDistanceOffset); delayHit(hitDelay, weaponId, attackStyle, getRangeHit(player, getRandomMaxHit(player, weaponId, attackStyle, true))); if (hit > (max_hit - 10)) { target.addFreezeDelay(10000, false); target.setNextGraphics(new Graphics(181, 0, 96)); } } public void dropAmmo(Player player, int quantity) { if (quantity == -2) { final int ammoId = player.getEquipment().getAmmoId(); player.getEquipment().removeAmmo(ammoId, 1); } else if (quantity == -1 || quantity == -3) { final int weaponId = player.getEquipment().getWeaponId(); if (weaponId != -1) { if ((quantity == -3 && Utils.getRandom(10) < 2) || (quantity != -3 && Utils.getRandom(3) > 0)) { int capeId = player.getEquipment().getCapeId(); if (capeId != -1 && ItemDefinitions.getItemDefinitions(capeId) .getName().contains("Ava's")) return; // nothing happens } else { player.getEquipment().removeAmmo(weaponId, quantity); return; } player.getEquipment().removeAmmo(weaponId, quantity); World.updateGroundItem( new Item(weaponId, quantity), new WorldTile(target.getCoordFaceX(target.getSize()), target.getCoordFaceY(target.getSize()), target .getPlane()), player); } } else { final int ammoId = player.getEquipment().getAmmoId(); if (Utils.getRandom(3) > 0) { int capeId = player.getEquipment().getCapeId(); if (capeId != -1 && ItemDefinitions.getItemDefinitions(capeId).getName() .contains("Ava's")) return; // nothing happens } else { player.getEquipment().removeAmmo(ammoId, quantity); return; } if (ammoId != -1) { player.getEquipment().removeAmmo(ammoId, quantity); World.updateGroundItem( new Item(ammoId, quantity), new WorldTile(target.getCoordFaceX(target.getSize()), target.getCoordFaceY(target.getSize()), target .getPlane()), player); } } } public void dropAmmo(Player player) { dropAmmo(player, 1); } public int getArrowThrowGfxId(int weaponId, int arrowId) { if (arrowId == 884) { return 18; } else if (arrowId == 886) { return 20; } else if (arrowId == 888) { return 21; } else if (arrowId == 890) { return 22; } else if (arrowId == 892) { return 24; } return 19; // bronze default } public int getArrowProjectileGfxId(int weaponId, int arrowId) { if (arrowId == 884) { return 11; } else if (arrowId == 886) { return 12; } else if (arrowId == 888) { return 13; } else if (arrowId == 890) { return 14; } else if (arrowId == 892) return 15; else if (arrowId == 11212) return 1120; else if (weaponId == 20171 || weaponId == 24456) return 1066; else if (weaponId == 24474) return 3196; return 10;// bronze default } public static int getKnifeThrowGfxId(int weaponId) { // knives TODO ALL if (weaponId == 868) { return 225; } else if (weaponId == 867) { return 224; } else if (weaponId == 866) { return 223; } else if (weaponId == 865) { return 221; } else if (weaponId == 864) { return 219; } else if (weaponId == 863) { return 220; } // darts if (weaponId == 806) { return 232; } else if (weaponId == 807) { return 233; } else if (weaponId == 808) { return 234; } else if (weaponId == 3093) { return 273; } else if (weaponId == 809) { return 235; } else if (weaponId == 810) { return 236; } else if (weaponId == 811) { return 237; } else if (weaponId == 11230) { return 1123; } // javelins if (weaponId >= 13954 && weaponId <= 13956 || weaponId >= 13879 && weaponId <= 13882) return 1837; // thrownaxe if (weaponId == 13883 || weaponId == 13957) return 1839; if (weaponId == 800) return 43; else if (weaponId == 13883 || weaponId == 13957) return 1839; else if (weaponId == 13954 || weaponId == 13955 || weaponId == 13956 || weaponId == 13879 || weaponId == 13880 || weaponId == 13881 || weaponId == 13882) return 1837; return 219; } @SuppressWarnings("unused") private int getRangeHitDelay(Player player) { return Utils.getDistance(player.getX(), player.getY(), target.getX(), target.getY()) >= 5 ? 2 : 1; } private int meleeAttack(final Player player) { int weaponId = player.getEquipment().getWeaponId(); int attackStyle = player.getCombatDefinitions().getAttackStyle(); int combatDelay = getMeleeCombatDelay(player, weaponId); int soundId = getSoundId(weaponId, attackStyle); if (weaponId == -1) { Item gloves = player.getEquipment().getItem(Equipment.SLOT_HANDS); if (gloves != null && gloves.getDefinitions().getName().contains("Goliath gloves")) { weaponId = -2; } } if (player.getCombatDefinitions().isUsingSpecialAttack()) { if(!specialExecute(player)) return combatDelay; switch (weaponId) { case 15442:// whip start case 15443: case 15444: case 15441: case 4151: case 23691: player.setSwitchDelay(Utils.currentTimeMillis() + 700); player.setNextAnimation(new Animation(11971)); target.setNextGraphics(new Graphics(2108, 0, 100)); if (target instanceof Player) { Player p2 = (Player) target; p2.setRunEnergy(p2.getRunEnergy() > 25 ? p2.getRunEnergy() - 25 : 0); } delayNormalHit( weaponId, attackStyle, getMeleeHit( player, getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.2, true))); break; case 11730: // sara sword case 23690: player.setSwitchDelay(Utils.currentTimeMillis() + 1000); player.setNextAnimation(new Animation(11993)); target.setNextGraphics(new Graphics(1194)); delayNormalHit( weaponId, attackStyle, getMeleeHit(player, 50 + Utils.getRandom(100)), getMeleeHit(player, getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.1, true))); soundId = 3853; break; case 1249://d spear case 1263: case 3176: case 5716: case 5730: case 13770: case 13772: case 13774: case 13776: player.setSwitchDelay(Utils.currentTimeMillis() + 500); player.setNextAnimation(new Animation(12017)); player.stopAll(); target.setNextGraphics(new Graphics(80, 5, 60)); if (!target.addWalkSteps(target.getX() - player.getX() + target.getX(), target.getY() - player.getY() + target.getY(), 1)) player.setNextFaceEntity(target); target.setNextFaceEntity(player); WorldTasksManager.schedule(new WorldTask() { @Override public void run() { target.setNextFaceEntity(null); player.setNextFaceEntity(null); } }); if (target instanceof Player) { final Player other = (Player) target; other.lock(); other.addFoodDelay(3000); other.setDisableEquip(true); WorldTasksManager.schedule(new WorldTask() { @Override public void run() { other.setDisableEquip(false); other.unlock(); } }, 5); } else { NPC n = (NPC) target; n.setFreezeDelay(3000); n.resetCombat(); n.setRandomWalk(false); } break; case 11698: // sgs case 23681: player.setSwitchDelay(Utils.currentTimeMillis() + 1000); player.setNextAnimation(new Animation(7071)); player.setNextGraphics(new Graphics(2109)); int sgsdamage = getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.1, true); player.heal(sgsdamage / 2); player.getPrayer().restorePrayer((sgsdamage / 4) * 10); delayNormalHit(weaponId, attackStyle, getMeleeHit(player, sgsdamage)); break; case 11696: // bgs case 23680: player.setSwitchDelay(Utils.currentTimeMillis() + 1000); player.setNextAnimation(new Animation(11991)); player.setNextGraphics(new Graphics(2114)); int damage = getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.2, true); delayNormalHit(weaponId, attackStyle, getMeleeHit(player, damage)); if (target instanceof Player) { Player targetPlayer = ((Player) target); int amountLeft; if ((amountLeft = targetPlayer.getSkills().drainLevel(Skills.DEFENCE, damage / 10)) > 0) { if ((amountLeft = targetPlayer.getSkills().drainLevel( Skills.STRENGTH, amountLeft)) > 0) { if ((amountLeft = targetPlayer.getSkills() .drainLevel(Skills.PRAYER, amountLeft)) > 0) { if ((amountLeft = targetPlayer.getSkills() .drainLevel(Skills.ATTACK, amountLeft)) > 0) { if ((amountLeft = targetPlayer.getSkills() .drainLevel(Skills.MAGIC, amountLeft)) > 0) { if (targetPlayer.getSkills() .drainLevel(Skills.RANGE, amountLeft) > 0) { break; } } } } } } } break; case 11694: // ags case 23679: player.setSwitchDelay(Utils.currentTimeMillis() + 1000); player.setNextAnimation(new Animation(11989)); player.setNextGraphics(new Graphics(2113)); delayNormalHit( weaponId, attackStyle, getMeleeHit(player, getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.375, true))); break; case 13899: // vls case 13901: player.setSwitchDelay(Utils.currentTimeMillis() + 600); player.setNextAnimation(new Animation(10502)); delayNormalHit( weaponId, attackStyle, getMeleeHit(player, getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.20, true))); break; case 13902: // statius hammer case 13904: player.setSwitchDelay(Utils.currentTimeMillis() + 600); player.setNextAnimation(new Animation(10505)); player.setNextGraphics(new Graphics(1840)); delayNormalHit( weaponId, attackStyle, getMeleeHit( player, getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.25, true))); break; case 13905: // vesta spear case 13907: player.setSwitchDelay(Utils.currentTimeMillis() + 1000); player.setNextAnimation(new Animation(10499)); player.setNextGraphics(new Graphics(1835)); delayNormalHit( weaponId, attackStyle, getMeleeHit( player, getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.1, true))); break; case 19784: // korasi sword case 18786: player.setSwitchDelay(Utils.currentTimeMillis() + 600); player.setNextAnimation(new Animation(14788)); player.setNextGraphics(new Graphics(1729)); int korasiDamage = getMaxHit(player, weaponId, attackStyle, false, true, 1); double multiplier = 0.5 + Math.random(); max_hit = (int) (korasiDamage * 1.5); korasiDamage *= multiplier; delayNormalHit(weaponId, attackStyle, getMagicHit(player, korasiDamage)); break; case 11700: player.setSwitchDelay(Utils.currentTimeMillis() + 1000); int zgsdamage = getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.0, true); player.setNextAnimation(new Animation(7070)); player.setNextGraphics(new Graphics(1221)); if (zgsdamage != 0 && target.getSize() <= 1) { target.setNextGraphics(new Graphics(2104)); target.addFreezeDelay(18000); } delayNormalHit(weaponId, attackStyle, getMeleeHit(player, zgsdamage)); break; case 14484: //d claws case 23695: player.setSwitchDelay(Utils.currentTimeMillis() + 1500); player.setNextAnimation(new Animation(10961)); player.setNextGraphics(new Graphics(1950)); int[] hits = new int[] {0, 1}; int hit = getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.4, true); if (hit > 0) { hits = new int[] {hit, hit / 2, (hit / 2) / 2, (hit / 2) - ((hit / 2) / 2)}; } else { hit = getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.4, true); if (hit > 0) { hits = new int[] {0, hit, hit / 2, hit - (hit / 2)}; } else { hit = getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.4, true); if (hit > 0) { hits = new int[] {0, 0, hit / 2, (hit / 2) + 10}; } else { hit = getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.4, true); if (hit > 0) { hits = new int[] {0, 0, 0, (int) (hit * 1.5)}; } else { hits = new int[] {0, 0, 0, Utils.getRandom(7)}; } } } } for (int i = 0; i < hits.length; i++) { if (i > 1) { delayHit(1, weaponId, attackStyle, getMeleeHit(player, hits[i])); } else { delayNormalHit(weaponId, attackStyle, getMeleeHit(player, hits[i])); } } break; case 10887: // anchor player.setSwitchDelay(Utils.currentTimeMillis() + 1500); player.setNextAnimation(new Animation(5870)); player.setNextGraphics(new Graphics(1027)); delayNormalHit(weaponId, attackStyle, getMeleeHit(player, getRandomMaxHit(player, weaponId, attackStyle, false, false, 1.0, true))); break; case 1305: // dragon long player.setSwitchDelay(Utils.currentTimeMillis() + 1000); player.setNextAnimation(new Animation(12033)); player.setNextGraphics(new Graphics(2117)); delayNormalHit(weaponId, attackStyle, getMeleeHit(player, getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.25, true))); break; case 3204: // d hally player.setSwitchDelay(Utils.currentTimeMillis() + 600); player.setNextAnimation(new Animation(1665)); player.setNextGraphics(new Graphics(282)); if (target.getSize() < 3) { target.setNextGraphics(new Graphics(254, 0, 100)); target.setNextGraphics(new Graphics(80)); } delayNormalHit(weaponId, attackStyle, getMeleeHit(player, getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.1, true))); if (target.getSize() > 1) delayHit(1, weaponId, attackStyle, getMeleeHit(player, getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.1, true))); break; case 4587: // dragon sci player.setSwitchDelay(Utils.currentTimeMillis() + 600); player.setNextAnimation(new Animation(12031)); player.setNextGraphics(new Graphics(2118)); Hit hit1 = getMeleeHit( player, getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.0, true)); if (target instanceof Player) { Player p2 = (Player) target; if (hit1.getDamage() > 0) p2.setPrayerDelay(5000);// 5 seconds } delayNormalHit(weaponId, attackStyle, hit1); soundId = 2540; break; case 1215: // dragon dagger case 5698: // dds player.setSwitchDelay(Utils.currentTimeMillis() + 600); player.setNextAnimation(new Animation(1062)); player.setNextGraphics(new Graphics(252, 0, 100)); delayNormalHit( weaponId, attackStyle, getMeleeHit( player, getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.15, true)), getMeleeHit( player, getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.15, true))); soundId = 2537; break; case 1434: // dragon mace player.setSwitchDelay(Utils.currentTimeMillis() + 600); player.setNextAnimation(new Animation(1060)); player.setNextGraphics(new Graphics(251)); delayNormalHit( weaponId, attackStyle, getMeleeHit( player, getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.45, true))); soundId = 2541; break; default: player.getPackets().sendGameMessage("This weapon has no special Attack, if you still see special bar please relogin."); return combatDelay; } } else { if (weaponId == -2 && new Random().nextInt(25) == 0) { player.setNextAnimation(new Animation(14417)); final int attack = attackStyle; attackTarget(getMultiAttackTargets(player, 5, Integer.MAX_VALUE), new MultiAttack() { private boolean nextTarget; @Override public boolean attack() { target.addFreezeDelay(10000, true); target.setNextGraphics(new Graphics(181, 0, 96)); final Entity t = target; WorldTasksManager.schedule(new WorldTask() { @Override public void run() { final int damage = getRandomMaxHit(player, -2, attack, false, false, 1.0, false); t.applyHit(new Hit(player, damage, HitLook.REGULAR_DAMAGE)); stop(); } }, 1); if (target instanceof Player) { Player p = (Player) target; for (int i = 0; i < 7; i++) { if (i != 3 && i != 5) { p.getSkills().drainLevel(i, 7); } } p.getPackets().sendGameMessage("Your stats have been drained!"); } if (!nextTarget) { nextTarget = true; } return nextTarget; } }); return combatDelay; } delayNormalHit(weaponId, attackStyle, getMeleeHit(player, getRandomMaxHit(player, weaponId, attackStyle, false))); player.setNextAnimation(new Animation(getWeaponAttackEmote(weaponId, attackStyle))); } playSound(soundId, player, target); return combatDelay; } public void playSound(int soundId, Player player, Entity target) { if (soundId == -1) return; player.getPackets().sendSound(soundId, 0, 1); if (target instanceof Player) { Player p2 = (Player) target; p2.getPackets().sendSound(soundId, 0, 1); } } public static int getSpecialAmmount(int weaponId) { switch (weaponId) { case 4587: // dragon sci case 859: // magic longbow case 861: // magic shortbow case 10284: // Magic composite bow case 18332: // Magic longbow (sighted) case 19149:// zamorak bow case 19151: case 19143:// saradomin bow case 19145: case 19146: case 19148:// guthix bow return 55; case 11235: // dark bows case 15701: case 15702: case 15703: case 15704: return 65; case 13899: // vls case 13901: case 1305: // dragon long case 1215: // dragon dagger case 5698: // dds case 1434: // dragon mace case 1249://d spear case 1263: case 3176: case 5716: case 5730: case 13770: case 13772: case 13774: case 13776: return 25; case 15442:// whip start case 15443: case 15444: case 15441: case 4151: case 23691: case 11698: // sgs case 23681: case 11694: // ags case 23679: case 13902: // statius hammer case 13904: case 13905: // vesta spear case 13907: case 14484: // d claws case 23695: case 10887: // anchor case 3204: // d hally case 4153: // granite maul case 14684: // zanik cbow case 15241: // hand cannon case 13908: case 13954:// morrigan javelin case 13955: case 13956: case 13879: case 13880: case 13881: case 13882: case 13883:// morigan thrown axe case 13957: return 50; case 11730: // ss case 23690: case 11696: // bgs case 23680: case 11700: // zgs case 23682: case 35:// Excalibur case 8280: case 14632: case 1377:// dragon battle axe case 13472: case 15486:// staff of lights case 22207: case 22209: case 22211: case 22213: return 100; case 19784: // korasi sword return 60; default: return 0; } } public int getRandomMaxHit(Player player, int weaponId, int attackStyle, boolean ranging) { return getRandomMaxHit(player, weaponId, attackStyle, ranging, true, 1.0D, false); } public int getRandomMaxHit(Player player, int weaponId, int attackStyle, boolean ranging, boolean defenceAffects, double specMultiplier, boolean usingSpec) { max_hit = getMaxHit(player, weaponId, attackStyle, ranging, usingSpec, specMultiplier); if (defenceAffects) { double att = player.getSkills().getLevel(ranging ? 4 : 0) + player.getCombatDefinitions().getBonuses()[ranging ? 4 : CombatDefinitions.getMeleeBonusStyle(weaponId, attackStyle)]; if (weaponId == -2) { att += 82; } att *= ranging ? player.getPrayer().getRangeMultiplier() : player .getPrayer().getAttackMultiplier(); if (fullVoidEquipped(player, ranging ? (new int[] { 11664, 11675 }) : (new int[] { 11665, 11676 }))) att *= 1.1; if (ranging) att *= player.getAuraManager().getRangeAccurayMultiplier(); double def = 0; if (target instanceof Player) { Player p2 = (Player) target; def = (double) p2.getSkills().getLevel(Skills.DEFENCE) + (2 * p2.getCombatDefinitions().getBonuses()[ranging ? 9 : CombatDefinitions .getMeleeDefenceBonus(CombatDefinitions .getMeleeBonusStyle(weaponId, attackStyle))]); def *= p2.getPrayer().getDefenceMultiplier(); if (!ranging) { if (p2.getFamiliar() instanceof Steeltitan) def *= 1.15; } } else { NPC n = (NPC) target; def = n.getBonuses() != null ? n.getBonuses()[ranging ? 9 : CombatDefinitions .getMeleeDefenceBonus(CombatDefinitions .getMeleeBonusStyle(weaponId, attackStyle))] : 0; def *= 2; if(n.getId() == 1160 && fullVeracsEquipped(player)) def *= 0.6; } if (usingSpec) { double multiplier = /* 0.25 + */getSpecialAccuracyModifier(player); att *= multiplier; } if(def < 0) { def = -def; att += def; } double prob = att / def; if (prob > 0.90) // max, 90% prob hit so even lvl 138 can miss at // lvl 3 prob = 0.90; else if (prob < 0.05) // minimun 5% so even lvl 3 can hit lvl 138 prob = 0.05; if (prob < Math.random()) return 0; } int hit = Utils.random(max_hit+1); if (target instanceof NPC) { NPC n = (NPC) target; if (n.getId() == 9463 && hasFireCape(player)) hit += 40; } if (player.getAuraManager().usingEquilibrium()) { int perc25MaxHit = (int) (max_hit * 0.25); hit -= perc25MaxHit; max_hit -= perc25MaxHit; if (hit < 0) hit = 0; if (hit < perc25MaxHit) hit += perc25MaxHit; } return hit; } private final int getMaxHit(Player player, int weaponId, int attackStyle, boolean ranging, boolean usingSpec, double specMultiplier) { if (!ranging) { /*//whip hiting 450 no pot no pray? lmao nty int strLvl = player.getSkills().getLevel(Skills.STRENGTH); int strBonus = player.getCombatDefinitions().getBonuses()[CombatDefinitions.STRENGTH_BONUS]; double strMult = player.getPrayer().getStrengthMultiplier(); double xpStyle = CombatDefinitions.getXpStyle(weaponId, attackStyle); double style = xpStyle == Skills.STRENGTH ? 3 : xpStyle == CombatDefinitions.SHARED ? 1 : 0; int dhp = 0; double dharokMod = 1.0; double hitMultiplier = 1.0; if (fullDharokEquipped(player)) { dhp = player.getMaxHitpoints() - player.getHitpoints(); dharokMod = (dhp * 0.001) + 1; } if (fullVoidEquipped(player, 11665, 11676)) { hitMultiplier *= 1.1; } hitMultiplier *= specMultiplier; double cumulativeStr = (strLvl * strMult + style) * dharokMod; return (int) ((14 + cumulativeStr + (strBonus / 8) + ((cumulativeStr * strBonus) / 64)) * hitMultiplier);*/ double strengthLvl = player.getSkills().getLevel(Skills.STRENGTH); int xpStyle = CombatDefinitions.getXpStyle(weaponId, attackStyle); double styleBonus = xpStyle == Skills.STRENGTH ? 3 : xpStyle == CombatDefinitions.SHARED ? 1 : 0; double otherBonus = 1; if (fullDharokEquipped(player)) { double hp = player.getHitpoints(); double maxhp = player.getMaxHitpoints(); double d = hp / maxhp; otherBonus = 2 - d; } double effectiveStrength = 8 + Math.floor((strengthLvl * player.getPrayer().getStrengthMultiplier()) + styleBonus); if (fullVoidEquipped(player, 11665, 11676)) effectiveStrength = Math.floor(effectiveStrength*1.1); double strengthBonus = player.getCombatDefinitions().getBonuses()[CombatDefinitions.STRENGTH_BONUS]; if (weaponId == -2) { strengthBonus += 82; } double baseDamage = 5 + effectiveStrength * (1 + (strengthBonus / 64)); return (int) Math.floor(baseDamage * specMultiplier * otherBonus); } else { if(weaponId == 24338 && target instanceof Player) { player.getPackets().sendGameMessage("The royal crossbow feels weak and unresponsive against other players."); return 60; } double rangedLvl = player.getSkills().getLevel(Skills.RANGE); double styleBonus = attackStyle == 0 ? 3 : attackStyle == 1 ? 0 : 1; double effectiveStrenght = Math.floor(rangedLvl * player.getPrayer().getRangeMultiplier()) + styleBonus; if (fullVoidEquipped(player, 11664, 11675)) effectiveStrenght += Math.floor((player.getSkills().getLevelForXp( Skills.RANGE) / 5) + 1.6); double strengthBonus = player.getCombatDefinitions().getBonuses()[CombatDefinitions.RANGED_STR_BONUS]; double baseDamage = 5 + (((effectiveStrenght + 8) * (strengthBonus + 64)) / 64); return (int) Math.floor(baseDamage * specMultiplier); } } /* public int getRandomMaxHit(Player player, int weaponId, int attackStyle, boolean ranging, boolean defenceAffects, double specMultiplier, boolean usingSpec) { Random r = new Random(); max_hit = getMaxHit(player, weaponId, attackStyle, ranging, usingSpec, specMultiplier); double accuracyMultiplier = 1.0; if (defenceAffects) { accuracyMultiplier = getSpecialAccuracyModifier(player); } if (ranging && defenceAffects) { double accuracy = accuracyMultiplier * getRangeAccuracy(player, attackStyle) + 1; double defence = getRangeDefence(target) + 1; if (r.nextInt((int) accuracy) < r.nextInt((int) defence)) { return 0; } } else if (defenceAffects) { double accuracy = accuracyMultiplier * getMeleeAccuracy(player, attackStyle, weaponId) + 1; double defence = getMeleeDefence(target, attackStyle, weaponId) + 1; if (r.nextInt((int) accuracy) < r.nextInt((int) defence)) { return 0; } } int hit = r.nextInt(max_hit + 1); if (target instanceof NPC) { NPC n = (NPC) target; if (n.getId() == 9463 && hasFireCape(player)) hit += 40; } if (player.getAuraManager().usingEquilibrium()) { int perc25MaxHit = (int) (max_hit * 0.25); hit -= perc25MaxHit; max_hit -= perc25MaxHit; if (hit < 0) hit = 0; if (hit < perc25MaxHit) hit += perc25MaxHit; } return hit; } /** * Gets the melee accuracy of the player. * @param e The player. * @param attackStyle The attack style. * @param weaponId The weapon id. * @return The melee accuracy. */ /* public static double getMeleeAccuracy(Player e, int attackStyle, int weaponId) { int style = attackStyle == 0 ? 3 : attackStyle == 2 ? 1 : 0; int attLvl = e.getSkills().getLevel(Skills.ATTACK); int attBonus = e.getCombatDefinitions().getBonuses()[CombatDefinitions.getMeleeBonusStyle(weaponId, attackStyle)]; if (weaponId == -2) { attBonus += 82; } double attMult = 1.0 * e.getPrayer().getAttackMultiplier(); double accuracyMultiplier = 1.0; if (fullVoidEquipped(e, 11665, 11676)) { accuracyMultiplier *= 0.15; } double cumulativeAtt = attLvl * attMult + style; return (14 + cumulativeAtt + (attBonus / 8) + ((cumulativeAtt * attBonus) / 64)) * accuracyMultiplier; } /** * Gets the maximum melee hit. * @param e The player. * @param attackStyle The attack style. * @param weaponId The weapon id. * @return The maximum melee hit. */ /* public static double getMeleeMaximum(Player e, int attackStyle, int weaponId) { int strLvl = e.getSkills().getLevel(Skills.STRENGTH); int strBonus = e.getCombatDefinitions().getBonuses()[CombatDefinitions.STRENGTH_BONUS]; if (weaponId == -2) { strBonus += 82; } double strMult = e.getPrayer().getStrengthMultiplier(); double xpStyle = CombatDefinitions.getXpStyle(weaponId, attackStyle); double style = xpStyle == Skills.STRENGTH ? 3 : xpStyle == CombatDefinitions.SHARED ? 1 : 0; int dhp = 0; double dharokMod = 1.0; double hitMultiplier = 1.0; if (fullDharokEquipped(e)) { dhp = e.getMaxHitpoints() - e.getHitpoints(); dharokMod = (dhp * 0.001) + 1; } if (fullVoidEquipped(e, 11665, 11676)) { hitMultiplier *= 1.1; } double cumulativeStr = (strLvl * strMult + style) * dharokMod; return (int) ((14 + cumulativeStr + (strBonus / 8) + ((cumulativeStr * strBonus) / 64)) * hitMultiplier); } /** * Gets the melee defence. * @param e The entity. * @param attackStyle The attack style. * @param weaponId The weapon id. * @return The maximum melee defence. */ /* public static double getMeleeDefence(Entity e, int attackStyle, int weaponId) { boolean player = e instanceof Player; int style = player ? ((Player) e).getCombatDefinitions().getAttackStyle() : 0; style = style == 2 ? 1 : style == 3 ? 3 : 0; int defLvl = player ? ((Player) e).getSkills().getLevel(Skills.DEFENCE) : (int) (((NPC) e).getCombatLevel() * 0.6); int defBonus = player ? ((Player) e).getCombatDefinitions().getBonuses()[ CombatDefinitions.getMeleeDefenceBonus(CombatDefinitions.getMeleeBonusStyle(weaponId, attackStyle))] : 0; if (!player) { defBonus = ((NPC) e).getBonuses() != null ? ((NPC) e).getBonuses()[ CombatDefinitions.getMeleeDefenceBonus(CombatDefinitions.getMeleeBonusStyle(weaponId, attackStyle))] : 0; } double defMult = 1.0 * (player ? ((Player) e).getPrayer().getDefenceMultiplier() : 1.0); double cumulativeDef = defLvl * defMult + style; return 14 + cumulativeDef + (defBonus / 8) + ((cumulativeDef * (defBonus)) / 64); } /** * Gets the range accuracy of the player. * @param e The player. * @param attackStyle The attack style. * @return The range accuracy. */ /* public static double getRangeAccuracy(Player e, int attackStyle) { int style = attackStyle == 0 ? 3 : attackStyle == 2 ? 1 : 0; int attLvl = e.getSkills().getLevel(Skills.RANGE); int attBonus = e.getCombatDefinitions().getBonuses()[4]; double attMult = 1.0 * e.getPrayer().getRangeMultiplier() * e.getAuraManager().getRangeAccurayMultiplier(); double accuracyMultiplier = 1.05; if (fullVoidEquipped(e, 11664, 11675)) { accuracyMultiplier += 0.10; } double cumulativeAtt = attLvl * attMult + style; return (14 + cumulativeAtt + (attBonus / 8) + ((cumulativeAtt * attBonus) / 64)) * accuracyMultiplier; } /** * Gets the maximum range hit. * @param e The player. * @param attackStyle The attack style. * @return The maximum range hit. */ /* public static double getRangeMaximum(Player e, int attackStyle) { int style = attackStyle == 0 ? 3 : attackStyle == 2 ? 1 : 0; int strLvl = e.getSkills().getLevel(Skills.RANGE); int strBonus = e.getCombatDefinitions().getBonuses()[CombatDefinitions.RANGED_STR_BONUS]; double strMult = 1.0 * e.getPrayer().getRangeMultiplier(); double hitMultiplier = 1.0; if (fullVoidEquipped(e, 11664, 11675)) { hitMultiplier += 0.1; } double cumulativeStr = strLvl * strMult + style; return (14 + cumulativeStr + (strBonus / 8) + ((cumulativeStr * strBonus) / 64)) * hitMultiplier; } /** * Gets the range defence. * @param e The entity. * @return The maximum range defence. */ /* public static double getRangeDefence(Entity e) { boolean player = e instanceof Player; int style = player ? ((Player) e).getCombatDefinitions().getAttackStyle() : 0; style = style == 2 ? 1 : style == 3 ? 3 : 0; int defLvl = player ? ((Player) e).getSkills().getLevel(Skills.DEFENCE) : (int) (((NPC) e).getCombatLevel() * 0.6); int defBonus = player ? ((Player) e).getCombatDefinitions().getBonuses()[CombatDefinitions.RANGE_DEF] : 0; if (!player) { defBonus = ((NPC) e).getBonuses() != null ? ((NPC) e).getBonuses()[9] : 0; } double defMult = 1.0 * (player ? ((Player) e).getPrayer().getDefenceMultiplier() : 1.0); double cumulativeDef = defLvl * defMult + style; return 14 + cumulativeDef + (defBonus / 8) + ((cumulativeDef * defBonus) / 64); }*/ private double getSpecialAccuracyModifier(Player player) { Item weapon = player.getEquipment().getItem(Equipment.SLOT_WEAPON); if (weapon == null) return 1; String name = weapon.getDefinitions().getName().toLowerCase(); if (name.contains("whip") || name.contains("dragon longsword") || name.contains("dragon scimitar") || name.contains("dragon dagger")) return 1.1; if (name.contains("anchor") || name.contains("magic longbow")) return 2; if (name.contains("dragon claws") || name.contains("armadyl godsword")) return 2; return 1; } public boolean hasFireCape(Player player) { int capeId = player.getEquipment().getCapeId(); return capeId == 6570 || capeId == 20769 || capeId == 20771; } public static final boolean fullVanguardEquipped(Player player) { int helmId = player.getEquipment().getHatId(); int chestId = player.getEquipment().getChestId(); int legsId = player.getEquipment().getLegsId(); int weaponId = player.getEquipment().getWeaponId(); int bootsId = player.getEquipment().getBootsId(); int glovesId = player.getEquipment().getGlovesId(); if (helmId == -1 || chestId == -1 || legsId == -1 || weaponId == -1 || bootsId == -1 || glovesId == -1) return false; return ItemDefinitions.getItemDefinitions(helmId).getName().contains("Vanguard") && ItemDefinitions.getItemDefinitions(chestId).getName().contains("Vanguard") && ItemDefinitions.getItemDefinitions(legsId).getName().contains("Vanguard") && ItemDefinitions.getItemDefinitions(weaponId).getName().contains("Vanguard") && ItemDefinitions.getItemDefinitions(bootsId).getName().contains("Vanguard") && ItemDefinitions.getItemDefinitions(glovesId).getName().contains("Vanguard"); } public static final boolean usingGoliathGloves(Player player) { String name = player.getEquipment().getItem(Equipment.SLOT_SHIELD) != null ? player .getEquipment().getItem(Equipment.SLOT_SHIELD).getDefinitions().getName().toLowerCase() : ""; if (player.getEquipment().getItem((Equipment.SLOT_HANDS)) != null) { if (player.getEquipment().getItem(Equipment.SLOT_HANDS).getDefinitions().getName().toLowerCase().contains("goliath") && player.getEquipment().getWeaponId() == -1) { if (name.contains("defender") && name.contains("dragonfire shield")) return true; return true; } } return false; } public static final boolean fullVeracsEquipped(Player player) { int helmId = player.getEquipment().getHatId(); int chestId = player.getEquipment().getChestId(); int legsId = player.getEquipment().getLegsId(); int weaponId = player.getEquipment().getWeaponId(); if (helmId == -1 || chestId == -1 || legsId == -1 || weaponId == -1) return false; return ItemDefinitions.getItemDefinitions(helmId).getName() .contains("Verac's") && ItemDefinitions.getItemDefinitions(chestId).getName() .contains("Verac's") && ItemDefinitions.getItemDefinitions(legsId).getName() .contains("Verac's") && ItemDefinitions.getItemDefinitions(weaponId).getName() .contains("Verac's"); } public static final boolean fullDharokEquipped(Player player) { int helmId = player.getEquipment().getHatId(); int chestId = player.getEquipment().getChestId(); int legsId = player.getEquipment().getLegsId(); int weaponId = player.getEquipment().getWeaponId(); if (helmId == -1 || chestId == -1 || legsId == -1 || weaponId == -1) return false; return ItemDefinitions.getItemDefinitions(helmId).getName() .contains("Dharok's") && ItemDefinitions.getItemDefinitions(chestId).getName() .contains("Dharok's") && ItemDefinitions.getItemDefinitions(legsId).getName() .contains("Dharok's") && ItemDefinitions.getItemDefinitions(weaponId).getName() .contains("Dharok's"); } public static final boolean fullVoidEquipped(Player player, int... helmid) { boolean hasDeflector = player.getEquipment().getShieldId() == 19712; if (player.getEquipment().getGlovesId() != 8842) { if (hasDeflector) hasDeflector = false; else return false; } int legsId = player.getEquipment().getLegsId(); boolean hasLegs = legsId != -1 && (legsId == 8840 || legsId == 19786 || legsId == 19788 || legsId == 19790); if (!hasLegs) { if (hasDeflector) hasDeflector = false; else return false; } int torsoId = player.getEquipment().getChestId(); boolean hasTorso = torsoId != -1 && (torsoId == 8839 || torsoId == 10611 || torsoId == 19785 || torsoId == 19787 || torsoId == 19789); if (!hasTorso) { if (hasDeflector) hasDeflector = false; else return false; } if (hasDeflector) return true; int helmId = player.getEquipment().getHatId(); if (helmId == -1) return false; boolean hasHelm = false; for (int id : helmid) { if (helmId == id) { hasHelm = true; break; } } if (!hasHelm) return false; return true; } public void delayNormalHit(int weaponId, int attackStyle, Hit... hits) { delayHit(0, weaponId, attackStyle, hits); } public Hit getMeleeHit(Player player, int damage) { return new Hit(player, damage, HitLook.MELEE_DAMAGE); } public Hit getRangeHit(Player player, int damage) { return new Hit(player, damage, HitLook.RANGE_DAMAGE); } public Hit getMagicHit(Player player, int damage) { return new Hit(player, damage, HitLook.MAGIC_DAMAGE); } private void delayMagicHit(int delay, final Hit... hits) { delayHit(delay, -1, -1, hits); } public void resetVariables() { base_mage_xp = 0; mage_hit_gfx = 0; magic_sound = 0; max_poison_hit = 0; freeze_time = 0; reduceAttack = false; blood_spell = false; block_tele = false; } private void delayHit(int delay, final int weaponId, final int attackStyle, final Hit... hits) { addAttackedByDelay(hits[0].getSource()); final Entity target = this.target; final int max_hit = this.max_hit; final double base_mage_xp = this.base_mage_xp; final int mage_hit_gfx = this.mage_hit_gfx; final int magic_sound = this.magic_sound; final int max_poison_hit = this.max_poison_hit; final int freeze_time = this.freeze_time; @SuppressWarnings("unused") final boolean reduceAttack = this.reduceAttack; final boolean blood_spell = this.blood_spell; final boolean block_tele = this.block_tele; resetVariables(); for (Hit hit : hits) { Player player = (Player) hit.getSource(); if(target instanceof Player) { Player p2 = (Player) target; if (player.getPrayer().usingPrayer(1, 18)) p2.sendSoulSplit(hit, player); } int damage = hit.getDamage() > target.getHitpoints() ? target .getHitpoints() : hit.getDamage(); if (hit.getLook() == HitLook.RANGE_DAMAGE || hit.getLook() == HitLook.MELEE_DAMAGE) { double combatXp = damage / 2.5; if (combatXp > 0) { player.getAuraManager().checkSuccefulHits(hit.getDamage()); if (hit.getLook() == HitLook.RANGE_DAMAGE) { if (attackStyle == 2) { player.getSkills() .addXp(Skills.RANGE, combatXp / 2); player.getSkills().addXp(Skills.DEFENCE, combatXp / 2); } else player.getSkills().addXp(Skills.RANGE, combatXp); } else { int xpStyle = CombatDefinitions.getXpStyle(weaponId, attackStyle); if (xpStyle != CombatDefinitions.SHARED) player.getSkills().addXp(xpStyle, combatXp); else { player.getSkills().addXp(Skills.ATTACK, combatXp / 3); player.getSkills().addXp(Skills.STRENGTH, combatXp / 3); player.getSkills().addXp(Skills.DEFENCE, combatXp / 3); } } double hpXp = damage / 7.5; if (hpXp > 0) player.getSkills().addXp(Skills.HITPOINTS, hpXp); } } else if (hit.getLook() == HitLook.MAGIC_DAMAGE) { if (mage_hit_gfx != 0 && damage > 0) { if (freeze_time > 0) { target.addFreezeDelay(freeze_time, freeze_time == 0); if (freeze_time > 0) if (target instanceof Player) { ((Player) target).stopAll(false); } target.addFrozenBlockedDelay(freeze_time + (4 * 1000));//four seconds of no freeze } } else if (damage < 0) { damage = 0; } double combatXp = base_mage_xp * 1 + (damage / 5); if (combatXp > 0) { player.getAuraManager().checkSuccefulHits(hit.getDamage()); if (player.getCombatDefinitions().isDefensiveCasting() || (hasPolyporeStaff(player) && player.getCombatDefinitions().getAttackStyle() == 1)) { int defenceXp = (int) (damage / 7.5); if (defenceXp > 0) { combatXp -= defenceXp; player.getSkills().addXp(Skills.DEFENCE, defenceXp / 7.5); } } player.getSkills().addXp(Skills.MAGIC, combatXp); double hpXp = damage / 7.5; if (hpXp > 0) player.getSkills().addXp(Skills.HITPOINTS, hpXp); } } } WorldTasksManager.schedule(new WorldTask() { @Override public void run() { for (Hit hit : hits) { boolean splash = false; Player player = (Player) hit.getSource(); if (player.isDead() || player.hasFinished() || target.isDead() || target.hasFinished()) return; if (hit.getDamage() > -1) { target.applyHit(hit); // also reduces damage if needed, pray // and special items affect here } else { splash = true; hit.setDamage(0); } doDefenceEmote(); int damage = hit.getDamage() > target.getHitpoints() ? target .getHitpoints() : hit.getDamage(); if ((damage >= max_hit * 0.90) && (hit.getLook() == HitLook.MAGIC_DAMAGE || hit.getLook() == HitLook.RANGE_DAMAGE || hit .getLook() == HitLook.MELEE_DAMAGE)) hit.setCriticalMark(); if (hit.getLook() == HitLook.RANGE_DAMAGE || hit.getLook() == HitLook.MELEE_DAMAGE) { double combatXp = damage / 2.5; if (combatXp > 0) { if (hit.getLook() == HitLook.RANGE_DAMAGE) { if (weaponId != -1) { String name = ItemDefinitions .getItemDefinitions(weaponId) .getName(); if (name.contains("(p++)")) { if (Utils.getRandom(8) == 0) target.getPoison().makePoisoned(48); } else if (name.contains("(p+)")) { if (Utils.getRandom(8) == 0) target.getPoison().makePoisoned(38); } else if (name.contains("(p)")) { if (Utils.getRandom(8) == 0) target.getPoison().makePoisoned(28); } } } else { if (weaponId != -1) { String name = ItemDefinitions .getItemDefinitions(weaponId) .getName(); if (name.contains("(p++)")) { if (Utils.getRandom(8) == 0) target.getPoison().makePoisoned(68); } else if (name.contains("(p+)")) { if (Utils.getRandom(8) == 0) target.getPoison().makePoisoned(58); } else if (name.contains("(p)")) { if (Utils.getRandom(8) == 0) target.getPoison().makePoisoned(48); } if (target instanceof Player) { if (((Player) target).getPolDelay() >= Utils .currentTimeMillis()) target.setNextGraphics(new Graphics( 2320)); } } } } } else if (hit.getLook() == HitLook.MAGIC_DAMAGE) { if (splash) { target.setNextGraphics(new Graphics(85, 0, 96)); playSound(227, player, target); } else { if (mage_hit_gfx != 0) { target.setNextGraphics(new Graphics( mage_hit_gfx, 0, mage_hit_gfx == 369 || mage_hit_gfx == 1843 || (mage_hit_gfx > 1844 && mage_hit_gfx < 1855) ? 0 : 96)); if (blood_spell) player.heal(damage / 4); if (block_tele) { if (target instanceof Player) { Player targetPlayer = (Player) target; targetPlayer .setTeleBlockDelay((targetPlayer .getPrayer() .usingPrayer(0, 17) || targetPlayer .getPrayer() .usingPrayer(1, 7) ? 100000 : 300000)); targetPlayer .getPackets() .sendGameMessage( "You have been teleblocked.", true); } } } if (magic_sound > 0) playSound(magic_sound, player, target); } } if (max_poison_hit > 0 && Utils.getRandom(10) == 0) { if (!target.getPoison().isPoisoned()) target.getPoison().makePoisoned(max_poison_hit); } if (target instanceof Player) { Player p2 = (Player) target; p2.closeInterfaces(); if (p2.getCombatDefinitions().isAutoRelatie() && !p2.getActionManager().hasSkillWorking() && !p2.hasWalkSteps()) p2.getActionManager().setAction( new PlayerCombat(player)); } else { NPC n = (NPC) target; if (!n.isUnderCombat() || n.canBeAttackedByAutoRelatie()) n.setTarget(player); } } } }, delay); } private int getSoundId(int weaponId, int attackStyle) { if (weaponId != -1) { String weaponName = ItemDefinitions.getItemDefinitions(weaponId).getName().toLowerCase(); if (weaponName.contains("dart") || weaponName.contains("knife")) return 2707; } return -1; } public static int getWeaponAttackEmote(int weaponId, int attackStyle) { if (weaponId != -1) { if (weaponId == -2) { //punch/block:14393 kick:14307 spec:14417 switch (attackStyle) { case 1: return 14307; default: return 14393; } } String weaponName = ItemDefinitions.getItemDefinitions(weaponId).getName().toLowerCase(); if (weaponName != null && !weaponName.equals("null")) { if (weaponName.contains("crossbow")) return weaponName.contains("karil's crossbow") ? 2075 : 4230; if (weaponName.contains("bow") || weaponName.contains("decimation")) return 426; if (weaponName.contains("chinchompa")) return 2779; if (weaponName.contains("staff of light") || weaponName.contains("obliteration")) { switch (attackStyle) { case 0: return 15072; case 1: return 15071; case 2: return 414; } } if (weaponName.contains("frostmourne")) { switch (attackStyle) { case 2: return 15072; default: return 15071; } } if (weaponName.contains("decimation")) { switch (attackStyle) { case 2: return 15072; default: return 15071; } } if (weaponName.contains("staff") || weaponName.contains("wand")) return 419; if (weaponName.contains("dart")) return 6600; if (weaponName.contains("knife")) return 9055; if (weaponName.contains("scimitar") || weaponName.contains("korasi's sword")) { switch (attackStyle) { case 2: return 15072; default: return 15071; } } if (weaponName.contains("granite mace")) return 400; if (weaponName.contains("mace") || weaponName.contains("annihilation")) { switch (attackStyle) { case 2: return 400; default: return 401; } } if (weaponName.contains("hatchet")) { switch (attackStyle) { case 2: return 401; default: return 395; } } if (weaponName.contains("warhammer")) { switch (attackStyle) { default: return 401; } } if (weaponName.contains("claws")) { switch (attackStyle) { case 2: return 1067; default: return 393; } } if (weaponName.contains("whip")) { switch (attackStyle) { case 1: return 11969; case 2: return 11970; default: return 11968; } } if (weaponName.contains("anchor")) { switch (attackStyle) { default: return 5865; } } if (weaponName.contains("tzhaar-ket-em")) { switch (attackStyle) { default: return 401; } } if (weaponName.contains("tzhaar-ket-om")) { switch (attackStyle) { default: return 13691; } } if (weaponName.contains("halberd")) { switch (attackStyle) { case 1: return 440; default: return 428; } } if (weaponName.contains("zamorakian spear")) { switch (attackStyle) { case 1: return 12005; case 2: return 12009; default: return 12006; } } if (weaponName.contains("spear")) { switch (attackStyle) { case 1: return 440; case 2: return 429; default: return 428; } } if (weaponName.contains("flail")) { return 2062; } if (weaponName.contains("javelin")) { return 10501; } if (weaponName.contains("morrigan's throwing axe")) return 10504; if (weaponName.contains("pickaxe")) { switch (attackStyle) { case 2: return 400; default: return 401; } } if (weaponName.contains("dagger")) { switch (attackStyle) { case 2: return 377; default: return 376; } } if (weaponName.contains("2h sword") || weaponName.equals("dominion sword") || weaponName.equals("thok's sword") || weaponName.equals("saradomin sword")) { switch (attackStyle) { case 2: return 7048; case 3: return 7049; default: return 7041; } } if (weaponName.contains(" sword") || weaponName.contains("saber") || weaponName.contains("longsword") || weaponName.contains("light") || weaponName.contains("excalibur")) { switch (attackStyle) { case 2: return 12310; default: return 12311; } } if (weaponName.contains("rapier") || weaponName.contains("brackish")) { switch (attackStyle) { case 2: return 13048; default: return 13049; } } if (weaponName.contains("katana")) { switch (attackStyle) { case 2: return 1882; default: return 1884; } } if (weaponName.contains("godsword")) { switch (attackStyle) { case 2: return 11980; case 3: return 11981; default: return 11979; } } if (weaponName.contains("greataxe")) { switch (attackStyle) { case 2: return 12003; default: return 12002; } } if (weaponName.contains("granite maul")) { switch (attackStyle) { default: return 1665; } } } } switch (weaponId) { case 16405:// novite maul case 16407:// Bathus maul case 16409:// Maramaros maul case 16411:// Kratonite maul case 16413:// Fractite maul case 18353:// chaotic maul case 16415:// Zephyrium maul case 16417:// Argonite maul case 16419:// Katagon maul case 16421:// Gorgonite maul case 16423:// Promethium maul case 16425:// primal maul return 2661; // maul case 13883: // morrigan thrown axe return 10504; case 15241: return 12174; default: switch (attackStyle) { case 1: return 423; default: return 422; // todo default emote } } } private void doDefenceEmote() { target.setNextAnimationNoPriority(new Animation(Combat .getDefenceEmote(target))); } private int getMeleeCombatDelay(Player player, int weaponId) { if (weaponId != -1) { String weaponName = ItemDefinitions.getItemDefinitions(weaponId) .getName().toLowerCase(); // Interval 2.4 if (weaponName.equals("zamorakian spear") || weaponName.equals("korasi's sword")) return 3; // Interval 3.6 if (weaponName.contains("godsword") || weaponName.contains("warhammer") || weaponName.contains("battleaxe") || weaponName.contains("maul") || weaponName.equals("dominion sword")) return 5; // Interval 4.2 if (weaponName.contains("greataxe") || weaponName.contains("halberd") || weaponName.contains("2h sword") || weaponName.contains("two handed sword") || weaponName.contains("katana") || weaponName.equals("thok's sword")) return 6; // Interval 3.0 if (weaponName.contains("spear") || weaponName.contains(" sword") || weaponName.contains("longsword") || weaponName.contains("light") || weaponName.contains("hatchet") || weaponName.contains("pickaxe") || weaponName.contains("mace") || weaponName.contains("hasta") || weaponName.contains("warspear") || weaponName.contains("flail") || weaponName.contains("hammers") || weaponName.contains("obliteration")) return 4; } switch (weaponId) { case 6527:// tzhaar-ket-em return 4; case 10887:// barrelchest anchor return 5; case 15403:// balmung case 6528:// tzhaar-ket-om return 6; default: return 3; } } @Override public void stop(final Player player) { player.setNextFaceEntity(null); } private boolean checkAll(Player player) { if (player.isDead() || player.hasFinished() || target.isDead() || target.hasFinished()) { return false; } int distanceX = player.getX() - target.getX(); int distanceY = player.getY() - target.getY(); int size = target.getSize(); int maxDistance = 16; if (player.getPlane() != target.getPlane() || distanceX > size + maxDistance || distanceX < -1 - maxDistance || distanceY > size + maxDistance || distanceY < -1 - maxDistance) { return false; } if (player.getFreezeDelay() >= Utils.currentTimeMillis()) { if (player.withinDistance(target, 0))// done return false; return true; } if (target instanceof Player) { Player p2 = (Player) target; if (!player.isCanPvp() || !p2.isCanPvp()) return false; } else { NPC n = (NPC) target; if (n.isCantInteract()) { return false; } if (n instanceof Familiar) { Familiar familiar = (Familiar) n; if (!familiar.canAttack(target)) return false; } else { if (!n.canBeAttackFromOutOfArea() && !MapAreas.isAtArea(n.getMapAreaNameHash(), player)) { return false; } if (n.getId() == 14578) { if (player.getEquipment().getWeaponId() != 2402 && player.getCombatDefinitions().getAutoCastSpell() <= 0 && !hasPolyporeStaff(player)) { player.getPackets().sendGameMessage("I'd better wield Silverlight first."); return false; } else { int slayerLevel = Combat.getSlayerLevelForNPC(n.getId()); if (slayerLevel > player.getSkills().getLevel(Skills.SLAYER)) { player.getPackets().sendGameMessage("You need at least a slayer level of " + slayerLevel + " to fight this."); return false; } } } else if (n.getId() == 6222 || n.getId() == 6223 || n.getId() == 6225 || n.getId() == 6227) { if (isRanging(player) == 0) { player.getPackets().sendGameMessage("I can't reach that!"); return false; } } } } if (!(target instanceof NPC && ((NPC) target).isForceMultiAttacked())) { if (!target.isAtMultiArea() || !player.isAtMultiArea()) { if (player.getAttackedBy() != target && player.getAttackedByDelay() > Utils.currentTimeMillis()) { return false; } if (target.getAttackedBy() != player&& target.getAttackedByDelay() > Utils.currentTimeMillis()) { return false; } } } int isRanging = isRanging(player); if (distanceX < size && distanceX > -1 && distanceY < size && distanceY > -1 && !target.hasWalkSteps()) { player.resetWalkSteps(); if (!player.addWalkSteps(target.getX() + size, target.getY())) { player.resetWalkSteps(); if (!player.addWalkSteps(target.getX() - 1, target.getY())) { player.resetWalkSteps(); if (!player.addWalkSteps(target.getX(), target.getY() + size)) { player.resetWalkSteps(); if (!player.addWalkSteps(target.getX(), target.getY() - 1)) { return false; } } } } return true; } else if (isRanging == 0 && target.getSize() == 1 && player.getCombatDefinitions().getSpellId() <= 0 && !hasPolyporeStaff(player) && Math.abs(player.getX() - target.getX()) == 1 && Math.abs(player.getY() - target.getY()) == 1 && !target.hasWalkSteps()) { if (!player.addWalkSteps(target.getX(), player.getY(), 1)) player.addWalkSteps(player.getX(), target.getY(), 1); return true; } maxDistance = isRanging != 0 || player.getCombatDefinitions().getSpellId() > 0 || hasPolyporeStaff(player) ? 7 : 0; if ((!player.clipedProjectile(target, maxDistance == 0 && !forceCheckClipAsRange(target))) || distanceX > size + maxDistance || distanceX < -1 - maxDistance || distanceY > size + maxDistance || distanceY < -1 - maxDistance) { if (!player.hasWalkSteps()) { player.resetWalkSteps(); player.addWalkStepsInteract(target.getX(), target.getY(), player.getRun() ? 2 : 1, size, true); } return true; } else { player.resetWalkSteps(); } if (player.getPolDelay() >= Utils.currentTimeMillis() && !(player.getEquipment().getWeaponId() == 15486 || player.getEquipment().getWeaponId() == 22207 || player.getEquipment().getWeaponId() == 22209 || player.getEquipment().getWeaponId() == 22211 || player .getEquipment().getWeaponId() == 22213)) player.setPolDelay(0); player.getAttributes().put("last_target", target); if (target != null) target.getAttributes().put("last_attacker", player); if (player.getCombatDefinitions().isInstantAttack()) { player.getCombatDefinitions().setInstantAttack(false); if (player.getCombatDefinitions().getAutoCastSpell() > 0) return true; if (player.getCombatDefinitions().isUsingSpecialAttack()) { if (!specialExecute(player)) return true; player.getActionManager().setActionDelay(0); int weaponId = player.getEquipment().getWeaponId(); int attackStyle = player.getCombatDefinitions().getAttackStyle(); switch(weaponId) { case 4153: player.setNextAnimation(new Animation(1667)); player.setNextGraphics(new Graphics(340, 0, 96 << 16)); delayNormalHit(weaponId, attackStyle, getMeleeHit(player, getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.1, true))); break; } player.getActionManager().setActionDelay(4); } return true; } return true; } public static boolean specialExecute(Player player) { int weaponId = player.getEquipment().getWeaponId(); player.getCombatDefinitions().switchUsingSpecialAttack(); int specAmt = getSpecialAmmount(weaponId); if (specAmt == 0) { player.getPackets().sendGameMessage("This weapon has no special Attack, if you still see special bar please relogin."); player.getCombatDefinitions().desecreaseSpecialAttack(0); return false; } if (player.getCombatDefinitions().hasRingOfVigour()) specAmt *= 0.9; if (player.getCombatDefinitions().getSpecialAttackPercentage() < specAmt) { player.getPackets().sendGameMessage("You don't have enough power left."); player.getCombatDefinitions().desecreaseSpecialAttack(0); return false; } player.getCombatDefinitions().desecreaseSpecialAttack(specAmt); return true; } /* * 0 not ranging, 1 invalid ammo so stops att, 2 can range, 3 no ammo */ public static final int isRanging(Player player) { int weaponId = player.getEquipment().getWeaponId(); if (weaponId == -1) return 0; String name = ItemDefinitions.getItemDefinitions(weaponId).getName(); if (name != null) { // those dont need arrows if (name.contains("knife") || name.contains("dart") || name.contains("javelin") || name.contains("thrownaxe") || name.contains("throwing axe") || name.contains("crystal bow") || name.equalsIgnoreCase("zaryte bow") || name.contains("chinchompa") || name.contains("Bolas") || name.contains("Boogie")) return 2; } int ammoId = player.getEquipment().getAmmoId(); switch (weaponId) { case 24456: case 24474: return 2; case 15241: // Hand cannon switch (ammoId) { case -1: return 3; case 15243: // bronze arrow return 2; default: return 1; } case 839: // longbow case 841: // shortbow switch (ammoId) { case -1: return 3; case 882: // bronze arrow case 884: // iron arrow return 2; default: return 1; } case 843: // oak longbow case 845: // oak shortbow switch (ammoId) { case -1: return 3; case 882: // bronze arrow case 884: // iron arrow case 886: // steel arrow return 2; default: return 1; } case 847: // willow longbow case 849: // willow shortbow case 13541: // Willow composite bow switch (ammoId) { case -1: return 3; case 882: // bronze arrow case 884: // iron arrow case 886: // steel arrow case 888: // mithril arrow return 2; default: return 1; } case 851: // maple longbow case 853: // maple shortbow case 18331: // Maple longbow (sighted) switch (ammoId) { case -1: return 3; case 882: // bronze arrow case 884: // iron arrow case 886: // steel arrow case 888: // mithril arrow case 890: // adamant arrow return 2; default: return 1; } case 2883:// ogre bow switch (ammoId) { case -1: return 3; case 2866: // ogre arrow return 2; default: return 1; } case 4827:// Comp ogre bow switch (ammoId) { case -1: return 3; case 2866: // ogre arrow case 4773: // bronze brutal case 4778: // iron brutal case 4783: // steel brutal case 4788: // black brutal case 4793: // mithril brutal case 4798: // adamant brutal case 4803: // rune brutal return 2; default: return 1; } case 855: // yew longbow case 857: // yew shortbow case 10281: // Yew composite bow case 14121: // Sacred clay bow case 859: // magic longbow case 861: // magic shortbow case 10284: // Magic composite bow case 18332: // Magic longbow (sighted) case 6724: // seercull switch (ammoId) { case -1: return 3; case 882: // bronze arrow case 884: // iron arrow case 886: // steel arrow case 888: // mithril arrow case 890: // adamant arrow case 892: // rune arrow return 2; default: return 1; } case 11235: // dark bows case 15701: case 15702: case 15703: case 15704: switch (ammoId) { case -1: return 3; case 882: // bronze arrow case 884: // iron arrow case 886: // steel arrow case 888: // mithril arrow case 890: // adamant arrow case 892: // rune arrow case 11212: // dragon arrow return 2; default: return 1; } case 19143: // saradomin bow switch (ammoId) { case -1: return 3; case 19152: // saradomin arrow return 2; default: return 1; } case 19146: // guthix bow switch (ammoId) { case -1: return 3; case 19157: // guthix arrow return 2; default: return 1; } case 19149: // zamorak bow switch (ammoId) { case -1: return 3; case 19162: // zamorak arrow return 2; default: return 1; } case 24338: // Royal crossbow switch (ammoId) { case -1: return 3; case 24336: // Coral bolts return 2; default: return 1; } case 24303: // Coral crossbow switch (ammoId) { case -1: return 3; case 24304: // Coral bolts return 2; default: return 1; } case 4734: // karil crossbow switch (ammoId) { case -1: return 3; case 4740: // bolt rack return 2; default: return 1; } case 10156: // hunters crossbow switch (ammoId) { case -1: return 3; case 10158: // Kebbit bolts case 10159: // Long kebbit bolts return 2; default: return 1; } case 8880: // Dorgeshuun c'bow switch (ammoId) { case -1: return 3; case 877: // bronze bolts case 9140: // iron bolts case 8882: // bone bolts return 2; default: return 1; } case 14684: // zanik crossbow switch (ammoId) { case -1: return 3; case 877: // bronze bolts case 9140: // iron bolts case 9141: // steel bolts case 13083: // black bolts case 9142:// mithril bolts case 9143: // adam bolts case 9145: // silver bolts case 8882: // bone bolts return 2; default: return 1; } case 767: // phoenix crossbow case 837: // crossbow switch (ammoId) { case -1: return 3; case 877: // bronze bolts return 2; default: return 1; } case 9174: // bronze crossbow switch (ammoId) { case -1: return 3; case 877: // bronze bolts case 9236: // Opal bolts (e) return 2; default: return 1; } case 9176: // blurite crossbow switch (ammoId) { case -1: return 3; case 877: // bronze bolts case 9140: // iron bolts case 9141: // steel bolts case 13083: // black bolts case 9236: // Opal bolts (e) case 9238: // Pearl bolts (e) case 9239: // Topaz bolts (e) case 9139: // Blurite bolts case 9237: // Jade bolts (e) return 2; default: return 1; } case 9177: // iron crossbow switch (ammoId) { case -1: return 3; case 877: // bronze bolts case 9140: // iron bolts case 9236: // Opal bolts (e) case 9238: // Pearl bolts (e) return 2; default: return 1; } case 9179: // steel crossbow switch (ammoId) { case -1: return 3; case 877: // bronze bolts case 9140: // iron bolts case 9141: // steel bolts case 9236: // Opal bolts (e) case 9238: // Pearl bolts (e) case 9239: // Topaz bolts (e) return 2; default: return 1; } case 13081: // black crossbow switch (ammoId) { case -1: return 3; case 877: // bronze bolts case 9140: // iron bolts case 9141: // steel bolts case 13083: // black bolts case 9236: // Opal bolts (e) case 9238: // Pearl bolts (e) case 9239: // Topaz bolts (e) return 2; default: return 1; } case 9181: // Mith crossbow switch (ammoId) { case -1: return 3; case 877: // bronze bolts case 9140: // iron bolts case 9141: // steel bolts case 13083: // black bolts case 9142:// mithril bolts case 9145: // silver bolts case 9236: // Opal bolts (e) case 9238: // Pearl bolts (e) case 9239: // Topaz bolts (e) case 9240: // Sapphire bolts (e) case 9241: // Emerald bolts (e) return 2; default: return 1; } case 9183: // adam c bow switch (ammoId) { case -1: return 3; case 877: // bronze bolts case 9140: // iron bolts case 9141: // steel bolts case 13083: // black bolts case 9142:// mithril bolts case 9143: // adam bolts case 9145: // silver bolts wtf case 9236: // Opal bolts (e) case 9238: // Pearl bolts (e) case 9239: // Topaz bolts (e) case 9240: // Sapphire bolts (e) case 9241: // Emerald bolts (e) case 9242: // Ruby bolts (e) case 9243: // Diamond bolts (e) return 2; default: return 1; } case 22348: // Dominion Crossbow case 9185: // rune c bow case 18357: // chaotic crossbow case 18358: switch (ammoId) { case -1: return 3; case 877: // bronze bolts case 9140: // iron bolts case 9141: // steel bolts case 13083: // black bolts case 9142:// mithril bolts case 9143: // adam bolts case 9144: // rune bolts case 9145: // silver bolts wtf case 9236: // Opal bolts (e) case 9238: // Pearl bolts (e) case 9239: // Topaz bolts (e) case 9240: // Sapphire bolts (e) case 9241: // Emerald bolts (e) case 9242: // Ruby bolts (e) case 9243: // Diamond bolts (e) case 9244: // Dragon bolts (e) case 9245: // Onyx bolts (e) case 24116: //Bakriminel bolts return 2; default: return 1; } default: return 0; } } /** * Checks if the player is wielding polypore staff. * @param player The player. * @return {@code True} if so. */ private static boolean hasPolyporeStaff(Player player) { int weaponId = player.getEquipment().getWeaponId(); return weaponId == 22494 || weaponId == 22496 || weaponId == 24457; } public Entity getTarget() { return target; } }
[ "me@seeocon.co" ]
me@seeocon.co
27df807f564b91100f50efd8c3bec2e4be7cada5
cf6708117ad1e706d06edcf1c2a3546284fdd3ff
/app/src/main/java/com/dhc3800/mp5/SetLocation.java
71d313a979b130f459389fef1dc21b426c3f377d
[]
no_license
dhc3800/MP5
441cb52a8e44bd9e96eda87d8c97e4d621624b96
e627572d2ce2d4aced57b31e6f042dab7cc4d2b6
refs/heads/master
2020-04-28T16:09:18.769711
2019-03-15T14:29:35
2019-03-15T14:29:35
175,400,135
0
0
null
null
null
null
UTF-8
Java
false
false
442
java
package com.dhc3800.mp5; public class SetLocation { public double Latitude; public double Longitude; public String address; public String id; public String name; public SetLocation(double latitude, double longitude, String id, String address, String name) { this.Latitude = latitude; this.Longitude = longitude; this.id = id; this.address = address; this.name = name; } }
[ "dohyuncheon@berkeley.edu" ]
dohyuncheon@berkeley.edu
db5fb575bed294362e4341fcb4d492d0eb33e48a
5cfa198302132047bd9b9859b285d4e8fc82bf68
/src/main/java/August/javaProject/dataBase/DataBase.java
053e99fd0275cdcb5847e10808a88e8afda932cb
[]
no_license
arsv2017/eLibrary
82d09b9920368b0850813a1e3c4dddc5ab888133
c72f6fa07b4c6fc56688788faebf584573a5a9a8
refs/heads/master
2021-01-02T09:16:26.930859
2017-08-20T23:42:00
2017-08-20T23:42:00
99,175,578
0
0
null
null
null
null
UTF-8
Java
false
false
267
java
package August.javaProject.dataBase; import August.javaProject.domain.Book; import java.util.List; /** * Created by SynMobUsr on 7/24/2017. */ public interface DataBase { void saveNewBookInLibrary(Book book); List<Book> findBookInLibrary(Book book); }
[ "arsv@inbox.lv" ]
arsv@inbox.lv
2d4adb2a320abb08a4166c438a045d7b66f7878e
52b47de0d4e87dec82c40a11968445e359e60ccd
/JavaEpamHomework6_MVC/src/com/group1/controller/Controller.java
647437af3e565b169af896910728bc1ca462c666
[]
no_license
YaroslavMaslych/JAVA_EPAM_TASKS
a4e00a19c0b745c04f307efb04c37d5486e06407
70fd1a53b2b7df9028913b0bbf9a7b22184cc5d2
refs/heads/master
2020-04-23T16:04:06.659287
2019-04-07T18:56:39
2019-04-07T18:56:39
171,285,429
0
0
null
null
null
null
UTF-8
Java
false
false
4,582
java
package com.group1.controller; import com.group1.model.Model; import com.group1.view.View; import java.util.Scanner; public class Controller { private final Model model; private final View view; private final Scanner sc; public Controller() { this.model = new Model(); this.view = new View(); this.sc = new Scanner(System.in); } private int getInt() { try { String integ = sc.nextLine(); int integers = Integer.parseInt(integ); if (integers<0 || integers>=1000000) { view.printMessage(View.WRONG_INPUT_DATA); return getInt(); } return integers; } catch (Exception e) { view.printMessage(View.WRONG_INPUT_DATA); return getInt(); } } private String getStr() { return sc.nextLine(); } private double getDoub() { try { String doub = sc.nextLine(); return Double.parseDouble(doub); } catch (Exception e) { view.printMessage(View.WRONG_INPUT_DATA); return getDoub(); } } private void control(String command) { switch (command) { case "ADD": { view.printMessage(View.INPUT_NAME); String name = getStr(); view.printMessage(View.INPUT_AUTHOR); String author = getStr(); view.printMessage(View.INPUT_PUBHOUSE); String pubhouse = getStr(); view.printMessage(View.INPUT_YEAR); int year = getInt(); view.printMessage(View.INPUT_PAGES); int pages = getInt(); view.printMessage(View.INPUT_PRICE); double price = getDoub(); if (!model.addBook(name, author, pubhouse, year, pages, price)) { view.printMessage(View.MANY_BOOKS); int size = getInt(); if (size == 0) { view.printMessage(View.COMMAND); String commandTwo = getStr(); control(commandTwo); } else { model.recreateBooks(size); control("ADD"); } } else { view.printMessage(View.BOOK_CREATED); view.printMessage(View.COMMAND); String commandTwo = getStr(); control(commandTwo); } break; } case "ALL": { view.printMessage(model.allBooks()); view.printMessage(View.COMMAND); String commandTwo = getStr(); control(commandTwo); break; } case "PRICE": { view.printMessage(View.INPUT_NEW_PRICE); int price = getInt(); model.changePrice(price); view.printMessage(View.COMMAND); String commandTwo = getStr(); control(commandTwo); break; } case "AUTHOR": { view.printMessage(View.INPUT_SEARCH_BY_AUTHOR); String author = getStr(); view.printMessage(model.findByAuthor(author)); view.printMessage(View.COMMAND); String commandTwo = getStr(); control(commandTwo); break; } case "YEAR": { view.printMessage(View.INPUT_SEARCH_BY_YEAR); int year = getInt(); view.printMessage(model.findByYear(year)); view.printMessage(View.COMMAND); String commandTwo = getStr(); control(commandTwo); break; } default: { view.printMessage(View.WRONG_INPUT_DATA); view.printMessage(View.COMMAND); String commandTwo = getStr(); control(commandTwo); } } } public void start() { view.printMessage(View.NEW_BOOKS_DATA); model.createBooks(getInt()); view.printMessage(View.BOOKS_CREATED); view.printMessage(View.COMMAND); String command = getStr(); control(command); } }
[ "noreply@github.com" ]
noreply@github.com