blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
c212e00ee7ba4bad1c345e4916ed7bbd8537d5ff
0b53f75b35363409daf597c2355117dee9b8b24c
/app/src/main/java/com/maibo/lvyongsheng/xianhui/view/AutoSwipeRefreshLayout.java
dda5d8030768a60d3d1b9e669266b667bfc1eb5c
[]
no_license
Nimodou2/changer
5d5955eb166c06d7d604445ad6a73b3c58288561
21ad9336f1bac8b705f106f6b20361b80e7f4491
refs/heads/master
2021-01-20T02:53:09.784573
2017-04-27T01:21:42
2017-04-27T01:21:42
89,462,133
0
0
null
null
null
null
UTF-8
Java
false
false
1,188
java
package com.maibo.lvyongsheng.xianhui.view; import android.content.Context; import android.support.v4.widget.SwipeRefreshLayout; import android.util.AttributeSet; import android.view.View; import java.lang.reflect.Field; import java.lang.reflect.Method; /** * Created by LYS on 2016/10/18. */ public class AutoSwipeRefreshLayout extends SwipeRefreshLayout { public AutoSwipeRefreshLayout(Context context) { super(context); } public AutoSwipeRefreshLayout(Context context, AttributeSet attrs) { super(context, attrs); } /** * 自动刷新 */ public void autoRefresh() { try { Field mCircleView = SwipeRefreshLayout.class.getDeclaredField("mCircleView"); mCircleView.setAccessible(true); View progress = (View) mCircleView.get(this); progress.setVisibility(VISIBLE); Method setRefreshing = SwipeRefreshLayout.class.getDeclaredMethod("setRefreshing", boolean.class, boolean.class); setRefreshing.setAccessible(true); setRefreshing.invoke(this, true, true); } catch (Exception e) { e.printStackTrace(); } } }
50a05ba7468469cacf9bcb6231e3be946f81edde
5a4fbbd07ba3bec35429906cae3c1e644ddc6fd2
/Exercicio6.java
21d8367ecb9ed5831775eb63dc253e67be7763d3
[]
no_license
ricardozadinell/exercicios-de-programacao
e591f493ab88e96924f7d11c21f05610ac6e2b4e
9032914263d75072264a7b788a4b5a2309360f8d
refs/heads/master
2020-07-23T11:39:03.698838
2019-11-17T12:42:42
2019-11-17T12:42:42
207,545,968
0
0
null
null
null
null
UTF-8
Java
false
false
1,096
java
/** *[EXERCICIO 6] *Escreva um algoritmo para ler as dimensões de um retângulo (base e altura), calcular e escrever a área do retângulo. */ import java.util.Scanner; public class Exercicio6 { public static void main(String[] args) { Scanner entrada = new Scanner(System.in); int Base; int Altura, Resp; System.out.println("***********************************************************************************************************"); System.out.println("**Esse algoritmo lê as dimensões de um retângulo (base e altura), calcula e devolve a área do retângulo: **"); System.out.println("***********************************************************************************************************"); System.out.print("Qual o valor da base do retangulo? "); Base = entrada.nextInt(); System.out.print("Qual a altura do retângulo? "); Altura = entrada.nextInt(); Resp = Base * Altura; System.out.print("O numero anterior ao digitado é " + Resp + "\n"); } }
5e524e3951a278b2f05c9631416b04e6b635d317
32df773ed42e172590d36e6a3f9ccc513fd875a9
/app/src/main/java/com/letscombine/jsonparsing/jsonparsing/MainActivity.java
7b6f0d3ca04e96eef5eca6baf4eb2147f8caf335
[]
no_license
konamgil/JsonParsing
923bef5945e1186aa1960d120b0eb288f8e99ee4
6d94a95fa692aea10a67f45521a09e0b58c5c925
refs/heads/master
2021-01-21T06:46:54.232318
2017-05-17T14:39:41
2017-05-17T14:39:41
91,586,739
0
0
null
null
null
null
UTF-8
Java
false
false
1,979
java
package com.letscombine.jsonparsing.jsonparsing; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import org.json.JSONArray; import org.json.JSONObject; public class MainActivity extends AppCompatActivity { private Button btnSumit; private TextView text; private String str; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnSumit = (Button)findViewById(R.id.btnSumit); text = (TextView)findViewById(R.id.text); btnSumit.setOnClickListener(mOnClickListner); str = "[{'name':'배트맨','age':43,'address':'고담'},"+ "{'name':'슈퍼맨','age':36,'address':'뉴욕'},"+ "{'name':'앤트맨','age':25,'address':'LA'}]"; } Button.OnClickListener mOnClickListner = new View.OnClickListener() { @Override public void onClick(View v) { try { JSONArray jarray = new JSONArray(str); StringBuffer sb = new StringBuffer(); for(int i=0; i < jarray.length(); i++){ JSONObject jObject = jarray.getJSONObject(i); // JSONObject 추출 String address = jObject.getString("address"); String name = jObject.getString("name"); int age = jObject.getInt("age"); sb.append( "주소:" + address + ", " + "이름:" + name + ", " + "나이:" + age + "\n" ); } text.setText(sb.toString()); }catch (Exception e){ e.printStackTrace(); } } }; }
19eb73d7ffb6487bcb6542c2a54213dc2e2627ad
2cbaa206212960b2d999a65b21490323976158a2
/org/springframework/orm/jpa/vendor/OpenJpaVendorAdapter.java
f3c6c297d75a4827873135ddb2e8647af4f15a59
[]
no_license
mangr3n/spring-2.5.6-java8
a40b8cd5c80846e6ca1fa37dafe64668d47677e4
7da66576c873054b4779a0a197f89e44452a9419
refs/heads/master
2023-02-10T00:42:18.256318
2021-01-11T16:54:54
2021-01-11T16:54:54
328,728,219
0
0
null
null
null
null
UTF-8
Java
false
false
3,814
java
/* * Copyright 2002-2008 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.springframework.orm.jpa.vendor; import java.util.Map; import java.util.Properties; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.spi.PersistenceProvider; import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI; import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI; import org.apache.openjpa.persistence.PersistenceProviderImpl; import org.springframework.orm.jpa.JpaDialect; /** * {@link org.springframework.orm.jpa.JpaVendorAdapter} implementation for * Apache OpenJPA. Developed and tested against OpenJPA 1.0.0. * * <p>Exposes OpenJPA's persistence provider and EntityManager extension interface, * and supports {@link AbstractJpaVendorAdapter}'s common configuration settings. * * @author Costin Leau * @author Juergen Hoeller * @since 2.0 * @see org.apache.openjpa.persistence.PersistenceProviderImpl * @see org.apache.openjpa.persistence.OpenJPAEntityManager */ public class OpenJpaVendorAdapter extends AbstractJpaVendorAdapter { private final PersistenceProvider persistenceProvider = new PersistenceProviderImpl(); private final OpenJpaDialect jpaDialect = new OpenJpaDialect(); public PersistenceProvider getPersistenceProvider() { return this.persistenceProvider; } public String getPersistenceProviderRootPackage() { return "org.apache.openjpa"; } public Map getJpaPropertyMap() { Properties jpaProperties = new Properties(); if (getDatabasePlatform() != null) { jpaProperties.setProperty("openjpa.jdbc.DBDictionary", getDatabasePlatform()); } else if (getDatabase() != null) { String databaseDictonary = determineDatabaseDictionary(getDatabase()); if (databaseDictonary != null) { jpaProperties.setProperty("openjpa.jdbc.DBDictionary", databaseDictonary); } } if (isGenerateDdl()) { jpaProperties.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)"); } if (isShowSql()) { // Taken from the OpenJPA 0.9.6 docs ("Standard OpenJPA Log Configuration + All SQL Statements") jpaProperties.setProperty("openjpa.Log", "DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE"); } return jpaProperties; } /** * Determine the OpenJPA database dictionary name for the given database. * @param database the specified database * @return the OpenJPA database dictionary name, or <code>null<code> if none found */ protected String determineDatabaseDictionary(Database database) { switch (database) { case DB2: return "db2"; case DERBY: return "derby"; case HSQL: return "hsql(SimulateLocking=true)"; case INFORMIX: return "informix"; case MYSQL: return "mysql"; case ORACLE: return "oracle"; case POSTGRESQL: return "postgres"; case SQL_SERVER: return "sqlserver"; case SYBASE: return "sybase"; default: return null; } } public JpaDialect getJpaDialect() { return this.jpaDialect; } public Class<? extends EntityManagerFactory> getEntityManagerFactoryInterface() { return OpenJPAEntityManagerFactorySPI.class; } public Class<? extends EntityManager> getEntityManagerInterface() { return OpenJPAEntityManagerSPI.class; } }
903c4213c9780a63fa1f5e299a0151bbbb3e6a86
fb075d2cd02b043e9a043678e37de6a81d62d841
/mvpdemo/app/src/main/java/com/example/mvpdemo/mvp/model/impl/VersionModel.java
ba2669cf3e066cb7e41de20057cb2a07b7c35be0
[]
no_license
shanyezhihe/mvpdemo
512aa1ccb17849c97e0b0ea9220e5068843cf17f
dfd1057619fb9599a31bdbd0f6f7e9421551ddd5
refs/heads/master
2020-05-21T10:09:31.876236
2016-10-01T09:34:35
2016-10-01T09:34:35
69,730,140
8
1
null
null
null
null
UTF-8
Java
false
false
2,437
java
package com.example.mvpdemo.mvp.model.impl; import android.content.Context; import android.util.Log; import com.example.mvpdemo.bean.Version; import com.example.mvpdemo.mvp.model.IModel; import org.json.JSONObject; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; /** * Created by pengdongyuan491 on 16/10/1. */ public class VersionModel implements IModel { public interface VersionCallback { void onVersionCallback(Version version); } private HttpURLConnection httpURLConnection = null; private InputStream inputStream = null; private BufferedReader bufferedReader = null; public void getNewVersion(Context context,final String url, final VersionCallback versionCallback) { new Thread(new Runnable() { @Override public void run() { try { httpURLConnection = (HttpURLConnection) new URL(url).openConnection(); httpURLConnection.connect(); inputStream = httpURLConnection.getInputStream(); bufferedReader = new BufferedReader(new InputStreamReader(inputStream, "utf-8")); StringBuilder stringBuilder = new StringBuilder(); String tempLine = null; while ((tempLine = bufferedReader.readLine()) != null) { stringBuilder.append(tempLine).append("\n"); } String data = stringBuilder.toString(); Log.e("data", data); JSONObject jsonObject=null; jsonObject = new JSONObject(data); Version version=new Version(); version.setLatest_version(jsonObject.optString("latest_version")); version.setDesc(jsonObject.optString("desc")); version.setHasNewVersion(jsonObject.optString("hasNewVersion")); versionCallback.onVersionCallback(version); } catch (Exception e) { e.printStackTrace(); } finally { try { bufferedReader.close(); inputStream.close(); } catch (Exception e) { } } } }).start(); } }
22d91e6b1f5e5718a5394e7fbaa5d4bbcf10a559
1a8f0b054b8391e6d8b1aa0718d38e45c95bbc55
/src/com/example/watchshop/LoginActivity.java
57746800cf8fa5eb84c731512cb854b73a682a23
[]
no_license
Pchesha/Android-Online-Shopping-Aplication
cf9c9605e827063261de8ea114e5c0315ce9752c
d99a5893bfd382bbe4c180a21ce800e912174f44
refs/heads/master
2021-01-25T09:10:52.374855
2016-09-24T17:15:53
2016-09-24T17:15:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,290
java
package com.example.watchshop; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.List; import javax.net.ssl.HttpsURLConnection; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; import org.apache.http.client.ResponseHandler; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.BasicResponseHandler; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import org.json.JSONObject; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.preference.PreferenceManager; import android.app.ActionBar; import android.app.Activity; import android.app.DownloadManager.Request; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.util.Log; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class LoginActivity extends Activity { Button b1; EditText e1,e2; JSONParser jsonParser = new JSONParser(); private static final String TAG_SUCCESS = "success"; private static final String TAG_MESSAGE = "message"; String LOGIN_URL = "http://192.168.43.157/watchShopAdmin/userlogin.php"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActionBar actionBar=getActionBar(); actionBar.hide(); setContentView(R.layout.activity_login); Intent i=getIntent(); b1=(Button) findViewById(R.id.sendButton); e1=(EditText) findViewById(R.id.displaymessage); e2=(EditText) findViewById(R.id.editText2); } public void send(View v) { new AttemptLogin().execute(); } class AttemptLogin extends AsyncTask<String, String, String> { @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected String doInBackground(String... args) { // TODO Auto-generated method stub // Check for success tag int success; String username=e1.getText().toString(); String password=e2.getText().toString(); try { // Building Parameters List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("username", username)); params.add(new BasicNameValuePair("password", password)); Log.d("request!", "starting"); // getting product details by making HTTP request JSONObject json = jsonParser.makeHttpRequest(LOGIN_URL,"GET",params); // check your log for json response Log.d("Login attempt", json.toString()); // json success tag success = json.getInt(TAG_SUCCESS); if (success == 1) { Log.d("Login Successful!", json.toString()); // save user data SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); Editor edit = sp.edit(); edit.putString("username", username); edit.commit(); Intent i = new Intent(LoginActivity.this, Home1Activity.class); i.putExtra("Username",e1.getText().toString()); finish(); startActivity(i); return json.getString(TAG_MESSAGE); } else { Log.d("Login Failure!", json.getString(TAG_MESSAGE)); return json.getString(TAG_MESSAGE); } } catch (JSONException e) { e.printStackTrace(); } return null; } protected void onPostExecute(String file_url) { // dismiss the dialog once product deleted if (file_url != null) { Toast.makeText(LoginActivity.this, file_url, Toast.LENGTH_LONG).show(); } } } }
314803d9f2015f7eb37ca09c3408ef443f61045e
0802a6a589f0db038c4ddf1e2cdb2b5aaf525ed2
/tests/numbers/PlusOneTest.java
501e118d9fbf60382ce3aa17260f16c8034e9215
[]
no_license
ah673/challenges
be76bca4131a50219f3089f5414790da23bc05bc
edafe7a16281ee476734148bfb9051f270f3dd9c
refs/heads/master
2021-01-10T14:53:35.230003
2015-12-04T17:24:54
2015-12-04T17:24:54
45,153,644
0
0
null
null
null
null
UTF-8
Java
false
false
1,358
java
package numbers; import static org.junit.Assert.*; import org.junit.Test; public class PlusOneTest { @Test public void test_emptyArray() { int[] answer = PlusOne.plusOne( new int[]{} ); assertEquals( 1, answer.length ); assertEquals( 1, answer[0] ); } @Test public void test_carry() { int[] answer = PlusOne.plusOne( new int[]{ 9 } ); assertEquals( 2, answer.length ); assertEquals( 1, answer[0] ); assertEquals( 0, answer[1] ); } @Test public void test_no_carry() { int[] answer = PlusOne.plusOne( new int[]{ 1 } ); assertEquals( 1, answer.length ); assertEquals( 2, answer[0] ); } @Test public void test_multi_digits_all_carry() { int[] answer = PlusOne.plusOne( new int[]{ 9,9,9 } ); assertEquals( 4, answer.length ); assertEquals( 1, answer[0] ); assertEquals( 0, answer[1] ); assertEquals( 0, answer[2] ); assertEquals( 0, answer[3] ); } @Test public void test_multi_digits_some_carry() { int[] answer = PlusOne.plusOne( new int[]{ 9,8,9 } ); assertEquals( 3, answer.length ); assertEquals( 9, answer[0] ); assertEquals( 9, answer[1] ); assertEquals( 0, answer[2] ); } @Test public void test_multi_digits_no_carry() { int[] answer = PlusOne.plusOne( new int[]{ 1, 2 } ); assertEquals( 2, answer.length ); assertEquals( 1, answer[0] ); assertEquals( 3, answer[1] ); } }
9d9ff065167cf278f7435db90a812abf96ff5375
d3773871226a2ab12383bc1d74ab9ae427bd0bc1
/TankWars/src/tankwars/Arena.java
995adc7c46a58c45f338daff1cb94f8bba995b50
[]
no_license
psoder3/TankWars
df8518db90d9424fa3a30f3d8afcc6b83188364a
c2be848ddba0d82128605c291d63158e498512a9
refs/heads/master
2022-03-02T23:13:39.157129
2022-03-01T15:12:07
2022-03-01T15:12:07
125,418,035
2
1
null
null
null
null
UTF-8
Java
false
false
39,056
java
package tankwars; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.Timer; import tankwars.tanks.ControlTank; /** * * @author psoderquist */ public class Arena extends JComponent { public int maxNumTanks = 24; Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int screen_width = (int)screenSize.getWidth(); int screen_height = (int)screenSize.getHeight(); int tankPlaces = 0; final int numRows = 13; final int numCols = 21; final int healthSquareSize = 16; final int cellHeight = (screen_height - 250) / numRows; final int cellWidth = (screen_width - 250) / numCols; private Image blankImage = null; private Image redSquare = null; private Image greenSquare = null; public double randPassword; //private int[][] grid = new int[numRows][numCols]; private ArrayList<Tank> tanks = new ArrayList(); private ArrayList<Bullet> bullets = new ArrayList(); private ArrayList<Lightning> lightnings = new ArrayList(); private ArrayList<Heart> hearts = new ArrayList(); private ArrayList<Bomb> bombs = new ArrayList(); private ArrayList<Explosion> explosions = new ArrayList(); private ArrayList<GameObject> tiles; private static boolean update = false; private ArrayList<TankAction> actions = new ArrayList(); //private TimerComponent frameTimer; public Tank controlTank1; public Tank controlTank2; public int timeCounter = 0; public int timeLimit = 90; public int secondsLeft = timeLimit; private boolean gameOver = false; private static boolean GameStarted = false; private ArrayList<Tank> resultTanks = new ArrayList(); public ArrayList<String> tankNames; boolean isTeamBattle = false; public Frame_TankWars frame; private ArrayList<Integer> superTanks; /*void setFrameTimer(TimerComponent frameTimer) { this.frameTimer = frameTimer; }*/ public Arena() { tiles = new ArrayList(); randPassword = Math.random(); superTanks = new ArrayList(); try { blankImage = ImageIO.read(new File("images/sand4.png"));//blank.png")); redSquare = ImageIO.read(new File("images/red2.png")); greenSquare = ImageIO.read(new File("images/green2.png")); } catch (IOException ex) { Logger.getLogger(Arena.class.getName()).log(Level.SEVERE, null, ex); } } public static boolean gameHasStarted() { return GameStarted; } private void touchingLightning(Tank t) { for (Lightning l : lightnings) { if (l.getX() == t.getX() && l.getY() == t.getY()) { if (!superTanks.contains(t.getId())) { superTanks.add(t.getId()); } l.destroy(); lightnings.remove(l); return; } } } private void touchingHeart(Tank t) { for (Heart h : hearts) { if (h.getX() == t.getX() && h.getY() == t.getY()) { if (t.getLives() < (int)this.frame.numLivesBox.getSelectedItem()) { randPassword = Math.random(); t.addLife(randPassword); } h.destroy(); hearts.remove(h); return; } } } public void doAction(TankAction action) { if (action.action.equals("rotateLeft")) { randPassword = Math.random(); action.actingTank.rotateLeftAction(randPassword); } else if (action.action.equals("rotateRight")) { randPassword = Math.random(); action.actingTank.rotateRightAction(randPassword); } else if (action.action.equals("moveUp")) { randPassword = Math.random(); action.actingTank.moveUpAction(randPassword); touchingLightning(action.actingTank); touchingHeart(action.actingTank); } else if (action.action.equals("moveLeft")) { randPassword = Math.random(); action.actingTank.moveLeftAction(randPassword); touchingLightning(action.actingTank); touchingHeart(action.actingTank); } else if (action.action.equals("moveRight")) { randPassword = Math.random(); action.actingTank.moveRightAction(randPassword); touchingLightning(action.actingTank); touchingHeart(action.actingTank); } else if (action.action.equals("moveDown")) { randPassword = Math.random(); action.actingTank.moveDownAction(randPassword); touchingLightning(action.actingTank); touchingHeart(action.actingTank); } else if (action.action.equals("fire")) { randPassword = Math.random(); action.actingTank.fireAction(action.actingTank, randPassword); } else if (action.action.equals("setBomb")) { randPassword = Math.random(); action.actingTank.bombAction(action.actingTank, randPassword); } } public void setTanksToStartValue(int startingLives) { for (Tank t : tanks) { while (t.getLives() > startingLives) t.loseLife(); } } public boolean superShootersContains(int id) { return superTanks.contains(id); } public Tank getControlTank1() { return controlTank1; } public Tank getControlTank2() { return controlTank2; } private void removeBulletsOffBoard() { List<Bullet> toRemove = new ArrayList(); for (Bullet b : bullets) { if (gameOver) { b.destroy(); } if (b.getX() < -1) { toRemove.add(b); } else if (b.getY() < -1) { toRemove.add(b); } else if (b.getX() > numCols) { toRemove.add(b); } else if (b.getY() > numRows) { toRemove.add(b); } } for (Bullet b : toRemove) { bullets.remove(b); awardBulletPoints(b, false); } } private void removeDuplicateActions() { List<TankAction> toRemove = new ArrayList(); List<Tank> tankActors = new ArrayList(); for (TankAction a : actions) { if (tankActors.contains(a.actingTank)) { toRemove.add(a); } else { tankActors.add(a.actingTank); } } for (TankAction a : toRemove) { actions.remove(a); } } private void calculateTieBreaker() { int maxKills = tanks.get(0).getKills(); int maxAlmostKills = tanks.get(0).getAlmostKills(); double bestAccuracy = tanks.get(0).getBulletAverageAccuracy(); Tank tMostKills = tanks.get(0); Tank tMostAlmostKills = tanks.get(0); Tank tBestAccuracy = tanks.get(0); for (Tank t : tanks) { if (t.equals(tanks.get(0))) { continue; } if (t.getKills() > maxKills) { maxKills = t.getKills(); tMostKills = t; } if (t.getAlmostKills() > maxAlmostKills) { maxAlmostKills = t.getAlmostKills(); tMostAlmostKills = t; } if (t.getBulletAverageAccuracy() < bestAccuracy) { bestAccuracy = t.getBulletAverageAccuracy(); tBestAccuracy = t; } } if (isTeamBattle) { return; } int tanksWithMostKills = 0; for (Tank t : tanks) { if (t.getKills() == maxKills) { tanksWithMostKills += 1; } } if (tanksWithMostKills > 1) { int tanksWithMostAlmostKills = 0; for (Tank t : tanks) { if (t.getAlmostKills() == maxAlmostKills) { tanksWithMostAlmostKills += 1; } } if (tanksWithMostAlmostKills > 1) { eliminateAllTanksBesides(tBestAccuracy); } else { eliminateAllTanksBesides(tMostAlmostKills); } } else { eliminateAllTanksBesides(tMostKills); } } private void endGame() { gameOver = true; if (tanks.size() > 1) { calculateTieBreaker(); } else { tanks.get(0).setPlaceFinished(1); resultTanks.add(tanks.get(0)); } JTextArea textArea = new JTextArea(getResults()); JScrollPane scrollPane = new JScrollPane(textArea); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); textArea.setEditable(false); Font currentFont = textArea.getFont(); Font newFont = currentFont.deriveFont(currentFont.getSize() * 2F); textArea.setFont(newFont); scrollPane.setPreferredSize( new Dimension( 500, 500 ) ); JOptionPane.showMessageDialog(this, scrollPane, "Results", JOptionPane.PLAIN_MESSAGE); //JOptionPane.showMessageDialog(this, getResults()); } private void endGameTeamBattle() { gameOver = true; if (tanks.size() > 1) { calculateTieBreaker(); } else { tanks.get(0).setPlaceFinished(1); resultTanks.add(tanks.get(0)); } JTextArea textArea = new JTextArea("TEAM RESULTS\n\n" + getTeamResults() + "\n\nINDIVIDUAL RESULTS\n\n" + getResults()); JScrollPane scrollPane = new JScrollPane(textArea); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); textArea.setEditable(false); Font currentFont = textArea.getFont(); Font newFont = currentFont.deriveFont(currentFont.getSize() * 2F); textArea.setFont(newFont); scrollPane.setPreferredSize(new Dimension(500, 500)); JOptionPane.showMessageDialog(this, scrollPane, "Results", JOptionPane.PLAIN_MESSAGE); //JOptionPane.showMessageDialog(this, getResults()); } private String getTeamResults() { HashMap<String, Integer> teamSurviveCounterMap = new HashMap(); HashMap<String, Integer> teamKillCounterMap = new HashMap(); String message = ""; for (Tank t : resultTanks) { teamSurviveCounterMap.put(t.getTeam(), 0); teamKillCounterMap.put(t.getTeam(), 0); } for (Tank t : tanks) { int numberLeft = 1; String teamName = t.getTeam(); if (teamSurviveCounterMap.containsKey(teamName)) { int currentNumLeft = teamSurviveCounterMap.get(teamName); numberLeft += currentNumLeft; } teamSurviveCounterMap.put(teamName,numberLeft); int numberKills = t.getKills(); if (teamKillCounterMap.containsKey(t.getTeam())) { numberKills += teamKillCounterMap.get(t.getTeam()); } teamKillCounterMap.put(t.getTeam(),numberKills); } for (Tank t : resultTanks) { int numberKills = t.getKills(); if (teamKillCounterMap.containsKey(t.getTeam())) { numberKills += teamKillCounterMap.get(t.getTeam()); } teamKillCounterMap.put(t.getTeam(),numberKills); } message += "\nTANKS LEFT:\n"; Iterator it = teamSurviveCounterMap.entrySet().iterator(); while (it.hasNext()) { Map.Entry pair = (Map.Entry)it.next(); message += "Team " + pair.getKey() + ": " + pair.getValue() + "\n"; it.remove(); // avoids a ConcurrentModificationException } message += "\nKILLS:\n"; Iterator it2 = teamKillCounterMap.entrySet().iterator(); while (it2.hasNext()) { Map.Entry pair = (Map.Entry)it2.next(); message += "Team " + pair.getKey() + ": " + pair.getValue() + "\n"; it2.remove(); // avoids a ConcurrentModificationException } return message; } private String getResults() { String message = ""; Collections.sort(resultTanks); for (int i = 0; i < resultTanks.size(); i++) { message += resultTanks.get(i).toString() + "\n"; } return message; } public void startGame() { GameStarted = true; new Thread() { @Override public void run() { final int millisecondInterval = 5; Timer timer = new Timer(millisecondInterval, new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { removeBulletsOffBoard(); if (gameOver) { return; } if (isTeamBattle) { String firstTeamName = tanks.get(0).getTeam(); boolean teamGameOver = true; for (Tank t : tanks) { if (!t.getTeam().equals(firstTeamName)) { teamGameOver = false; } } if (teamGameOver) { gameOver = true; removeBulletsOffBoard(); endGameTeamBattle(); } } else if (tanks.size() < 2) { gameOver = true; removeBulletsOffBoard(); endGame(); stop(); } if (actions.size() > 0) { removeDuplicateActions(); doAction(actions.get(0)); actions.remove(0); } } }); timer.setRepeats(true); timer.start(); } }.start(); new Thread() { @Override public void run() { final int millisecondInterval = 1000; Timer timer = new Timer(millisecondInterval, new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { if (gameOver) { return; } if (timeCounter % 3 == 0) { addLightning(); addHeart(); //numberTanksAtBeginning = tanks.size(); } timeCounter++; int secondsExpired = timeCounter; secondsLeft = timeLimit - secondsExpired; if (secondsLeft < 1) { secondsLeft = 0; gameOver = true; removeBulletsOffBoard(); if (isTeamBattle) { endGameTeamBattle(); } else { endGame(); } } frame.timerLabel.setText(" " + secondsLeft); } }); timer.setRepeats(true); timer.start(); } }.start(); } private void addLightning() { int lx = 0; int ly = 0; boolean spotTaken; do { spotTaken = false; lx = (int) (Math.random() * this.numCols); ly = (int) (Math.random() * this.numRows); for (Tank t : tanks) { if (t.getX() == lx && t.getY() == ly) { spotTaken = true; break; } } if (spotTaken) continue; for (Lightning l : lightnings) { if (l.getX() == lx && l.getY() == ly) { spotTaken = true; break; } } } while (spotTaken); final Lightning l = new Lightning(lx,ly); lightnings.add(l); int lightningInterval = 500; Timer timer = new Timer(lightningInterval, new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { if (l == null || !l.isAlive()) { return; } l.tickClock(); if (!l.isAlive()) lightnings.remove(l); paintBoard(); } }); timer.setRepeats(true); // Only execute once timer.start(); } private void addHeart() { int hx = 0; int hy = 0; boolean spotTaken; do { spotTaken = false; hx = (int) (Math.random() * this.numCols); hy = (int) (Math.random() * this.numRows); for (Tank t : tanks) { if (t.getX() == hx && t.getY() == hy) { spotTaken = true; break; } } if (spotTaken) continue; for (Heart h : hearts) { if (h.getX() == hx && h.getY() == hy) { spotTaken = true; break; } } } while (spotTaken); final Heart h = new Heart(hx,hy); hearts.add(h); int heartInterval = 500; Timer timer = new Timer(heartInterval, new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { if (h == null || !h.isAlive()) { return; } h.tickClock(); if (!h.isAlive()) hearts.remove(h); paintBoard(); } }); timer.setRepeats(true); // Only execute once timer.start(); } public List<Tank> getUnmodifiableTanks() { List<Tank> clone_tanks = new ArrayList(); for(Tank t : tanks) { clone_tanks.add(t.getCopyTank()); } return clone_tanks; } public List<Bullet> getUnmodifiableBullets() { List<Bullet> clone_bullets = new ArrayList(); for(Bullet b : bullets) { clone_bullets.add(b.getCopy()); } return clone_bullets; } public List<Lightning> getUnmodifiableLightnings() { List<Lightning> clone_lightnings = new ArrayList(); for(Lightning l : lightnings) { clone_lightnings.add(l.getCopy()); } return clone_lightnings; } public List<Heart> getUnmodifiableHearts() { List<Heart> clone_hearts = new ArrayList(); for(Heart h : hearts) { clone_hearts.add(h.getCopy()); } return clone_hearts; } public List<Bomb> getUnmodifiableBombs() { List<Bomb> clone_bombs = new ArrayList(); for(Bomb b : bombs) { clone_bombs.add(b.getCopy()); } return clone_bombs; } public void addTank(Tank tank) { if (tankPlaces >= maxNumTanks) { return; } if (tank.getClass() == ControlTank.class) { if (controlTank1 == null) { controlTank1 = tank; } else { controlTank2 = tank; } } tanks.add(tank); tankPlaces++; //grid[(int)tank.getY()][(int)tank.getX()] = 1; } /* public void addPlaceHolder() { if (tankPlaces > 23) { return; } if (tanks.size() == 23) { controlTank1 = tanks.get(4); controlTank2 = tanks.get(22); } tankPlaces ++; } */ void addAction(TankAction tankAction) { actions.add(tankAction); } void recalculateGrid() { for (int i = 0; i < numRows; i++) { for (int j = 0; j < numCols; j++) { //grid[i][j] = 0; } } for (Tank tank : tanks) { //grid[(int)tank.getY()][(int)tank.getX()] = 1; } } void paintBoard() { //recalculateGrid(); tiles.clear(); for (int i = 0; i < numRows; i++) { for (int j = 0; j < numCols; j++) { //if (grid[i][j] != 1) { int x = j * cellWidth; int y = i * cellHeight; drawCell(blankImage,x,y,new GameObject()); } } } for (Tank tank : tanks) { if (tank.isAlive()) { drawObject(tank, true); } } for (Bullet bullet : bullets) { if (bullet.isAlive()) { drawObject(bullet, false); } } for (Lightning lightning : lightnings) { if (lightning.isAlive()) { drawObject(lightning, false); } } for (Heart heart : hearts) { if (heart.isAlive()) { drawObject(heart, false); } } for (Bomb bomb : bombs) { if (bomb.isAlive()) { drawObject(bomb, false); } } for (Explosion explosion : explosions) { if (explosion.isAlive()) { drawObject(explosion, false); } } this.repaint(); } private void drawObject(GameObject gameObject, boolean isTank) { drawCell(gameObject.image, gameObject.getX() * cellWidth, gameObject.getY() * cellHeight, gameObject); if ((isTank || frame.colorBullets.isSelected()) && isTeamBattle && frame.colorTeams.isSelected()) { drawCell(gameObject.team_image, gameObject.getX() * cellWidth, gameObject.getY() * cellHeight, new GameObject()); } if (isTank && frame.livesCheckBox.isSelected()) { Tank t = (Tank)gameObject; int maxLives = (int)frame.numLivesBox.getSelectedItem(); for (int i = 0; i < maxLives; i++) { Image square; if (i >= t.getLives()) { square = redSquare; } else { square = greenSquare; } drawCell(square, gameObject.getX() * cellWidth+i*healthSquareSize, gameObject.getY() * cellHeight, new GameObject()); } } } private void drawCell(Image img, double x, double y, GameObject t) { t.drawingImage = new DrawingImage(img, new Rectangle2D.Double(x, y, cellWidth, cellHeight)); tiles.add(t); } boolean checkCollision(Bullet b) { Tank owner = null; for (Tank t : tanks) { if (b.isBulletsOwner(t)) { owner = t; break; } } for (Bomb bomb : bombs) { if (b.getX() == bomb.getX() && b.getY() == bomb.getY()) { b.destroy(); bullets.remove(b); explode(bomb); return true; } } for (Tank tank : tanks) { if (b.getX() == tank.getX() && b.getY() == tank.getY()) { if ((frame.canKillTeammates.isSelected() == false && tank.getTeam().equals(b.getTeam())) || tank.equals(owner)) { continue; } //tanks.remove(tank); //grid[(int)tank.getY()][(int)tank.getX()] = 0; tank.loseLife(); if (tank.getLives() <= 0) { tank.destroy(); tank.setPlaceFinished(tanks.size()); tanks.remove(tank); resultTanks.add(tank); } awardBulletPoints(b, true); b.destroy(); bullets.remove(b); //System.out.println(tank.toString()); if (tanks.size() == 1) { //System.out.println(tanks.get(0).toString()); } return true; } } if (frame.bulletsCollide.isSelected()) { for (Bullet bullet : bullets) { if (b.getX() == bullet.getX() && b.getY() == bullet.getY()) { if (b.equals(bullet)) { continue; } bullets.remove(bullet); bullets.remove(b); awardBulletPoints(bullet, false); awardBulletPoints(bullet, false); b.destroy(); //grid[(int)bullet.y][(int)bullet.x] = 0; bullet.destroy(); return true; } } } return false; } void fireBullet(int rotateDegrees, double x, double y, Tank tank) { final Bullet b = new Bullet(rotateDegrees, x, y, tank); bullets.add(b); int bulletInterval = 125; if (superTanks.contains(tank.getId())) { bulletInterval = 63; } Timer timer = new Timer(bulletInterval, new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { if (!b.isAlive()) { return; } if (b.getRotateDegrees() == 0) { b.setBulletX(b.getX()+.5); } if (b.getRotateDegrees() == 180) { b.setBulletX(b.getX()-.5); } if (b.getRotateDegrees() == 90) { b.setBulletY(b.getY()+.5); } if (b.getRotateDegrees() == 270) { b.setBulletY(b.getY()-.5); } checkBulletDistanceToATank(b); checkCollision(b); paintBoard(); } }); timer.setRepeats(true); // Only execute once timer.start(); } public void setBomb(double x, double y, Tank t) { final Bomb b = new Bomb(x, y, t); for (Bomb b2 : bombs) { if (b2.getX() == x && b2.getY() == y) { return; } } bombs.add(b); t.loseLife(); if (t.getLives() <= 0) { t.destroy(); tanks.remove(t); } int bombInterval = 500; Timer timer = new Timer(bombInterval, new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { if (!b.isAlive()) { return; } b.tickClock(); if (!b.isAlive()) { explode(b); } paintBoard(); } }); timer.setRepeats(true); // Only execute once timer.start(); } private void explode(Bomb b) { final Explosion e = new Explosion(b.getX(), b.getY()); explosions.add(e); bombs.remove(b); int explosionInterval = 500; Timer timer = new Timer(explosionInterval, new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { if (!e.isAlive()) { return; } e.tickClock(); if (!e.isAlive()) { explosions.remove(e); } paintBoard(); } }); timer.setRepeats(true); // Only execute once timer.start(); int blastRadius = 2; ArrayList<Tank> tanksToDie = new ArrayList(); for (Tank t : tanks) { double diffHoriz = Math.abs(t.getX() - b.getX()); double diffVert = Math.abs(t.getY() - b.getY()); if ((diffHoriz != diffVert || diffHoriz != 2) && diffHoriz <= blastRadius && diffVert <= blastRadius) { b.awardBombKill(true); t.loseLife(); t.loseLife(); if (t.getLives() <= 0) { tanksToDie.add(t); } } } for (Tank t : tanksToDie) { t.destroy(); tanks.remove(t); } b.destroy(); bombs.remove(b); for (Bomb b2 : bombs) { if (Math.abs(b2.getX() - b.getX()) < blastRadius && Math.abs(b2.getY() - b.getY()) < blastRadius) { explode(b2); } } } private void awardBulletPoints(Bullet b, boolean killed) { b.awardBulletPoints(killed); } private double distanceFromBulletToTank(Bullet b, Tank t) { double yoffset = b.getY() - t.getY(); double xoffset = b.getX() - t.getX(); double distance = Math.sqrt(xoffset*xoffset + yoffset*yoffset); return distance; } // used to determine a winner when no tank outlasts the others private void checkBulletDistanceToATank(Bullet b) { for (Tank t : tanks) { if (b.isBulletsOwner(t) || (isTeamBattle && b.getTeam().equals(t.getTeam()))) { continue; } double distance = distanceFromBulletToTank(b,t); // if bullet distance to a tank is closer than closest already, set this as min if (distance < b.getMinDistance()) { b.setMinDistance(distance); } // if bullet distance to a tank it is facing is closer than closest already, set this as min for that if (distance < b.getMinFacingDistance()) { if (t.getX() < b.getX() && b.getRotateDegrees() == 180 && t.getY() == b.getY()) { b.setMinFacingDistance(distance); } if (t.getX() > b.getX() && b.getRotateDegrees() == 0 && t.getY() == b.getY()) { b.setMinFacingDistance(distance); } if (t.getX() == b.getX() && b.getRotateDegrees() == 270 && t.getY() < b.getY()) { b.setMinFacingDistance(distance); } if (t.getX() == b.getX() && b.getRotateDegrees() == 90 && t.getY() > b.getY()) { b.setMinFacingDistance(distance); } } } } private void eliminateAllTanksBesides(Tank winningTank) { for (Tank t : tanks) { t.setPlaceFinished(tanks.size()); resultTanks.add(t); } tanks = new ArrayList(); winningTank.setPlaceFinished(1); tanks.add(winningTank); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; drawBackground(g2); drawShapes(g2); } private void drawBackground(Graphics2D g2) { g2.setColor(getBackground()); g2.fillRect(0, 0, getWidth(), getHeight()); } private void drawShapes(Graphics2D g2) { for (GameObject O : tiles) { DrawingShape shape = O.drawingImage; AffineTransform at = new AffineTransform(); AffineTransform oldXForm = g2.getTransform(); at.rotate(Math.toRadians(O.getRotateDegrees()), (cellWidth+2)/2 + O.getX()*cellWidth, (cellHeight+2)/2 + O.getY()*cellHeight); g2.transform(at); shape.draw(g2); g2.setTransform(oldXForm); } } interface DrawingShape { boolean contains(Graphics2D g2, double x, double y); void adjustPosition(double dx, double dy); void draw(Graphics2D g2); } class DrawingImage implements DrawingShape { public Image image; public Rectangle2D rect; public int value; public DrawingImage(Image image, Rectangle2D rect) { this.image = image; this.rect = rect; //this.value = value; } @Override public boolean contains(Graphics2D g2, double x, double y) { return rect.contains(x, y); } @Override public void adjustPosition(double dx, double dy) { rect.setRect(rect.getX() + dx, rect.getY() + dy, rect.getWidth(), rect.getHeight()); } @Override public void draw(Graphics2D g2) { Rectangle2D bounds = rect.getBounds2D(); int explosionSize = 375; if (image == null) { System.out.println("Pause here"); } if (image.getHeight(null) == explosionSize) { g2.drawImage(image, (int)bounds.getMinX()-(int)((2)*cellWidth), (int)bounds.getMinY()-(int)((2)*cellHeight), (int)bounds.getMaxX()+(int)((2)*cellWidth), (int)bounds.getMaxY()+(int)((2)*cellHeight), 0, 0, image.getWidth(null), image.getHeight(null), null); } else if (image.getHeight(null) == healthSquareSize) { g2.drawImage(image, (int)bounds.getMinX(), (int)bounds.getMinY()-(int)((1.0/8)*cellWidth), (int)bounds.getMaxX()-(int)((7.0/8)*cellWidth), (int)bounds.getMaxY()-(int)((7.0/8)*cellWidth), 0, 0, image.getWidth(null), image.getHeight(null), null); } else { g2.drawImage(image, (int)bounds.getMinX(), (int)bounds.getMinY(), (int)bounds.getMaxX(), (int)bounds.getMaxY(), 0, 0, image.getWidth(null), image.getHeight(null), null); } } } }
1d92ad14820fba4e7bc484541a4bdb533d15108d
04b8a59f9eb4c0cc21bb2542b0b8659f0cf32b9a
/src/main/java/com/pulingle/user_service/utils/RespondBuilder.java
ad40725d742f069369d3af426493aa2f93eab60c
[]
no_license
Konoha-orz/user_service
8ed229d2f32dd2932b2f55304c64db4264652d10
dcad31ec3f05c8dc05f83d7fd4617167878c2014
refs/heads/master
2020-03-07T21:38:34.146594
2018-07-16T06:58:45
2018-07-16T06:58:45
127,732,369
1
1
null
null
null
null
UTF-8
Java
false
false
1,024
java
package com.pulingle.user_service.utils; import com.pulingle.user_service.domain.dto.RespondBody; /** * Created by @杨健 on 2018/4/1 17:43 * * @Des: 消息载体构建工具类 */ public class RespondBuilder { public static RespondBody buildNormalResponse(Object object) { RespondBody respondBody = new RespondBody(); respondBody.setStatus("1"); respondBody.setMsg("0000"); respondBody.setData(object); return respondBody; } public static RespondBody buildErrorResponse(String msg) { RespondBody respondBody = new RespondBody(); respondBody.setStatus("0"); respondBody.setMsg(msg); respondBody.setData(null); return respondBody; } public static RespondBody buildTokenErrorResponse(Object object) { RespondBody respondBody = new RespondBody(); respondBody.setStatus("2"); respondBody.setMsg("没有Token或Token"); respondBody.setData(object); return respondBody; } }
9e4980f65c5c3f5572a19d7f54928e889262ac62
e870cb9807a9a452069950483f2e906952c1c977
/gen/com/tstine/pangolinprecision/R.java
5318ffabd5958fbcfb9da141e8441d851aeef5f8
[]
no_license
taylorstine/Pangolin-Precision
6115e759cc5244f6fc147296920f7b15f4e5ffb2
810a24dfaab2d252fa80dfd562a20cfcab165cbf
refs/heads/master
2020-06-02T00:03:44.008901
2013-10-02T19:08:34
2013-10-02T19:08:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,969
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.tstine.pangolinprecision; public final class R { public static final class attr { } public static final class drawable { public static final int ic_launcher=0x7f020000; } public static final class id { public static final int add_to_cart_button=0x7f05000b; public static final int category_list=0x7f050005; public static final int cross_sale_label=0x7f050011; public static final int cross_sales=0x7f050012; public static final int grid=0x7f050002; public static final int item_currency=0x7f050009; public static final int item_image=0x7f050000; public static final int item_retail_price=0x7f050007; public static final int item_sale_price=0x7f050008; public static final int item_text=0x7f050001; public static final int item_title=0x7f050015; public static final int list=0x7f050003; public static final int list_text=0x7f050016; public static final int main_image=0x7f05000a; public static final int options_spinner=0x7f05000c; public static final int product_bullets=0x7f05000f; public static final int product_leading_equity=0x7f05000e; public static final int product_title=0x7f050006; public static final int progress_bar=0x7f050004; public static final int promos=0x7f050010; public static final int swatch_grid=0x7f05000d; public static final int up_sale_label=0x7f050013; public static final int up_sales=0x7f050014; } public static final class layout { public static final int basic_grid_item=0x7f030000; public static final int category_grid_item=0x7f030001; public static final int grid_item=0x7f030002; public static final int grid_view=0x7f030003; public static final int list_view=0x7f030004; public static final int loading=0x7f030005; public static final int main=0x7f030006; public static final int main_categories=0x7f030007; public static final int product_details=0x7f030008; public static final int product_grid_item=0x7f030009; public static final int sorry=0x7f03000a; public static final int spinner_item=0x7f03000b; public static final int subcat=0x7f03000c; public static final int swatch_grid_item=0x7f03000d; } public static final class string { public static final int addToCartButton=0x7f040001; public static final int app_name=0x7f040000; public static final int cross_sale_text=0x7f040004; public static final int options_spinner_hint=0x7f040002; public static final int sorry_text=0x7f040003; public static final int up_sale_text=0x7f040005; } }
ba7a077a8517d10bb0010f5b3c46add74f28f96e
343875befafa6947ccf6dcb990f8ab240425104b
/Ball/BallThread.java
a4c8dd47c5e3a4a6cc005d48dff6d7a4f102e569
[]
no_license
silverzoey/silverzoey
138541c3b42499803b166f20d36fb47a4928497f
20e2fad958ffa74746fb97a9df73c635e58992ec
refs/heads/master
2021-07-08T04:58:42.020996
2020-07-21T06:10:47
2020-07-21T06:10:47
158,320,436
0
0
null
null
null
null
UTF-8
Java
false
false
914
java
package Ball; import java.awt.Graphics; import java.awt.Graphics2D; import java.util.ArrayList; import java.util.Random; public class BallThread extends Thread{ private Graphics g; private int x,y,vx,vy; private BallFrame bf; private ArrayList<Ball> list; public boolean Pauseflag=true; public BallThread(int x,int y,Graphics g,BallFrame bf,ArrayList<Ball> list){ this.x =x; this.y = y; this.g = g; this.bf = bf; this.list = list; } public void run(){ while(Pauseflag){ for(int i =0;i<list.size();i++){ for(int j = 0;j<list.size()&&j!=i;j++){ } Ball ball = (Ball)list.get(i); int x1 = ball.x; int y1 = ball.y; ball.clear(g, bf); ball.draw((Graphics2D)g,bf); ball.move(g); } try { Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } } } }
0f6a6d602ca1da7d27eb327e7df86bae289a8ef5
3d03b5233dfc3060c044702472c979ad568d388b
/src/lv/javaguru/lessons/lesson3/ExampleForLoop.java
5349c412ce6e854004ddf64a479e73c814b4fd86
[]
no_license
javagururt/jg-java-for-qa-august-2019
33a02510ed801cf1262f57fe3e08e8b78909664f
33f271ca7cdb0149abb93f1036bca4840c52c426
refs/heads/master
2020-07-09T00:19:10.893069
2019-09-11T18:23:39
2019-09-11T18:23:39
203,820,237
0
1
null
null
null
null
UTF-8
Java
false
false
214
java
package lv.javaguru.lessons.lesson3; class ExampleForLoop { public static void main(String[] args) { for (int i = 1; i < 101; i++) { System.out.print("i = " + i + ", "); } } }
67f34105f436987271dc63b6373e191369502718
4f90ba5183bdf6280e0c305b2cce988741120135
/version 5/src/recognizer/FeatureExtractor.java
65b5d1e5aa1a587f6d6c931f52cb3efa664cbc1f
[]
no_license
Swtdream/Manuscript-Formula-Recognition
f87084ae62e6a20abc26d1b68273339d743d601e
7e4792c3c69d4f28274e43a1b2397bd6961e5e91
refs/heads/master
2016-09-06T06:51:02.826306
2015-03-20T19:43:31
2015-03-20T19:43:31
32,769,195
0
0
null
null
null
null
UTF-8
Java
false
false
4,878
java
package recognizer; /** * Created by yingshuo chen on 2015/3/16. */ import model.*; import graphic.*; import utils.MathUtils; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; public class FeatureExtractor { public final int order = 25; public List<ArrayList<MyPoint>> lines; public double width, height; public double minX, minY; public int noOfLines; public FeatureExtractor(MyRect rect) { lines = new ArrayList<ArrayList<MyPoint>>(); noOfLines = 0; for (MyLine line : rect.lineList) { if (line.pointList != null) { noOfLines++; ArrayList<MyPoint> newLine = new ArrayList<MyPoint>(); newLine.add(new MyPoint(line.pointList.get(0))); for (int i = 1; i < line.pointList.size(); i++) { if (!line.pointList.get(i).equals(line.pointList.get(i - 1))) { newLine.add(new MyPoint(line.pointList.get(i))); } } lines.add(newLine); } } this.width = (double) rect.width; this.height = (double) rect.height; this.minX = (double) rect.lx; this.minY = (double) rect.ly; } public MyFeature Extract() { MyFeature mf = new MyFeature(noOfLines); Interpolate(mf); Reshape(mf); return mf; } public MySymbol PointToUnit(MyFeature mf) { List<MyStroke> strokes = new ArrayList<MyStroke>(); for(int i = 0; i < noOfLines; i++) { List<MyUnit> units = new ArrayList<MyUnit>(); for(int j = 0; j < order - 1; j++) { MyPoint p = mf.feature.get(i).get(j); MyPoint q = mf.feature.get(i).get(j+1); units.add(new MyUnit(MathUtils.getAngle(p,q),MathUtils.getDistance(p,q))); } strokes.add(new MyStroke(mf.feature.get(i).get(0).x,mf.feature.get(i).get(0).y,units)); } MySymbol ms = new MySymbol(strokes); return ms; } private void Interpolate(MyFeature mf) { double minX = 32768, minY = 32768, maxX = 0, maxY = 0; for(int i = 0; i < noOfLines; i ++) { double total = 0; ArrayList<MyPoint> line = lines.get(i); int length = line.size(); LinkedList<Double> distance = new LinkedList<Double>(); for(int j = 0; j < length - 1; j++) { double temp = Math.sqrt(Math.pow(line.get(j).x - line.get(j + 1).x, 2) + Math.pow(line.get(j).y - line.get(j + 1).y, 2)); distance.add(temp); total += temp; } double step = total / (order - 1); double leftDis = step; int k; MyPoint tempP = new MyPoint(line.get(0)); mf.feature.get(i).add(new MyPoint(tempP)); maxX = (tempP.x>maxX?tempP.x:maxX); minX = (tempP.x<minX?tempP.x:minX); maxY = (tempP.y>maxY?tempP.y:maxY); minY = (tempP.y<minY?tempP.y:minY); for(k = 1; !distance.isEmpty();) { double tempDis = distance.getFirst(); if(tempDis >= leftDis) { tempP.x += leftDis/tempDis*(line.get(k).x-tempP.x); tempP.y += leftDis/tempDis*(line.get(k).y-tempP.y); mf.feature.get(i).add(new MyPoint(tempP)); distance.set(0,tempDis - leftDis); leftDis = step; maxX = (tempP.x>maxX?tempP.x:maxX); minX = (tempP.x<minX?tempP.x:minX); maxY = (tempP.y>maxY?tempP.y:maxY); minY = (tempP.y<minY?tempP.y:minY); } else { distance.removeFirst(); leftDis -= tempDis; tempP = new MyPoint(line.get(k)); k ++; } } if(mf.feature.get(i).size()<order) { mf.feature.get(i).add(new MyPoint(line.get(line.size()-1))); } } this.width = maxX - minX; this.height = maxY - minY; this.minX = minX; this.minY = minY; } private void Reshape(MyFeature mf) { double offsetX, offsetY, unit; if(width >= height) { unit = width; offsetX = 0; offsetY = (1 - height/width)/2; } else { unit = height; offsetX = (1 - width/height)/2; offsetY = 0; } for(int i = 0; i < noOfLines; i++) { for(MyPoint mp : mf.feature.get(i)) { mp.x = (mp.x - minX)/unit + offsetX; mp.y = (mp.y - minY)/unit + offsetY; } } } }
81559ebc2f06176cbe9c941958af708f2bf4b8d6
db7df952b12886f6ec8cdc550dbfdc9612f1df53
/src/main/java/com/lucasbarroso/ChallengeJava/ChallengeJavaApplication.java
f44b45a871a4d0013278bbf6ce86d0723699108c
[]
no_license
lbarroso92/pre-aceleraci-n-tech---Lucas-Barroso
b1caa09c3f67b5ebbd2ba384f747a8dc6e857ced
fe617241c85a089eb9a6f3c5a88b8bf1f8cba74a
refs/heads/main
2023-07-26T14:06:55.750071
2021-09-05T22:05:57
2021-09-05T22:05:57
403,431,195
0
0
null
null
null
null
UTF-8
Java
false
false
337
java
package com.lucasbarroso.ChallengeJava; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ChallengeJavaApplication { public static void main(String[] args) { SpringApplication.run(ChallengeJavaApplication.class, args); } }
e3b7e693632e465237d41a2dbf21d4bc785b9ace
1272a6547cca833a75e6613c0888cb284355fb7b
/src/com/example/sns/AndroidUploade2.java
480131ba2eeb0124af6c8e4d119e9ca10fd728e4
[]
no_license
NebulousK/somensomeApp
60ae3683df8b687b9227905efc4d3b593d4a9f4d
fefe4134beb5f047f8cb0c84cea0ba7c01dc4b91
refs/heads/master
2021-01-02T22:17:57.083601
2014-08-03T11:28:30
2014-08-03T11:28:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,132
java
package com.example.sns; import java.io.*; import java.net.*; import android.util.Log; public class AndroidUploade2{ static String serviceDomain = "http://192.168.10.31/homepage"; static String postUrl = serviceDomain + "/android/android_member_join.jsp"; // static String str = URLDecoder.decode(postUrl , "utf-8"); static String CRLF = "\r\n"; static String twoHyphens = "--"; static String boundary = "*****b*o*u*n*d*a*r*y*****"; private String pictureFileName = null; private String id = null; private String password = null; private String name = null; private String check_password = null; private String email1 = null; private String email2 = null; private String tel = null; private String tel2 = null; private String tel3 = null; private String birthday = null; private String age = null; private String sex = null; private String num1=null; private String num2=null; private String addr=null; private DataOutputStream dataStream = null; enum ReturnCode { noPicture, unknown, http201, http400, http401, http403, http404, http500}; private String TAG = "멀티파트 테스트"; public AndroidUploade2(String id, String password, String name, String check_password, String email1, String email2, String tel,String tel2,String tel3, String birthday, String age, String sex, String num1, String num2, String addr){ this.id = id; this.password = password; this.name = name; this.check_password=check_password; this.email1=email1; this.email2=email2; this.tel=tel; this.tel2=tel2; this.tel3=tel3; this.birthday=birthday; this.age=age; this.sex=sex; this.num1=num1; this.num2=num2; this.addr=addr; Log.i("AndroidUploader 생성자: ", id+ ","+password+","+name +"," +check_password+", "+email1+ ","+email2+ ","+tel+ ","+tel2+ ","+tel3+ "," +birthday+ ","+age + ","+sex+", "+num1+", "+num2+", "+addr); } public static void setServiceDomain(String domainName) { serviceDomain = domainName; } public static String getServiceDomain() { return serviceDomain; } public ReturnCode uploadPicture(String pictureFileName) { this.pictureFileName = pictureFileName; File uploadFile = new File(pictureFileName); if (uploadFile.exists()){ Log.i("pictureFileName", pictureFileName); Log.i("uploadFile", uploadFile.toString()); try { FileInputStream fileInputStream = new FileInputStream(uploadFile); URL connectURL = new URL(postUrl); HttpURLConnection conn = (HttpURLConnection)connectURL.openConnection(); Log.i("uploadFile.exists", "uploadFile.exists"); conn.setDoInput(true); conn.setDoOutput(true); conn.setUseCaches(false); conn.setRequestMethod("POST"); //conn.setRequestProperty("User-Agent", "myFileUploader"); conn.setRequestProperty("Connection","Keep-Alive"); conn.setRequestProperty("Content-Type","multipart/form-data;boundary="+boundary); conn.setRequestProperty("accept-language","ko"); conn.connect(); new Thread(){ }.start(); dataStream = new DataOutputStream(conn.getOutputStream()); writeFormField("login", id); writeFormField("password", password); writeFormField("name", name ); writeFormField("check_password", check_password); writeFormField("email1", email1); writeFormField("email2", email2); writeFormField("tel", tel); writeFormField("tel2", tel2); writeFormField("tel3", tel3); writeFormField("birthday", birthday); writeFormField("age",age); writeFormField("sex", sex); writeFormField("num1", num1); writeFormField("num2", num2); writeFormField("addr", addr); writeFileField("photo1", pictureFileName, "image/jpg", fileInputStream); // final closing boundary line dataStream.writeBytes(twoHyphens + boundary + twoHyphens + CRLF); fileInputStream.close(); dataStream.flush(); dataStream.close(); dataStream = null; Log.d("업로드 테스트", "***********전송완료***********"); String response = getResponse(conn); int responseCode = conn.getResponseCode(); if (response.contains("uploaded successfully")) return ReturnCode.http201; else // for now assume bad name/password return ReturnCode.http401; } catch (MalformedURLException mue) { Log.e(TAG, "errorM: " + mue.getMessage(), mue); return ReturnCode.http400; } catch (IOException ioe) { Log.e(TAG, "errori: " + ioe.getMessage(), ioe); return ReturnCode.http500; } catch (Exception e) { Log.e(TAG, "errorE: " + e.getMessage(), e); return ReturnCode.unknown; } } else { return ReturnCode.noPicture; } } private String getResponse(HttpURLConnection conn) { try { DataInputStream dis = new DataInputStream(conn.getInputStream()); byte [] data = new byte[1024]; int len = dis.read(data, 0, 1024); dis.close(); int responseCode = conn.getResponseCode(); if (len > 0) return new String(data, 0, len); else return ""; } catch(Exception e) { //System.out.println("AndroidUploader: "+e); Log.e(TAG, "AndroidUploader: "+e); return ""; } } /** * this mode of reading response no good either */ private String getResponseOrig(HttpURLConnection conn) { InputStream is = null; try { is = conn.getInputStream(); // scoop up the reply from the server int ch; StringBuffer sb = new StringBuffer(); while( ( ch = is.read() ) != -1 ) { sb.append( (char)ch ); } return sb.toString(); // TODO Auto-generated method stub } catch(Exception e) { //System.out.println("GeoPictureUploader: biffed it getting HTTPResponse"); Log.e(TAG, "AndroidUploader: "+e); } finally { try { if (is != null) is.close(); } catch (Exception e) {} } return ""; } /** * write one form field to dataSream * @param fieldName * @param fieldValue */ private void writeFormField(String fieldName, String fieldValue) { try { dataStream.writeBytes(twoHyphens + boundary + CRLF); dataStream.writeBytes("Content-Disposition: form-data; name=\"" + fieldName + "\"" + CRLF); dataStream.writeBytes(CRLF); dataStream.writeUTF(fieldValue); dataStream.writeBytes(CRLF); Log.i("writeFormField", fieldName+fieldValue); } catch(Exception e) { //System.out.println("AndroidUploader.writeFormField: got: " + e.getMessage()); Log.e(TAG, "AndroidUploader.writeFormField: " + e.getMessage()); } } /** * write one file field to dataSream * @param fieldName - name of file field * @param fieldValue - file name * @param type - mime type * @param fileInputStream - stream of bytes that get sent up */ private void writeFileField( String fieldName, String fieldValue, String type, FileInputStream fis) { try { // opening boundary line dataStream.writeBytes(twoHyphens + boundary + CRLF); dataStream.writeBytes("Content-Disposition: form-data; name=\"" + fieldName + "\";filename=\"" + fieldValue + "\"" + CRLF); dataStream.writeBytes("Content-Type: " + type + CRLF); dataStream.writeBytes(CRLF); // create a buffer of maximum size int bytesAvailable = fis.available(); int maxBufferSize = 1024; int bufferSize = Math.min(bytesAvailable, maxBufferSize); byte[] buffer = new byte[bufferSize]; // read file and write it into form... int bytesRead = fis.read(buffer, 0, bufferSize); while (bytesRead > 0) { dataStream.write(buffer, 0, bufferSize); bytesAvailable = fis.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); bytesRead = fis.read(buffer, 0, bufferSize); } dataStream.writeBytes(CRLF); } catch(Exception e) { Log.e(TAG, "AndroidUploader.writeFormField: got: " + e.getMessage()); } } public static void main(String[] args) { //실행 안됨 if (args.length >= 0) { Log.i("main","main"); String picName = args[0]; } } }
e96ba82a08f1a69fcaa7c30d26f7fc8fb0422932
3597659b95c5adcafec07dee7ac84d0433dcca89
/app/src/main/java/com/example/nowmeal/shipper/ui/gallery/GalleryViewModel.java
824e518276f567f65791d680744b9b1b7684f452
[]
no_license
NithyaYamsinghe/Nowmeal
a04c825a480667c339316a3b7f10bf8b65615956
76f964bfa2230acc841b40a7c00bdec5b130bafa
refs/heads/master
2022-04-18T03:01:11.446538
2020-04-22T10:01:13
2020-04-22T10:01:13
256,160,160
0
0
null
null
null
null
UTF-8
Java
false
false
462
java
package com.example.nowmeal.shipper.ui.gallery; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.ViewModel; public class GalleryViewModel extends ViewModel { private MutableLiveData<String> mText; public GalleryViewModel() { mText = new MutableLiveData<>(); mText.setValue("This is gallery fragment"); } public LiveData<String> getText() { return mText; } }
5ff3492ef4c10d0972b1656093bafaa73279fce8
52ee535dfb1d1ab371f4d20b5f69e9fd5833d089
/spring-demo-aop-pointcut-declarations/src/com/luv2code/aopdemo/aspect/MyDemoLoggingAspect.java
a83c3b9b6cdf21c3c18635786d9d8f9ae2cb8ebf
[]
no_license
AbhilashZemoso/SpringLDP
e59e8b2060bf0c60c2c3b1580dcf3830033165e5
e53035bc99f2b2bda632790c3f1c0e552a4c4794
refs/heads/master
2023-01-30T16:35:40.178030
2020-12-08T01:58:56
2020-12-08T01:58:56
308,522,486
0
0
null
null
null
null
UTF-8
Java
false
false
638
java
package com.luv2code.aopdemo.aspect; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import org.springframework.stereotype.Component; @Aspect @Component public class MyDemoLoggingAspect { @Pointcut("execution(* com.luv2code.aopdemo.dao.*.*(..))") public void forDaoPackage() {} @Before("forDaoPackage()") public void beforeAddAccountAdvice() { System.out.println("\n======>>> Executing before method"); } @Before("forDaoPackage()") public void performApiAnalytics() { System.out.println("\n======>>> Executing API method"); } }
7a7c8dc8610bd33a5f2fbb2a6f8fe3a2ab5084ce
28c40b1cb95b171a78f7f702eb6fb76ea91821de
/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iotdata/model/transform/UpdateThingShadowRequestMarshaller.java
dda2c08e4c585ccd0a53fdec62ab81e79bf6b37c
[ "Apache-2.0", "JSON" ]
permissive
picantegamer/aws-sdk-java
e9249bc9fad712f475c15df74068b306d773df10
206557596ee15a8aa470ad2f33a06d248042d5d0
refs/heads/master
2021-01-14T13:44:03.807035
2016-01-08T22:23:36
2016-01-08T22:23:36
49,227,858
0
0
null
2016-01-07T20:07:24
2016-01-07T20:07:23
null
UTF-8
Java
false
false
2,878
java
/* * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. 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. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazonaws.services.iotdata.model.transform; import static com.amazonaws.util.StringUtils.UTF8; import static com.amazonaws.util.StringUtils.COMMA_SEPARATOR; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.OutputStreamWriter; import java.io.StringWriter; import java.io.Writer; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.List; import java.util.regex.Pattern; import com.amazonaws.AmazonClientException; import com.amazonaws.Request; import com.amazonaws.DefaultRequest; import com.amazonaws.http.HttpMethodName; import com.amazonaws.services.iotdata.model.*; import com.amazonaws.transform.Marshaller; import com.amazonaws.util.BinaryUtils; import com.amazonaws.util.StringUtils; import com.amazonaws.util.StringInputStream; import com.amazonaws.util.json.*; /** * UpdateThingShadowRequest Marshaller */ public class UpdateThingShadowRequestMarshaller implements Marshaller<Request<UpdateThingShadowRequest>, UpdateThingShadowRequest> { private static final String DEFAULT_CONTENT_TYPE = ""; public Request<UpdateThingShadowRequest> marshall( UpdateThingShadowRequest updateThingShadowRequest) { if (updateThingShadowRequest == null) { throw new AmazonClientException( "Invalid argument passed to marshall(...)"); } Request<UpdateThingShadowRequest> request = new DefaultRequest<UpdateThingShadowRequest>( updateThingShadowRequest, "AWSIotData"); request.setHttpMethod(HttpMethodName.POST); String uriResourcePath = "/things/{thingName}/shadow"; uriResourcePath = uriResourcePath.replace( "{thingName}", (updateThingShadowRequest.getThingName() == null) ? "" : StringUtils.fromString(updateThingShadowRequest .getThingName())); request.setResourcePath(uriResourcePath); request.setContent(BinaryUtils.toStream(updateThingShadowRequest .getPayload())); if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", DEFAULT_CONTENT_TYPE); } return request; } }
a0abd5264d405282fb74ee42a787014b658be929
f8dded68b9125a95e64745b3838c664b11ce7bbe
/cdm/src/main/java/ucar/nc2/iosp/adde/AddeVariable.java
186348b8778a94f22c299359e8d27f1a27ad763e
[ "NetCDF" ]
permissive
melissalinkert/netcdf
8d01f27f377b0b6639ac47bfc891e1b92e5b3bd1
18482c15fce43a4b378dacdc9177ec600280c903
refs/heads/master
2016-09-09T19:25:59.885325
2012-02-07T01:44:35
2012-02-07T01:44:35
3,373,307
1
4
null
null
null
null
UTF-8
Java
false
false
2,668
java
/* * Copyright 1998-2009 University Corporation for Atmospheric Research/Unidata * * Portions of this software were developed by the Unidata Program at the * University Corporation for Atmospheric Research. * * Access and use of this software shall impose the following obligations * and understandings on the user. The user is granted the right, without * any fee or cost, to use, copy, modify, alter, enhance and distribute * this software, and any derivative works thereof, and its supporting * documentation for any purpose whatsoever, provided that this entire * notice appears in all copies of the software, derivative works and * supporting documentation. Further, UCAR requests that the user credit * UCAR/Unidata in any publications that result from the use of this * software or in any product that includes this software. The names UCAR * and/or Unidata, however, may not be used in any advertising or publicity * to endorse or promote any products or commercial entity unless specific * written permission is obtained from UCAR/Unidata. The user also * understands that UCAR/Unidata is not obligated to provide the user with * any support, consulting, training or assistance of any kind with regard * to the use, operation and performance of this software nor to provide * the user with any updates, revisions, new versions or "bug fixes." * * THIS SOFTWARE IS PROVIDED BY UCAR/UNIDATA "AS IS" AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL UCAR/UNIDATA BE LIABLE FOR ANY SPECIAL, * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE. */ package ucar.nc2.iosp.adde; import ucar.nc2.Structure; import ucar.ma2.DataType; import ucar.nc2.dataset.NetcdfDataset; /** * A Variable implemented through an ADDE server. * * * @author caron * @version $Revision: 51 $ $Date: 2006-07-12 17:13:13Z $ */ public class AddeVariable extends ucar.nc2.dataset.VariableDS { private int nparam; public AddeVariable( NetcdfDataset ncfile, Structure parentStructure, String shortName, DataType dataType, String dims, String units, String desc, int nparam) { super(ncfile, null, parentStructure, shortName, dataType, dims, units, desc); this.nparam = nparam; } int getParam() { return nparam; } }
0ce7971855071fd1f1725c03471a584c269761a5
94cb48658040df60a16a5a13da0976ed07c01ceb
/dunwu-tool/dunwu-tool-core/src/test/java/io/github/dunwu/tool/io/FileUtilTest.java
ce3a82d5dde68ebee57ac2aff4c58397b675130e
[ "Apache-2.0" ]
permissive
wtopps/dunwu
569ea2f7aefbebf81efe0057b07b95f7ce00403b
7c94d56808d76b4cf96aa34141ddc7d3b7fe4414
refs/heads/master
2020-12-08T12:58:54.891740
2019-12-20T15:42:30
2019-12-20T15:42:30
232,987,475
1
0
Apache-2.0
2020-01-10T07:08:20
2020-01-10T07:08:19
null
UTF-8
Java
false
false
11,931
java
package io.github.dunwu.tool.io; import io.github.dunwu.tool.io.file.LineSeparator; import io.github.dunwu.tool.lang.Console; import io.github.dunwu.tool.util.CharsetUtil; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import java.io.File; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; /** * {@link FileUtil} 单元测试类 * * @author Looly */ public class FileUtilTest { @Test public void fileTest() { File file = FileUtil.file("d:/aaa", "bbb"); Assertions.assertNotNull(file); // 构建目录中出现非子目录抛出异常 FileUtil.file(file, "../ccc"); FileUtil.file("E:/"); } @Test public void getAbsolutePathTest() { String absolutePath = FileUtil.getAbsolutePath("LICENSE-junit.txt"); Assertions.assertNotNull(absolutePath); String absolutePath2 = FileUtil.getAbsolutePath(absolutePath); Assertions.assertNotNull(absolutePath2); Assertions.assertEquals(absolutePath, absolutePath2); String path = FileUtil.getAbsolutePath("中文.xml"); Assertions.assertTrue(path.contains("中文.xml")); path = FileUtil.getAbsolutePath("d:"); Assertions.assertEquals("d:", path); } @Test @Disabled public void touchTest() { FileUtil.touch("d:\\tea\\a.jpg"); } @Test @Disabled public void delTest() { // 删除一个不存在的文件,应返回true boolean result = FileUtil.del("e:/Hutool_test_3434543533409843.txt"); Assertions.assertTrue(result); } @Test @Disabled public void delTest2() { // 删除一个不存在的文件,应返回true boolean result = FileUtil.del(Paths.get("e:/Hutool_test_3434543533409843.txt")); Assertions.assertTrue(result); } @Test @Disabled public void renameTest() { FileUtil.rename(FileUtil.file("hutool.jpg"), "b.png", false, false); } @Test public void copyTest() { File srcFile = FileUtil.file("hutool.jpg"); File destFile = FileUtil.file("hutool.copy.jpg"); FileUtil.copy(srcFile, destFile, true); Assertions.assertTrue(destFile.exists()); Assertions.assertEquals(srcFile.length(), destFile.length()); } @Test @Disabled public void copyFilesFromDir() { File srcFile = FileUtil.file("D:\\驱动"); File destFile = FileUtil.file("d:\\驱动备份"); FileUtil.copyFilesFromDir(srcFile, destFile, true); } @Test public void equlasTest() { // 源文件和目标文件都不存在 File srcFile = FileUtil.file("d:/hutool.jpg"); File destFile = FileUtil.file("d:/hutool.jpg"); boolean equals = FileUtil.equals(srcFile, destFile); Assertions.assertTrue(equals); // 源文件存在,目标文件不存在 File srcFile1 = FileUtil.file("hutool.jpg"); File destFile1 = FileUtil.file("d:/hutool.jpg"); boolean notEquals = FileUtil.equals(srcFile1, destFile1); Assertions.assertFalse(notEquals); } @Test @Disabled public void convertLineSeparatorTest() { FileUtil.convertLineSeparator(FileUtil.file("d:/aaa.txt"), CharsetUtil.CHARSET_UTF_8, LineSeparator.WINDOWS); } @Test public void normalizeTest() { Assertions.assertEquals("/foo/", FileUtil.normalize("/foo//")); Assertions.assertEquals("/foo/", FileUtil.normalize("/foo/./")); Assertions.assertEquals("/bar", FileUtil.normalize("/foo/../bar")); Assertions.assertEquals("/bar/", FileUtil.normalize("/foo/../bar/")); Assertions.assertEquals("/baz", FileUtil.normalize("/foo/../bar/../baz")); Assertions.assertEquals("/", FileUtil.normalize("/../")); Assertions.assertEquals("foo", FileUtil.normalize("foo/bar/..")); Assertions.assertEquals("bar", FileUtil.normalize("foo/../../bar")); Assertions.assertEquals("bar", FileUtil.normalize("foo/../bar")); Assertions.assertEquals("/server/bar", FileUtil.normalize("//server/foo/../bar")); Assertions.assertEquals("/bar", FileUtil.normalize("//server/../bar")); Assertions.assertEquals("C:/bar", FileUtil.normalize("C:\\foo\\..\\bar")); Assertions.assertEquals("C:/bar", FileUtil.normalize("C:\\..\\bar")); Assertions.assertEquals("bar", FileUtil.normalize("../../bar")); Assertions.assertEquals("C:/bar", FileUtil.normalize("/C:/bar")); Assertions.assertEquals("C:", FileUtil.normalize("C:")); Assertions.assertEquals("\\/192.168.1.1/Share/", FileUtil.normalize("\\\\192.168.1.1\\Share\\")); } @Test public void normalizeHomePathTest() { String home = FileUtil.getUserHomePath().replace('\\', '/'); Assertions.assertEquals(home + "/bar/", FileUtil.normalize("~/foo/../bar/")); } @Test public void normalizeClassPathTest() { Assertions.assertEquals("", FileUtil.normalize("classpath:")); } @Test public void doubleNormalizeTest() { String normalize = FileUtil.normalize("/aa/b:/c"); String normalize2 = FileUtil.normalize(normalize); Assertions.assertEquals("/aa/b:/c", normalize); Assertions.assertEquals(normalize, normalize2); } @Test public void subPathTest() { Path path = Paths.get("/aaa/bbb/ccc/ddd/eee/fff"); Path subPath = FileUtil.subPath(path, 5, 4); Assertions.assertEquals("eee", subPath.toString()); subPath = FileUtil.subPath(path, 0, 1); Assertions.assertEquals("aaa", subPath.toString()); subPath = FileUtil.subPath(path, 1, 0); Assertions.assertEquals("aaa", subPath.toString()); // 负数 subPath = FileUtil.subPath(path, -1, 0); Assertions.assertEquals("aaa/bbb/ccc/ddd/eee", subPath.toString().replace('\\', '/')); subPath = FileUtil.subPath(path, -1, Integer.MAX_VALUE); Assertions.assertEquals("fff", subPath.toString()); subPath = FileUtil.subPath(path, -1, path.getNameCount()); Assertions.assertEquals("fff", subPath.toString()); subPath = FileUtil.subPath(path, -2, -3); Assertions.assertEquals("ddd", subPath.toString()); } @Test public void subPathTest2() { String subPath = FileUtil.subPath("d:/aaa/bbb/", "d:/aaa/bbb/ccc/"); Assertions.assertEquals("ccc/", subPath); subPath = FileUtil.subPath("d:/aaa/bbb", "d:/aaa/bbb/ccc/"); Assertions.assertEquals("ccc/", subPath); subPath = FileUtil.subPath("d:/aaa/bbb", "d:/aaa/bbb/ccc/test.txt"); Assertions.assertEquals("ccc/test.txt", subPath); subPath = FileUtil.subPath("d:/aaa/bbb/", "d:/aaa/bbb/ccc"); Assertions.assertEquals("ccc", subPath); subPath = FileUtil.subPath("d:/aaa/bbb", "d:/aaa/bbb/ccc"); Assertions.assertEquals("ccc", subPath); subPath = FileUtil.subPath("d:/aaa/bbb", "d:/aaa/bbb"); Assertions.assertEquals("", subPath); subPath = FileUtil.subPath("d:/aaa/bbb/", "d:/aaa/bbb"); Assertions.assertEquals("", subPath); } @Test public void getPathEle() { Path path = Paths.get("/aaa/bbb/ccc/ddd/eee/fff"); Path ele = FileUtil.getPathEle(path, -1); Assertions.assertEquals("fff", ele.toString()); ele = FileUtil.getPathEle(path, 0); Assertions.assertEquals("aaa", ele.toString()); ele = FileUtil.getPathEle(path, -5); Assertions.assertEquals("bbb", ele.toString()); ele = FileUtil.getPathEle(path, -6); Assertions.assertEquals("aaa", ele.toString()); } @Test public void listFileNamesTest() { List<String> names = FileUtil.listFileNames("classpath:"); Assertions.assertTrue(names.contains("hutool.jpg")); names = FileUtil.listFileNames(""); Assertions.assertTrue(names.contains("hutool.jpg")); names = FileUtil.listFileNames("."); Assertions.assertTrue(names.contains("hutool.jpg")); } @Test @Disabled public void listFileNamesTest2() { List<String> names = FileUtil.listFileNames( "D:\\m2_repo\\commons-cli\\commons-cli\\1.0\\commons-cli-1.0.jar!org/apache/commons/cli/"); for (String string : names) { Console.log(string); } } @Test @Disabled public void loopFilesTest() { List<File> files = FileUtil.loopFiles("d:/"); for (File file : files) { Console.log(file.getPath()); } } @Test @Disabled public void loopFilesWithDepthTest() { List<File> files = FileUtil.loopFiles(FileUtil.file("d:/m2_repo"), 2, null); for (File file : files) { Console.log(file.getPath()); } } @Test public void getParentTest() { // 只在Windows下测试 if (FileUtil.isWindows()) { File parent = FileUtil.getParent(FileUtil.file("d:/aaa/bbb/cc/ddd"), 0); Assertions.assertEquals(FileUtil.file("d:\\aaa\\bbb\\cc\\ddd"), parent); parent = FileUtil.getParent(FileUtil.file("d:/aaa/bbb/cc/ddd"), 1); Assertions.assertEquals(FileUtil.file("d:\\aaa\\bbb\\cc"), parent); parent = FileUtil.getParent(FileUtil.file("d:/aaa/bbb/cc/ddd"), 2); Assertions.assertEquals(FileUtil.file("d:\\aaa\\bbb"), parent); parent = FileUtil.getParent(FileUtil.file("d:/aaa/bbb/cc/ddd"), 4); Assertions.assertEquals(FileUtil.file("d:\\"), parent); parent = FileUtil.getParent(FileUtil.file("d:/aaa/bbb/cc/ddd"), 5); Assertions.assertNull(parent); parent = FileUtil.getParent(FileUtil.file("d:/aaa/bbb/cc/ddd"), 10); Assertions.assertNull(parent); } } @Test public void lastIndexOfSeparatorTest() { String dir = "d:\\aaa\\bbb\\cc\\ddd"; int index = FileUtil.lastIndexOfSeparator(dir); Assertions.assertEquals(13, index); String file = "ddd.jpg"; int index2 = FileUtil.lastIndexOfSeparator(file); Assertions.assertEquals(-1, index2); } @Test public void getNameTest() { String path = "d:\\aaa\\bbb\\cc\\ddd\\"; String name = FileUtil.getName(path); Assertions.assertEquals("ddd", name); path = "d:\\aaa\\bbb\\cc\\ddd.jpg"; name = FileUtil.getName(path); Assertions.assertEquals("ddd.jpg", name); } @Test public void mainNameTest() { String path = "d:\\aaa\\bbb\\cc\\ddd\\"; String mainName = FileUtil.mainName(path); Assertions.assertEquals("ddd", mainName); path = "d:\\aaa\\bbb\\cc\\ddd"; mainName = FileUtil.mainName(path); Assertions.assertEquals("ddd", mainName); path = "d:\\aaa\\bbb\\cc\\ddd.jpg"; mainName = FileUtil.mainName(path); Assertions.assertEquals("ddd", mainName); } @Test public void extNameTest() { String path = "d:\\aaa\\bbb\\cc\\ddd\\"; String mainName = FileUtil.extName(path); Assertions.assertEquals("", mainName); path = "d:\\aaa\\bbb\\cc\\ddd"; mainName = FileUtil.extName(path); Assertions.assertEquals("", mainName); path = "d:\\aaa\\bbb\\cc\\ddd.jpg"; mainName = FileUtil.extName(path); Assertions.assertEquals("jpg", mainName); } @Test public void getWebRootTest() { File webRoot = FileUtil.getWebRoot(); Assertions.assertNotNull(webRoot); Assertions.assertEquals("hutool-core", webRoot.getName()); } @Test public void getMimeTypeTest() { String mimeType = FileUtil.getMimeType("test2Write.jpg"); Assertions.assertEquals("image/jpeg", mimeType); } }
e697d58efbb39713b0019b0336a144bb8bc1b268
22211f1267ad53d70a0c5da07727ecf20ed86513
/BT Mark 3/app/src/main/java/com/example/biblio_tech_mark_3/Type.java
d430e18635c949e6a93dc9500658f8ede64613c1
[]
no_license
knight-captain/Librarians
297bdb484a22bbfefea227a2e0afeb609a0fe74f
ccc56177c0c30147dc61236cfb41350a25e91317
refs/heads/master
2023-07-04T17:49:21.896338
2021-08-12T01:30:37
2021-08-12T01:30:37
365,545,816
0
1
null
2021-08-12T01:30:37
2021-05-08T15:16:32
Java
UTF-8
Java
false
false
133
java
package com.example.biblio_tech_mark_3; public class Type { // A stub class used in Author and Book public String key; }
a73c1ac44c0636cdcf151736542148048a64bee2
f4fa110ad7edcd6bdea9aa4d33d672d3cc9520b1
/src/practice/designpattern/behavioral/memento/OrderListCaretaker.java
b4a28559204eaa7a6c56a93d5f87e6d3f1f5482c
[]
no_license
bluesky020990/learning-java
b56cae9fdfd04235267cf8f5140b72b74dd94383
956f0a6af61669ee0bd4c6e9ce7522c2b54b40d9
refs/heads/master
2021-01-25T13:41:54.100331
2020-02-24T16:02:58
2020-02-24T16:02:58
123,607,051
0
0
null
null
null
null
UTF-8
Java
false
false
296
java
package practice.designpattern.behavioral.memento; public class OrderListCaretaker { private Object obj; public void save (OrderList orderList){ this.obj = orderList.save(); } public void undo(OrderList orderList){ orderList.undoToLastSave(this.obj); } }
ffc2a9ff5c600ae168c5cb737cf3864bafe9b0a7
642ad042befd3760dc45316774d529dbae1a743b
/src/main/java/com/nullbugs/easy/Exam1009.java
d8a81440e4a481020d2c78acfeebda57ac0fea49
[]
no_license
StephenChen9527/LeetCoode
7b2e3b96aa535b7e42cae685e92e3d40910b35c1
76df02abf5ecb17c4ceda520ff209149c77d514b
refs/heads/master
2021-06-26T11:58:23.043239
2021-04-08T06:57:51
2021-04-08T06:57:51
224,141,150
0
0
null
null
null
null
UTF-8
Java
false
false
451
java
package com.nullbugs.easy; public class Exam1009 { public static void main(String[] args) { int x=10; //System.out.println(Integer.toBinaryString(~x)); System.out.println(bitwiseComplement(x)); } public static int bitwiseComplement(int N) { String s = Integer.toBinaryString(~N); String t = Integer.toBinaryString(N); return Integer.valueOf(s.substring(s.length()-t.length()), 2); } }
5f501408256d03c9c10d527022f1507deeea3380
7564413fae5403220022b5ec978f19522f1179ea
/src/beans/ColaPrioridad.java
ed4855e6217315b41b38387f36a4200026a6bb32
[]
no_license
elJuanjoRamos/MechanicsWorkshop
89e704d0aff05abc0a480182fc15a89d1321db2c
76887eed4320c8cc79eb96405ffb6f08b1ce6328
refs/heads/master
2022-01-30T03:20:35.008035
2019-05-18T02:10:49
2019-05-18T02:10:49
181,045,664
0
0
null
null
null
null
UTF-8
Java
false
false
3,211
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 beans; /** * * @author Juan José Ramos */ public class ColaPrioridad { public class Nodo { int valor; int prioridad; Nodo siguiente; public void Nodo(){ this.valor = 0; this.prioridad = 0; this.siguiente = null; } // Métodos get y set para los atributos. } private Nodo inicio; // Variable para registrar el tamaño de la lista. private int longitud; public void ColaPrioridad(){ inicio = null; longitud = 0; } public boolean esVacia(){ return inicio == null; } public void inserta(int elemento, int prioridad) { System.out.println("elememnto" + elemento); Nodo p = new Nodo(), q; boolean encontrado = false; p= inicio; while ((p.siguiente != null) && (!encontrado)) { if (p.siguiente.prioridad == prioridad ) encontrado = true; else p = p.siguiente; q = p.siguiente; p.siguiente = new Nodo(); p = p.siguiente; p.valor = (elemento); p.prioridad = (prioridad); p.siguiente = (q); } } public void show(){ Nodo aux = inicio; while(aux != null){ System.out.println(""); System.out.println("el elemento es " + aux.valor + " la prioridad " + aux.prioridad ); aux = aux.siguiente; } } // private Celda cola; // // public ColaPrioridad() { // cola = new Celda(); // cola.sig = null; // } // // public boolean vacia() { // return (cola == null); // } // // public int primero_prioridad() throws Exception { // if (vacia()) { // throw new NullPointerException(); // } // return cola.prioridad; // } // // // public void inserta(int elemento, int prioridad) { // // Celda p, q; // boolean encontrado = false; // p = cola; // while ((p.sig != null) && (!encontrado)) { // if (p.sig.prioridad == prioridad ) // encontrado = true; // else p = p.sig; // } // q = p.sig; // p.sig = new Celda(); // p = p.sig; // p.elemento = elemento; // p.prioridad = prioridad; // p.sig = q; // } // // public void suprime() { // if (vacia()) { // throw new NullPointerException(); // } // cola = cola.sig; // } // // // public void show(){ // Celda aux = cola; // // while(aux != null){ // System.out.println(""); // System.out.println("el elemento es " + aux.elemento + " la prioridad " + aux.prioridad ); // aux = aux.sig; // } // // Celda temp = aux; // // // // // } }
dfc2d1a3c5793345984f1a825d67aa401ff95ee5
a53295a739809a36c72ecc848c941006a580e4a4
/Karibu-consumer/src/main/java/dk/au/cs/karibu/testdoubles/NullStatisticHandler.java
48d037a39f36abde29fa7d7ebc84f4e6b47a6819
[ "Apache-2.0" ]
permissive
ecosense-au-dk/Karibu-core
2bf085c4ab7983e40ef8e68b9dfca1476091c234
c1b31637a7c818a808678e2b6e9124c5cc6a41f5
refs/heads/master
2021-01-10T20:13:53.225175
2018-11-22T10:53:35
2018-11-22T10:53:35
19,276,705
0
0
null
null
null
null
UTF-8
Java
false
false
1,506
java
/* * Copyright 2013 Henrik Baerbak Christensen, Aarhus University * * 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 dk.au.cs.karibu.testdoubles; import java.util.Date; import dk.au.cs.karibu.backend.StatisticHandler; public class NullStatisticHandler implements StatisticHandler { @Override public void notifyReceive(String producerCode, long countOfBytes) { } @Override public void flushToStorage() { } public Date getEndTimestamp() { return null; } public Date getStartTimestamp() { return null; } public String getMaxChunkProducerCode() { return null; } public long getTotalCountMsg() { return 0; } public long getTotalBytesSent() { return 0; } public long getMaxChunkSize() { return 0; } @Override public String getStatusAsString() { return "NullStatisticsHandler does not provide any real data"; } @Override public String getDaemonIP() { return "NullStatisticsHandler has no IP"; } }
fad79dc01cd6caeeaf8b79a13738bc1e8a6f9853
d352d1f57cfd741efd6559ecd4c5882d2dbd4f26
/vespa-testrunner-components/src/main/java/com/yahoo/vespa/hosted/testrunner/TestRunner.java
fb5dccc551dfc24a90e1ffc43af412c5c0e68779
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
hshukla/vespa
69b154388bda4f374370883f8c50360a3ad55f0c
d618d1442bc1963de08e843ef14c49f12ae7e9d9
refs/heads/master
2020-05-18T09:48:45.357329
2019-04-30T22:17:59
2019-04-30T22:17:59
184,333,759
0
0
Apache-2.0
2019-04-30T21:26:04
2019-04-30T21:26:04
null
UTF-8
Java
false
false
9,316
java
package com.yahoo.vespa.hosted.testrunner; import com.google.inject.Inject; import com.yahoo.vespa.defaults.Defaults; import org.fusesource.jansi.AnsiOutputStream; import org.fusesource.jansi.HtmlAnsiOutputStream; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; import java.io.UncheckedIOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Collection; import java.util.List; import java.util.SortedMap; import java.util.concurrent.ConcurrentSkipListMap; import java.util.function.Function; import java.util.logging.Level; import java.util.logging.LogRecord; import java.util.logging.Logger; import java.util.stream.Collectors; import java.util.stream.Stream; import static com.yahoo.log.LogLevel.ERROR; /** * @author valerijf * @author jvenstad */ public class TestRunner { private static final Logger logger = Logger.getLogger(TestRunner.class.getName()); private static final Level HTML = new Level("html", 1) { }; private static final Path vespaHome = Paths.get(Defaults.getDefaults().vespaHome()); private static final String settingsXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<settings xmlns=\"http://maven.apache.org/SETTINGS/1.0.0\"\n" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" + " xsi:schemaLocation=\"http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd\">\n" + " <mirrors>\n" + " <mirror>\n" + " <id>maven central</id>\n" + " <mirrorOf>*</mirrorOf>\n" + // Use this for everything! " <url>https://repo.maven.apache.org/maven2/</url>\n" + " </mirror>\n" + " </mirrors>\n" + "</settings>"; private final Path artifactsPath; private final Path testPath; private final Path logFile; private final Path configFile; private final Path settingsFile; private final Function<TestProfile, ProcessBuilder> testBuilder; private final SortedMap<Long, LogRecord> log = new ConcurrentSkipListMap<>(); private volatile Status status = Status.NOT_STARTED; @Inject public TestRunner(TestRunnerConfig config) { this(config.artifactsPath(), vespaHome.resolve("tmp/test"), vespaHome.resolve("logs/vespa/maven.log"), vespaHome.resolve("tmp/config.json"), vespaHome.resolve("tmp/settings.xml"), profile -> { // Anything to make this testable! >_< String[] command = new String[]{ "mvn", "test", "--batch-mode", // Run in non-interactive (batch) mode (disables output color) "--show-version", // Display version information WITHOUT stopping build "--settings", // Need to override repository settings in ymaven config >_< vespaHome.resolve("tmp/settings.xml").toString(), // Disable maven download progress indication "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn", "-Dstyle.color=always", // Enable ANSI color codes again "-DfailIfNoTests=" + profile.failIfNoTests(), "-Dvespa.test.config=" + vespaHome.resolve("tmp/config.json"), "-Dvespa.test.credentials.root=" + Defaults.getDefaults().vespaHome() + "/var/vespa/sia", String.format("-DargLine=-Xms%1$dm -Xmx%1$dm", config.surefireMemoryMb()) }; ProcessBuilder builder = new ProcessBuilder(command); builder.environment().merge("MAVEN_OPTS", " -Djansi.force=true", String::concat); builder.directory(vespaHome.resolve("tmp/test").toFile()); builder.redirectErrorStream(true); return builder; }); } TestRunner(Path artifactsPath, Path testPath, Path logFile, Path configFile, Path settingsFile, Function<TestProfile, ProcessBuilder> testBuilder) { this.artifactsPath = artifactsPath; this.testPath = testPath; this.logFile = logFile; this.configFile = configFile; this.settingsFile = settingsFile; this.testBuilder = testBuilder; } public synchronized void test(TestProfile testProfile, byte[] testConfig) { if (status == Status.RUNNING) throw new IllegalArgumentException("Tests are already running; should not receive this request now."); log.clear(); status = Status.RUNNING; new Thread(() -> runTests(testProfile, testConfig)).start(); } public Collection<LogRecord> getLog(long after) { return log.tailMap(after + 1).values(); } public synchronized Status getStatus() { return status; } private void runTests(TestProfile testProfile, byte[] testConfig) { ProcessBuilder builder = testBuilder.apply(testProfile); { LogRecord record = new LogRecord(Level.INFO, String.format("Starting %s. Artifacts directory: %s Config file: %s\nCommand to run: %s", testProfile.name(), artifactsPath, configFile, String.join(" ", builder.command()))); log.put(record.getSequenceNumber(), record); logger.log(record); } boolean success; // The AnsiOutputStream filters out ANSI characters, leaving the file contents pure. try (PrintStream fileStream = new PrintStream(new AnsiOutputStream(new BufferedOutputStream(new FileOutputStream(logFile.toFile())))); ByteArrayOutputStream logBuffer = new ByteArrayOutputStream(); PrintStream logFormatter = new PrintStream(new HtmlAnsiOutputStream(logBuffer))){ writeTestApplicationPom(testProfile); Files.write(configFile, testConfig); Files.write(settingsFile, settingsXml.getBytes()); Process mavenProcess = builder.start(); BufferedReader in = new BufferedReader(new InputStreamReader(mavenProcess.getInputStream())); in.lines().forEach(line -> { fileStream.println(line); logFormatter.print(line); LogRecord record = new LogRecord(HTML, logBuffer.toString()); log.put(record.getSequenceNumber(), record); logBuffer.reset(); }); success = mavenProcess.waitFor() == 0; } catch (Exception exception) { LogRecord record = new LogRecord(ERROR, "Failed to execute maven command: " + String.join(" ", builder.command())); record.setThrown(exception); logger.log(record); log.put(record.getSequenceNumber(), record); try (PrintStream file = new PrintStream(new FileOutputStream(logFile.toFile(), true))) { file.println(record.getMessage()); exception.printStackTrace(file); } catch (IOException ignored) { } status = Status.ERROR; return; } status = success ? Status.SUCCESS : Status.FAILURE; } private void writeTestApplicationPom(TestProfile testProfile) throws IOException { List<Path> files = listFiles(artifactsPath); Path testJar = files.stream().filter(file -> file.toString().endsWith("tests.jar")).findFirst() .orElseThrow(() -> new IllegalStateException("No file ending with 'tests.jar' found under '" + artifactsPath + "'!")); String pomXml = PomXmlGenerator.generatePomXml(testProfile, files, testJar); testPath.toFile().mkdirs(); Files.write(testPath.resolve("pom.xml"), pomXml.getBytes()); } private static List<Path> listFiles(Path directory) { try (Stream<Path> element = Files.walk(directory)) { return element .filter(Files::isRegularFile) .filter(path -> path.toString().endsWith(".jar")) .collect(Collectors.toList()); } catch (IOException e) { throw new UncheckedIOException("Failed to list files under " + directory, e); } } public enum Status { NOT_STARTED, RUNNING, FAILURE, ERROR, SUCCESS } }
148123c72a18528d78ad4537bc6dd68b0715487f
87e76ab10126b558728d5c3521de4ae058552231
/library/src/main/java/com/rejasupotaro/octodroid/models/Comment.java
ece284191c3c0f626eb280b6fa04aa6ed67c8806
[ "MIT" ]
permissive
rmjspaz/octodroid
175db2445690c55801994072dfc28bedbc3b10f1
e4af7cb485bd2335f55633fabcb822e8dee6a52d
refs/heads/master
2023-03-18T11:27:13.967522
2016-05-02T01:04:48
2016-05-02T01:04:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,557
java
package com.rejasupotaro.octodroid.models; import com.google.gson.annotations.SerializedName; import java.util.Date; public class Comment extends Resource { @SerializedName("url") private String url; @SerializedName("html_url") private String htmlUrl; @SerializedName("issue_url") private String issueUrl; @SerializedName("id") private int id; @SerializedName("user") private User user; @SerializedName("position") private int position; @SerializedName("line") private int line; @SerializedName("path") private String path; @SerializedName("commit_id") private String commitId; @SerializedName("created_at") private Date createdAt; @SerializedName("updated_at") private Date updatedAt; @SerializedName("body") private String body; public String getUrl() { return url; } public String getHtmlUrl() { return htmlUrl; } public String getIssueUrl() { return issueUrl; } public int getId() { return id; } public User getUser() { return user; } public int getPosition() { return position; } public int getLine() { return line; } public String getPath() { return path; } public String getCommitId() { return commitId; } public Date getCreatedAt() { return createdAt; } public Date getUpdatedAt() { return updatedAt; } public String getBody() { return body; } }
52568f00cac901cf0958e9e226f4a05d7eda1138
f60d95b220ff42b0dded2d3b56144874a3142fef
/test/Type/TypeTest.java
09c282689e91233bd1cc3a36f7af391c7d251874
[]
no_license
david-knott/moderncompilerinjava
5f943cd7bd7f255ff912577e78afaf2ce19a840b
55b570ae9f48ca7d80cd85a2ebec9048bf2a8b9e
refs/heads/master
2021-06-30T14:21:30.283715
2020-12-08T13:44:48
2020-12-08T13:44:48
201,885,718
0
0
null
2020-05-22T07:34:50
2019-08-12T08:06:36
Java
UTF-8
Java
false
false
20,961
java
package Type; import static org.junit.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.PrintStream; import org.junit.Test; import Absyn.Absyn; import Absyn.PrettyPrinter; import Bind.Binder; import ErrorMsg.ErrorMsg; import Parse.CupParser; import Parse.Parser; import Parse.Program; import Types.TypeChecker; public class TypeTest { @Test public void test_4_31a() { PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Parser parser = new CupParser("1 + \"2\"",errorMsg); Absyn program = parser.parse(); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, false); program.accept(prettyPrinter); assertTrue(errorMsg.anyErrors); } @Test public void test_4_31b() { PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Parser parser = new CupParser("\"1\" + 2",errorMsg); Absyn program = parser.parse(); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, false); program.accept(prettyPrinter); assertTrue(errorMsg.anyErrors); } @Test public void test_4_32() { PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Parser parser = new CupParser("/* error: index variable erroneously assigned to. */ for i := 10 to 1 do i := i - 1", errorMsg); Absyn program = parser.parse(); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, false); program.accept(prettyPrinter); assertTrue(errorMsg.anyErrors); } @Test public void varDec() { PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Parser parser = new CupParser("let var a:string := 1 in end",errorMsg); Absyn program = parser.parse(); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, false); program.accept(prettyPrinter); assertTrue(errorMsg.anyErrors); } @Test public void binopAssignIntToString() { PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Parser parser = new CupParser("let var a:string := 1 + 2 in end",errorMsg); Absyn program = parser.parse(); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, false); program.accept(prettyPrinter); assertTrue(errorMsg.anyErrors); } @Test public void binopAssignIntOk() { PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Parser parser = new CupParser("let var a:int := 1 + 2 in end",errorMsg); Absyn program = parser.parse(); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, false); program.accept(prettyPrinter); assertFalse(errorMsg.anyErrors); } @Test public void binopAssignStringToInt() { PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Parser parser = new CupParser("let var a:int := \"one\" + \"two\" in end",errorMsg); Absyn program = parser.parse(); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, false); program.accept(prettyPrinter); assertTrue(errorMsg.anyErrors); } @Test public void binopAssignStringOk() { PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Parser parser = new CupParser("let var a:string := \"one\" + \"two\" in end",errorMsg); Absyn program = parser.parse(); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, false); program.accept(prettyPrinter); assertFalse(errorMsg.anyErrors); } @Test public void ifThenElseOk() { PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Parser parser = new CupParser("let var r:int := 0 in r := (if (1) then 2 else 3) end",errorMsg); Absyn program = parser.parse(); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, false); program.accept(prettyPrinter); assertFalse(errorMsg.anyErrors); } @Test public void ifThenElseAssignType() { PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Parser parser = new CupParser("let var r:string := \"\" in r := (if (1) then 2 else 3) end",errorMsg); Absyn program = parser.parse(); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, false); program.accept(prettyPrinter); assertTrue(errorMsg.anyErrors); } @Test public void ifThenElseReturnType() { PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Parser parser = new CupParser("let var r:int := 0 in r := (if (1) then 2 else \"string\") end",errorMsg); Absyn program = parser.parse(); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, false); program.accept(prettyPrinter); assertTrue(errorMsg.anyErrors); } @Test public void ifThenElseTestType() { PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Parser parser = new CupParser("let var r:int := 0 in r := (if (\"string\") then 2 else 3) end",errorMsg); Absyn program = parser.parse(); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, false); program.accept(prettyPrinter); assertTrue(errorMsg.anyErrors); } @Test public void sequenceAssign() { PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Parser parser = new CupParser("let var r:int := 0 in r := (1; 2; 3; 4; \"string\") end",errorMsg); Absyn program = parser.parse(); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, false); program.accept(prettyPrinter); assertTrue(errorMsg.anyErrors); } @Test public void sequenceAssignVoid() { PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Parser parser = new CupParser("let var r:int := 0 in r := (1; 2; 3; 4; r := r + 1) end",errorMsg); Absyn program = parser.parse(); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, false); program.accept(prettyPrinter); assertTrue(errorMsg.anyErrors); } @Test public void sequenceAssignOk() { PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Parser parser = new CupParser("let var r:int := 0 in r := (1; 2; 3; 4; 5) end",errorMsg); Absyn program = parser.parse(); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, false); program.accept(prettyPrinter); assertFalse(errorMsg.anyErrors); } @Test public void whileTestType() { PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Parser parser = new CupParser("let var r:int := 0 in while (\"string\") do r := r + 1 end",errorMsg); Absyn program = parser.parse(); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, false); program.accept(prettyPrinter); assertTrue(errorMsg.anyErrors); } @Test public void whileBodyType() { PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Parser parser = new CupParser("let var r:int := 0 in while (1) do r end",errorMsg); Absyn program = parser.parse(); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, false); program.accept(prettyPrinter); assertTrue(errorMsg.anyErrors); } @Test public void whileOk() { PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Parser parser = new CupParser("let var r:int := 0 in while (1) do r := r + 1 end",errorMsg); Absyn program = parser.parse(); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, false); program.accept(prettyPrinter); assertFalse(errorMsg.anyErrors); } @Test public void whileOk2() { PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Parser parser = new CupParser("let in while (1) do () end",errorMsg); Absyn program = parser.parse(); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, false); program.accept(prettyPrinter); assertFalse(errorMsg.anyErrors); } @Test public void functionInvalidArgType() { PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Parser parser = new CupParser("let function a(a:int, b:int) = () in a(1, \"string\") end",errorMsg); Absyn program = parser.parse(); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, false); program.accept(prettyPrinter); assertTrue(errorMsg.anyErrors); } @Test public void functionMissingArgs() { PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Parser parser = new CupParser("let function a(a:int, b:int) = () in a() end",errorMsg); Absyn program = parser.parse(); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, false); program.accept(prettyPrinter); assertTrue(errorMsg.anyErrors); } @Test public void functionExtraArgs() { PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Parser parser = new CupParser("let function a(a:int, b:int) = () in a(1, 2, 3) end",errorMsg); Absyn program = parser.parse(); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, false); program.accept(prettyPrinter); assertTrue(errorMsg.anyErrors); } @Test public void recAssignToInt() { Parser parser = new CupParser("let type rec = { a : int} var r := rec { a = 42} in r := 1 end", new ErrorMsg("", System.out)); Absyn program = parser.parse(); PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, true); program.accept(prettyPrinter); assertTrue(errorMsg.anyErrors); } @Test public void recAssignField() { Parser parser = new CupParser("let type rec = { a : string} var r := rec { a = 42} in r := nil end", new ErrorMsg("", System.out)); Absyn program = parser.parse(); PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, true); program.accept(prettyPrinter); assertTrue(errorMsg.anyErrors); } @Test public void recAssignToNil() { Parser parser = new CupParser("let type rec = { a : int} var r := rec { a = 42} in r := nil end", new ErrorMsg("", System.out)); Absyn program = parser.parse(); PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, true); program.accept(prettyPrinter); assertFalse(errorMsg.anyErrors); } @Test public void arraySizeString() { Parser parser = new CupParser("let type iat = array of int var a:iat := iat[\"\"] of 0 in end", new ErrorMsg("", System.out)); Absyn program = parser.parse(); PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, true); program.accept(prettyPrinter); assertTrue(errorMsg.anyErrors); } @Test public void arrayInitialiserInt() { Parser parser = new CupParser("let type iat = array of string var a:iat := iat[0] of 1 in end", new ErrorMsg("", System.out)); Absyn program = parser.parse(); PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, true); program.accept(prettyPrinter); assertTrue(errorMsg.anyErrors); } @Test public void arrayInitialiserString() { Parser parser = new CupParser("let type iat = array of int var a:iat := iat[0] of \"string\" in end", new ErrorMsg("", System.out)); Absyn program = parser.parse(); PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, true); program.accept(prettyPrinter); assertTrue(errorMsg.anyErrors); } @Test public void arrayAssignToInt() { Parser parser = new CupParser("let type iat = array of int var a:iat := iat[10] of 0 in a := 1 end", new ErrorMsg("", System.out)); Absyn program = parser.parse(); PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, true); program.accept(prettyPrinter); assertTrue(errorMsg.anyErrors); } @Test public void arrayOk() { Parser parser = new CupParser("let type iat = array of int var a:iat := iat[10] of 0 in end", new ErrorMsg("", System.out)); Absyn program = parser.parse(); PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, true); program.accept(prettyPrinter); assertFalse(errorMsg.anyErrors); } @Test public void desugarStringEquality() { Parser parser = new CupParser("\"foo\" = \"bar\"", new ErrorMsg("", System.out)); Absyn program = parser.parse(); PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, true); program.accept(prettyPrinter); assertFalse(errorMsg.anyErrors); } @Test public void desugarStringLess() { Parser parser = new CupParser("\"foo\" < \"bar\"", new ErrorMsg("", System.out)); Absyn program = parser.parse(); PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, true); program.accept(prettyPrinter); assertFalse(errorMsg.anyErrors); } @Test public void desugarFor() { Parser parser = new CupParser("for i := 0 to 10 do print_int(i)", new ErrorMsg("", System.out)); Absyn program = parser.parse(); PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, true); program.accept(prettyPrinter); assertFalse(errorMsg.anyErrors); } @Test public void voidTest() { Parser parser = new CupParser("let var void1 := () var void2 := () var void3 := () in void1 := void2 := void3 := () end", new ErrorMsg("", System.out)); Absyn program = parser.parse(); PrintStream outputStream = System.out; ErrorMsg errorMsg = new ErrorMsg("", outputStream); Binder binder = new Binder(errorMsg); program.accept(binder); program.accept(new TypeChecker(errorMsg)); PrettyPrinter prettyPrinter = new PrettyPrinter(System.out, false, true); program.accept(prettyPrinter); assertFalse(errorMsg.anyErrors); } }
ee95e772f46c7c6c38736caa11a1ff7fa0fac3c0
1f19aec2ecfd756934898cf0ad2758ee18d9eca2
/u-1/u-11/u-11-111/u-11-111-1112/u-11-111-1112-f6708.java
91c966e31a110a0280196ed03de414512826acd7
[]
no_license
apertureatf/perftest
f6c6e69efad59265197f43af5072aa7af8393a34
584257a0c1ada22e5486052c11395858a87b20d5
refs/heads/master
2020-06-07T17:52:51.172890
2019-06-21T18:53:01
2019-06-21T18:53:01
193,039,805
0
0
null
null
null
null
UTF-8
Java
false
false
106
java
mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117 7054073107330
bf7dfd6f67791155fda5b80e08dad76075a8bd88
fcd682557509bf32ae29fd34106886af80c0dd8b
/Assignment 2/src/ir/assignments/three/Frontier.java
f962644b39c7609bab7bbbbeff44abe58ad4b5da
[]
no_license
LindaFe/inf141Crawler
b821b3ca4076bf4fd2957d2637c94dc4247f6a03
ab7a88b0e28675e3fa9e7518b31ef1e8d95b65b0
refs/heads/master
2020-12-24T14:35:32.874802
2016-02-05T05:13:20
2016-02-05T05:13:20
50,479,827
0
0
null
2016-01-27T03:47:03
2016-01-27T03:47:03
null
UTF-8
Java
false
false
5,864
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 src.ir.assignments.three; import java.util.List; //import org.slf4j.Logger; // org.slf4j.LoggerFactory; import com.sleepycat.je.DatabaseException; import com.sleepycat.je.Environment; /** * @author Yasser Ganjisaffar */ public class Frontier extends Configurable { //protected static final Logger logger = LoggerFactory.getLogger(Frontier.class); private static final String DATABASE_NAME = "PendingURLsDB"; private static final int IN_PROCESS_RESCHEDULE_BATCH_SIZE = 100; protected WorkQueues workQueues; protected InProcessPagesDB inProcessPages; protected final Object mutex = new Object(); protected final Object waitingList = new Object(); protected boolean isFinished = false; protected long scheduledPages; protected Counters counters; public Frontier(Environment env, CrawlConfig config) { super(config); this.counters = new Counters(env, config); try { workQueues = new WorkQueues(env, DATABASE_NAME, config.isResumableCrawling()); if (config.isResumableCrawling()) { scheduledPages = counters.getValue(Counters.ReservedCounterNames.SCHEDULED_PAGES); inProcessPages = new InProcessPagesDB(env); long numPreviouslyInProcessPages = inProcessPages.getLength(); if (numPreviouslyInProcessPages > 0) { //logger.info("Rescheduling {} URLs from previous crawl.", numPreviouslyInProcessPages); scheduledPages -= numPreviouslyInProcessPages; List<WebURL> urls = inProcessPages.get(IN_PROCESS_RESCHEDULE_BATCH_SIZE); while (!urls.isEmpty()) { scheduleAll(urls); inProcessPages.delete(urls.size()); urls = inProcessPages.get(IN_PROCESS_RESCHEDULE_BATCH_SIZE); } } } else { inProcessPages = null; scheduledPages = 0; } } catch (DatabaseException e) { //logger.error("Error while initializing the Frontier", e); workQueues = null; } } public void scheduleAll(List<WebURL> urls) { int maxPagesToFetch = config.getMaxPagesToFetch(); synchronized (mutex) { int newScheduledPage = 0; for (WebURL url : urls) { if ((maxPagesToFetch > 0) && ((scheduledPages + newScheduledPage) >= maxPagesToFetch)) { break; } try { workQueues.put(url); newScheduledPage++; } catch (DatabaseException e) { //logger.error("Error while putting the url in the work queue", e); } } if (newScheduledPage > 0) { scheduledPages += newScheduledPage; counters.increment(Counters.ReservedCounterNames.SCHEDULED_PAGES, newScheduledPage); } synchronized (waitingList) { waitingList.notifyAll(); } } } public void schedule(WebURL url) { int maxPagesToFetch = config.getMaxPagesToFetch(); synchronized (mutex) { try { if (maxPagesToFetch < 0 || scheduledPages < maxPagesToFetch) { workQueues.put(url); scheduledPages++; counters.increment(Counters.ReservedCounterNames.SCHEDULED_PAGES); } } catch (DatabaseException e) { //logger.error("Error while putting the url in the work queue", e); } } } public void getNextURLs(int max, List<WebURL> result) { while (true) { synchronized (mutex) { if (isFinished) { return; } try { List<WebURL> curResults = workQueues.get(max); workQueues.delete(curResults.size()); if (inProcessPages != null) { for (WebURL curPage : curResults) { inProcessPages.put(curPage); } } result.addAll(curResults); } catch (DatabaseException e) { //logger.error("Error while getting next urls", e); } if (result.size() > 0) { return; } } try { synchronized (waitingList) { waitingList.wait(); } } catch (InterruptedException ignored) { // Do nothing } if (isFinished) { return; } } } public void setProcessed(WebURL webURL) { counters.increment(Counters.ReservedCounterNames.PROCESSED_PAGES); if (inProcessPages != null) { if (!inProcessPages.removeURL(webURL)) { //logger.warn("Could not remove: {} from list of processed pages.", webURL.getURL()); } } } public long getQueueLength() { return workQueues.getLength(); } public long getNumberOfAssignedPages() { return inProcessPages.getLength(); } public long getNumberOfProcessedPages() { return counters.getValue(Counters.ReservedCounterNames.PROCESSED_PAGES); } public boolean isFinished() { return isFinished; } public void close() { workQueues.close(); counters.close(); if (inProcessPages != null) { inProcessPages.close(); } } public void finish() { isFinished = true; synchronized (waitingList) { waitingList.notifyAll(); } } }
8b4653daed72597772fa8f923f545bdbbd017678
56531acac44b5e6883991d1ff6af903e870f6d05
/backend/company-service/src/main/java/companyservice/service/CompanyService.java
2a4ab6311ea5f9b17bd570bca20ce05eec3db850
[]
no_license
shreyasnopany/stockmarket-project
a794659c1c7dccb41a7159cf0ad9ecbc228064ff
0314e2ff017598562681b6e7e12123a9a75f69ce
refs/heads/main
2023-06-25T15:13:33.099149
2021-07-21T10:55:20
2021-07-21T10:55:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
65
java
package companyservice.service; public class CompanyService { }
ddcf7bfd2c1575c50930ce5feb21cdb942f4a4f9
17cb2fa298d98b82a82d6cfa9be2da8e495d302c
/p4-starter/src/PriorityQueue.java
1f9e987172e9340983cdb5cf401e8e4fff4daf22
[]
no_license
shubhankar90/DataStructures-JavaCode
4e3487fe188de4ff921047fe1425e7240b08f7e6
d6af31bc1f26ebfab774d2d1c25a793ca81ac840
refs/heads/master
2021-01-22T18:42:43.020731
2017-11-06T18:12:07
2017-11-06T18:12:07
85,105,683
0
0
null
null
null
null
UTF-8
Java
false
false
836
java
import java.util.Comparator; /** * * This is the same ADT given in lecture except that it has been * made generic and the accessor method, comparator(), has been * added. * * Don't make any changes to this file. */ public interface PriorityQueue<E> { /** * Inserts the given key into this priority queue. */ void insert(E key); /** * Retrieves and removes the highest priority key in this queue, or returns * null if this queue is empty. */ E delete(); /** * Retrieves, but does not remove, the head of this queue. */ E peek(); /** * Returns the comparator used to organize this queue. */ Comparator<E> comparator(); /** * Returns the number of keys in this queue. */ int size(); /** * Returns true iff this queue is empty. */ default boolean isEmpty() { return size() == 0; } }
cfdf5d650bc8604cef6004a5dec644a044ab3434
f0563c7c9a3f284ab9a8750adc1741052a4e31d8
/src/k/f/bottle/ReusableBottle.java
f36ac0ca9a103c7719062c89cf92338341f2e6af
[]
no_license
Kalumniatoris/wzorceprojekt
989b51222d6c0305453da1ed763cfd3358292942
41f110b222ad8cc03d69723ca8d4c78fef5721b5
refs/heads/master
2020-03-19T08:38:27.099869
2018-06-08T10:24:18
2018-06-08T10:24:18
136,223,188
0
0
null
null
null
null
UTF-8
Java
false
false
216
java
package k.f.bottle; public class ReusableBottle extends BasicBottle { public ReusableBottle(int capacity, String name) { super(capacity, name); // TODO Auto-generated constructor stub } }
a8ef4b74061cdfb158d4451de36cd07add79c21f
91d1797fde724d9139ab4738174313ed81bfaa9d
/TCPClient/src/com/Sortex/controller/Viewer.java
e52a063e3c51a14f5c891a23bd505aed1b245cbf
[]
no_license
Lakmini/TCP-Client
248eb578aff1d4e69fdb5cd417d14beb9174e2fd
bbb25dd1b831c55399cf70cb44f12fc9a7ace90f
refs/heads/master
2021-01-11T21:37:55.518876
2017-04-27T05:01:42
2017-04-27T05:01:42
78,824,226
0
1
null
null
null
null
UTF-8
Java
false
false
1,604
java
package com.Sortex.controller; import java.awt.FlowLayout; import java.awt.List; import java.awt.image.BufferedImage; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.LinkedList; import java.util.Queue; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; public class Viewer { final static JFrame frame = new JFrame(); private static ImageIcon icon; private static JLabel label; public static void initialize() { frame.getContentPane().setLayout(new FlowLayout()); icon = new ImageIcon(); label = new JLabel(); label.setIcon(icon); frame.getContentPane().add(label); frame.pack(); frame.setVisible(true); } public static void updateFrame() throws IOException { Queue<String> imageList = new LinkedList<String>(); Files.walk(Paths.get("OutputImages")).forEach(filePath -> { if (Files.isRegularFile(filePath)) { imageList.add(filePath.getFileName().toString()); System.out.println("File name: " + filePath.getFileName()); } }); String path; for (int i = 0; i < imageList.size(); i++) { path = "OutputImages/" + imageList.poll(); visibleImage(ImageIO.read(new File(path))); } } public static void visibleImage(BufferedImage image) { icon.setImage(image); frame.pack(); frame.setVisible(true); // label.setIcon(icon); frame.pack(); frame.setVisible(true); frame.repaint(); } }
799673c8a5ec000660bf580351066952286599ed
baa29762bed58f6f73d4bd6513f348feda4d3597
/src/main/java/com/mps/blindsec/config/ConfigurationVariables.java
e235a0775f0ffcede280c34973de763cf6589f42
[]
no_license
igorDSMK/TeR
509f87cc25d150592dd8a1ec3ca89b6c6c1413a6
fd2547f28b243d4fbbf4486bba21f4f8c00cd2eb
refs/heads/master
2021-02-14T01:47:36.835718
2020-02-24T18:41:50
2020-02-24T18:41:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
372
java
package com.mps.blindsec.config; import org.springframework.boot.context.properties.ConfigurationProperties; import lombok.Data; import lombok.NoArgsConstructor; import lombok.var; @ConfigurationProperties @Data @NoArgsConstructor public class ConfigurationVariables{ private var PUBLIC_KEY_NAME; private var ACTUAL_STORAGE_PATH; private var SALT; }
f4843732079e250e0c9da994b06d87982758272a
4836f6a2bf7ecca407d9ed2fc46276311109a0e5
/android/app/src/main/java/com/photo_react_native_app/MainActivity.java
056cfc1778c3967da7d4f3564cd275b2a3464a9b
[]
no_license
qapasaskhat/photo_app_react_native
f6f9eb334e538417c3bb5c46272a406585b2836e
7c9275cb69084ef0e98d966823f8e702ba5ec579
refs/heads/master
2022-12-07T04:19:37.429081
2020-08-29T21:34:08
2020-08-29T21:34:08
288,518,250
0
0
null
null
null
null
UTF-8
Java
false
false
842
java
package com.photo_react_native_app; import com.facebook.react.ReactActivity; import com.facebook.react.ReactActivityDelegate; import com.facebook.react.ReactRootView; import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView; public class MainActivity extends ReactActivity { /** * Returns the name of the main component registered from JavaScript. This is used to schedule * rendering of the component. */ @Override protected String getMainComponentName() { return "photo_react_native_app"; } @Override protected ReactActivityDelegate createReactActivityDelegate() { return new ReactActivityDelegate(this, getMainComponentName()) { @Override protected ReactRootView createRootView() { return new RNGestureHandlerEnabledRootView(MainActivity.this); } }; } }
069968566fa99e8dae8b3e310279d7775f4a7428
4bc858ee4a5b6c496e933740d1c5acdf729e2185
/4. Verkefni/ArrayList.java
c06b3dda62ad1e6cbd3ac663ccfe9cf78b6720e5
[]
no_license
jonnigs/Tolvunarfraedi_2
54a2326e2f7043658aaf76c295998fba46b16091
2333672a09a339cfed1868f6a4b1ca5e85186d76
refs/heads/master
2021-02-28T18:26:38.308258
2020-03-08T02:18:03
2020-03-08T02:18:03
245,722,852
0
0
null
null
null
null
UTF-8
Java
false
false
3,877
java
/* Takmörkuð eftirlíking af java.util.ArrayList klasanum fyrir Tölvunarfræði 2 */ import java.util.Iterator; import java.util.NoSuchElementException; import edu.princeton.cs.algs4.StdOut; public class ArrayList<Item> implements Iterable<Item>{ private Item[] storage; // Fjölnota geymslusvæði private int length; // Fjöldi staka í listanum public ArrayList() { //Smiður, býr til tóman lista með upphafsrýmd 2 this.storage = (Item[]) new Object[2]; this.length = 0; } public int size() { // Skilar fjölda staka í listanum return this.length; } public int capacity() { // Skilar rýmd listans, fjölda staka sem hægt er að bæta við án þess að breyta geymslusvæðinu return this.storage.length; } public void clear() { // Eyðir öllum stökum úr listanum og upphafsstillir rýmd hans this.storage = (Item[]) new Object[2]; this.length = 0; } private void resize(int newCapacity) { // Eykur rýmd listans upp í newCapacity, ekki er gert ráð fyrir minnkun á rýmd assert newCapacity >= length; Item[] temp = (Item[]) new Object[newCapacity]; for (int i = 0; i < this.length; i++) { temp[i] = this.storage[i]; } this.storage = temp; } public Item get(int index) { // Sækir stak númer index í listanum if (index < 0 || this.size() <= index) { throw new IndexOutOfBoundsException("Þessi vísir er utan geymslunnar"); } return this.storage[index]; } public Item set(int index, Item item) { // Yfirskrifar stak númer index með item Item previousItem = this.storage[index]; this.storage[index] = item; return previousItem; } public void add(Item item) { // Bætir item aftast í listann, eykur rýmd ef á þarf að halda if (this.length == this.storage.length) { this.resize(2 * this.storage.length); } this.storage[this.length++] = item; } public void add(int index, Item item) { // Bætir item í listann í staðsetningu index, if (index < 0 || this.size() < index) { throw new IndexOutOfBoundsException("Þessi vísir er utan geymslunnar"); } else if (index == this.length) { this.add(item); } else { Item oldItem = this.set(index, item); this.add(index + 1, oldItem); } } public Iterator<Item> iterator() { return new ListIterator<Item>(storage); } private class ListIterator<Item> implements Iterator<Item> { private int currentIndex; private Item[] current; public ListIterator(Item[] first) { current = first; currentIndex = 0; } public boolean hasNext() { return current != null; } public void remove() { throw new UnsupportedOperationException(); } public Item next() { if (!hasNext()) throw new NoSuchElementException(); Item item = current[currentIndex]; if (currentIndex < size()-1) { currentIndex = currentIndex + 1; } else { current = null; } return item; } } public static void main(String[] args) { ArrayList<Character> myList = new ArrayList<>(); myList.add(0, 'A'); // Tómur listi búinn til myList.add(1, 'N'); myList.add(1, 'A'); myList.add(3, 'I'); // Bætt aftast í lista myList.add(0, 'B'); // Bætt framan á lista myList.add(2, 'N'); StdOut.print("[ "); // Afkommentið þetta fyrir sýnidæmið for (Character c : myList) { StdOut.print(c + " "); } StdOut.println("]"); } }
27be2fd790ad2e4bde70ae2f60f8581561f014f7
cc3b65a6963cee4f2237e93dfdc98bcedb8e2005
/src/cf/tgtiger/express/Dao/ExpTrackDao.java
39c471c94d4d70c2f55c03e5c56f770c3e65680c
[]
no_license
tsreal/ExpressTest
ebbdabe6643d55f8059ddb54897cad182e6c6c04
d01f7512d5aa733d78e63550b1c5f74539f7e5d8
refs/heads/master
2021-07-23T18:35:46.228665
2017-10-31T15:53:01
2017-10-31T15:53:01
105,384,725
0
0
null
null
null
null
UTF-8
Java
false
false
582
java
package cf.tgtiger.express.Dao; import cf.tgtiger.express.bean.ExpressTrack; public interface ExpTrackDao { void addTrack(ExpressTrack adr); void updateTrack(ExpressTrack adr); //根据快递单号查找追踪 ExpressTrack getExpressTrack(String expnum); //返回追踪全部信息 String getFullTrack(String expnum); String getExpLocate(String exprssNum); boolean expExist(String expressNum); boolean existExpressman(String expressNum); String getExpressmanName(String expressNum); String getExressmanPhone(String expressNum); }
5b8e5e7f7c474b0cda78e9c7d5fd1718187583c4
37f55e147c1a052c4eea7a3cc39137f19362c21e
/lingo/src/main/java/org/logicblaze/lingo/jms/impl/OneWayRequestor.java
ecf6aa2f1f3637ca28a9102797c0a7666ec85ad9
[ "Apache-2.0" ]
permissive
chetan/lingo
aacbf78e84df7832dfc3af276f962e007f2acd30
b8ca950bb04029f8bd8db3d0e73e66e89abeae6c
refs/heads/master
2022-02-28T08:45:22.083747
2009-07-01T14:15:05
2009-07-01T14:15:05
239,878
0
0
null
2022-02-01T00:58:29
2009-06-30T16:41:44
Java
UTF-8
Java
false
false
7,881
java
/** * * Copyright 2005 LogicBlaze, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * **/ package org.logicblaze.lingo.jms.impl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.logicblaze.lingo.jms.JmsProducerConfig; import org.logicblaze.lingo.jms.ReplyHandler; import org.logicblaze.lingo.jms.Requestor; import org.springframework.beans.factory.DisposableBean; import javax.jms.Connection; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageProducer; import javax.jms.Session; /** * A simple requestor which only supports one-way and so does not need a * consumer. * * @version $Revision: 93 $ */ public class OneWayRequestor implements Requestor, DisposableBean { private static final Log log = LogFactory.getLog(OneWayRequestor.class); private Connection connection; private Session session; private MessageProducer producer; private boolean ownsConnection = true; private Destination serverDestination; private long counter; public static OneWayRequestor newInstance(Connection connection, JmsProducerConfig config, boolean ownsConnection) throws JMSException { Session session = config.createSession(connection); MessageProducer producer = config.createMessageProducer(session); return new OneWayRequestor(connection, session, producer, null, ownsConnection); } public OneWayRequestor(JmsProducerConfig config, Destination serverDestination) throws JMSException { this.serverDestination = serverDestination; this.ownsConnection = true; this.connection = config.createConnection(); this.session = config.createSession(connection); this.producer = config.createMessageProducer(session); } public OneWayRequestor(Connection connection, Session session, MessageProducer producer, Destination serverDestination, boolean ownsConnection) { this.connection = connection; this.session = session; this.producer = producer; this.serverDestination = serverDestination; this.ownsConnection = ownsConnection; } public void close() throws JMSException { if (producer != null) { MessageProducer tmp = producer; producer = null; tmp.close(); } if (session != null) { Session tmp = session; session = null; tmp.close(); } if (connection != null) { Connection tmp = connection; connection = null; if (ownsConnection) { tmp.close(); } } } public void destroy() throws Exception { close(); } public void send(Destination destination, Message message) throws JMSException { send(destination, message, getTimeToLive()); } public void send(Destination destination, Message message, long timeToLive) throws JMSException { doSend(destination, message, timeToLive); } public void send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException { doSend(destination, message, deliveryMode, priority, timeToLive); } public Message receive(long timeout) throws JMSException { throw new JMSException("receive(long) not implemented for OneWayRequestor"); } public Message request(Destination destination, Message message) throws JMSException { throw new JMSException("request(Destination, Message) not implemented for OneWayRequestor"); } public Message request(Destination destination, Message message, long timeout) throws JMSException { throw new JMSException("request(Destination, Message, long) not implemented for OneWayRequestor"); } public void request(Destination destination, Message requestMessage, ReplyHandler handler, long timeout) throws JMSException { throw new JMSException("request(Destination, Message, ReplyHandler, long) not implemented for OneWayRequestor"); } // Properties // ------------------------------------------------------------------------- public Connection getConnection() { return connection; } public Session getSession() { return session; } public MessageProducer getMessageProducer() { return producer; } public int getDeliveryMode() throws JMSException { return getMessageProducer().getDeliveryMode(); } /** * Sets the default delivery mode of request messages * * @throws JMSException */ public void setDeliveryMode(int deliveryMode) throws JMSException { getMessageProducer().setDeliveryMode(deliveryMode); } public int getPriority() throws JMSException { return getMessageProducer().getPriority(); } /** * Sets the default priority of request messages * * @throws JMSException */ public void setPriority(int priority) throws JMSException { getMessageProducer().setPriority(priority); } /** * The default time to live on request messages * * @throws JMSException */ public long getTimeToLive() throws JMSException { return getMessageProducer().getTimeToLive(); } /** * Sets the maximum time to live for requests * * @throws JMSException */ public void setTimeToLive(long timeToLive) throws JMSException { getMessageProducer().setTimeToLive(timeToLive); } // Implementation methods // ------------------------------------------------------------------------- /** * A hook to allow custom implementations to process headers differently. */ protected void populateHeaders(Message message) throws JMSException { } protected void doSend(Destination destination, Message message, long timeToLive) throws JMSException { destination = validateDestination(destination); if (log.isDebugEnabled()) { log.debug("Sending message to: " + destination + " message: " + message); } getMessageProducer().send(destination, message, getDeliveryMode(), getPriority(), timeToLive); } protected void doSend(Destination destination, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException { destination = validateDestination(destination); if (log.isDebugEnabled()) { log.debug("Sending message to: " + destination + " message: " + message); } getMessageProducer().send(destination, message, deliveryMode, priority, timeToLive); } protected Destination validateDestination(Destination destination) { if (destination == null) { destination = serverDestination; } return destination; } /** * Creates a new correlation ID. Note that because the correlationID is used * on a per-temporary destination basis, it does not need to be unique * across more than one destination. So a simple counter will suffice. * * @return */ public String createCorrelationID() { return Long.toString(nextCounter()); } protected synchronized long nextCounter() { return ++counter; } }
43a442b0196018e06a792b83acef6ef8b51b73a9
0ed70dcadf47a685135989f21bd824e6a06b2553
/src/main/java/com/slokam/test/entity/Application.java
9db4ef712480963f8ea8b601d9e3f0edafeddaaf
[]
no_license
manideepnalla/hr
1fc6dde014626a16beb802170e99412d3910c796
586a18229d14ae486b55f0ca61e60e62cd957f7e
refs/heads/master
2020-12-07T19:28:43.729640
2020-01-09T10:10:39
2020-01-09T10:10:39
232,781,986
0
0
null
null
null
null
UTF-8
Java
false
false
857
java
package com.slokam.hr.entity; import java.io.Serializable; import javax.persistence.*; import java.util.*; @Entity public class Application implements Serializable { @Id @GeneratedValue private Integer id; @ManyToOne() @JoinColumn(name="fkid52") private Candidate candidate; @ManyToOne() @JoinColumn(name="fkid53") private Openning openning; private Date time; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Candidate getCandidate() { return candidate; } public void setCandidate(Candidate candidate) { this.candidate = candidate; } public Openning getOpenning() { return openning; } public void setOpenning(Openning openning) { this.openning = openning; } public Date getTime() { return time; } public void setTime(Date time) { this.time = time; } }
1d36ca267e573b7b299a802f7d704cd3cb9c41db
ef106fb82cfd19649b8774eace39455367378bb1
/login/src/main/java/com/myhomie/module/login/data/LoginDataSource.java
93a395273aa75c8df412a1dbdea72df40322391d
[]
no_license
josephHai/MyHomieApp
0be7b1042360beb7d2e444729250d345b6375aff
48e4a4c76c998b3fb351bbbbf8af53d0cef0eba4
refs/heads/master
2022-01-09T08:58:33.782934
2019-06-24T16:58:39
2019-06-24T16:58:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
245
java
package com.myhomie.module.login.data; /** * Class that handles authentication w/ login credentials and retrieves user information. */ public class LoginDataSource { public void logout() { // TODO: revoke authentication } }
03f954490dd22d5a85d7dda8dd3121f66dfc251a
552079711f496b9ccec2b255af63fae027195ac3
/app/src/main/java/ObserverPattern/perfect/HanFeiZi.java
237041202d30df2d1a1744f4005298d080958f9d
[]
no_license
1074685590/designPatern
a5c51e0b0cef19ee55cb65e5c21799ae40a41866
e68ce669d0faa3c54f91952de26386eccd47ee75
refs/heads/master
2023-01-08T10:06:49.925038
2022-12-30T02:16:15
2022-12-30T02:16:15
101,856,705
0
0
null
null
null
null
UTF-8
Java
false
false
774
java
package ObserverPattern.perfect; import java.util.Observable; /** * @author cbf4Life [email protected] * I'm glad to share my knowledge with you all. * 韩非子,李斯的师弟,韩国的重要人物 */ public class HanFeiZi extends Observable { //韩非子要吃饭了 public void haveBreakfast() { System.out.println("韩非子:开始吃饭了..."); //通知所有的观察者 super.setChanged(); super.notifyObservers("韩非子在吃饭"); } //韩非子开始娱乐了,古代人没啥娱乐,你能想到的就那么多 public void haveFun() { System.out.println("韩非子:开始娱乐了..."); super.setChanged(); this.notifyObservers("韩非子在娱乐"); } }
2a9b838b2c7ea58153d58172ef955fb2057a2304
8ecb46c24ba8c0ef1398a204d1cd07ff30b2e146
/src/com/pvt/less_04/cl_01_time/Test.java
9a6d294d24176d2f0cbf0c16d1e65cecff9fb7de
[]
no_license
will-see/jd1
179d7cc1ef6542ecf706f70def8ee880a5616780
0b614ac43f889df63f96650d5230db1c21654bfd
refs/heads/master
2021-09-05T18:15:10.065110
2018-01-30T04:40:32
2018-01-30T04:40:32
112,992,908
0
0
null
null
null
null
UTF-8
Java
false
false
325
java
package com.pvt.less_04.cl_01_time; /** * Created by W510 on 03.12.2017. */ public class Test { public static void main(String[] args) { TimeRange tr1 = new TimeRange(2,55,28); tr1.print(); TimeRange tr2 = new TimeRange(123456); tr2.print(); tr1.parseToSeconds(1,2,3); } }
61c3e2fafa134fd68bfab9f63a428d215c0ecab0
47aa59f2b503fe66d171d6f8a07840ac2b8a193c
/src/ru/khrebtov/lesson3/Expression.java
ac4adad55961dc3d2f8f35e30d7dda4056081d14
[]
no_license
framzik/geekbrainsLessons_algo
9573860fc7c0ecd5605bf05b620dacbe0f9fd726
66c231adfba2344df7dafa76dd55197f06003153
refs/heads/master
2023-09-01T05:29:48.693023
2021-10-03T12:47:08
2021-10-03T12:47:08
405,358,181
0
0
null
2021-10-03T15:30:08
2021-09-11T11:14:02
Java
UTF-8
Java
false
false
1,166
java
package ru.khrebtov.lesson3; public class Expression { private String exp; public Expression(String exp) { this.exp = exp; } public boolean checkBracket() { MyStack<Character> stack = new MyStack<>(exp.length()); for (int i = 0; i < exp.length(); i++) { char ch = exp.charAt(i); if (ch == '(' || ch == '{' || ch == '[') { stack.push(ch); } else if (ch == ')' || ch == '}' || ch == ']') { if (stack.isEmpty()) { System.out.println("Error in " + i + " position"); return false; } char top = stack.pop(); if (ch == ')' && top != '(' || ch == '}' && top != '{' || ch == ']' && top != '[') { System.out.println("Error in " + i + " position: bracket doesn't match"); return false; } } } if (!stack.isEmpty()) { System.out.println("Error: bracket doesn't match"); return false; } return true; } }
cab7a1003554d2e01a3f9f5a1e0e4a2afebb03ba
7606c27a9d052d5357eac413cbf2eaf4327f8eab
/src/main/java/smtp/SMTPAuth.java
8d70fd163748b286165c84e8587d1204f96a7add
[]
no_license
YOOJAEYEONG/alouer
6b3d532c80453b954f8b65b408879f2532a77b5d
a7d0e9f2c4d35633542df5f4fb6d1d4c31c27238
refs/heads/master
2023-09-05T20:54:58.141732
2021-11-21T13:45:02
2021-11-21T13:45:02
288,455,060
0
0
null
null
null
null
UTF-8
Java
false
false
1,780
java
package smtp; import java.util.Map; import java.util.Properties; import javax.mail.Address; import javax.mail.Authenticator; import javax.mail.Message; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; public class SMTPAuth extends Authenticator{ @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("jjeong1992", "1bijoup2013"); } public boolean emailSending(Map<String, String> map) { //메일발송 성공 플래그 boolean sendOk = false; //정보를 담을 객체 Properties p = new Properties(); // SMTP 서버에 접속하기 위한 정보들 p.put("mail.smtp.host","smtp.naver.com"); // 네이버 SMTP p.put("mail.smtp.port", "465"); p.put("mail.smtp.starttls.enable", "true"); p.put("mail.smtp.auth", "true"); p.put("mail.smtp.debug", "true"); p.put("mail.smtp.socketFactory.port", "465"); p.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); p.put("mail.smtp.socketFactory.fallback", "false"); try { Authenticator auth = new SMTPAuth(); Session ses = Session.getInstance(p, auth); ses.setDebug(true); MimeMessage msg = new MimeMessage(ses); msg.setSubject(map.get("subject")); Address fromAddr = new InternetAddress(map.get("from")); msg.setFrom(fromAddr); Address toAddr = new InternetAddress(map.get("to")); msg.addRecipient(Message.RecipientType.TO, toAddr); msg.setContent(map.get("content"), "text/html;charset=UTF-8"); Transport.send(msg); sendOk = true; } catch(Exception e) { sendOk = false; e.printStackTrace(); } return sendOk; } }
e5ede8b970f737e4f840a5812072909f2a2fc366
cc948561b7a1ee597925e33c928d9edb05e48f97
/src/main/java/com/edutilos/main/tableView/WorkerDetailsStage.java
5c23526d35760e8702d7d9cb7684159174097ec1
[]
no_license
edutilos6666/JavaFXExamples
56b1a9a1f32752f1c2a0edacc1c89f4478b577e7
08da9e10f4e332291c14560ac104104c6d374aae
refs/heads/master
2020-03-19T19:05:32.447441
2018-06-22T17:15:03
2018-06-22T17:15:03
136,839,416
0
0
null
null
null
null
UTF-8
Java
false
false
2,444
java
package com.edutilos.main.tableView; import javafx.collections.ObservableList; import javafx.scene.Scene; import javafx.scene.control.Alert; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; import javafx.stage.Stage; /** * Created by edutilos on 10.06.18. */ public class WorkerDetailsStage extends Stage { //Properties private Worker selected; private Scene scene; private GridPane root; private Label lblTitle, lblId, lblName , lblAge, lblWage, lblActive; private TextField fieldId, fieldName, fieldAge, fieldWage, fieldActive; private Button btnOk; public WorkerDetailsStage(Worker selected) { this.selected = selected; setStage(); populateData(); } private void populateData() { fieldId.setText(selected.getId().toString()); fieldName.setText(selected.getName()); fieldAge.setText(selected.getAge().toString()); fieldWage.setText(selected.getWage().toString()); fieldActive.setText(selected.isActive().toString()); } private void setStage() { addComponents(); registerEvents(); scene = new Scene(root, 500, 500); this.setScene(scene); // this.showAndWait(); } private void addComponents() { root = new GridPane(); lblTitle = new Label("Worker Details"); lblId = new Label("Id:"); fieldId = new TextField(); lblName= new Label("Name:"); fieldName = new TextField(); lblAge = new Label("Age:"); fieldAge = new TextField(); lblWage = new Label("Wage:"); fieldWage = new TextField(); lblActive = new Label("Active:"); fieldActive = new TextField(); btnOk = new Button("Ok"); root.addRow(0,lblTitle); root.addRow(1, lblId, fieldId); root.addRow(2, lblName, fieldName); root.addRow(3, lblAge, fieldAge); root.addRow(4, lblWage, fieldWage); root.addRow(5, lblActive, fieldActive); root.addRow(6, btnOk); fieldId.setEditable(false); fieldName.setEditable(false); fieldAge.setEditable(false); fieldWage.setEditable(false); fieldActive.setEditable(false); } private void registerEvents() { btnOk.setOnAction(handler->{ this.close(); }); } }
b01860a870cb61d35d52c1f923996f7608912e1f
cea2bd428ba7b16186ef6fb5cc7e993f84da729e
/spring-cloud-gcp-storage/src/test/java/org/springframework/cloud/gcp/storage/it/GoogleStorageIntegrationTests.java
a99bc371daa2087c649d4aae9fc71c98f27645a5
[ "Apache-2.0" ]
permissive
RomanKharkiv/spring-cloud-gcp
2299f23667877a7a87904f2de5b6c49c95775749
62612a3cdacdcde57ddf77092e7582fd7ef3ede3
refs/heads/master
2020-03-23T18:00:51.911469
2018-07-19T21:03:03
2018-07-19T21:03:03
141,885,581
1
0
Apache-2.0
2018-07-22T10:18:11
2018-07-22T10:18:10
null
UTF-8
Java
false
false
5,050
java
/* * Copyright 2018 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.springframework.cloud.gcp.storage.it; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.charset.Charset; import com.google.api.gax.core.CredentialsProvider; import com.google.cloud.storage.Storage; import com.google.cloud.storage.StorageOptions; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.cloud.gcp.core.Credentials; import org.springframework.cloud.gcp.core.DefaultCredentialsProvider; import org.springframework.cloud.gcp.core.DefaultGcpProjectIdProvider; import org.springframework.cloud.gcp.core.GcpProjectIdProvider; import org.springframework.cloud.gcp.storage.GoogleStorageProtocolResolver; import org.springframework.cloud.gcp.storage.GoogleStorageResource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.context.annotation.PropertySource; import org.springframework.core.io.Resource; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.util.StreamUtils; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assume.assumeThat; /** * @author Chengyuan Zhao */ @RunWith(SpringRunner.class) @ContextConfiguration(classes = { GoogleStorageIntegrationTests.GoogleStorageIntegrationTestsConfiguration.class }) public class GoogleStorageIntegrationTests { private static final String CHILD_RELATIVE_NAME = "child"; @Autowired private Storage storage; @Value("gs://${test.integration.storage.bucket}/integration-test") private Resource resource; @BeforeClass public static void checkToRun() { assumeThat( "Storage integration tests are disabled. Please use '-Dit.storage=true' " + "to enable them. ", System.getProperty("it.storage"), is("true")); } private GoogleStorageResource thisResource() { return (GoogleStorageResource) this.resource; } private GoogleStorageResource getChildResource() throws IOException { return thisResource().createRelative(CHILD_RELATIVE_NAME); } private void deleteResource(GoogleStorageResource googleStorageResource) throws IOException { if (googleStorageResource.exists()) { this.storage.delete(googleStorageResource.getBlob().getBlobId()); } } @Before public void setUp() throws IOException { deleteResource(thisResource()); deleteResource(getChildResource()); } @Test public void createAndWriteTest() throws IOException { String message = "test message"; try (OutputStream os = thisResource().getOutputStream()) { os.write(message.getBytes()); } assertTrue(this.resource.exists()); try (InputStream is = this.resource.getInputStream()) { assertEquals(message, StreamUtils.copyToString(is, Charset.defaultCharset())); } GoogleStorageResource childResource = getChildResource(); assertFalse(childResource.exists()); try (OutputStream os = childResource.getOutputStream()) { os.write(message.getBytes()); } assertTrue(childResource.exists()); try (InputStream is = childResource.getInputStream()) { assertEquals(message, StreamUtils.copyToString(is, Charset.defaultCharset())); } } @Configuration @PropertySource("application-test.properties") @Import(GoogleStorageProtocolResolver.class) public static class GoogleStorageIntegrationTestsConfiguration { @Bean public static Storage storage(CredentialsProvider credentialsProvider, GcpProjectIdProvider projectIdProvider) throws IOException { return StorageOptions.newBuilder() .setCredentials(credentialsProvider.getCredentials()) .setProjectId(projectIdProvider.getProjectId()).build().getService(); } @Bean public GcpProjectIdProvider gcpProjectIdProvider() { return new DefaultGcpProjectIdProvider(); } @Bean public CredentialsProvider credentialsProvider() { try { return new DefaultCredentialsProvider(Credentials::new); } catch (IOException e) { throw new RuntimeException(e); } } } }
a32a11e182c7c27e25046fb915d7dd7acac52f68
6331cfebd66af238469f3fea63dc3815da8b41a5
/mantis-tests/src/test/java/iss/work/mantis/appmanager/RegistrationHelper.java
108361812feb489b38e12fbb0ea7d32aec613c2d
[]
no_license
ktonkov/work
84cd3f44d144b87ff7a3514028242213bb201ef6
25d2ea897ca956738cef9dd76df1194c05a66c73
refs/heads/master
2022-06-11T18:54:38.731028
2020-07-14T05:09:48
2020-07-14T05:09:48
171,800,560
0
2
null
2022-05-20T21:50:36
2019-02-21T04:33:08
Java
UTF-8
Java
false
false
749
java
package iss.work.mantis.appmanager; import org.openqa.selenium.By; public class RegistrationHelper extends HelperBase { public RegistrationHelper(ApplicationManager app) { super(app); } public void start(String username, String email) { driver.get(app.getProperty("web.baseUrl") + "signup_page.php"); type(By.name("username"), username); type(By.name("email"), email); click(By.cssSelector("input[type=\"submit\"]")); } public void finish(String confirmationLink, String password) { driver.get(confirmationLink); type(By.name("password"), password); type(By.name("password_confirm"), password); click(By.cssSelector("input[type=\"submit\"]")); } }
234bd0c5b5ad4a8312f2008ab4f8d32306329eb8
bdfd9b53393625585e540ca9523b8e9d247a04bc
/org.xtext.icam.statemachine/src-gen/org/xtext/icam/stateMachine/impl/modelImpl.java
48ed538bec8bbe0a4ce72d30b44c0b5a1eb47640
[]
no_license
BrendanKeane32/StateMachineProject
0a0657e3aca203291bae1e3f0d90440f6b879b03
74b03b7f92fcaaa59a3ba8ff69e68fbcd1781a04
refs/heads/master
2020-03-13T16:32:27.164987
2018-05-15T19:15:14
2018-05-15T19:15:14
131,200,318
0
0
null
null
null
null
UTF-8
Java
false
false
3,830
java
/** * generated by Xtext 2.12.0 */ package org.xtext.icam.stateMachine.impl; import java.util.Collection; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; import org.xtext.icam.stateMachine.StateMachine; import org.xtext.icam.stateMachine.StateMachinePackage; import org.xtext.icam.stateMachine.model; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>model</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link org.xtext.icam.stateMachine.impl.modelImpl#getStatemachine <em>Statemachine</em>}</li> * </ul> * * @generated */ public class modelImpl extends MinimalEObjectImpl.Container implements model { /** * The cached value of the '{@link #getStatemachine() <em>Statemachine</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getStatemachine() * @generated * @ordered */ protected EList<StateMachine> statemachine; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected modelImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return StateMachinePackage.Literals.MODEL; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<StateMachine> getStatemachine() { if (statemachine == null) { statemachine = new EObjectContainmentEList<StateMachine>(StateMachine.class, this, StateMachinePackage.MODEL__STATEMACHINE); } return statemachine; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case StateMachinePackage.MODEL__STATEMACHINE: return ((InternalEList<?>)getStatemachine()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case StateMachinePackage.MODEL__STATEMACHINE: return getStatemachine(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case StateMachinePackage.MODEL__STATEMACHINE: getStatemachine().clear(); getStatemachine().addAll((Collection<? extends StateMachine>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case StateMachinePackage.MODEL__STATEMACHINE: getStatemachine().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case StateMachinePackage.MODEL__STATEMACHINE: return statemachine != null && !statemachine.isEmpty(); } return super.eIsSet(featureID); } } //modelImpl
e4cd555255fe32dcc721cc71f3e3ce2ab48cdeeb
965f02c409020d692c9aa6045ffdc0805471fffd
/gwt-openlayers-client/src/main/java/org/gwtopenmaps/openlayers/client/layer/LayerCreatorStore.java
fdd970628ee35a761e16d514d2539b3c0ef8712b
[ "Apache-2.0" ]
permissive
gunayus/GWT-OpenLayers
18beedb8e7724deb56fb0ca510107359b86701e6
c31494509408d6c92dbe865493cce4a9a5deadda
refs/heads/master
2021-06-05T17:53:34.381583
2016-10-20T08:22:19
2016-10-20T08:22:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,683
java
/* * Copyright 2014 geoSDI. * * 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.gwtopenmaps.openlayers.client.layer; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.gwtopenmaps.openlayers.client.util.JSObject; /** * * @author Giuseppe La Scaleia - CNR IMAA geoSDI Group * @email [email protected] */ abstract class LayerCreatorStore { protected final Map<String, Layer.LayerCreator<? extends Layer>> registar = new HashMap<String, Layer.LayerCreator<? extends Layer>>(); final boolean isLayerCreatorRegisterd(String classLayerName) { return this.registar.containsKey(classLayerName); } final Layer.LayerCreator<? extends Layer> getLayerCreator( String layerClassName) { return this.registar.get(layerClassName); } final Collection<Layer.LayerCreator<? extends Layer>> getAllLayerCreator() { return Collections.unmodifiableCollection(this.registar.values()); } protected abstract void registerLayerCreator(Layer layer); protected abstract <L extends Layer> L createLayer(JSObject jsObject); }
c876920f4b5ce76c2615b9f6bc75924748610895
cfd0dbe83bc95aea3987bbf458708a28e62b7ed6
/src/sample/Exercise31_10Server.java
d1954a2be301eacc092cf4c4621f29221be6b1fe
[]
no_license
DanORLarsen/ChatServer
610f8850b92fc6deb8bf21b27866cd31154968e2
507b662c34b86231a93de7e4d507c879a890d289
refs/heads/master
2020-07-13T19:08:21.473338
2019-09-15T19:41:50
2019-09-15T19:41:50
205,136,226
0
1
null
null
null
null
UTF-8
Java
false
false
600
java
package sample; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class Exercise31_10Server extends Application { @Override public void start(Stage primaryStage) throws Exception{ Parent root = FXMLLoader.load(getClass().getResource("sampleServer.fxml")); primaryStage.setTitle("Hello World"); primaryStage.setScene(new Scene(root, 300, 275)); primaryStage.show(); } public static void main(String[] args) { launch(args); } }
a6e5c408b9fba7f5f95d9022762564c17f116d8f
047ec5dde03d9568721221ac37fcab5fb7773523
/app/src/main/java/com/example/just10/SQLite.java
37d39408885a3e7e030af5f2b79e4fc7a4843a1b
[]
no_license
kevinization/aplicacionJust10
26fb2622f4b07e01d461ee56a9bbc686a3b61ba3
e8cad4ea7220bcd38c77ed8787093a7c1f4dfcab
refs/heads/master
2022-11-30T03:18:18.899574
2020-08-17T15:12:21
2020-08-17T15:12:21
288,212,706
0
0
null
null
null
null
UTF-8
Java
false
false
2,220
java
package com.example.just10; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import androidx.annotation.Nullable; public class SQLite extends SQLiteOpenHelper { public SQLite(@Nullable Context context, @Nullable String name, @Nullable SQLiteDatabase.CursorFactory factory, int version) { super(context, name, factory, version); } @Override public void onCreate(SQLiteDatabase Database) { /*ejemplo de creacion de tabla en base de datos*/ Database.execSQL("create table ejemplotabla(nombreTema text primary key, primerCampo int, segundoCampo text)"); } /* private Temas campo1, campo2 , campo3; @Override private void onCreate(Bundle savedInstanceState) { super.onCreate (savedInstancestate); setcontentView(R.layout.activity_algo): campo1 = (EditText)findViewById(r.id.txt_algo1); campo2 = (EditText)findViewById(r.id.txt_algo2); campo3 = (EditText)findViewById(r.id.txt_algo3); } */ //Metodos sql /* public void Register(Vew view){ SQLite admin = new AdminSQLiteOpenHelper(this, name: "just10", null, 1); SQLiteDatabase dataBase = admin.getWritetableDatabase(); //guardar cosas en la base de datos dependiendo de lo que se inserte en campos String algo1 = campo1.getText().toString(); String algo2 = campo2.getText().toString(); String algo3 = campo3.getText().toString(); //validar campos if(!algo1.isEmpty() && !algo2.isEmpty() && !algo3.isEmpty()){ ContentValues register = new ContentValues(); register.put("algo1", algo1); register.put("algo2", algo2); register.put("algo3", algo3); Database.insert("ejemplotabla", null, register); Databade.close(); }else{ Toast.makeText(this, "Debes llenar todos los campos", Toast.LENGTH_SHORT).show(); } } //metodo para consultar o buscar un producto public void Search(Vew view){ } */ @Override public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) { } }
f4da3a696cdb9a055abb5d34a11542a27b50ab65
8e2ae9de2f03ce9093f0c612c236bce9673385bf
/src/main/java/org/blinemedical/examination/domain/AssignedScenarioLearner.java
62abb0ee6fbeb93cd75e935e90e3a69f7370fdf6
[]
no_license
blinemedical/automated-scheduling
cd13a425e508e19d0e0318a91ea7edcd2a65e6a0
8291be88049a1ce3bc3fa91c7f9278395d8a9e67
refs/heads/main
2023-07-11T23:43:46.313896
2021-08-13T20:11:00
2021-08-13T20:11:00
322,086,861
0
0
null
null
null
null
UTF-8
Java
false
false
1,338
java
package org.blinemedical.examination.domain; import java.util.Objects; /** * Used in Drools scoring */ public class AssignedScenarioLearner { private Scenario scenario; private Person learner; public AssignedScenarioLearner(Scenario scenario, Person learner) { this.scenario = scenario; this.learner = learner; } public Scenario getScenario() { return scenario; } public void setScenario(Scenario scenario) { this.scenario = scenario; } public Person getLearner() { return learner; } public void setLearner(Person learner) { this.learner = learner; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final AssignedScenarioLearner other = (AssignedScenarioLearner) o; return Objects.equals(scenario, other.scenario) && Objects.equals(learner, other.learner); } @Override public int hashCode() { return Objects.hash(scenario, learner); } @Override public String toString() { return "AssignedScenarioLearner{" + "scenario=" + scenario + ", person=" + learner + '}'; } }
70d7593b374eefe4107ef040c4886d4cdb4e0e35
187713e94047e26b7019721d7ca2e2f5158b1c20
/src/main/java/com/ras/searchParam/SearchParamDaoImpl.java
bd84d0d6b34e16499295d752b8b05a5476cd6e1f
[]
no_license
algz/Framework
f7b793d94f1e81d6d878492466c77e022833f872
4a6f1e3e25e25f34192c82beb7b4d49d973606ae
refs/heads/master
2021-01-18T22:40:40.300148
2018-04-18T01:56:51
2018-04-18T01:56:51
30,111,934
0
1
null
null
null
null
UTF-8
Java
false
false
4,482
java
package com.ras.searchParam; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import org.hibernate.SessionFactory; import org.hibernate.transform.Transformers; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.ras.aircraftType.AircraftType; import com.ras.aircraftType.AircraftTypeDao; import com.ras.country.Country; import com.ras.country.CountryDao; import net.sf.json.JSONArray; import net.sf.json.JSONObject; @Repository public class SearchParamDaoImpl implements SearchParamDao { @Autowired private CountryDao countryDao; @Autowired private AircraftTypeDao aircraftTypeDao; @Autowired private SessionFactory sf; @SuppressWarnings("unchecked") @Override public void findAll(SearchParamVo<SearchParam> vo) { String sql=" from ras_search_param tag where 1=1 "; if(vo.getOnlyRead()!=null&&!vo.getOnlyRead().equals("1")){ sql+= " and tag.onlyRead='"+vo.getOnlyRead()+"' "; } BigDecimal count=(BigDecimal)sf.getCurrentSession().createSQLQuery("select count(1) "+sql).uniqueResult(); vo.setRecordsTotal(count.intValue()); List<SearchParam> list=sf.getCurrentSession().createSQLQuery("select * "+sql+" order by tag.PARENT_ID,tag.sequence,tag.id") .addEntity(SearchParam.class) .setFirstResult(vo.getStart()) .setMaxResults(vo.getLength()) .list(); vo.setData(list); } @Override public List<SearchParam> findAllParent() { String sql="select * from ras_search_param tag where tag.parent_id=0 order by tag.id"; return sf.getCurrentSession().createSQLQuery(sql).addEntity(SearchParam.class).list(); } @Override public List<SearchParam> findAllByIds(String[] ids) { String sql="select * from ras_search_param tag where tag.id in(:ids) order by tag.id"; List<SearchParam> tagList= sf.getCurrentSession().createSQLQuery(sql).addEntity(SearchParam.class).setParameterList("ids", ids).list(); for(SearchParam tag :tagList){ switch (tag.getUi_type()) { case "checkbox": List<String> list=new ArrayList<String>(); sql="select count(1) from user_tables where upper(table_name)='"+tag.getUi_value().toUpperCase()+"'"; BigDecimal count=(BigDecimal)sf.getCurrentSession().createSQLQuery(sql).uniqueResult(); if(count.intValue()>0){ sql="select name from "+tag.getUi_value(); list=sf.getCurrentSession().createSQLQuery(sql).list(); }else{ String[] vals=tag.getUi_value().split(","); Collections.addAll(list, vals); } for(String v:list){ SearchParam t=new SearchParam(); t.setId(null); t.setName(v); tag.getSearchTags().add(t); } break; } } return tagList; } public List<?> findAttribute(String tableName){ String sql="select * from "+tableName; return sf.getCurrentSession().createSQLQuery(sql).list(); } @Override public void save(SearchParam searchTag){ sf.getCurrentSession().save(searchTag); } @Override public Map<String, String> searchSummarize(String overviewID) { String sql=""; if(overviewID==null){ sql="select * from RAS_AIRCRAFT_OVERVIEW ao where ao.id='"+overviewID+"'"; }else{ sql="select * from aircraftallparam ap where ap.basicID='"+overviewID+"'"; } return (Map<String,String>)sf.getCurrentSession().createSQLQuery(sql) .setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP) .uniqueResult(); } @Override public List<SearchParam> findAllChildren(String parentID) { String sql="select * from RAS_SEARCH_param t where t.enname is not null "+(parentID==null?"":" and PARENT_ID='"+parentID+"'"); return sf.getCurrentSession().createSQLQuery(sql).addEntity(SearchParam.class).list(); } @SuppressWarnings("unchecked") @Override public Map<String,List<String>> findAllCheckboxTypeList() { String hql="from SearchParam where ui_type='checkbox'"; List<SearchParam> list=sf.getCurrentSession().createQuery(hql).list(); Map<String,List<String>> m=new HashMap<String,List<String>>(); for(SearchParam param:list){ String sql="select name from "+param.getUi_value(); List<String> tem=sf.getCurrentSession().createSQLQuery(sql).list(); m.put(param.getUi_value(), tem); } return m; } }
169fe0cb957207c55f67768e82a0d0d8d836ba1d
ca2fa78cb148a2c1be7f76034517785108c11410
/frameworks/Java/dropwizard/src/main/java/com/example/helloworld/db/jdbi/WorldRepository.java
d51d22b1c4673d52d6e4150ad2ab366425303cfa
[ "LicenseRef-scancode-warranty-disclaimer" ]
permissive
tomciopp/FrameworkBenchmarks
a587d81af47520010d1eda0aa4efedba9c3ef8ae
5b0e00e64b36deb46183f3c5edaa612e086c47f2
refs/heads/master
2021-06-19T03:04:25.807108
2021-02-19T00:57:28
2021-02-19T00:57:28
215,122,645
6
1
BSD-3-Clause
2020-01-26T08:02:06
2019-10-14T18:56:55
Java
UTF-8
Java
false
false
1,569
java
package com.example.helloworld.db.jdbi; import java.util.Arrays; import java.util.Comparator; import org.jdbi.v3.core.Handle; import org.jdbi.v3.core.Jdbi; import com.example.helloworld.db.WorldDAO; import com.example.helloworld.db.model.World; import com.example.helloworld.resources.Helper; public class WorldRepository implements WorldDAO { private final Jdbi jdbi; public WorldRepository(Jdbi jdbi) { this.jdbi = jdbi; } @Override public World findById(int id) { return jdbi.withExtension(WorldJDBIImpl.class, dao -> dao.findById(id)); } @Override public World[] findById(int[] ids) { return jdbi.withExtension(WorldJDBIImpl.class, dao -> { World[] worlds = new World[ids.length]; for(int i = 0; i < ids.length; i++) { worlds[i] = dao.findById(ids[i]); } return worlds; }); } @Override public World findAndModify(int id, int newRandomNumber) { throw new RuntimeException("Don't call this"); } @Override public World[] updatesQueries(int totalQueries) { try (Handle handle = jdbi.open()) { WorldJDBIImpl dao = handle.attach(WorldJDBIImpl.class); final World updates[] = new World[totalQueries]; for (int i = 0; i < totalQueries; i++) { final World world = dao.findById(Helper.randomWorld()); world.setRandomNumber(Helper.randomWorld()); updates[i] = world; } // Reason for sorting : https://github.com/TechEmpower/FrameworkBenchmarks/pull/2684 Arrays.sort(updates, Comparator.comparingInt(World::getId)); dao.update(updates); handle.commit(); return updates; } } }
efef777ced6c24a2666ca8759b2c46d5a61b4802
1cc34fd18ee0e3605a4aa493ca72f486e4646adf
/src/muscle/GrowthFactors.java
baf2d4bc6bee0d8655e36be27bdc54d96d70e2bc
[]
no_license
kbc7vn/DMD_original
fd9d32c1bfa89fed9cbc32ad83688399301ea7a6
885914a60dd5e6b9b731d226f48c8d12a8c3bb68
refs/heads/main
2023-01-18T16:10:38.716146
2020-12-02T03:19:16
2020-12-02T03:19:16
317,736,516
0
0
null
null
null
null
UTF-8
Java
false
false
14,516
java
/** * */ package muscle; import java.util.List; import repast.simphony.context.Context; import repast.simphony.engine.environment.RunEnvironment; import repast.simphony.parameter.Parameters; import repast.simphony.space.continuous.ContinuousSpace; import repast.simphony.space.grid.Grid; import repast.simphony.engine.schedule.ScheduledMethod; import repast.simphony.util.ContextUtils; /** * @author Kelley Virgilio * This class contains the growth factors for the model: getGF, setGF functions defined for all */ public class GrowthFactors { public static Grid<Object> grid; public static ContinuousSpace<Object> space; public static int activeDelay = 96; // time delay from latent to active tgf, 96 normal // DISEASE STATE PARAMETERS public static double m1MacAdded = 0; // 0 at healthy public static double m2MacAdded = 0; // 0 at healthy public static double mdxTGF = 0; // 0 at healthy //private static int activeDelay = 1; // void at healthy; add baseline active TGF static final int numGrowthFactors = 31; // Number of growth factors in model public static double[] growthFactors = new double[numGrowthFactors]; // growth factors static final int simLength = 3000 + activeDelay + 1; public static double[] activeTgf = new double[simLength]; // holds active TGF at each time step public GrowthFactors(Grid<Object> grid, ContinuousSpace<Object> space){ this.grid = grid; this.space = space; } public static double[] getGrowthFactors(){ return growthFactors; } // Growth factor solver public static double[] growthFactorSolver(double[] inflamCells, Context<Object> context){ //inflammCells: 0 RM; 1 N; 2 Na; 3 M1; 4 M1ae; 5 M1de; 6 M2 double[] growthFactorsTemp = new double[numGrowthFactors]; List<Object> activeFibroblasts = Fibroblast.getActiveFibroblasts(context);// active fibroblasts double numActiveFibrob = activeFibroblasts.size(); // number of active fibroblasts double inflamFibroblasts = 0; // fibroblasts only secrete certain factors in an inflammatory environment double inflamSSC = 0; // sscs only secrete certain factors in an inflammatory environment double numActiveSSC = SSC.getActiveSSCs(context).size(); // number of active sscs // exclude signals from fully differentiated SSCs double numActiveSecretingSSC = SSC.getNumActSecretingSSCs(context); // secreting sscs double numMyofbs = Fibroblast.getMyofibroblasts(context).size(); // number of myofibroblasts double rmNecr = 0.; // number of resident macrophages scaled to the amount of muscle damage double percentNecrotic = Necrosis.getPercentNecrotic(context); // percent of muscle that is necrotic // activation is a function of initial damage only int timestep = 1; if (percentNecrotic < 0.001){ // lower limit of damage for resident macrophages to detect rmNecr = 0; } else{ rmNecr = inflamCells[0]; // else all resident macrophages detect damage } // INFLAMMATION WEIGHTING FUNCTION: // weighting function to determine if it is a pro-inflammatory or anti-inflammatory environment double inflamWeight = (growthFactors[1]- getActiveTgf(InflamCell.getTick()))/(40.*Fiber.origFiberNumber); if (inflamWeight < 0) { inflamWeight = 0; } inflamFibroblasts = numActiveFibrob*inflamWeight; // number of fibroblasts weighted by inflammatory environment inflamSSC = numActiveSSC*inflamWeight; // number of sscs weighted by inflammatory environment double m1Mac = inflamCells[3]; // m1 macrophages double m2Mac = inflamCells[6]; // m2 macrophages // DISEASE STATE PARAMETERS // MACROPHAGE PHENOTYPE ANALYSIS: // M1: INFLAMMATORY-- add in a constant level of inflammatory M1s //m1Mac = m1Mac + m1MacAdded; // 0 added at healthy // // M2: anti-inflammatory- add in constant level of M2 //m2Mac = m2Mac + m2MacAdded; // 0 added at healthy // LIT REPLICATION SCALING PARAMTERS: Murphy et al. 2011 numActiveFibrob = numActiveFibrob*(1/Fiber.tcf4Scale); // scale secretions --> less // tcf4scale = 1 at healthy = no change inflamFibroblasts = inflamFibroblasts*(1/Fiber.tcf4Scale); // scale secretions --> less // tcf4scale = 1 at healthy = no change numActiveSecretingSSC = numActiveSecretingSSC*(1/Fiber.pax7Scale); // scale secretions --> more // pax7scale = 1 at healthy = no change inflamSSC = inflamSSC*(1/Fiber.pax7Scale); // scale secretions --> more // pax7scale = 1 at healthy = no change numMyofbs = numMyofbs*(1/Fiber.tcf4Scale); // scale secretions --> less // tcf4scale = 1 at healthy = no change // INFLAMMATORY CELLS: // 0 RM- resident macrophages // 1 N- neutrophils // 2 Na- apoptotic neutrophils // 3 M1- M1 macrophages // 4 M1ae- M1 apoptotic eating // 5 M1de- M1 debris eating // 6 M2- M2 macrophages // SECRETE GROWTH FACTORS AT EACH TIME STEP: double dtgfdt = (1*numActiveFibrob + 1*inflamCells[4] + 2*m2Mac); //tgf double dtnfdt = (1*rmNecr + 2*inflamCells[1] +2*m1Mac + 2*inflamCells[4] + 2*inflamCells[5] + .2*inflamSSC); //tnf double digf1dt = (2*numActiveFibrob + 1*m1Mac+1*inflamCells[4]+1*inflamCells[5]+1*m2Mac); //igf1 double dpdgfdt = (1*numActiveFibrob); //pdgf double dmmpxdt = (1*numActiveFibrob + 1*numActiveSecretingSSC + 1*numMyofbs);// mmpX double dactiveTGFTempdt = (2*numMyofbs);//tgf myofibroblast release double decmprotdt = (2*numActiveFibrob + 1*numActiveSecretingSSC + 1*numMyofbs);//ecmprot double dil1dt = (2*rmNecr+1*inflamCells[1]+1*m1Mac+1*inflamCells[4]+1*inflamCells[5] + 1*inflamFibroblasts + 1*numActiveSecretingSSC);//il1 double dil8dt = (1*rmNecr+1*inflamCells[1]+1*m1Mac+2*inflamCells[5] + 1*inflamFibroblasts + .2*inflamSSC);//il8 double dcxcl2dt = (1*rmNecr);//cxcl2 double dcxcl1dt = (1*rmNecr);//cxcl1 double dccl3dt = (1*rmNecr+1*inflamCells[1]-1*inflamCells[2]);//ccl3 double dccl4dt = (1*rmNecr+1*inflamCells[1]);//ccl4 double dil6dt = (1*inflamCells[1]+3*m1Mac+3*inflamCells[5] + 1*numActiveFibrob + 1*inflamSSC);//il6 double dmcpdt = (1.7*inflamCells[1] + 1*inflamFibroblasts + 1*inflamSSC);//mcp double difndt = (5*inflamCells[1]+1*inflamCells[5]);//ifn double dlactoferinsdt = (5*inflamCells[2]);//lactoferins double dhgfdt = percentNecrotic*100*5;//hgf - Released from ecm with damage // eliminated effect of apop neutrophils and released with % necrotic at damage double dvegfdt = (1*inflamCells[2]+1*m1Mac+inflamCells[4]+1*inflamCells[5]+.5*numActiveSecretingSSC);//vegf double dmmp12dt = (2*m1Mac+2*inflamCells[4]+2*inflamCells[5]+1*numActiveSecretingSSC);//mmp12 double dgcsfdt = (1*m1Mac+1*inflamCells[4]+1*inflamCells[5]);//gcsf double dil10dt = (1*m1Mac+ 0.1*inflamCells[4]+ 0.5*inflamCells[5]+1.2*m2Mac);//il10 double dlipoxinsdt = (1*inflamCells[4]+1*inflamCells[5]);//lipoxins double dresolvinsdt = (3*inflamCells[4]+2*inflamCells[5]);//resolvins double dccl17dt = (1*inflamCells[4]+2.8*m2Mac);//ccl17 double dccl22dt = (1*inflamCells[4]+1*m2Mac+1*numActiveSecretingSSC);//ccl22 double dcollagen4dt = (1*m2Mac);//collagen4 double dpge2dt = (3*m2Mac);// pge2 double drosdt = (1*inflamCells[1] + 1*inflamCells[5]);// ros double dfgfdt = numActiveFibrob; // fgf double dil4dt = 0; // il4 // GROWTH FACTOR SOLVER // add new growth factors and include half-life growthFactorsTemp[0] = (growthFactors[0] + dtgfdt)*Math.pow(.5, timestep/5.); growthFactorsTemp[1] = (growthFactors[1] + dtnfdt)*Math.pow(.5, timestep/5.); growthFactorsTemp[2] = (growthFactors[2] + digf1dt)*Math.pow(.5, timestep/5.); growthFactorsTemp[3] = (growthFactors[3] + dpdgfdt)*Math.pow(.5, timestep/5.); growthFactorsTemp[4] = (growthFactors[4] + dmmpxdt)*Math.pow(.5, timestep/5.); growthFactorsTemp[5] = (growthFactors[5] + dactiveTGFTempdt)*Math.pow(.5, timestep/5.); growthFactorsTemp[6] = (growthFactors[6] + decmprotdt)*Math.pow(.5, timestep/5.); growthFactorsTemp[7] = (growthFactors[7] + dil1dt)*Math.pow(.5, timestep/5.); growthFactorsTemp[8] = (growthFactors[8] + dil8dt)*Math.pow(.5, timestep/5.); growthFactorsTemp[9] = (growthFactors[9] + dcxcl2dt)*Math.pow(.5, timestep/5.); growthFactorsTemp[10] = (growthFactors[10] + dcxcl1dt)*Math.pow(.5, timestep/5.); growthFactorsTemp[11] = (growthFactors[11] + dccl3dt)*Math.pow(.5, timestep/5.); growthFactorsTemp[12] = (growthFactors[12] + dccl4dt)*Math.pow(.5, timestep/5.); growthFactorsTemp[13] = (growthFactors[13] + dil6dt)*Math.pow(.5, timestep/5.); growthFactorsTemp[14] = (growthFactors[14] + dmcpdt)*Math.pow(.5, timestep/5.); growthFactorsTemp[15] = (growthFactors[15] + difndt)*Math.pow(.5, timestep/5.); growthFactorsTemp[16] = (growthFactors[16] + dlactoferinsdt)*Math.pow(.5, timestep/5.); growthFactorsTemp[17] = (growthFactors[17] + dhgfdt)*Math.pow(.5, timestep/8.); // slower half-life to account for ecm breakdown/release growthFactorsTemp[18] = (growthFactors[18] + dvegfdt)*Math.pow(.5, timestep/5.); growthFactorsTemp[19] = (growthFactors[19] + dmmp12dt)*Math.pow(.5, timestep/5.); growthFactorsTemp[20] = (growthFactors[20] + dgcsfdt)*Math.pow(.5, timestep/5.); growthFactorsTemp[21] = (growthFactors[21] + dil10dt)*Math.pow(.5, timestep/5.); growthFactorsTemp[22] = (growthFactors[22] + dlipoxinsdt)*Math.pow(.5, timestep/5.); growthFactorsTemp[23] = (growthFactors[23] + dresolvinsdt)*Math.pow(.5, timestep/5.); growthFactorsTemp[24] = (growthFactors[24] + dccl17dt)*Math.pow(.5, timestep/5.); growthFactorsTemp[25] = (growthFactors[25] + dccl22dt)*Math.pow(.5, timestep/5.); growthFactorsTemp[26] = (growthFactors[26] + dcollagen4dt)*Math.pow(.5, timestep/5.); growthFactorsTemp[27] = (growthFactors[27] + dpge2dt)*Math.pow(.5, timestep/5.); growthFactorsTemp[28] = drosdt; // does not build up- flushes every step growthFactorsTemp[29] = (growthFactors[29] + dfgfdt)*Math.pow(.5, timestep/5.); growthFactorsTemp[30] = (growthFactors[30] + dil4dt)*Math.pow(.5, timestep/5.); growthFactors = growthFactorsTemp; // if growth factor below threshold == 0 if (growthFactors[0] < .0001){ growthFactors[0] = 0.; } if (growthFactors[1] < .0001){ growthFactors[1] = 0.; } // DISEASE STATE PARAMETERS // // LEMOS REPLICATION: ANTI-TNF at day 3,4,5,6 // if (InflamCell.getTick() >= 60 && InflamCell.getTick() < 144){ // growthFactors[1] = 0.; // } // // Full TNF block //growthFactors[1] = 0.; // // if (growthFactors[2] < .0001){ growthFactors[2] = 0.; } if (growthFactors[3] < .0001){ growthFactors[3] = 0.; } if (growthFactors[4] < .0001){ growthFactors[4] = 0.; } if (growthFactors[5] < .0001){ growthFactors[5] = 0.; } if (growthFactors[6] < .0001){ growthFactors[6] = 0.; } if (growthFactors[7] < .0001){ growthFactors[7] = 0.; } if (growthFactors[8] < .0001){ growthFactors[8] = 0.; } if (growthFactors[9] < .0001){ growthFactors[9] = 0.; } if (growthFactors[10] < .0001){ growthFactors[10] = 0.; } if (growthFactors[11] < .0001){ growthFactors[11] = 0.; } if (growthFactors[12] < .0001){ growthFactors[12] = 0.; } if (growthFactors[13] < .0001){ growthFactors[13] = 0.; } if (growthFactors[14] < .0001){ growthFactors[14] = 0.; } if (growthFactors[15] < .0001){ growthFactors[15] = 0.; } if (growthFactors[16] < .0001){ growthFactors[16] = 0.; } if (growthFactors[17] < .0001){ growthFactors[17] = 0.; } if (growthFactors[18] < .0001){ growthFactors[18] = 0.; } if (growthFactors[19] < .0001){ growthFactors[19] = 0.; } if (growthFactors[20] < .0001){ growthFactors[20] = 0.; } if (growthFactors[21] < .0001){ growthFactors[21] = 0.; } if (growthFactors[22] < .0001){ growthFactors[22] = 0.; } if (growthFactors[23] < .0001){ growthFactors[23] = 0.; } if (growthFactors[24] < .0001){ growthFactors[24] = 0.; } if (growthFactors[25] < .0001){ growthFactors[25] = 0.; } if (growthFactors[26] < .0001){ growthFactors[26] = 0.; } if (growthFactors[27] < .0001){ growthFactors[27] = 0.; } if (growthFactors[28] < .0001){ growthFactors[28] = 0.; } if (growthFactors[29] < .0001){ growthFactors[29] = 0.; } if (growthFactors[30] < .0001){ growthFactors[30] = 0.; } return growthFactors; } // Calculate active-TGFbeta public static void initializeActiveTgf(){ for (int i = 0; i < activeDelay; i++){ activeTgf[i] = 0 + mdxTGF; } } public static void setActiveTgf(int tick){ // at each time step, store the amount of active tgf activeTgf[tick + activeDelay] = growthFactors[0] + mdxTGF; //activeTgf[tick + activeDelay] = 0; // TEST: block active tgf } public static double getActiveTgf(int tick){ return activeTgf[tick] + growthFactors[5]; //return 0; // TEST: block active tgf } // get growth factors: public double getTgf(){ return growthFactors[0]; } public double getTnf(){ return growthFactors[1] + Fiber.mdxTnf; } public double getIgf1(){ return growthFactors[2]; } public double getPdgf(){ return growthFactors[3]; } public double getMmpx(){ return growthFactors[4]; } public double getCollagenX(){ return growthFactors[5]; } public double getEcmprot(){ return growthFactors[6]; } public double getIl1(){ return growthFactors[7]; } public double getIl8(){ return growthFactors[8]; } public double getCxcl2(){ return growthFactors[9]; } public double getCxcl1(){ return growthFactors[10]; } public double getCcl3(){ return growthFactors[11]; } public double getCcl4(){ return growthFactors[12]; } public double getIl6(){ return growthFactors[13]; } public double getMcp(){ return growthFactors[14]; } public double getIfn(){ return growthFactors[15] + Fiber.mdxIfn; } public double getLactoferins(){ return growthFactors[16]; } public double getHgf(){ return growthFactors[17]; } public double getVegf(){ return growthFactors[18]; } public double getMmp12(){ return growthFactors[19]; } public double getGcsf(){ return growthFactors[20]; } public double getIl10(){ return growthFactors[21]; } public double getLipoxins(){ return growthFactors[22]; } public double getResolvins(){ return growthFactors[23]; } public double getCcl17(){ return growthFactors[24]; } public double getCcl22(){ return growthFactors[25]; } public double getCollagen4(){ return growthFactors[26]; } public double getPge2(){ return growthFactors[27]; } public double getRos(){ return growthFactors[28]; } public double getFgf(){ return growthFactors[29]; } }
a405afe93dd367276f071b5e3732a30ac71e8e74
74120da1dae4f768850d0259f85ddf71a2854ca0
/progs/java/NumPattern.java
9d78963b074e631cd6a3586f73b8113c6bcda6a8
[]
no_license
hemantborole/config_files
be8b40703ed65a1f26cc3093040626d7778fcae4
4570b8628e27e06d345af3fc312beb3555787d15
refs/heads/master
2021-01-19T18:58:19.941430
2016-03-01T23:10:52
2016-03-01T23:10:52
28,241,069
0
0
null
null
null
null
UTF-8
Java
false
false
120
java
public class NumPattern { public static void main(String a[]) { System.out.println(a[0].matches("^\\d+$")); } }
a12e8c29cb0bcc5f92651cf948e0a5858cb694a1
383ed1f5addd61956a11fa84143c9d8ca2c47e39
/dev/src/main/java/com/attendU/dev/microservices/user/UserServer.java
a97810f1ec3269d757a09cad509852390f32dede
[]
no_license
zmr227/Attendance-App
c9040162e621007775e6b406a1b7259c83fb299c
f72aa523b7703e9372c6d91a0956689400f495bc
refs/heads/master
2020-04-17T18:56:22.028114
2019-01-21T07:55:36
2019-01-21T07:55:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
723
java
package com.attendU.dev.microservices.user; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.loadbalancer.LoadBalanced; import org.springframework.context.annotation.Bean; import org.springframework.web.client.RestTemplate; @EnableDiscoveryClient @SpringBootApplication public class UserServer { public static void main(String[] args) { System.setProperty("spring.config.name", "UserServer"); SpringApplication.run(UserServer.class, args); } @LoadBalanced @Bean RestTemplate restTemplate() { return new RestTemplate(); } }
37d75e6b7238f8245f970d5e8489c64b05405535
4679765abe2f358c38b4c400d9168c27705acbce
/src/main/java/com/ironhack/MidtermProject/controller/impl/user/AccountHolderControllerImpl.java
2c1696ac65b00dc0776d27a0777b4cef450aef66
[]
no_license
JoseteSoria/Midterm-Project
10b4656e759474b6ac77a83c301af43a68cf6a15
19b096adaa256cabeda9aa9efc1331fa48cb69a0
refs/heads/master
2022-11-08T01:30:04.872947
2020-06-29T06:45:35
2020-06-29T06:45:35
273,775,586
0
0
null
null
null
null
UTF-8
Java
false
false
2,696
java
package com.ironhack.MidtermProject.controller.impl.user; import com.ironhack.MidtermProject.controller.interfaces.user.AccountHolderController; import com.ironhack.MidtermProject.dto.AccountMainFields; import com.ironhack.MidtermProject.model.user.AccountHolder; import com.ironhack.MidtermProject.model.user.User; import com.ironhack.MidtermProject.service.user.AccountHolderService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; import java.util.Currency; import java.util.List; @RestController public class AccountHolderControllerImpl implements AccountHolderController { @Autowired private AccountHolderService accountHolderService; @GetMapping("/account-holders") @ResponseStatus(code = HttpStatus.OK) public List<AccountHolder> findAll() { return accountHolderService.findAll(); } @GetMapping("/account-holders/{id}") @ResponseStatus(code = HttpStatus.OK) public AccountHolder findById(@AuthenticationPrincipal User user, @PathVariable Integer id) { return accountHolderService.checkFindById(id, user); } @GetMapping("/account-holders/{id}/accounts") @ResponseStatus(code = HttpStatus.OK) public List<AccountMainFields> findAllAccountById(@AuthenticationPrincipal User user, @PathVariable Integer id) { return accountHolderService.findAllAccountAsPrimaryOwnerById(id, user); } @PostMapping("/account-holders") @ResponseStatus(code = HttpStatus.CREATED) public AccountHolder create(@RequestBody AccountHolder accountHolder) { return accountHolderService.store(accountHolder); } @PatchMapping("/account-holders/logged-in/{looggedIn}") @ResponseStatus(code = HttpStatus.NO_CONTENT) public void setLogged(@AuthenticationPrincipal User user, @PathVariable(name = "looggedIn") boolean loggedIn) { accountHolderService.setLogged(user, loggedIn); } @PostMapping("/account-holders/transference/{id}") @ResponseStatus(code = HttpStatus.ACCEPTED) public void transference(@AuthenticationPrincipal User user, @PathVariable Integer id, @RequestParam(name = "receiver-account-id") Integer receiverId, @RequestParam(name = "amount") BigDecimal amount, @RequestParam(name = "currency", required = false) Currency currency) { accountHolderService.prepareTransference(user, id, receiverId, amount, currency); } }
84d0708a36aefee7aacde99c5e2bf7e0c742def5
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Chart/16/org/jfree/chart/axis/DateTickUnit_rollDate_267.java
d572761cebab362af75846dc75ce53b5ac5684c7
[]
no_license
hvdthong/NetML
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
9bb103da21327912e5a29cbf9be9ff4d058731a5
refs/heads/master
2021-06-30T15:03:52.618255
2020-10-07T01:58:48
2020-10-07T01:58:48
150,383,588
1
1
null
2018-09-26T07:08:45
2018-09-26T07:08:44
null
UTF-8
Java
false
false
879
java
org jfree chart axi tick unit subclass link date axi dateaxi instanc immut date tick unit datetickunit tick unit tickunit serializ roll date forward amount roll unit count param base base date roll date roll date rolldat date time zone timezon date roll date rolldat date base calendar calendar calendar instanc getinst calendar set time settim base calendar add calendar field getcalendarfield roll unit rollunit roll count rollcount calendar time gettim
38d0d886b9f1b5acbdb633afe1ef8e22d4cb0667
474986ebbf0284f2c097385d73bbe6a829db4c0c
/MultiplayerTest/src/cz/opt/networking/SocketListener.java
6ff38671b67d05938c2d8feef763ce7a08b30574
[]
no_license
Opticalll/Tanks
9cf26726f3aae4d8b9c12549529d0d458c65fec6
3cff8b38f40fb6beffba8393e67a3b5ecc2adb26
refs/heads/master
2016-09-05T14:50:41.607299
2012-11-09T17:33:42
2012-11-09T17:33:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
168
java
package cz.opt.networking; import java.awt.event.ActionListener; public interface SocketListener extends ActionListener { void socketReadyRead(SocketEvent event); }
0718b4e36b1307cefd2980eb4b731d21e218cae7
7b647ef880390c033524ecf98d2aafe4d58d125d
/kratos/kratos-system/src/main/java/com/logikas/common/validation/constraints/Uniqueness.java
1c688a85f31b1b0fa42372a4f92507a0c308ab3a
[]
no_license
csrinaldi/standard-erp
f5c33983c223cf3ce4bfaaeaf264741dcabebe90
e12239e7760e658ecce98faf8ee2430559823f18
refs/heads/master
2016-09-05T15:06:19.858120
2013-06-21T12:42:56
2013-06-21T12:42:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,399
java
/** * */ package com.logikas.common.validation.constraints; import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.CONSTRUCTOR; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import javax.validation.Constraint; import javax.validation.Payload; /** * @author Andrés Testi ([email protected]) * @since 04/01/2013 */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @Constraint(validatedBy = UniquenessValidator.class) public @interface Uniqueness { String message() default "{com.quiencotiza.common.validation.constraints.Uniqueness.message}"; Class<?>[] groups() default {}; Class<? extends Payload>[] payload() default {}; String[] value(); /** * Defines several <code>@Uniqueness</code> annotations on the same element * @see Uniqueness * */ @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER }) @Retention(RUNTIME) @Documented @interface List { Uniqueness[] value(); } }
0ee1425d50787404129a75ed1123f88e04f67309
97340a9928a5bedf2962073361b0b63982d6c503
/game/src/cn/qziedu/game/pojo/Fabuinfo.java
e92e48522f900157d446bac89c92968b9cefb8f9
[]
no_license
wengcong1300/wengcong
bdb677fd2ba2fca5064cdb0f8dd2a425ca5f67a0
80075cb1e1d54b5c46b0a3f395bda66f895760bf
refs/heads/main
2023-04-25T06:14:33.599283
2021-04-03T13:58:02
2021-04-03T13:58:02
354,304,535
0
0
null
null
null
null
UTF-8
Java
false
false
2,162
java
package cn.qziedu.game.pojo; import java.util.Date; public class Fabuinfo { private Integer id; private String gamename; private String miaoshu; private String guize; private Date time1; private Date time2; private Date time3; private Date time4; private Integer userid; private Integer buildid; private Integer number; private Integer money; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getGamename() { return gamename; } public void setGamename(String gamename) { this.gamename = gamename == null ? null : gamename.trim(); } public String getMiaoshu() { return miaoshu; } public void setMiaoshu(String miaoshu) { this.miaoshu = miaoshu == null ? null : miaoshu.trim(); } public String getGuize() { return guize; } public void setGuize(String guize) { this.guize = guize == null ? null : guize.trim(); } public Date getTime1() { return time1; } public void setTime1(Date time1) { this.time1 = time1; } public Date getTime2() { return time2; } public void setTime2(Date time2) { this.time2 = time2; } public Date getTime3() { return time3; } public void setTime3(Date time3) { this.time3 = time3; } public Date getTime4() { return time4; } public void setTime4(Date time4) { this.time4 = time4; } public Integer getUserid() { return userid; } public void setUserid(Integer userid) { this.userid = userid; } public Integer getBuildid() { return buildid; } public void setBuildid(Integer buildid) { this.buildid = buildid; } public Integer getNumber() { return number; } public void setNumber(Integer number) { this.number = number; } public Integer getMoney() { return money; } public void setMoney(Integer money) { this.money = money; } }
efb058d9463073bc572b33b642a857f2151da7bc
4c269e8a93a0c4f36f9cbfe729e7a19b11dec3be
/PlusOne.java
1d5975ff098e15769db8fb838d7ec483056eca3a
[]
no_license
zbs881314/Data-Structure---Algorithm
08a836d5642b274361bbbcd7bdc53d70857b024b
c7466fb6d341da26a166069d73cf62b470f6c079
refs/heads/master
2020-04-19T19:12:46.083798
2019-03-23T02:14:53
2019-03-23T02:14:53
168,382,810
0
0
null
null
null
null
UTF-8
Java
false
false
1,174
java
class Solution { public int[] plusOne(int[] digits) { int n = digits.length; for(int i=n-1; i>=0; i--) { if(digits[i] < 9) { digits[i]++; return digits; } digits[i] = 0; } int[] newNumber = new int[n+1]; newNumber[0] = 1; return newNumber; } } // method 2 python // we are given a list of digits, and the idea here is to convert that list to an // integer, num. So each digit is multiplited by the proper place value and added to // num. For example, if digits=[3, 8, 2, 5] then on the first iteration 3 is // multiplied by 10 to the power of 4-1-0=3, so this results in 3000, which is added // to num. Then 8 is multiplied by 10^2 and added to num, and so on. The last step // is to add 1 to num, convert it to a list and return that list. def plusOne(digits): num = 0 for i in range(len(digits)): num += digits[i] * pow(10, (len(digits)-1-i)) return [int(i) for i in str(num+1)] def plusOne2(self, digits): for i in range(len(digits)-1, -1, -1): if digits[i] < 9: digits[i] = digits[i] + 1 return digits else: digits[i] = 0 digits.insert(0, 1) return digits
7f9b748715bc1fa9c710a1d40f4b7901e6de3a53
c4f6894cc23fae7de47ecad9a9592bb7d422f985
/sharedLib/src/main/java/de/furdevs/discordBot/sharedLib/configuration/model/Handler.java
4d0cfe34b169824604a44ad23e0baa261a638986
[]
no_license
FurDevs/discordBot
1d702bba7933e401b3c6d26bfa358b7903fc61e4
cd89c44452256de18c8e353936cd476d09f0177e
refs/heads/master
2020-05-27T15:02:49.646641
2019-06-26T11:40:45
2019-06-26T11:40:45
188,576,956
0
0
null
null
null
null
UTF-8
Java
false
false
113
java
package de.furdevs.discordBot.sharedLib.configuration.model; public class Handler { private String name; }
cce7c2d85c6234b57dbba8e721a59e71f5c1efd8
e6940138b8ff274c3bb8a85e37616ffcc8000713
/src/code/GenericDynamicArray/lab-code/src/trivera/storage/StringArrayTest.java
9d14ccb2066a4c1e087238ed916cefd29e05af88
[]
no_license
cloudacademy/javaadv-lab2-cli
4000bfb9e695af7b24d44cf803ede2aa076cb193
9f48ca95ce0e63c95e6db457155d540f983c3339
refs/heads/master
2023-01-15T17:39:35.701559
2020-11-03T06:59:03
2020-11-03T06:59:03
256,445,208
0
0
null
null
null
null
UTF-8
Java
false
false
501
java
package trivera.storage; import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; class StringArrayTest { @BeforeAll public static void log() { System.out.println("Exercise: GenericDynamicArray - StringArrayTest"); System.out.println("Type: solution-code"); System.out.println("Java: " + System.getProperty("java.version")); } //CODE7:Implement Tests to test ObjectArray<String> array }
bf692817a6e6a9334cb4a8ce8a10d69a4921675e
e3d8c9f0884ddffcfbf3c6777371c0366f54bdfc
/src/api/web/gw2/jsonp/v2/traits/JsonpTraitSkill.java
b247a7f9d3b4a4ba90f66af09f969c7683613ad0
[]
no_license
fabricebouye/gw2-web-api-jsonp
c82fafe223fcb022a1f16cfd622914e4a0d05c63
0dcb81a00ee5b80c90982e1a280a10c81aecb796
refs/heads/master
2020-04-04T07:05:30.932965
2019-04-25T02:12:31
2019-04-25T02:12:31
38,599,044
3
0
null
null
null
null
UTF-8
Java
false
false
1,957
java
/* * Copyright (C) 2015-2019 Fabrice Bouyé * All rights reserved. * * This software may be modified and distributed under the terms * of the BSD license. See the LICENSE file for details. */ package api.web.gw2.jsonp.v2.traits; import api.web.gw2.jsonp.core.RuntimeType; import api.web.gw2.mapping.core.IdValue; import api.web.gw2.mapping.core.LocalizedResource; import api.web.gw2.mapping.core.SetValue; import api.web.gw2.mapping.core.URLReference; import api.web.gw2.mapping.core.URLValue; import api.web.gw2.mapping.v2.traits.TraitFact; import api.web.gw2.mapping.v2.traits.TraitSkill; import java.util.Collections; import java.util.Set; /** * Default JSON-P implementation of a trait skill. * * @author Fabrice Bouyé */ public final class JsonpTraitSkill implements TraitSkill { @IdValue private int id = IdValue.DEFAULT_INTEGER_ID; @LocalizedResource private String name = LocalizedResource.DEFAULT; @URLValue private URLReference icon = URLReference.empty(); @LocalizedResource private String description = LocalizedResource.DEFAULT; @SetValue @RuntimeType(selector = "type", pattern = "Trait%sFact") // NOI18N. private Set<TraitFact> facts = Collections.EMPTY_SET; @SetValue @RuntimeType(selector = "type", pattern = "Trait%sFact") // NOI18N. private Set<TraitFact> traitedFacts = Collections.EMPTY_SET; /** * Creates a new empty instance. */ public JsonpTraitSkill() { } @Override public int getId() { return id; } @Override public String getName() { return name; } @Override public URLReference getIcon() { return icon; } @Override public String getDescription() { return description; } @Override public Set<TraitFact> getFacts() { return facts; } @Override public Set<TraitFact> getTraitedFacts() { return traitedFacts; } }
a2279478dd5438bfa12773c83ee43cb79090621f
02c1dc0cbaab9b51f0e112b0f9aa4b808adc2f16
/jms-consumer/src/main/java/com/github/kazuki43zoo/sample/api/controller/todo/TodosController.java
cfa7c17eb1c1ea14907e0af5f5851f2058d52c1c
[]
no_license
lenicliu/spring-boot-multi-sample
21f51169e54cfe1849e827fb0c20dd279d2e4dd0
7593689e719c0e8635833cf3ca1a23fe98079a9e
refs/heads/master
2021-01-16T21:32:39.928966
2016-04-10T02:19:53
2016-04-10T02:19:53
56,490,669
1
0
null
2016-04-18T08:32:06
2016-04-18T08:32:05
null
UTF-8
Java
false
false
1,109
java
package com.github.kazuki43zoo.sample.api.controller.todo; import com.github.kazuki43zoo.sample.domain.model.Todo; import com.github.kazuki43zoo.sample.domain.service.TodoService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jms.annotation.JmsListener; import org.springframework.messaging.handler.annotation.Header; import org.springframework.stereotype.Controller; import java.util.Optional; import java.util.UUID; @Controller public class TodosController { @Autowired TodoService todoService; @JmsListener(destination = "todo") public void create(TodoResource newResource , @Header(name = "username", defaultValue = "anonymousUser") String username , @Header(name = "trackingId", required = false) String trackingId ) { Todo newTodo = new Todo(); BeanUtils.copyProperties(newResource, newTodo); newTodo.setTrackingId(Optional.ofNullable(trackingId).orElse(UUID.randomUUID().toString())); todoService.create(newTodo, username); } }
18ec5ec25094581237067d383bbf10f1c1bd556c
1ee75d7fab3f1ed2747d26da0e35d854fc3c14f3
/src/main/java/com/github/xiaoy/droolrule/mapper/RuleConfigInfoMapper.java
6ac6344b777b228716b99a03bb94b7e4048c4738
[]
no_license
wwkin/drool-rule
604868b784465c5f6df87e0f175d6547bb528038
76f211044959b147e496e74016c3d782a7b0b105
refs/heads/master
2023-03-15T06:52:03.002270
2021-01-13T08:31:01
2021-01-13T08:31:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
288
java
package com.github.xiaoy.droolrule.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.xiaoy.droolrule.entity.RuleConfigInfo; import org.apache.ibatis.annotations.Mapper; @Mapper public interface RuleConfigInfoMapper extends BaseMapper<RuleConfigInfo> { }
463b3af2b99c300a9b11aa052fb6c9d34b6f57de
afdae9d6baf7abecee8c9cedaea514e9db163c0d
/src/test/java/support/Pages/ibe_desktop/Page1.java
ca01964020c62281ff1e116e2034dfed43e1008b
[]
no_license
andieroseumilda/Noccbooking
fb12ceda248d3c57ea5ce3c0a3cd6712011563a8
a3239778a9f1aa984da31399a35d3b2e5a4e30e8
refs/heads/master
2021-08-23T13:01:01.668644
2017-12-05T00:47:06
2017-12-05T00:47:06
113,110,975
0
0
null
null
null
null
UTF-8
Java
false
false
2,872
java
package support.Pages.ibe_desktop; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.ui.WebDriverWait; import static org.openqa.selenium.support.ui.ExpectedConditions.elementToBeClickable; import support.Locators.ibe_desktop.LocatorStep1; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.HashMap; public class Page1 { private WebDriverWait wait; private LocatorStep1 step1; private JavascriptExecutor scroll; private int get_day_format = Calendar.DATE; private DateFormat date_format = new SimpleDateFormat("d"); public Page1(WebDriver driver) { PageFactory.initElements(driver, this); this.wait = new WebDriverWait(driver, 10); JavascriptExecutor scrollDown = (JavascriptExecutor) driver; this.scroll = scrollDown; step1 = new LocatorStep1(driver); } public void step1_stayDates(int arrival, int departure) throws InterruptedException { HashMap stay_dates = getStayDates(arrival, departure); checkDate((String) stay_dates.get("arrival")); checkDate((String) stay_dates.get("departure")); scroll.executeScript("window.scrollBy(0,250)",""); step1.getViewRoomAndPricesButton().click(); Thread.sleep(10000); } public HashMap getStayDates(int arrival, int departure) { HashMap stay_dates = new HashMap(); stay_dates.put("arrival", formatDate(arrival) ); stay_dates.put("departure", formatDate(departure)); return stay_dates; } public String formatDate(int desiredDate) { Calendar day = Calendar.getInstance(); day.add(get_day_format, desiredDate); Date set_date2 = day.getTime(); return String.valueOf(date_format.format(set_date2)); } public void checkDate(String date) { wait.until(elementToBeClickable(By.linkText(date))).click(); } // public HashMap getStayDates(int arrival, int no_of_nights) { // // // Compute Arrival // Calendar arrival_day = Calendar.getInstance(); // arrival_day.add(get_day_format, arrival); // String arr = formatDate(arrival_day); // // // Compute Departure // arrival_day.add(get_day_format, no_of_nights); // String dep = formatDate(arrival_day); // // // Return Stay Dates // HashMap stay_dates = new HashMap(); // stay_dates.put("arrival", arr ); // stay_dates.put("departure", dep); // return stay_dates; // } // // public String formatDate(Calendar date) { // Date set_date2 = date.getTime(); // return String.valueOf(date_format.format(set_date2)); // } }
1371f0d7eda8a456198e19e9a5b17688e7f6f363
4d3cc21d95d93735d9640a6125021a43bae55393
/material_design_pro2/app/src/main/java/multi/android/material_design_pro2/recycler/SimpleItem.java
6d197c56be31807ca8b6f7de5d0148ab857d51af
[]
no_license
yuhwanwoo/android
2659eef858aabbab7dad86a0bf34693be1869ebc
88ae0c17fe36d50b708c10216b3772a0e29ecf92
refs/heads/master
2021-05-16T22:30:15.518704
2020-05-25T04:13:53
2020-05-25T04:13:53
250,430,700
0
0
null
null
null
null
UTF-8
Java
false
false
450
java
package multi.android.material_design_pro2.recycler; //RecyclerView의 한 항목을 구성하는 데이터를 저장하는 객체 public class SimpleItem { String data; public SimpleItem(String data) { this.data = data; } public String getData() { return data; } @Override public String toString() { return "SimpleItem{" + "data='" + data + '\'' + '}'; } }
a2225a32e5452633cac0a16487a26f08b4944343
8fd46e13a75d648767338a49753b88086ca7609b
/numberone-framework/src/main/java/com/numberone/framework/shiro/web/filter/sync/SyncOnlineSessionFilter.java
8c29b93528145e8bc92d64f330f89a8c83ea596c
[ "MIT" ]
permissive
wangrifeng/numberone-springboot
14198b57430ec4d0f110baeb17662052fbb5ba3c
82a6f913afe8034a88804d78160f4f22658d418b
refs/heads/master
2022-09-14T23:38:42.468813
2020-02-21T03:58:40
2020-02-21T03:58:40
238,162,726
1
1
MIT
2022-09-01T23:19:50
2020-02-04T08:57:55
Java
UTF-8
Java
false
false
1,313
java
package com.numberone.framework.shiro.web.filter.sync; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import org.apache.shiro.web.filter.PathMatchingFilter; import org.springframework.beans.factory.annotation.Autowired; import com.numberone.common.constant.ShiroConstants; import com.numberone.framework.shiro.session.OnlineSession; import com.numberone.framework.shiro.session.OnlineSessionDAO; /** * 同步Session数据到Db * * @author numberone */ public class SyncOnlineSessionFilter extends PathMatchingFilter { @Autowired private OnlineSessionDAO onlineSessionDAO; /** * 同步会话数据到DB 一次请求最多同步一次 防止过多处理 需要放到Shiro过滤器之前 */ @Override protected boolean onPreHandle(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception { OnlineSession session = (OnlineSession) request.getAttribute(ShiroConstants.ONLINE_SESSION); // 如果session stop了 也不同步 // session停止时间,如果stopTimestamp不为null,则代表已停止 if (session != null && session.getUserId() != null && session.getStopTimestamp() == null) { onlineSessionDAO.syncToDb(session); } return true; } }
0478e87d6e42f5ea32754707b833960cd0207c82
a7885001c90a07d28fd502452647cdea5679a997
/demo/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/androidx/asynclayoutinflater/R.java
cc7ee2fa9305f5ec47c20e470c377743060c8e2b
[]
no_license
petaniiklan/nozbottomnavigation
f29036fd2f8519a7e8c1141252c8cbd18da0a3e9
04e7039a92b655266d1deb7a274e972ba5694172
refs/heads/master
2020-04-14T12:26:32.577697
2019-01-02T16:33:13
2019-01-02T16:33:13
163,840,121
0
0
null
null
null
null
UTF-8
Java
false
false
10,459
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package androidx.asynclayoutinflater; public final class R { private R() {} public static final class attr { private attr() {} public static final int alpha = 0x7f040028; public static final int font = 0x7f0400d5; public static final int fontProviderAuthority = 0x7f0400d7; public static final int fontProviderCerts = 0x7f0400d8; public static final int fontProviderFetchStrategy = 0x7f0400d9; public static final int fontProviderFetchTimeout = 0x7f0400da; public static final int fontProviderPackage = 0x7f0400db; public static final int fontProviderQuery = 0x7f0400dc; public static final int fontStyle = 0x7f0400dd; public static final int fontVariationSettings = 0x7f0400de; public static final int fontWeight = 0x7f0400df; public static final int ttcIndex = 0x7f0401d8; } public static final class color { private color() {} public static final int notification_action_color_filter = 0x7f06007e; public static final int notification_icon_bg_color = 0x7f06007f; public static final int ripple_material_light = 0x7f060089; public static final int secondary_text_default_material_light = 0x7f06008b; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f070077; public static final int compat_button_inset_vertical_material = 0x7f070078; public static final int compat_button_padding_horizontal_material = 0x7f070079; public static final int compat_button_padding_vertical_material = 0x7f07007a; public static final int compat_control_corner_material = 0x7f07007b; public static final int compat_notification_large_icon_max_height = 0x7f07007c; public static final int compat_notification_large_icon_max_width = 0x7f07007d; public static final int notification_action_icon_size = 0x7f07010a; public static final int notification_action_text_size = 0x7f07010b; public static final int notification_big_circle_margin = 0x7f07010c; public static final int notification_content_margin_start = 0x7f07010d; public static final int notification_large_icon_height = 0x7f07010e; public static final int notification_large_icon_width = 0x7f07010f; public static final int notification_main_column_padding_top = 0x7f070110; public static final int notification_media_narrow_margin = 0x7f070111; public static final int notification_right_icon_size = 0x7f070112; public static final int notification_right_side_padding_top = 0x7f070113; public static final int notification_small_icon_background_padding = 0x7f070114; public static final int notification_small_icon_size_as_large = 0x7f070115; public static final int notification_subtext_size = 0x7f070116; public static final int notification_top_pad = 0x7f070117; public static final int notification_top_pad_large_text = 0x7f070118; } public static final class drawable { private drawable() {} public static final int notification_action_background = 0x7f080070; public static final int notification_bg = 0x7f080072; public static final int notification_bg_low = 0x7f080073; public static final int notification_bg_low_normal = 0x7f080074; public static final int notification_bg_low_pressed = 0x7f080075; public static final int notification_bg_normal = 0x7f080076; public static final int notification_bg_normal_pressed = 0x7f080077; public static final int notification_icon_background = 0x7f080078; public static final int notification_template_icon_bg = 0x7f080079; public static final int notification_template_icon_low_bg = 0x7f08007a; public static final int notification_tile_bg = 0x7f08007b; public static final int notify_panel_notification_icon_bg = 0x7f08007c; } public static final class id { private id() {} public static final int action_container = 0x7f09000d; public static final int action_divider = 0x7f09000f; public static final int action_image = 0x7f090010; public static final int action_text = 0x7f090016; public static final int actions = 0x7f090017; public static final int async = 0x7f09001d; public static final int blocking = 0x7f090020; public static final int chronometer = 0x7f090030; public static final int forever = 0x7f09004f; public static final int icon = 0x7f09005c; public static final int icon_group = 0x7f09005d; public static final int info = 0x7f090060; public static final int italic = 0x7f090061; public static final int line1 = 0x7f090069; public static final int line3 = 0x7f09006a; public static final int normal = 0x7f090077; public static final int notification_background = 0x7f090078; public static final int notification_main_column = 0x7f090079; public static final int notification_main_column_container = 0x7f09007a; public static final int right_icon = 0x7f090084; public static final int right_side = 0x7f090085; public static final int tag_transition_group = 0x7f0900b0; public static final int tag_unhandled_key_event_manager = 0x7f0900b1; public static final int tag_unhandled_key_listeners = 0x7f0900b2; public static final int text = 0x7f0900b3; public static final int text2 = 0x7f0900b4; public static final int time = 0x7f0900bc; public static final int title = 0x7f0900bd; } public static final class integer { private integer() {} public static final int status_bar_notification_info_maxnum = 0x7f0a000e; } public static final class layout { private layout() {} public static final int notification_action = 0x7f0c0032; public static final int notification_action_tombstone = 0x7f0c0033; public static final int notification_template_custom_big = 0x7f0c0034; public static final int notification_template_icon_group = 0x7f0c0035; public static final int notification_template_part_chronometer = 0x7f0c0036; public static final int notification_template_part_time = 0x7f0c0037; } public static final class string { private string() {} public static final int status_bar_notification_info_overflow = 0x7f0f003b; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f10011a; public static final int TextAppearance_Compat_Notification_Info = 0x7f10011b; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f10011c; public static final int TextAppearance_Compat_Notification_Time = 0x7f10011d; public static final int TextAppearance_Compat_Notification_Title = 0x7f10011e; public static final int Widget_Compat_NotificationActionContainer = 0x7f1001c4; public static final int Widget_Compat_NotificationActionText = 0x7f1001c5; } public static final class styleable { private styleable() {} public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f040028 }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] FontFamily = { 0x7f0400d7, 0x7f0400d8, 0x7f0400d9, 0x7f0400da, 0x7f0400db, 0x7f0400dc }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f0400d5, 0x7f0400dd, 0x7f0400de, 0x7f0400df, 0x7f0401d8 }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
6423e8553633f9481ab6422b8955131708c88a35
74ebe5cf824768f33a28cce80845ca077e6d9c56
/java/mall-mid/src/main/java/org/xfh/mid/vo/BizError.java
0ec3934113d24bd7df6eebc16ae3a0d788f0bf4f
[ "MIT" ]
permissive
xiaofeipapa/VueEShop
cbc5de87d88a5dfd6598c3f3af417733ff626a98
50cb476e5642fd4f82dcb43c30ae48f00de0fb60
refs/heads/master
2022-04-25T09:11:32.851390
2020-04-28T01:14:54
2020-04-28T01:14:54
259,184,565
2
0
MIT
2020-04-27T09:53:01
2020-04-27T02:31:40
Java
UTF-8
Java
false
false
387
java
package org.xfh.mid.vo; public class BizError { Long id; String msg; public BizError() { super(); } public BizError(Long id, String msg) { super(); this.id = id; this.msg = msg; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } }
7cf489698f1eb267e9db1a0f4dc77b03feda1d00
032ce8435aafa62ddf1fe109d6e742c28bc84a57
/app/src/androidTest/java/app/inacap/casinoqr/com/casinoqr/ExampleInstrumentedTest.java
e3bcd0784a27739cd50d42491353dacf83a66049
[]
no_license
monkirojas/CasinoQR
074e8593b45febba3d4fe706dd179faced61eed8
a80b472745ca4f666f602312ac73c6103df0721f
refs/heads/master
2020-03-21T19:19:39.863655
2018-06-27T23:15:55
2018-06-27T23:15:55
138,942,387
0
0
null
null
null
null
UTF-8
Java
false
false
748
java
package app.inacap.casinoqr.com.casinoqr; 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("app.inacap.casinoqr.com.casinoqr", appContext.getPackageName()); } }
9d843b4625cf78bc2f5a36ada8cd032f98d28fa0
9666775c005d7bb582619a95e02c8a9e1e86ec98
/Puzzle-Runner/src/com/earthquakeunicorn/puzzlerunner/screens/GameScreen.java
420c40f709cd7f6881963c5a09aba83d7a769f6b
[]
no_license
mikefoley101/Puzzle-Runner
0ef28e9cd2278d969b0c3e99cb2d18c10f9b9048
d885b14aad06a5b2152cd5d6f50fb85b3f1ba746
refs/heads/master
2021-01-22T03:08:38.173988
2013-05-29T15:23:02
2013-05-29T15:23:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,993
java
package com.earthquakeunicorn.puzzlerunner.screens; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Vector2; import com.earthquakeunicorn.puzzlerunner.HUD; import com.earthquakeunicorn.puzzlerunner.InputHandler; import com.earthquakeunicorn.puzzlerunner.Level; import com.earthquakeunicorn.puzzlerunner.LevelBuilder; import com.earthquakeunicorn.puzzlerunner.PuzzleRunner; public class GameScreen implements Screen { public static Level level; public static OrthographicCamera camera; private Rectangle viewport; private Texture bg; SpriteBatch batch; PuzzleRunner game; HUD hud; private static final int VIRTUAL_WIDTH = 800; private static final int VIRTUAL_HEIGHT = 480; private static final float ASPECT_RATIO = (float)VIRTUAL_WIDTH/(float)VIRTUAL_HEIGHT; public static enum State { win, lose, pause, playing } public static State state; public GameScreen(PuzzleRunner game, String levelPath) { level = LevelBuilder.buildLevel(levelPath); this.game = game; batch = new SpriteBatch(); camera = new OrthographicCamera(); camera.setToOrtho(false, VIRTUAL_WIDTH, VIRTUAL_HEIGHT); bg = new Texture(Gdx.files.internal("textures/cityscape.png")); hud = new HUD(); state = State.playing; } @Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0.2f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); // set viewport Gdx.gl.glViewport((int) viewport.x, (int) viewport.y, (int) viewport.width, (int) viewport.height); InputHandler.handleGameInput(); if(InputHandler.reset) reset(); if(InputHandler.back) game.returnToLevelSelect(); switch(state) { case playing: if(InputHandler.menu) state = State.pause; camera.position.x++; if(level.player.rect.y + 50 <= 0) camera.position.y = 0; else camera.position.y = level.player.rect.y + 50; camera.update(); level.update(delta, camera); if(!level.player.isAlive) state = State.lose; else if(level.player.hasWon) state = State.win; hud.update(camera); batch.setProjectionMatrix(camera.combined); batch.begin(); batch.draw(bg, camera.position.x - camera.viewportWidth/2, -250); level.draw(batch); hud.draw(batch, state); batch.end(); break; case win: batch.setProjectionMatrix(camera.combined); level.winUpdate(delta, camera); batch.begin(); batch.draw(bg, camera.position.x - camera.viewportWidth/2, -250); level.draw(batch); hud.draw(batch, state); batch.end(); break; case lose: batch.setProjectionMatrix(camera.combined); batch.begin(); batch.draw(bg, camera.position.x - camera.viewportWidth/2, -250); level.draw(batch); hud.draw(batch, state); batch.end(); break; case pause: if(InputHandler.back) state = State.playing; batch.setProjectionMatrix(camera.combined); batch.begin(); batch.draw(bg, camera.position.x - camera.viewportWidth/2, -250); level.draw(batch); hud.draw(batch, state); batch.end(); break; } } public void reset() { camera = new OrthographicCamera(); camera.setToOrtho(false, VIRTUAL_WIDTH, VIRTUAL_HEIGHT); level.reset(); camera.position.y = level.player.rect.y + 100; state = State.playing; } @Override public void resize(int width, int height) { // calculate new viewport float aspectRatio = (float)width/(float)height; float scale = 1f; Vector2 crop = new Vector2(0f, 0f); if(aspectRatio > ASPECT_RATIO) { scale = (float)height/(float)VIRTUAL_HEIGHT; crop.x = (width - VIRTUAL_WIDTH*scale)/2f; } else if(aspectRatio < ASPECT_RATIO) { scale = (float)width/(float)VIRTUAL_WIDTH; crop.y = (height - VIRTUAL_HEIGHT*scale)/2f; } else { scale = (float)width/(float)VIRTUAL_WIDTH; } float w = (float)VIRTUAL_WIDTH*scale; float h = (float)VIRTUAL_HEIGHT*scale; viewport = new Rectangle(crop.x, crop.y, w, h); InputHandler.setScale(scale); } @Override public void show() { // TODO Auto-generated method stub } @Override public void hide() { // TODO Auto-generated method stub } @Override public void pause() { // TODO Auto-generated method stub } @Override public void resume() { // TODO Auto-generated method stub } @Override public void dispose() { // TODO Auto-generated method stub } }
2cc0b721b05a5e0d0bf9eaae3d5c11164263bdeb
31c4d01cc4e56f21ff227b69c592a0a67ef8b2d2
/app/src/main/java/com/obitestvernull/commonClassesAndUtils/analitics/GoogleAnalitics.java
99c492823ab54f4f8182c19761cdaadc032fa0eb
[]
no_license
sizikoff/obivovadebag
840571936021d7a0f43ffc14596421cebe60fb78
f2f99ea9926895c02ed9d9e2305a0b9c1ece60da
refs/heads/master
2020-04-30T16:39:17.959551
2019-03-21T15:47:18
2019-03-21T15:47:18
176,709,918
0
0
null
null
null
null
UTF-8
Java
false
false
781
java
package com.obitestvernull.commonClassesAndUtils.analitics; import android.content.Context; import android.os.Bundle; import com.google.firebase.analytics.FirebaseAnalytics; public class GoogleAnalitics { private static FirebaseAnalytics mFirebaseAnalytics; public static void sendMessageGoogleFireBaseAnalitics(Context context, String id, String name, String message) { mFirebaseAnalytics = FirebaseAnalytics.getInstance(context); Bundle bundle = new Bundle(); bundle.putString(FirebaseAnalytics.Param.ITEM_ID, id); bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, name); bundle.putString(FirebaseAnalytics.Param.CONTENT, message); mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle); } }
[ "BattleTried1" ]
BattleTried1
5f9ee860e1ebe8e34a32c992763161f581945386
a39ed46d1e54df79e4ba89479021173f5ddabf8d
/Release/3. Release v0.x/1. ME/Source/ns-me-portlet/docroot/WEB-INF/src/vn/dtt/sol/ns/baocaodli/dao/service/impl/BaoCaoDLILocalServiceImpl.java
2d1edfe186a615f2b46debb7a771d72141bc036b
[]
no_license
pforr/ME
f9666f426f11565e05b5654b9ab276ff68766df5
922c4eee8e12cfd02183a79af5a2f853b61c401a
refs/heads/master
2021-01-21T13:33:37.209663
2016-05-27T06:55:33
2016-05-27T06:55:33
53,647,945
0
0
null
null
null
null
UTF-8
Java
false
false
11,452
java
/** * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package vn.dtt.sol.ns.baocaodli.dao.service.impl; import java.io.File; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.List; import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.repository.model.FileEntry; import com.liferay.portal.kernel.util.OrderByComparator; import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.service.ServiceContext; import com.liferay.portal.util.PortalUtil; import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil; import vn.dtt.cmon.dm.dao.model.DATAITEM; import vn.dtt.sol.ns.baocaodli.dao.NgayBaoCaoException; import vn.dtt.sol.ns.baocaodli.dao.NguoiDuyetException; import vn.dtt.sol.ns.baocaodli.dao.NguoiLapException; import vn.dtt.sol.ns.baocaodli.dao.SoBaoCaoException; import vn.dtt.sol.ns.baocaodli.dao.UpdateChotBaoCaoException; import vn.dtt.sol.ns.baocaodli.dao.model.BaoCaoDLI; import vn.dtt.sol.ns.baocaodli.dao.model.impl.BaoCaoDLIImpl; import vn.dtt.sol.ns.baocaodli.dao.service.base.BaoCaoDLILocalServiceBaseImpl; import vn.dtt.sol.ns.baocaodli.util.BaoCaoDLIConstants; import vn.dtt.sol.ns.business.DataItemBusiness; /** * The implementation of the bao cao d l i local service. * * <p> * All custom service methods should be put in this class. Whenever methods are * added, rerun ServiceBuilder to copy their definitions into the * {@link vn.dtt.sol.ns.baocaodli.dao.service.BaoCaoDLILocalService} interface. * * <p> * This is a local service. Methods of this service will not have security * checks based on the propagated JAAS credentials because this service can only * be accessed from within the same VM. * </p> * * @author HuyMQ * @see vn.dtt.sol.ns.baocaodli.dao.service.base.BaoCaoDLILocalServiceBaseImpl * @see vn.dtt.sol.ns.baocaodli.dao.service.BaoCaoDLILocalServiceUtil */ public class BaoCaoDLILocalServiceImpl extends BaoCaoDLILocalServiceBaseImpl { public boolean hasInitBaoCaoTongHop() throws PortalException, SystemException { boolean hasInit = true; Date now = new Date(); Calendar cal = Calendar.getInstance(); cal.setTime(now); int nam = cal.get(Calendar.YEAR); if(baoCaoDLITongHopPersistence.countByNam(nam) == 0) { hasInit = false; } return hasInit; } public void initBaoCao(int nam) throws SystemException { List<DATAITEM> dataItems = DataItemBusiness.getInLevel1(1); for (DATAITEM dataItem : dataItems) { if (dataItem.getStatus() == 1) { String maTinh = dataItem.getNode1(); baoCaoDLILocalService.addBaoCao(nam, maTinh, BaoCaoDLIConstants.BAO_CAO_DLI_1_1); baoCaoDLILocalService.addBaoCao(nam, maTinh, BaoCaoDLIConstants.BAO_CAO_DLI_1_2); baoCaoDLILocalService.addBaoCao(nam, maTinh, BaoCaoDLIConstants.BAO_CAO_DLI_2_1); baoCaoDLILocalService.addBaoCao(nam, maTinh, BaoCaoDLIConstants.BAO_CAO_DLI_2_2); baoCaoDLILocalService.addBaoCao(nam, maTinh, BaoCaoDLIConstants.BAO_CAO_DLI_3); } } } public BaoCaoDLI addBaoCao(int nam, String maTinh, int loaiBaoCao) throws SystemException { BaoCaoDLI baoCao = baoCaoDLIPersistence.fetchByMaTinh_Nam_LoaiBaoCao( maTinh, nam, loaiBaoCao); if (baoCao == null) { Date now = new Date(); long id = counterLocalService.increment(BaoCaoDLI.class.getName()); baoCao = baoCaoDLIPersistence.create(id); baoCao.setNam(nam); baoCao.setMaTinh(maTinh); baoCao.setTrangThai(BaoCaoDLIConstants.TRANG_THAI_DANG_LAP); baoCao.setLoaiBaoCao(loaiBaoCao); baoCao.setNgayBaoCao(now); baoCao = baoCaoDLIPersistence.update(baoCao); } return baoCao; } public void deleteBaoCao(long baoCaoDLIId) throws PortalException, SystemException { BaoCaoDLI baoCao = baoCaoDLIPersistence.findByPrimaryKey(baoCaoDLIId); deleteBaoCao(baoCao); } /** * Khi xoa se empty het du lieu cua bao cao */ public void deleteBaoCao(BaoCaoDLI baoCaoDLI) throws PortalException, SystemException { BaoCaoDLI baoCaoDLIDelete = new BaoCaoDLIImpl(); baoCaoDLIDelete.setId(baoCaoDLI.getId()); baoCaoDLIDelete.setMaTinh(baoCaoDLI.getMaTinh()); baoCaoDLIDelete.setNam(baoCaoDLI.getNam()); baoCaoDLIDelete.setLoaiBaoCao(baoCaoDLI.getLoaiBaoCao()); baoCaoDLIDelete.setNgayBaoCao(new Date()); baoCaoDLIDelete.setTrangThai(BaoCaoDLIConstants.TRANG_THAI_DANG_LAP); baoCaoDLIPersistence.update(baoCaoDLIDelete); } public BaoCaoDLI updateBaoCao(long userId, long groupId, long baoCaoDLIId, int nam, String maTinh, String soBaoCao, String nguoiLap, String nguoiDuyet, int ngayBaoCaoMonth, int ngayBaoCaoDay, int ngayBaoCaoYear, long folderId, File luuTruPDF1, File luuTruPDF2, File luuTruCSV1, File luuTruCSV2, int trangThai, ServiceContext serviceContext) throws PortalException, SystemException { Date ngayBaoCao = PortalUtil.getDate(ngayBaoCaoMonth, ngayBaoCaoDay, ngayBaoCaoYear); if (trangThai == 0) { // validate(nam, null, nguoiLap, null, ngayBaoCao); } else { validate(soBaoCao, nguoiLap, nguoiDuyet, ngayBaoCao); } BaoCaoDLI baoCao = null; if (baoCaoDLIId > 0) { baoCao = baoCaoDLIPersistence.findByPrimaryKey(baoCaoDLIId); if (baoCao.getTrangThai() != 0) { throw new UpdateChotBaoCaoException(); } } else { baoCaoDLIId = counterLocalService.increment(BaoCaoDLI.class .getName()); baoCao = baoCaoDLIPersistence.create(baoCaoDLIId); } // baoCao.setNam(nam); // baoCao.setMaTinh(maTinh); baoCao.setSoBaoCao(soBaoCao); baoCao.setNguoiLap(nguoiLap); baoCao.setNguoiDuyet(nguoiDuyet); baoCao.setNgayBaoCao(ngayBaoCao); baoCao.setTrangThai(trangThai); long luuTruPDF1Id = 0; long luuTruPDF2Id = 0; long luuTruCSV1Id = 0; long luuTruCSV2Id = 0; if (luuTruPDF1 != null) { String luuTruPDF1Name = getFileBaoCaoName(nam, maTinh, baoCaoDLIId, "pdf1", ".pdf"); FileEntry fileEntry = DLAppLocalServiceUtil.addFileEntry(userId, groupId, folderId, luuTruPDF1Name, StringPool.BLANK, luuTruPDF1Name, StringPool.BLANK, StringPool.BLANK, luuTruPDF1, serviceContext); luuTruPDF1Id = fileEntry.getFileEntryId(); } if (luuTruPDF2 != null) { String luuTruPDF2Name = getFileBaoCaoName(nam, maTinh, baoCaoDLIId, "pdf2", ".pdf"); FileEntry fileEntry = DLAppLocalServiceUtil.addFileEntry(userId, groupId, folderId, luuTruPDF2Name, StringPool.BLANK, luuTruPDF2Name, StringPool.BLANK, StringPool.BLANK, luuTruPDF2, serviceContext); luuTruPDF2Id = fileEntry.getFileEntryId(); } if (luuTruCSV1 != null) { String luuTruCSV1Name = getFileBaoCaoName(nam, maTinh, baoCaoDLIId, "csv1", ".csv"); FileEntry fileEntry = DLAppLocalServiceUtil.addFileEntry(userId, groupId, folderId, luuTruCSV1Name, StringPool.BLANK, luuTruCSV1Name, StringPool.BLANK, StringPool.BLANK, luuTruCSV1, serviceContext); luuTruCSV1Id = fileEntry.getFileEntryId(); } if (luuTruCSV2 != null) { String luuTruCSV2Name = getFileBaoCaoName(nam, maTinh, baoCaoDLIId, "csv2", ".csv"); FileEntry fileEntry = DLAppLocalServiceUtil.addFileEntry(userId, groupId, folderId, luuTruCSV2Name, StringPool.BLANK, luuTruCSV2Name, StringPool.BLANK, StringPool.BLANK, luuTruCSV2, serviceContext); luuTruCSV2Id = fileEntry.getFileEntryId(); } baoCao.setLuuTruPDF1Id(luuTruPDF1Id); baoCao.setLuuTruPDF2Id(luuTruPDF2Id); baoCao.setLuuTruCSV1Id(luuTruCSV1Id); baoCao.setLuuTruCSV2Id(luuTruCSV2Id); baoCaoDLIPersistence.update(baoCao); return baoCao; } /** * * @param maTinh * @return * @throws SystemException */ public int countByMaTinh(String maTinh) throws SystemException { return baoCaoDLIPersistence.countByMaTinh(maTinh); } /** * * @param nam * @return * @throws SystemException */ public int countByNam(int nam) throws SystemException { return baoCaoDLIPersistence.countByNam(nam); } /** * * @param maTinh * @param nam * @return * @throws SystemException */ public BaoCaoDLI getByMaTinh_Nam(String maTinh, int nam) throws SystemException { return baoCaoDLIPersistence.fetchByMaTinh_Nam(maTinh, nam); } /** * * @param maTinh * @param start * @param end * @param obc * @return * @throws SystemException */ public List<BaoCaoDLI> getByMaTinh(String maTinh, int start, int end, OrderByComparator obc) throws SystemException { return baoCaoDLIPersistence.findByMaTinh(maTinh, start, end, obc); } /** * * @param nam * @param start * @param end * @param obc * @return * @throws SystemException */ public List<BaoCaoDLI> getByNam(int nam, int start, int end, OrderByComparator obc) throws SystemException { return baoCaoDLIPersistence.findByNam(nam, start, end, obc); } public List<BaoCaoDLI> search(String maTinh, int loaiBaoCao, int nam, Integer trangThai, int start, int end, OrderByComparator obc) throws SystemException { return baoCaoDLIFinder.searchDLI(maTinh, loaiBaoCao, nam, trangThai, start, end, obc); } public int searchCount(String maTinh, int loaiBaoCao, int nam, Integer trangThai) throws SystemException { return baoCaoDLIFinder.searchCountDLI(maTinh, loaiBaoCao, nam, trangThai); } public List<BaoCaoDLI> search(String maTinh, int nam, Integer trangThai, int start, int end, OrderByComparator obc) throws SystemException { return baoCaoDLIFinder.search(maTinh, nam, trangThai, start, end, obc); } public int searchCount(String maTinh, int nam, Integer trangThai) throws SystemException { return baoCaoDLIFinder.searchCount(maTinh, nam, trangThai); } private void validate(String soBaoCao, String nguoiLap, String nguoiDuyet, Date ngayBaoCao) throws PortalException { if (Validator.isNull(soBaoCao)) { throw new SoBaoCaoException(); } if (Validator.isNull(nguoiLap)) { throw new NguoiLapException(); } if (Validator.isNull(nguoiDuyet)) { throw new NguoiDuyetException(); } if (Validator.isNull(ngayBaoCao)) { throw new NgayBaoCaoException(); } } /** * * @param namBaoCao * @param maTinh * @param baoCaoDLIId * @param suffix * @param fileExtension * @return */ private String getFileBaoCaoName(int namBaoCao, String maTinh, long baoCaoDLIId, String suffix, String fileExtension) { Date now = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); StringBuilder sb = new StringBuilder(10); sb.append(namBaoCao); sb.append(StringPool.UNDERLINE); sb.append(maTinh); sb.append(StringPool.UNDERLINE); sb.append(baoCaoDLIId); sb.append(StringPool.UNDERLINE); sb.append(suffix); sb.append(StringPool.UNDERLINE); sb.append(sdf.format(now)); sb.append(fileExtension); return sb.toString(); } }
69679f1945cfcede4adf01a6fc9fa9d96a9f62c7
43f7d7319e9d4e39dc42a8f91658525eb0774835
/activerecord/src/com/aetrion/activerecord/errors/UnsupportedTypeException.java
2984b4417a33a6a798190369d0563c6e130edfa5
[]
no_license
raysalt10/rogueweb
e991febf2e402e0228ddfe794c07073809761f9e
2cdfc8e5411dfe1594f56d494057f6b44e3fa48e
refs/heads/master
2021-01-10T05:04:16.815570
2006-09-17T01:48:58
2006-09-17T01:48:58
52,864,650
0
0
null
null
null
null
UTF-8
Java
false
false
300
java
package com.aetrion.activerecord.errors; /** * Exception which is thrown when an unsupported SQL type is used. * * @author Anthony Eden */ public class UnsupportedTypeException extends ActiveRecordException { public UnsupportedTypeException(String message) { super(message); } }
[ "anthonyeden@8b5c5b56-841d-0410-b502-cf68dfdfd60c" ]
anthonyeden@8b5c5b56-841d-0410-b502-cf68dfdfd60c
5e721a78bc0ade5c36e7b7a655dfb9e233ba7611
b9761c96bb1b2b206c16628d0727683839d9020c
/ANDROID/p1cashv8/app/src/test/java/be/corentingoo/p1cashv8/ExampleUnitTest.java
09b25cbdc4ed051eb9a9bc87c27869d529da74d2
[]
no_license
corentingoo/hackathon-technofuturtic-2020
516aa099344fe7c6b94e94cd65a00456f863d3ca
2b258455ea3d10e4b95cdbbfd4082a925855e1e2
refs/heads/master
2022-12-15T22:50:46.954482
2020-02-28T14:00:47
2020-02-28T14:00:47
243,769,016
0
0
null
2022-12-08T09:49:10
2020-02-28T13:30:06
JavaScript
UTF-8
Java
false
false
384
java
package be.corentingoo.p1cashv8; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
4f20feeca2f393a9814d25e4dff74f5d5f845f62
9133002c10ebe7706473c4e8780cf0d7a917e363
/app/src/main/java/com/example/noteapp24062017/fragments/NoteLinedEditorFragment.java
17e3a0c405ff62e68bb64144ec1f21bc3d7d47ec
[]
no_license
dimalinc/NoteApp24.06.2017
834154da8ea7fa5ecfce07d0ffcc907ec9292bb5
a1e84a8b61c34cc374e57ce49bb34a955a0b4ba0
refs/heads/master
2021-01-21T14:52:38.405697
2017-06-25T08:47:30
2017-06-25T08:47:30
95,348,427
0
0
null
null
null
null
UTF-8
Java
false
false
897
java
package com.example.noteapp24062017.fragments; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.example.noteapp24062017.R; /** * A simple {@link Fragment} subclass. */ public class NoteLinedEditorFragment extends Fragment { public NoteLinedEditorFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_note_lined_editor, container, false); } }
bbe9993fd1d3a33f4b42f23596660842cd908ec8
2df95e145a0cba742f66410fb39185d6b87c5b05
/src/zhh/game/tetris/dialog/HotkeySetDialog.java
f3c59b327cd735304de857f1ca90cc4ebf2a3345
[]
no_license
19913143167/tetris
3a6d5d89d4ac53d419ff189abb19daf8b54e428f
0a56c13f89434dcdded83387b97971f3e78b58d7
refs/heads/master
2020-03-23T02:43:35.254964
2018-07-18T08:55:19
2018-07-18T08:55:19
140,988,835
0
0
null
null
null
null
UTF-8
Java
false
false
9,858
java
package zhh.game.tetris.dialog; import java.awt.Color; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JSeparator; import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.border.Border; import javax.swing.border.LineBorder; import zhh.game.tetris.global.Config; import zhh.game.tetris.global.Utilities; import zhh.game.tetris.listener.ConfigListener; /** * 游戏控制键设置对话框<br> * 以用户输入的控制键替代默认的控制键<br> * 1. "开始/结束"<br> * 2. "暂停/继续"<br> * 3. "左移"<br> * 4. "右移"<br> * 5. "变形"<br> * 6. "加速下落"<br> * 7. "一落到底"<br> * @author zhaohuihua */ public class HotkeySetDialog extends JDialog { /** * 串行化版本统一标识符 */ private static final long serialVersionUID = -8372498997747949041L; /** * 相同类型控件的总数 */ private final int controlCount = 7; /** * 控件用于存储序号的 key<br> * 序号存储于控件的 ClientProperty 属性中<br> */ private final String controlIndexKey = "INDEX"; /** * "确定"按钮 */ private final JButton btnOk; /** * 默认的背景颜色 */ private final Color background; /** * 用于获取输入的所有文本框 */ private JTextField[] textFields; /** * 所有控制键的内容 */ private int[] keyCodes; /** * 配置监听器 */ private ConfigListener[] configListeners; /** * 游戏控制键设置对话框 */ public HotkeySetDialog() { this(null, false); } /** * 游戏控制键设置对话框 * @param owner Frame 对话框的所有者 */ public HotkeySetDialog(Frame owner) { this(owner, false); } /** * 游戏控制键设置对话框 * @param owner Frame 对话框的所有者 * @param modal boolean 是否为模式对话框 */ public HotkeySetDialog(Frame owner, boolean modal) { super(owner, modal); // 设置窗口标题, 窗口尺寸 setTitle("控制键设置"); getContentPane().setLayout(null); setResizable(false); setSize(220, 295); setLocationRelativeTo(owner); // 增加监听器处理窗口关闭事件 addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { dispose(); } }); // 初始化控制键的内容, 与现有控制键相同 keyCodes = new int[controlCount]; keyCodes[0] = Config.KEY_START; keyCodes[1] = Config.KEY_PAUSE; keyCodes[2] = Config.KEY_LEFT; keyCodes[3] = Config.KEY_RIGHT; keyCodes[4] = Config.KEY_ROTATE; keyCodes[5] = Config.KEY_DOWN; keyCodes[6] = Config.KEY_SWIFT; // 文本框控件的按键处理器 final KeyAdapter handler = new KeyAdapter() { /** * 用户按键时的处理 */ public void keyPressed(KeyEvent e) { if(e.isAltDown() || e.isControlDown() || e.isShiftDown()) return; // 获取用户输入的键盘字符, 作为新的控制键 int keyCode = e.getKeyCode(); JTextField source = (JTextField)e.getSource(); int index = ((Integer)source.getClientProperty(controlIndexKey)).intValue(); if(keyCode > 0) { ((JTextField)e.getSource()).setText(KeyEvent.getKeyText(keyCode)); keyCodes[index] = keyCode; } // 检查控制键相互之间是否冲突 boolean collisional = checkCollisional(); // 只有在控制键相互之间不冲突的时候才能修改 btnOk.setEnabled(!collisional); // 销毁该按键事件, 避免继续传播 e.consume(); } public void keyTyped(KeyEvent e) { // 不处理按键文本输入 e.consume(); } }; // 提示标签的文本 final String[] labelText = {"开始/结束:", "暂停/继续:", "左移:", "右移:", "变形:", "加速下落:", "一落到底:"}; // 文本框边框 final Border txtBorder = new LineBorder(Config.COLOR_BORDER, 1, false); // 提示标签 final JLabel[] labels = new JLabel[controlCount]; // 获取输入的文本框 textFields = new JTextField[controlCount]; for(int i = 0; i < controlCount; i++) { // 设置提示标签 labels[i] = new JLabel(); labels[i].setText(labelText[i]); labels[i].setBounds(10, 10 + i * 27, 70, 15); getContentPane().add(labels[i]); // 设置文本框 textFields[i] = new JTextField(); textFields[i].setText(KeyEvent.getKeyText(keyCodes[i])); textFields[i].setBounds(84, 7 + i * 27, 120, 21); textFields[i].setBorder(txtBorder); textFields[i].setHorizontalAlignment(SwingConstants.CENTER); textFields[i].putClientProperty(controlIndexKey, new Integer(i)); textFields[i].addKeyListener(handler); getContentPane().add(textFields[i]); } // 分隔符 final JSeparator separator = new JSeparator(); separator.setBounds(10, 196, 194, 2); getContentPane().add(separator); // "恢复"按钮 final JButton btnRestoration = new JButton(); btnRestoration.setText("恢复(R)"); btnRestoration.setMnemonic('R'); btnRestoration.setToolTipText("恢复为应用程序的默认状态"); btnRestoration.setBounds(10, 204, 108, 23); btnRestoration.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // 恢复为应用程序的默认控制键 keyCodes[0] = Config.KEY_START_DEFAULT; keyCodes[1] = Config.KEY_PAUSE_DEFAULT; keyCodes[2] = Config.KEY_LEFT_DEFAULT; keyCodes[3] = Config.KEY_RIGHT_DEFAULT; keyCodes[4] = Config.KEY_ROTATE_DEFAULT; keyCodes[5] = Config.KEY_DOWN_DEFAULT; keyCodes[6] = Config.KEY_SWIFT_DEFAULT; // 更新文本框 for(int i = 0; i < controlCount; i++) { textFields[i].setText(KeyEvent.getKeyText(keyCodes[i])); textFields[i].setBackground(background); } btnOk.setEnabled(true); } }); getContentPane().add(btnRestoration); // "确定"按钮 btnOk = new JButton(); btnOk.setText("确定(O)"); btnOk.setMnemonic('O'); btnOk.setBounds(10, 233, 108, 23); btnOk.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // 检查控制键是否已经被改变 if(Config.KEY_START != keyCodes[0] || Config.KEY_PAUSE != keyCodes[1] || Config.KEY_LEFT != keyCodes[2] || Config.KEY_RIGHT != keyCodes[3] || Config.KEY_ROTATE != keyCodes[4] || Config.KEY_DOWN != keyCodes[5] || Config.KEY_SWIFT != keyCodes[6]) { // 更新控制键 Config.KEY_START = keyCodes[0]; Config.KEY_PAUSE = keyCodes[1]; Config.KEY_LEFT = keyCodes[2]; Config.KEY_RIGHT = keyCodes[3]; Config.KEY_ROTATE = keyCodes[4]; Config.KEY_DOWN = keyCodes[5]; Config.KEY_SWIFT = keyCodes[6]; int length = configListeners == null ? 0 : configListeners.length; for (int i = 0; i < length; i++) { configListeners[i].hotkeyConfigChanged(); } } dispose(); } }); getContentPane().add(btnOk); // "取消"按钮 final JButton btnCancel = new JButton(); btnCancel.setText("取消(C)"); btnCancel.setMnemonic('C'); btnCancel.setBounds(124, 233, 80, 23); btnCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); } }); getContentPane().add(btnCancel); background = textFields[0].getBackground(); } /** * 检查控制键相互之间是否冲突<br> * 将冲突的控制键用不同颜色予以标识<br> */ private boolean checkCollisional() { /* * mapping: 记录控制键与出现位置的映射情况 * [i][0] KeyCode * [i][1] IndexCount * [i][2..n] Index */ int[][] mapping = new int[controlCount][controlCount + 2]; // count: 共有多少组不同的控制键 int count = 0; for(int i = 0; i < controlCount; i++) { // 控制键的映射情况是否已存在 boolean existent = false; for(int j = 0; j < count; j++) { if(keyCodes[i] == mapping[j][0]) { // 已有该控制键的映射情况 // 修改映射情况, 增加出现位置 mapping[j][mapping[j][1] + 2] = i; mapping[j][1] ++; existent = true; break; } } if(!existent) { // 第一次遍历到该控制键, 记录映射情况 mapping[count][0] = keyCodes[i]; mapping[count][1] = 1; mapping[count][2] = i; count ++; } } // 控制键冲突时的标识颜色 final Color[] colors = new Color[] { new Color(0xFFCCCC), new Color(0xCCCCFF), new Color(0xCCFFCC) }; // index: 冲突控制键的序号, 记录已有几组冲突, 用以获取不同的颜色 // 将每组冲突的控制键用不同颜色予以标识 int index = 0; for(int i = 0; i < count; i++) { int indexCount = mapping[i][1]; if(indexCount == 1) textFields[mapping[i][2]].setBackground(background); else { for(int j = 2; j < indexCount + 2; j++) textFields[mapping[i][j]].setBackground(colors[index]); index ++; } } // 控制键是否冲突 return index > 0; } /** * 增加配置监听器 * @param listener ConfigListener 配置监听器 */ public void addConfigListener(ConfigListener listener) { if(configListeners == null) configListeners = new ConfigListener[]{}; configListeners = (ConfigListener[])Utilities.arrayAddItem( configListeners, listener); } /** * 移除配置监听器 * @param listener ConfigListener 配置监听器 */ public void removeConfigListener(ConfigListener listener) { configListeners = (ConfigListener[])Utilities.arrayRemoveItem( configListeners, listener); } }
e1676f80975d9989a43032734f3496af5e051dc9
344882ff0c6e238c80f9ad057466cba32089b61f
/utils/chop/Chop.java
77e76d5f87f92fd688c1929c69d9b70f859251b2
[]
no_license
MachineScripts/TRiBot
cf52015053a35358416a6d0445b85dacc8d9bdab
27311663105e859e78833f7680eb9ecf8a284aca
refs/heads/master
2016-09-05T22:58:00.379992
2014-06-04T03:17:21
2014-06-04T03:17:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,337
java
package scripts.utils.chop; import org.tribot.api.General; import org.tribot.api2007.*; import org.tribot.api2007.types.*; import org.tribot.script.Script; public class Chop { private Script script; private RSObject[] treeArray; private String treeName; private RSNPC[] closeNpcs; private RSArea treeArea; private RSGroundItem[] birdNest; private RSGroundItem nest; private RSObject closestTree; private RSPlayer player; private RSTile playerTile; private RSCharacter ent; public Chop(Script script, String treeName, RSArea treeArea){ this.script = script; this.treeName = treeName; this.treeArea = treeArea; } private RSObject getClosestTree(){ treeArray = Objects.findNearest(10,treeName); if(treeArray.length > 0) return treeArray[0]; return null; } public void avoidEnt(){ closeNpcs = NPCs.findNearest(treeName); player = Player.getRSPlayer(); if(player != null){ if(closeNpcs.length > 0){ for(RSNPC npc : closeNpcs){ if(npc.getName().equalsIgnoreCase(treeName)){ ent = player.getInteractingCharacter(); if(ent != null){ if(ent.getName().equals(treeName)){ if(player.getAnimation() != -1 && !Player.isMoving()){ playerTile = Player.getPosition(); script.println("ENT detected, avoiding the ENT!"); Walking.clickTileMM((new RSTile(playerTile.getX()+ General.random(2, 3), playerTile.getY() + General.random(2,3))), 1); } } } } } } } } public void pickUpNest(){ birdNest = GroundItems.find("Bird nest"); if(birdNest.length > 0){ nest = birdNest[0]; if(nest != null && !Player.isMoving()){ if(nest.isOnScreen()){ script.println("Bird nest detected, picking it up!"); nest.click("Take"); script.sleep(500,600); } else{ WebWalking.walkTo(nest.getPosition()); script.sleep(400,500); } } } } public void chopTree(){ player = Player.getRSPlayer(); if(player != null && treeArea != null){ if(treeArea.contains(player.getPosition())){ closestTree = getClosestTree(); if(closestTree != null){ if(!Player.isMoving() && Player.getAnimation() == -1){ if(closestTree.isOnScreen()){ closestTree.click("Chop down"); script.sleep(200,300); } else{ Walking.walkTo(closestTree.getPosition()); script.sleep(700,800); Camera.turnToTile(closestTree.getPosition()); } } } } } } }
655e546ea5d667951333eaaa0fa101b86b260e6a
a98d11557e9160078a4f77192f5ef530271f1499
/src/a167_两数之和2_输入有序数组/Solution.java
4a60df46498e6fb9b084474df52ded85de98a189
[]
no_license
leetcode-solution/leetcode
3b22df7b1ff7fd07dc1cc9eaa0e1e824792297ca
455f8fc993ffffd36588d91b9610470cb2aeed22
refs/heads/master
2020-06-25T07:17:42.694999
2019-06-25T14:18:51
2019-06-25T14:18:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
885
java
package a167_两数之和2_输入有序数组; /** * @Description: * @author: Gao Hang Hang * @date 2019/03/11 22:09 */ public class Solution { public int[] twoSum(int[] numbers, int target) { for (int i = 0; i < numbers.length; i++) { int low = i; int high = numbers.length - 1; while (low <= high) { int mid = (low + high) / 2; int midVal = numbers[mid]; int num2 = target - numbers[i]; if (num2 == midVal && i != mid) { return new int[]{i+1, mid + 1}; } else if (num2 > midVal) { low = mid + 1; } else if (num2 < midVal) { high = mid - 1; } else { low = mid + 1; } } } return null; } }
d7d91ea22607c1c80624ee829f3429b318edf87d
3622e0a492f013ce59dfe93d8363a7d5360dfba4
/mall-order/src/main/java/com/qian/mall/order/service/impl/OrderReturnApplyServiceImpl.java
c16f27fdb8814d3c170d0c34d4da70e60a06d5e4
[]
no_license
Me-to/qian-mall
38b7b8fabf982f47885b5bbf4d2358bcc4c5ac89
5d130f3fbf8c9fb03130d84c3958327c43255bad
refs/heads/master
2023-08-17T00:30:09.968300
2021-08-30T09:05:54
2021-08-30T09:05:54
296,982,125
1
0
null
null
null
null
UTF-8
Java
false
false
1,045
java
package com.qian.mall.order.service.impl; import org.springframework.stereotype.Service; import java.util.Map; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.qian.common.utils.PageUtils; import com.qian.common.utils.Query; import com.qian.mall.order.dao.OrderReturnApplyDao; import com.qian.mall.order.entity.OrderReturnApplyEntity; import com.qian.mall.order.service.OrderReturnApplyService; @Service("orderReturnApplyService") public class OrderReturnApplyServiceImpl extends ServiceImpl<OrderReturnApplyDao, OrderReturnApplyEntity> implements OrderReturnApplyService { @Override public PageUtils queryPage(Map<String, Object> params) { IPage<OrderReturnApplyEntity> page = this.page( new Query<OrderReturnApplyEntity>().getPage(params), new QueryWrapper<OrderReturnApplyEntity>() ); return new PageUtils(page); } }
22120965e331dfad4c3a86ac43555e14e88ed99d
dcd4b96e19605fdd8614aee1acea71d8238a74ec
/src/main/java/frc/robot/subsystems/DriveTrain.java
da115ed4e2390249b976639cb8d5f2011c9e88cf
[]
no_license
Phred7/SecondFullTestVSCodeAlpha
601dab9b9db21b39d11754ffb371c09f3c91a798
728784a17f1060e51f6b2525de622fb2fc015e53
refs/heads/master
2020-04-13T10:32:51.205565
2019-01-05T05:48:25
2019-01-05T05:48:25
163,144,003
0
0
null
null
null
null
UTF-8
Java
false
false
2,356
java
/*----------------------------------------------------------------------------*/ /* Copyright (c) 2018 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ package frc.robot.subsystems; import edu.wpi.first.wpilibj.ADXRS450_Gyro; import edu.wpi.first.wpilibj.Encoder; import edu.wpi.first.wpilibj.Talon; import edu.wpi.first.wpilibj.command.Subsystem; import edu.wpi.first.wpilibj.drive.DifferentialDrive; import frc.robot.RobotMap; import frc.robot.commands.*; public class DriveTrain extends Subsystem { private final DifferentialDrive driveWC = RobotMap.drive; Talon l = RobotMap.driveL; Talon r = RobotMap.driveR; Encoder encL = RobotMap.dtEncL; Encoder encR = RobotMap.dtEncR; ADXRS450_Gyro gyro = RobotMap.gyroSPI; public void reset() { resetEncs(); resetGyro(); } public void resetEncR(){ encR.reset(); } public void resetEncL(){ encL.reset(); } public void resetGyro(){ gyro.reset(); } public void calibrateGyro(){ gyro.calibrate(); } public void resetEncs(){ resetEncL(); resetEncR(); } public void rAndCGyro(){ resetGyro(); calibrateGyro(); } public int getEncL(){ return encL.get(); } public int getEncR(){ return encR.get(); } public double getGyro(){ return gyro.getAngle(); } public double getGyroRate(){ return gyro.getRate(); } public void setDriveL(double speed){ l.set(speed); } public void setDriveR(double speed){ r.set(speed); } public void stopL(){ l.set(0.0); } public void stopR(){ r.set(0.0); } public void stop(){ stopL(); stopR(); } public void arcadeDrive(double xSpeed, double yRotate){ driveWC.arcadeDrive(xSpeed, yRotate); } public void tankDrive(double speedL, double speedR){ driveWC.tankDrive(speedL, speedR); } public void initDefaultCommand() { // Set the default command for a subsystem here. setDefaultCommand(new Drive_Arcade()); //setDefaultCommand(new Drive_Tank()); } }
7674dcd352282604797a4ad04ce8575193283293
3f2bec091e0a42adedbb76ea787635422f8d5713
/First-Maven-Project/src/test/java/Apptest.java
bdb52f07d634260687df0b9bace1e3ce84537934
[]
no_license
Mansi-cloud/Maven-Assignment
3031a65fdc4e4569d0b64d0da926eef0f5c1c675
454864b34a8cb30b890b21e04da15f930c2cf9be
refs/heads/master
2023-03-06T09:48:36.333660
2021-02-26T12:26:27
2021-02-26T12:26:59
342,352,828
0
1
null
null
null
null
UTF-8
Java
false
false
181
java
import static org.junit.Assert.*; import org.junit.Test; public class Apptest { @Test public void testApp() { assertEquals(0,new App().calculateSomething()); } }
b0b0c87fdaa1a6c591bd3270a154efbee871c8aa
64d99d1f5a49e20e595c1e1e94d4c25e7e4e72ca
/imooc-coupon-service/coupon-permission-service/src/main/java/com/imooc/coupon/service/PathService.java
a6c6c2b46b4fbae44837915034620790694909aa
[]
no_license
usernameUndefind/imooc-coupon
2e007c29d8eb20c1c4c0e296deee3a33f84f405c
0c2b36ae52f5a4a6286592d64b166b973b69e788
refs/heads/master
2023-02-11T17:29:39.201425
2021-01-06T14:26:16
2021-01-06T14:26:16
312,294,033
1
1
null
null
null
null
UTF-8
Java
false
false
2,099
java
package com.imooc.coupon.service; import com.imooc.coupon.dao.PathRepository; import com.imooc.coupon.entity.Path; import com.imooc.coupon.vo.CreatePathRequest; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; @Service @Slf4j public class PathService { @Autowired private PathRepository pathRepository; public List<Integer> createPath(CreatePathRequest request) { List<CreatePathRequest.PathInfo> pathInfos = request.getPathInfos(); List<CreatePathRequest.PathInfo> validRequests = new ArrayList<>(request.getPathInfos().size()); List<Path> currentPaths = pathRepository.findAllByServiceName( pathInfos.get(0).getServiceName() ); if (CollectionUtils.isEmpty(currentPaths)) { for (CreatePathRequest.PathInfo pathInfo : pathInfos) { boolean isValid = true; for (Path currentPath : currentPaths) { if (currentPath.getPathPattern().equals(pathInfo.getPathPattern()) && currentPath.getHttpMethod().equals(pathInfo.getHttpMethod())) { isValid = false; break; } } if (isValid) { validRequests.add(pathInfo); } } } else { validRequests = pathInfos; } List<Path> paths = new ArrayList<>(validRequests.size()); validRequests.forEach(p -> paths.add(new Path( p.getPathPattern(), p.getHttpMethod(), p.getPathName(), p.getServiceName(), p.getOpMode() ))); return pathRepository.saveAll(paths) .stream().map(Path::getId).collect(Collectors.toList()); } }
47ff1821bf2bda7f8fb654120a7a665564811631
bd9c7f844b8933ae179687a9c82dfe11f1d785c7
/src/com/javarush/test/level13/lesson11/home05/Solution.java
b3015e6ba58a06a7b98c29e278fda9b79f67eb9f
[]
no_license
DenisDevy/JavaRush1
4da1a8d2e6ec06a9a94f75276f8156d6ee26540a
bbf782104f9331b290d00e5d8b5aefa54dfd4970
refs/heads/master
2021-05-04T07:28:48.198722
2016-10-11T18:31:03
2016-10-11T18:31:03
70,623,592
0
0
null
null
null
null
UTF-8
Java
false
false
1,209
java
package com.javarush.test.level13.lesson11.home05; /* Neo 1. Реализовать интерфейс DBObject в классе User. 2. Реализовать метод initializeIdAndName так, чтобы программа работала и выводила на экран "User has name Neo, id = 1". 3. Метод toString и метод main менять нельзя. 4. Подумай, что должен возвращать метод initializeIdAndName в классе User. */ public class Solution { public static void main(String[] args) throws Exception { System.out.println(Matrix.NEO); } static class Matrix { public static DBObject NEO = new User().initializeIdAndName(1, "Neo"); } interface DBObject { DBObject initializeIdAndName(long id, String name); } static class User implements DBObject { long id = 1; String name = "Neo"; @Override public String toString() { return String.format("User has name %s, id = %d", name, id); } public DBObject initializeIdAndName(long id, String name) { return new User(); } } }
57ec288cb4083d33501e7d129417b3e9af79b27e
093e22dcb5dcdfd99461be94bbc4bfc86d120686
/app/src/main/java/com/schneidernet/heating/DisplayMessageActivity.java
105f33a96a67b1a7f866555e92d3d58b7078d913
[]
no_license
gipde/heating
10a3c43e6beab620ddf582f5bb4de5f0dfd9fff7
030320cdbef763e66c068a608f23085de0c8f289
refs/heads/master
2020-12-02T21:03:09.591478
2017-07-04T20:12:14
2017-07-04T20:12:14
96,250,224
0
0
null
null
null
null
UTF-8
Java
false
false
787
java
package com.schneidernet.heating; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.TextView; public class DisplayMessageActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_message); // Get the Intent that started this activity and extract the string Intent intent = getIntent(); String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE); // Capture the layout's TextView and set the string as its text TextView textView = (TextView) findViewById(R.id.textView); textView.setText(message); } }
dedeb9fa773e3988ea3723b9f93b2cb499142916
0e7019f59f0e3b3f3ac013807d0a217fd496da94
/NFC/app/src/main/java/com/example/light/freezer/Person.java
567aa4033d7d44bab7d8091a3e69139d4ce11ac1
[]
no_license
HyoSang/Freezer
a656a0f7eb4eae9ad646e4856a1d92ba825d91bc
595055d20a4ef50411ed8656c1149af7071752f6
refs/heads/master
2021-03-12T17:54:27.899165
2017-06-08T13:33:56
2017-06-08T13:33:56
91,448,411
1
0
null
null
null
null
UTF-8
Java
false
false
400
java
package com.example.light.freezer; /** * Created by PC2 on 2017-05-26. */ public class Person { private String ID; private String Pass; public String getID() { return ID; } public String getPass() { return Pass; } public void setID(String ID) { this.ID = ID; } public void setPass(String Pass) { this.Pass = Pass; } }
907ec5530f1c90b424e297eca83a367f60ba2d41
bb5d6c81d6e306872c7cd0fce306bc524c8234f8
/src/com/example/myappdemo/Activity/MyData.java
18569bb0252ff0a79b7a5506daf6960a9ab9f037
[]
no_license
TU-RUI/beikexiaoyuan
38dad2e57e71258e422ee5feac6130b9cfacca4b
6eefeb3dc1ccb4fc5bfa2c86f89439547df1f435
refs/heads/master
2021-01-19T02:15:13.259418
2017-04-05T05:33:04
2017-04-05T05:33:04
87,266,589
0
0
null
null
null
null
UTF-8
Java
false
false
1,151
java
package com.example.myappdemo.Activity; import java.util.ArrayList; import android.app.Activity; import android.database.sqlite.SQLiteDatabase; import android.provider.OpenableColumns; public class MyData{ private static ArrayList<String> CardData, LibData, LibHisData,NewsData,NetData; public MyData(){ } public ArrayList<String> getCardData() { return CardData; } public static void setCardData(ArrayList<String> cardData) { CardData = cardData; } public ArrayList<String> getLibData() { return LibData; } public static void setLibData(ArrayList<String> libData) { LibData = libData; } public ArrayList<String> getLibHisData() { return LibHisData; } public static void setLibHisData(ArrayList<String> libHisData) { LibHisData = libHisData; } public ArrayList<String> getNewsData() { return NewsData; } public static void setNewsData(ArrayList<String> newsData) { NewsData = newsData; } public ArrayList<String> getNetData() { return NetData; } public static void setNetData(ArrayList<String> netData) { NetData = netData; } }
9df050342593cf7de1a0017a60390b930e835966
63e7b596851aced13a3c853c8bc3ad3308c07284
/Testservice/src/main/java/com/shell/siep/gto/persistence/databases/bg/repository/raw/BGOilWaterRepository.java
39f8bb4c76640ddb95d550b6f49849ac0cd13fdc
[]
no_license
sk-patnaik/testservice
d10e09ef15670f2de43176b33a399692f78f248c
6e4aae863c46e09581bda7c1e13b572e71c756d0
refs/heads/master
2023-08-17T18:18:33.603156
2021-10-27T08:31:53
2021-10-27T08:31:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
462
java
package com.shell.siep.gto.persistence.databases.bg.repository.raw; import com.shell.siep.gto.persistence.databases.bg.model.raw.BGOilWater; import com.shell.siep.gto.persistence.repository.raw.GTOOilWaterRepository; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface BGOilWaterRepository extends GTOOilWaterRepository<BGOilWater> { public List<BGOilWater> findAllBySampleIdIn(List<String> sampleId); }
a8729fdc71b3590119d570517b1a25452dc56450
b43283d2ee5e7fa305a32d74d3f529fdf0ff001e
/MyCalendar/sample/build/generated/source/r/debug/com/squareup/timessquare/sample/R.java
dda2d29efef7d163bc807ccf29b8fcad431f2a7e
[ "Apache-2.0" ]
permissive
choijiwung/Rememberme_withTeam
1cdac1d9deab69a54c9772ea8d25eb35683dad5c
4b8ee722d9238275c943e2c7aad42311dbffaad0
refs/heads/master
2021-05-06T15:45:20.765491
2017-12-09T07:33:00
2017-12-09T07:33:00
113,650,872
0
0
null
null
null
null
UTF-8
Java
false
false
27,384
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.squareup.timessquare.sample; public final class R { public static final class attr { /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int tsquare_dayBackground=0x7f010001; /** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int tsquare_dayTextColor=0x7f010002; /** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int tsquare_displayAlwaysDigitNumbers=0x7f010006; /** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int tsquare_displayDayNamesHeaderRow=0x7f010005; /** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int tsquare_displayHeader=0x7f010004; /** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int tsquare_dividerColor=0x7f010000; /** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int tsquare_headerTextColor=0x7f010007; /** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int tsquare_state_current_month=0x7f010009; /** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int tsquare_state_highlighted=0x7f01000e; /** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int tsquare_state_range_first=0x7f01000b; /** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int tsquare_state_range_last=0x7f01000d; /** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int tsquare_state_range_middle=0x7f01000c; /** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int tsquare_state_selectable=0x7f010008; /** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int tsquare_state_today=0x7f01000a; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int tsquare_titleTextStyle=0x7f010003; } public static final class color { public static final int calendar_active_month_bg=0x7f050000; public static final int calendar_bg=0x7f050001; public static final int calendar_divider=0x7f050002; public static final int calendar_highlighted_day_bg=0x7f050003; public static final int calendar_inactive_month_bg=0x7f050004; public static final int calendar_selected_day_bg=0x7f050005; public static final int calendar_selected_range_bg=0x7f050006; public static final int calendar_text_active=0x7f050007; public static final int calendar_text_highlighted=0x7f050008; public static final int calendar_text_inactive=0x7f050009; public static final int calendar_text_selected=0x7f05000a; public static final int calendar_text_selector=0x7f050014; public static final int calendar_text_unselectable=0x7f05000b; public static final int custom_background=0x7f05000c; public static final int custom_background_disabled=0x7f05000d; public static final int custom_background_today=0x7f05000e; public static final int custom_calendar_text_selector=0x7f050015; public static final int custom_header_text=0x7f05000f; public static final int custom_selected=0x7f050010; public static final int custom_text_inactive=0x7f050011; public static final int custom_text_selected=0x7f050012; public static final int transparent=0x7f050013; } public static final class dimen { public static final int calendar_day_headers_paddingbottom=0x7f060000; public static final int calendar_month_title_bottommargin=0x7f060001; public static final int calendar_month_topmargin=0x7f060002; public static final int calendar_text_medium=0x7f060003; public static final int calendar_text_small=0x7f060004; public static final int dimen_margin_circle=0x7f060005; public static final int dimen_margin_circle_negative=0x7f060006; } public static final class drawable { public static final int bg_circle_selected=0x7f020000; public static final int bg_circle_today=0x7f020001; public static final int calendar_bg_selector=0x7f020002; public static final int custom_calendar_bg_selector=0x7f020003; public static final int icon=0x7f020004; } public static final class id { public static final int button_arabic=0x7f07000e; public static final int button_arabic_with_digits=0x7f07000f; public static final int button_custom_view=0x7f070010; public static final int button_customized=0x7f07000b; public static final int button_decorator=0x7f07000c; public static final int button_dialog=0x7f07000a; public static final int button_display_only=0x7f070009; public static final int button_hebrew=0x7f07000d; public static final int button_highlight=0x7f070007; public static final int button_multi=0x7f070006; public static final int button_range=0x7f070008; public static final int button_single=0x7f070005; public static final int calendar_grid=0x7f070003; public static final int calendar_view=0x7f070002; public static final int day_names_header_row=0x7f070004; public static final int day_view=0x7f070001; public static final int day_view_adapter_class=0x7f070000; public static final int done_button=0x7f070011; } public static final class layout { public static final int day_view_custom=0x7f030000; public static final int dialog=0x7f030001; public static final int dialog_customized=0x7f030002; public static final int dialog_digits=0x7f030003; public static final int month=0x7f030004; public static final int sample_calendar_picker=0x7f030005; public static final int week=0x7f030006; } public static final class string { public static final int Arabic=0x7f040002; public static final int ArabicDigits=0x7f040003; public static final int CustomView=0x7f040004; public static final int Customized=0x7f040005; public static final int Decorator=0x7f040006; public static final int Dialog=0x7f040007; public static final int DisplayOnly=0x7f040008; public static final int Done=0x7f040009; public static final int Hebrew=0x7f04000a; public static final int Highlight=0x7f04000b; public static final int Multi=0x7f04000c; public static final int Range=0x7f04000d; public static final int Single=0x7f04000e; public static final int app_name=0x7f04000f; public static final int day_name_format=0x7f040010; public static final int invalid_date=0x7f040000; public static final int month_name_format=0x7f040001; } public static final class style { public static final int CalendarCell=0x7f080000; public static final int CalendarCell_CalendarDate=0x7f080001; public static final int CalendarCell_DayHeader=0x7f080002; public static final int CalendarTitle=0x7f080003; public static final int CustomCalendarTitle=0x7f080004; } public static final class styleable { /** Attributes that can be used with a CalendarPickerView. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #CalendarPickerView_android_background android:background}</code></td><td></td></tr> <tr><td><code>{@link #CalendarPickerView_tsquare_dayBackground com.squareup.timessquare.sample:tsquare_dayBackground}</code></td><td></td></tr> <tr><td><code>{@link #CalendarPickerView_tsquare_dayTextColor com.squareup.timessquare.sample:tsquare_dayTextColor}</code></td><td></td></tr> <tr><td><code>{@link #CalendarPickerView_tsquare_displayAlwaysDigitNumbers com.squareup.timessquare.sample:tsquare_displayAlwaysDigitNumbers}</code></td><td></td></tr> <tr><td><code>{@link #CalendarPickerView_tsquare_displayDayNamesHeaderRow com.squareup.timessquare.sample:tsquare_displayDayNamesHeaderRow}</code></td><td></td></tr> <tr><td><code>{@link #CalendarPickerView_tsquare_displayHeader com.squareup.timessquare.sample:tsquare_displayHeader}</code></td><td></td></tr> <tr><td><code>{@link #CalendarPickerView_tsquare_dividerColor com.squareup.timessquare.sample:tsquare_dividerColor}</code></td><td></td></tr> <tr><td><code>{@link #CalendarPickerView_tsquare_headerTextColor com.squareup.timessquare.sample:tsquare_headerTextColor}</code></td><td></td></tr> <tr><td><code>{@link #CalendarPickerView_tsquare_titleTextStyle com.squareup.timessquare.sample:tsquare_titleTextStyle}</code></td><td></td></tr> </table> @see #CalendarPickerView_android_background @see #CalendarPickerView_tsquare_dayBackground @see #CalendarPickerView_tsquare_dayTextColor @see #CalendarPickerView_tsquare_displayAlwaysDigitNumbers @see #CalendarPickerView_tsquare_displayDayNamesHeaderRow @see #CalendarPickerView_tsquare_displayHeader @see #CalendarPickerView_tsquare_dividerColor @see #CalendarPickerView_tsquare_headerTextColor @see #CalendarPickerView_tsquare_titleTextStyle */ public static final int[] CalendarPickerView = { 0x010100d4, 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007 }; /** <p>This symbol is the offset where the {@link android.R.attr#background} attribute's value can be found in the {@link #CalendarPickerView} array. @attr name android:background */ public static final int CalendarPickerView_android_background = 0; /** <p>This symbol is the offset where the {@link com.squareup.timessquare.sample.R.attr#tsquare_dayBackground} attribute's value can be found in the {@link #CalendarPickerView} array. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". @attr name com.squareup.timessquare.sample:tsquare_dayBackground */ public static final int CalendarPickerView_tsquare_dayBackground = 2; /** <p>This symbol is the offset where the {@link com.squareup.timessquare.sample.R.attr#tsquare_dayTextColor} attribute's value can be found in the {@link #CalendarPickerView} array. <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.squareup.timessquare.sample:tsquare_dayTextColor */ public static final int CalendarPickerView_tsquare_dayTextColor = 3; /** <p>This symbol is the offset where the {@link com.squareup.timessquare.sample.R.attr#tsquare_displayAlwaysDigitNumbers} attribute's value can be found in the {@link #CalendarPickerView} array. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.squareup.timessquare.sample:tsquare_displayAlwaysDigitNumbers */ public static final int CalendarPickerView_tsquare_displayAlwaysDigitNumbers = 7; /** <p>This symbol is the offset where the {@link com.squareup.timessquare.sample.R.attr#tsquare_displayDayNamesHeaderRow} attribute's value can be found in the {@link #CalendarPickerView} array. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.squareup.timessquare.sample:tsquare_displayDayNamesHeaderRow */ public static final int CalendarPickerView_tsquare_displayDayNamesHeaderRow = 6; /** <p>This symbol is the offset where the {@link com.squareup.timessquare.sample.R.attr#tsquare_displayHeader} attribute's value can be found in the {@link #CalendarPickerView} array. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.squareup.timessquare.sample:tsquare_displayHeader */ public static final int CalendarPickerView_tsquare_displayHeader = 5; /** <p>This symbol is the offset where the {@link com.squareup.timessquare.sample.R.attr#tsquare_dividerColor} attribute's value can be found in the {@link #CalendarPickerView} array. <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.squareup.timessquare.sample:tsquare_dividerColor */ public static final int CalendarPickerView_tsquare_dividerColor = 1; /** <p>This symbol is the offset where the {@link com.squareup.timessquare.sample.R.attr#tsquare_headerTextColor} attribute's value can be found in the {@link #CalendarPickerView} array. <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.squareup.timessquare.sample:tsquare_headerTextColor */ public static final int CalendarPickerView_tsquare_headerTextColor = 8; /** <p>This symbol is the offset where the {@link com.squareup.timessquare.sample.R.attr#tsquare_titleTextStyle} attribute's value can be found in the {@link #CalendarPickerView} array. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". @attr name com.squareup.timessquare.sample:tsquare_titleTextStyle */ public static final int CalendarPickerView_tsquare_titleTextStyle = 4; /** Attributes that can be used with a calendar_cell. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #calendar_cell_tsquare_state_current_month com.squareup.timessquare.sample:tsquare_state_current_month}</code></td><td></td></tr> <tr><td><code>{@link #calendar_cell_tsquare_state_highlighted com.squareup.timessquare.sample:tsquare_state_highlighted}</code></td><td></td></tr> <tr><td><code>{@link #calendar_cell_tsquare_state_range_first com.squareup.timessquare.sample:tsquare_state_range_first}</code></td><td></td></tr> <tr><td><code>{@link #calendar_cell_tsquare_state_range_last com.squareup.timessquare.sample:tsquare_state_range_last}</code></td><td></td></tr> <tr><td><code>{@link #calendar_cell_tsquare_state_range_middle com.squareup.timessquare.sample:tsquare_state_range_middle}</code></td><td></td></tr> <tr><td><code>{@link #calendar_cell_tsquare_state_selectable com.squareup.timessquare.sample:tsquare_state_selectable}</code></td><td></td></tr> <tr><td><code>{@link #calendar_cell_tsquare_state_today com.squareup.timessquare.sample:tsquare_state_today}</code></td><td></td></tr> </table> @see #calendar_cell_tsquare_state_current_month @see #calendar_cell_tsquare_state_highlighted @see #calendar_cell_tsquare_state_range_first @see #calendar_cell_tsquare_state_range_last @see #calendar_cell_tsquare_state_range_middle @see #calendar_cell_tsquare_state_selectable @see #calendar_cell_tsquare_state_today */ public static final int[] calendar_cell = { 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b, 0x7f01000c, 0x7f01000d, 0x7f01000e }; /** <p>This symbol is the offset where the {@link com.squareup.timessquare.sample.R.attr#tsquare_state_current_month} attribute's value can be found in the {@link #calendar_cell} array. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.squareup.timessquare.sample:tsquare_state_current_month */ public static final int calendar_cell_tsquare_state_current_month = 1; /** <p>This symbol is the offset where the {@link com.squareup.timessquare.sample.R.attr#tsquare_state_highlighted} attribute's value can be found in the {@link #calendar_cell} array. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.squareup.timessquare.sample:tsquare_state_highlighted */ public static final int calendar_cell_tsquare_state_highlighted = 6; /** <p>This symbol is the offset where the {@link com.squareup.timessquare.sample.R.attr#tsquare_state_range_first} attribute's value can be found in the {@link #calendar_cell} array. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.squareup.timessquare.sample:tsquare_state_range_first */ public static final int calendar_cell_tsquare_state_range_first = 3; /** <p>This symbol is the offset where the {@link com.squareup.timessquare.sample.R.attr#tsquare_state_range_last} attribute's value can be found in the {@link #calendar_cell} array. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.squareup.timessquare.sample:tsquare_state_range_last */ public static final int calendar_cell_tsquare_state_range_last = 5; /** <p>This symbol is the offset where the {@link com.squareup.timessquare.sample.R.attr#tsquare_state_range_middle} attribute's value can be found in the {@link #calendar_cell} array. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.squareup.timessquare.sample:tsquare_state_range_middle */ public static final int calendar_cell_tsquare_state_range_middle = 4; /** <p>This symbol is the offset where the {@link com.squareup.timessquare.sample.R.attr#tsquare_state_selectable} attribute's value can be found in the {@link #calendar_cell} array. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.squareup.timessquare.sample:tsquare_state_selectable */ public static final int calendar_cell_tsquare_state_selectable = 0; /** <p>This symbol is the offset where the {@link com.squareup.timessquare.sample.R.attr#tsquare_state_today} attribute's value can be found in the {@link #calendar_cell} array. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.squareup.timessquare.sample:tsquare_state_today */ public static final int calendar_cell_tsquare_state_today = 2; }; }
d77e189f17d0d800f2ce314cebd5f835016aa28a
baba7ae4f32f0e680f084effcd658890183e7710
/MutationFramework/muJava/muJavaMutantStructure/Persistence/bank/ATM/boolean_proxyExists(int)/LOI_23/ATM.java
f0507f589525af9c17fe865e6736b6c2344ac83f
[ "Apache-2.0" ]
permissive
TUBS-ISF/MutationAnalysisForDBC-FormaliSE21
75972c823c3c358494d2a2e9ec12e0a00e26d771
de825bc9e743db851f5ec1c5133dca3f04d20bad
refs/heads/main
2023-04-22T21:29:28.165271
2021-05-17T07:43:22
2021-05-17T07:43:22
368,096,901
0
0
null
null
null
null
UTF-8
Java
false
false
10,934
java
// This is a mutant program. // Author : ysma package bank; /** * Class whose objects represent the automated teller machines of our bank. * These machines can operate both online and offline. In the first case, all * transactions are directly transfered to the central host of the bank, in the * latter case transactions are first buffered (using class * <code>OfflineAccountProxy</code> and later written back to the central * host. */ public class ATM { public static final int maxAccountNumber = CentralHost.maxAccountNumber; /*@ public invariant accountProxies != null; public invariant accountProxies.length == maxAccountNumber; public invariant (\forall int i; i >= 0 && i < maxAccountNumber; ( accountProxies[i] == null || accountProxies[i].accountNumber == i )); @*/ public final OfflineAccountProxy[] accountProxies = new OfflineAccountProxy[maxAccountNumber]; //@ private invariant centralHost != null; public final CentralHost centralHost; /** * <code>true</code> iff the ATM is online, i.e. if * <code>centralHost</code> may be accessed */ public boolean online = true; /** * A bank card that is possible inserted into the ATM at the time */ public BankCard insertedCard = null; /** * <code>true</code> iff there is a card inserted and the customer has * entered the right PIN */ public boolean customerAuthenticated = false; /** * Count the number of wrong PINs entered since a valid card was inserted */ public int wrongPINCounter = 0; /*@ private invariant customerAuthenticated ==> insertedCard != null; private invariant insertedCard != null ==> !insertedCard.invalid; private invariant insertedCard != null ==> insertedCard.accountNumber >= 0; private invariant insertedCard != null ==> insertedCard.accountNumber < maxAccountNumber; private invariant ( online && insertedCard != null ) ==> centralHost.accounts[insertedCard.accountNumber] != null; @*/ public /*@ pure @*/ ATM (final CentralHost centralHost) { this.centralHost = centralHost; } /** * @return <code>true</code> iff the ATM is online */ private /*@ pure @*/ boolean isOnline () { return online; } /*@ private normal_behavior requires accountNumber >= 0; requires accountNumber < maxAccountNumber; requires centralHost.accounts[accountNumber] != null; ensures \result.accountNumber == accountNumber; assignable accountProxies[accountNumber]; @*/ private Account getAccount( int accountNumber ) { if (isOnline()) { return centralHost.getAccount( accountNumber ); } if (!proxyExists( accountNumber )) { setProxy( accountNumber, new OfflineAccountProxy( accountNumber ) ); } return getProxy( accountNumber ); } /*@ public normal_behavior ensures online == newOnline; assignable \everything; @*/ public void setOnline( boolean newOnline ) { if (this.online == newOnline) { return; } if (newOnline) { // synchronize with central host for (int i = 0; i != CentralHost.maxAccountNumber; ++i) { if (proxyExists( i )) { getProxy( i ).replay( centralHost.getAccount( i ) ); setProxy( i, null ); } } } if (cardForNonexistingAccountInserted()) { confiscateCard(); } this.online = newOnline; } /*@ public normal_behavior requires insertedCard == null; requires card != null; requires card.accountNumber >= 0; requires card.accountNumber < maxAccountNumber; ensures card.invalid <==> insertedCard == null; ensures !customerAuthenticated; ensures wrongPINCounter == 0; assignable insertedCard, customerAuthenticated, wrongPINCounter, card.invalid; @*/ public void insertCard( BankCard card ) { if (!(!cardIsInserted() && card != null && card.getAccountNumber() >= 0 && card.getAccountNumber() < maxAccountNumber)) { throw new java.lang.RuntimeException(); } insertedCard = card; customerAuthenticated = false; wrongPINCounter = 0; if (insertedCard.cardIsInvalid() || cardForNonexistingAccountInserted()) { confiscateCard(); } } /*@ public normal_behavior requires insertedCard != null; ensures insertedCard == null; assignable insertedCard, customerAuthenticated; @*/ public BankCard ejectCard() { if (!cardIsInserted()) { throw new java.lang.RuntimeException(); } final BankCard res = insertedCard; insertedCard = null; customerAuthenticated = false; return res; } /*@ public normal_behavior requires insertedCard != null; ensures insertedCard == null; ensures \old(insertedCard).invalid; assignable insertedCard, customerAuthenticated, insertedCard.invalid; @*/ public void confiscateCard() { if (!cardIsInserted()) { throw new java.lang.RuntimeException(); } insertedCard.makeCardInvalid(); insertedCard = null; customerAuthenticated = false; } /*@ public normal_behavior requires insertedCard != null; requires !customerAuthenticated; requires pin == insertedCard.correctPIN; assignable customerAuthenticated; ensures customerAuthenticated; also public normal_behavior requires insertedCard != null; requires !customerAuthenticated; requires pin != insertedCard.correctPIN; requires wrongPINCounter < 2; assignable wrongPINCounter; ensures wrongPINCounter == \old(wrongPINCounter) + 1; ensures !customerAuthenticated; also public normal_behavior requires insertedCard != null; requires !customerAuthenticated; requires pin != insertedCard.correctPIN; requires wrongPINCounter >= 2; assignable insertedCard, wrongPINCounter, insertedCard.invalid; ensures insertedCard == null; ensures \old(insertedCard).invalid; ensures !customerAuthenticated; @*/ public void enterPIN( int pin ) { if (!(cardIsInserted() && !customerIsAuthenticated())) { throw new java.lang.RuntimeException(); } if (insertedCard.pinIsCorrect( pin )) { customerAuthenticated = true; } else { ++wrongPINCounter; if (wrongPINCounter >= 3) { confiscateCard(); } } } /** * @return <code>true</code> iff a card is inserted in the ATM */ private /*@ pure @*/ boolean cardIsInserted () { return insertedCard != null; } /** * @return <code>true</code> iff a customer is regarded as authenticated, * i.e. if a valid card is inserted and the correct PIN has be * entered */ private /*@ pure @*/ boolean customerIsAuthenticated () { return customerAuthenticated; } /*@ private normal_behavior ensures \result <==> ( insertedCard != null && online && centralHost.accounts[insertedCard.accountNumber] == null ); @*/ private /*@ pure @*/ boolean cardForNonexistingAccountInserted () { return cardIsInserted() && isOnline() && !centralHost.accountExists( getAccountNumber() ); } /*@ private normal_behavior requires customerAuthenticated; @*/ private /*@ pure @*/ int getAccountNumber () { return insertedCard.getAccountNumber(); } /*@ private normal_behavior requires customerAuthenticated; assignable accountProxies[insertedCard.accountNumber]; @*/ private Account getAccount() { return getAccount( getAccountNumber() ); } /*@ public normal_behavior requires customerAuthenticated; ensures online ==> \result == centralHost.accounts[insertedCard.accountNumber].balance; assignable accountProxies[insertedCard.accountNumber]; @*/ public int accountBalance() { if (!customerIsAuthenticated()) { throw new java.lang.RuntimeException(); } if (!getAccount().balanceIsAccessible()) { return 0; } return getAccount().accountBalance(); } /*@ public normal_behavior requires customerAuthenticated; requires amount > 0; @*/ public int withdraw( int amount ) { if (!(customerIsAuthenticated() && amount > 0)) { throw new java.lang.RuntimeException(); } return getAccount().checkAndWithdraw( amount ); } /*@ public normal_behavior requires customerAuthenticated; @*/ public void requestAccountStatement() { if (!customerIsAuthenticated()) { throw new java.lang.RuntimeException(); } getAccount().requestStatement(); } /*@ private normal_behavior requires accountNumber >= 0; requires accountNumber < maxAccountNumber; ensures accountProxies[accountNumber] == proxy; assignable accountProxies[accountNumber]; @*/ private void setProxy( int accountNumber, OfflineAccountProxy proxy ) { accountProxies[accountNumber] = proxy; } /*@ private normal_behavior requires accountNumber >= 0; requires accountNumber < maxAccountNumber; ensures \result == accountProxies[accountNumber]; @*/ private /*@ pure @*/ OfflineAccountProxy getProxy (int accountNumber) { return accountProxies[accountNumber]; } /*@ private normal_behavior requires accountNumber >= 0; requires accountNumber < maxAccountNumber; ensures \result <==> accountProxies[accountNumber] != null; @*/ private /*@ pure @*/ boolean proxyExists (int accountNumber) { return getProxy( ~accountNumber ) != null; } }
6e8f2aafba801e8982d71562f566a21f7d2bc8e7
72bb384115dc7ff23c3069f110d8131fa901d577
/source/tools/src/main/java/ota/client12/IPublicEntityKey.java
f7976da499e8d7bf9995a06ec1739a9b2c6d6847
[]
no_license
Automic-Community/hp-quality-center-action-pack
cf2bb743866afe22c07ffc23f7bf4444b866d998
38803fece8e7c00f53ab62ba0402ecc31cc6b90d
refs/heads/master
2023-01-15T22:16:27.310318
2020-11-20T12:58:53
2020-11-20T12:58:53
292,007,852
0
0
null
null
null
null
UTF-8
Java
false
false
2,054
java
package ota.client12 ; import com4j.*; /** * Represents a PublicEntityKey. */ @IID("{FF0696B3-0C9F-4ECA-B1FD-B74829F6DBE1}") public interface IPublicEntityKey extends ota.client12.IBaseField { // Methods: /** * <p> * Get PublicEntityKey Owner ID. * </p> * <p> * Getter method for the COM property "OwnerId" * </p> * @return Returns a value of type int */ @DISPID(14) //= 0xe. The runtime will prefer the VTID if present @VTID(20) int ownerId(); /** * <p> * Get PublicEntityKey Owner Type. * </p> * <p> * Getter method for the COM property "OwnerType" * </p> * @return Returns a value of type java.lang.String */ @DISPID(15) //= 0xf. The runtime will prefer the VTID if present @VTID(21) java.lang.String ownerType(); /** * <p> * Get PublicEntityKey UserName * </p> * <p> * Getter method for the COM property "UserName" * </p> * @return Returns a value of type java.lang.String */ @DISPID(16) //= 0x10. The runtime will prefer the VTID if present @VTID(22) java.lang.String userName(); /** * <p> * Get PublicEntityKey Key * </p> * <p> * Getter method for the COM property "Key" * </p> * @return Returns a value of type java.lang.String */ @DISPID(17) //= 0x11. The runtime will prefer the VTID if present @VTID(23) java.lang.String key(); /** * <p> * Get PublicEntityKey ResourceType * </p> * <p> * Getter method for the COM property "ResourceType" * </p> * @return Returns a value of type java.lang.String */ @DISPID(18) //= 0x12. The runtime will prefer the VTID if present @VTID(24) java.lang.String resourceType(); /** * <p> * Get PublicEntityKey ResourceType * </p> * <p> * Setter method for the COM property "ResourceType" * </p> * @param pVal Mandatory java.lang.String parameter. */ @DISPID(18) //= 0x12. The runtime will prefer the VTID if present @VTID(25) void resourceType( java.lang.String pVal); // Properties: }
b99f70caf8fc05cd73f357710e0f6917123c6405
7e6f8b156b6beda78c79763768c07ddbc6cf0f63
/src/main/java/com/nokia/tudms/beans/search/SearchUploaderBeanList.java
f3d8379582d1b0d2a1801b45c74eb058f15393ed
[]
no_license
LiQiyao/TUDMS
57bf16478dbf32072f00b399d470c41183636814
95a316a3fa46fa89359e7c84e5c0f3edf5576d90
refs/heads/master
2021-03-27T10:05:08.740879
2017-10-29T13:42:00
2017-10-29T13:42:00
108,737,533
1
0
null
null
null
null
UTF-8
Java
false
false
926
java
package com.nokia.tudms.beans.search; import java.util.ArrayList; /** * Created by Lee on 2017/4/28. * 按发布者搜索的结果列表 */ public class SearchUploaderBeanList { private int num = 0; private ArrayList<SearchUploaderBean> list = new ArrayList<SearchUploaderBean>(); public void addSearchUploaderBean(SearchUploaderBean searchUploaderBean){ list.add(searchUploaderBean); this.num += 1; } public void removeSearchUploaderBean(SearchUploaderBean searchUploaderBean){ list.remove(searchUploaderBean); if(this.num > 0){ this.num--; } } public int getNum() { return num; } public void setNum(int num) { this.num = num; } public ArrayList<SearchUploaderBean> getList() { return list; } public void setList(ArrayList<SearchUploaderBean> list) { this.list = list; } }
1faafd69be4bc2c82e26210e2b5511098252a956
97793a45d28cd53d7b70ddbc5e72f9758b90e3b4
/NewsClient/src/johnsonyue/project/newsclient/LoginActivity.java
75fc78fe4bda1419b84da508416964e2a8bcbd70
[]
no_license
johnsonyue/NewsApp
ef50668f243cc33d342a3bb66377d5b888454b31
8b932a99a9510fe4dc1473a660326e110ad548d3
refs/heads/master
2021-01-21T12:47:42.557808
2016-03-22T06:10:16
2016-03-22T06:10:16
26,349,637
0
0
null
null
null
null
UTF-8
Java
false
false
4,072
java
package johnsonyue.project.newsclient; import java.util.Properties; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBar; import android.widget.Toast; public class LoginActivity extends Activity { private EditText nickNameEdit,passwordEdit; private Button loginBtn,registerBtn; private ProgressBar loginProBar; private String site; private LoginAsyncTask asyncTask; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); //Set to no title full screen. requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); SharedPreferences preferences2=getSharedPreferences("theme",Context.MODE_PRIVATE); int id=preferences2.getInt("theme_id", MainActivity.GREEN_THEME_ID); Log.v("dbg","theme_id: "+id); if(id==MainActivity.DARK_THEME_ID){ setTheme(R.style.DarkTheme); } else{ setTheme(R.style.GreenTheme); } setContentView(R.layout.login_activity_layout); Properties pro=new Properties(); try { pro.load(this.getAssets().open("config.properties")); } catch (Exception e) { e.printStackTrace(); } site=pro.getProperty("site"); loginProBar=(ProgressBar)findViewById(R.id.login_pro_bar); loginProBar.setVisibility(ProgressBar.GONE); loginBtn=(Button)findViewById(R.id.login_btn); loginBtn.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { String url=site+"/login"; asyncTask=new LoginAsyncTask(); asyncTask.execute(url); } }); registerBtn=(Button)findViewById(R.id.register_btn); registerBtn.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { Intent i = new Intent(LoginActivity.this,RegisterActivity.class); startActivity(i); }} ); nickNameEdit=(EditText)findViewById(R.id.nick_name_edit); passwordEdit=(EditText)findViewById(R.id.password_edit); } private String login(String url){ String[] params={"nick_name="+nickNameEdit.getText().toString(), "password="+passwordEdit.getText().toString()}; String ret="Network failed."; try{ String t=SyncHttp.httpGet(url, params); if(Integer.parseInt(t)!=-1){ ret="Successfully Logged In."; Intent i=new Intent(LoginActivity.this,NewsDetailActivity.class); Bundle extras=new Bundle(); extras.putBoolean("allowed", true); extras.putInt("user_id", Integer.parseInt(t)); Log.v("dbg",Integer.parseInt(t)+" putted"); i.putExtras(extras); setResult(NewsDetailActivity.KEY_LOGIN,i); finish(); } else{ ret="Login Failed"; } }catch(Exception e){ e.printStackTrace(); } return ret; } private class LoginAsyncTask extends AsyncTask<String,Integer,String>{ @Override protected String doInBackground(String... params) { // TODO Auto-generated method stub String ret=login(params[0]); return ret; } @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub loginProBar.setVisibility(ProgressBar.GONE); Toast.makeText(LoginActivity.this, result, 500).show(); } @Override protected void onPreExecute() { // TODO Auto-generated method stub loginProBar.setVisibility(ProgressBar.VISIBLE); Toast.makeText(LoginActivity.this, "Logging in...", 500).show(); } } }
77b60f0201506b47e4ce8dd88a0ec7fbf1da0ec4
a3a3c2fdf604d04ad0fd25c7bd97e59e9a6dfb0e
/src/assignment1/models/TemperatureData.java
ecc7adfb8b7d046e99f44b840d90f74b390bc78b
[]
no_license
ronnygeo/ParallelDataProcessing
04a410f063804fd6787a9fce2f94f7c2308ba948
ad2675a7a7e40ee328d7ad79ab13d4343220b729
refs/heads/master
2021-01-17T18:34:46.066491
2016-11-21T01:39:28
2016-11-21T01:39:28
71,512,345
0
1
null
null
null
null
UTF-8
Java
false
false
1,189
java
package assignment1.models; /** * Created by ronnygeo on 9/24/16. */ /* * Temperature Data Class stores the Total, count and the average TMAX * for a particular station. */ public class TemperatureData { private float TotalTMAX; private int countTMAX; private double averageTMAX; public TemperatureData(float total, int count) { TotalTMAX = total; countTMAX = count; updateAverage(); } public float getTotalTMAX() { return TotalTMAX; } public void setTotalTMAX(float totalTMAX) { TotalTMAX = totalTMAX; } public int getCountTMAX() { return countTMAX; } public void setCountTMAX(int countTMAX) { this.countTMAX = countTMAX; } public double getAverage() { return averageTMAX; } public void updateAverage() { this.averageTMAX = this.TotalTMAX / this.countTMAX; } //Update the Object with another Temperature Data Object public void updateDataFromTemperatureData(TemperatureData td) { setTotalTMAX(td.getTotalTMAX() + getTotalTMAX()); setCountTMAX(td.getCountTMAX() + getCountTMAX()); updateAverage(); } }
297729b381905a05e35e55c0bd5fe6f07163cd39
d00e0d6f7036e94b5891df22c02a0c8a69d71a0a
/assignments/1.ntoc/NooToCTranspiler/src/ntct/Program.java
736788e81ba741ccb8dcd795a227b8498493780d
[]
no_license
0x00000FF/cnucse-fall2019-introduction-to-compiler
b59dc25aaeb9ab81305d20000bebd3977bee81c5
df4b794c86a830908a1f7a7a01c829cf62cb0830
refs/heads/master
2020-07-18T06:45:31.686965
2019-11-26T06:57:08
2019-11-26T06:57:08
206,199,544
0
0
null
null
null
null
UTF-8
Java
false
false
1,589
java
package ntct; import java.io.*; public class Program { public static int lastRead = -1; public static int returnDepth = 0; public static void crash(String message) { System.out.println(message); System.exit(-1); } public static void main(String[] args) { System.out.println("Noo to C Transpiler\n" + "Copyright (c) Kangjun Heo @ Chungnam National University\n" + "========================================================"); if (args.length == 0) { System.out.println("USAGE: java -jar ntct.jar <filename or -stdin>\n"); System.exit(1); } try { Reader reader; if (args[0] == "-stdin") { reader = new InputStreamReader(System.in); } else { File file = new File(args[0]); if (!file.exists()) { System.out.println("[ERROR] File Not Found, Exit."); System.exit(1); } reader = new FileReader(file); } NooStateMachine nsm = new NooStateMachine(reader, false); String code = NooCodeGenerator.initialize(nsm) .build() .toString(); System.out.println(code); reader.close(); } catch (IOException e) { System.out.println("[ERROR] IOException thrown, cannot be proceed"); System.exit(-1); } } }